@kong-ui-public/entities-upstreams-targets 3.5.55 → 3.5.56

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.
@@ -1 +1 @@
1
- (function(L,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@kong-ui-public/entities-shared"),require("vue-router"),require("@kong/icons"),require("@kong-ui-public/i18n")):typeof define=="function"&&define.amd?define(["exports","vue","@kong-ui-public/entities-shared","vue-router","@kong/icons","@kong-ui-public/i18n"],e):(L=typeof globalThis<"u"?globalThis:L||self,e(L["kong-ui-entities-upstreams-targets"]={},L.Vue,L["kong-ui-public-entities-shared"],L.VueRouter,L.KongIcons,L["kong-ui-public-i18n"]))})(this,function(L,e,p,ye,oe,ge){"use strict";const Ze={upstreams:{list:{table_headers:{id:"ID",name:"Name",slots:"Slots",tags:"Tags"},empty_state:{title:"Configure a New Upstream",description:"Upstreams are used to load balance incoming requests."},toolbar_actions:{new_upstream:"New Upstream"}},title:"Upstreams",search:{placeholder:"Filter by exact name or ID"},actions:{create:"New Upstream",copy_id:"Copy ID",copy_json:"Copy JSON",edit:"Edit",delete:"Delete",view:"View Details"},delete:{title:"Delete an Upstream",description:"This action cannot be reversed so make sure to check upstream usage before deleting."},errors:{general:"Upstreams could not be retrieved",delete:"The upstream could not be deleted at this time.",copy:"Failed to copy to clipboard"},copy:{success:"Copied {val} to clipboard",success_brief:"Successfully copied to clipboard"},form:{errors:{name_required:"Name is required",should_be_integer:"Field should contain an integer",in_range:"Accepts an integer in the range of 10 - 65536"},general_info:{title:"General Information",help:"General information will help identify and manage this Upstream."},load_balancing:{title:"Load Balancing",help:"Active health checks actively probe targets for their health. Currently only support HTTP/HTTPS targets."},health_check:{title:"Health Checks & Circuit Breakers",help:"Active health checks actively probe targets for their health. Currently only support HTTP/HTTPS targets."},active_health_check:{title:"Active Health Checks",help:"Active health checks actively probe targets for their health. Currently only support HTTP/HTTPS targets."},passive_health_check:{title:"Passive Health Checks",help:"Passive health checks, also known as circuit breakers, are checks performed based on the requests being proxied by Kong (HTTP/HTTPS/TCP), with no additional traffic being generated."},buttons:{view_documentation:"View documentation"},algorithms:{round_robin_label:"Round Robin",least_connections_label:"Least Connections",consistent_hashing_label:"Consistent Hashing",latency_label:"Latency"},hash_labels:{none:"None",consumer:"Consumer",ip:"IP",header:"Header",cookie:"Cookie",path:"Path",query_argument:"Query Argument",uri_capture:"URI Capture"},hash_tooltips:{hash_on_header:{text:"The header name to take the value from as hash input. Only required when {hash_on} is set to {header}",hash_on:"hash_on",header:"header"},hash_on_uri_capture:{text:"The name of the route URI capture to take the value from as hash input. Only required when {hash_on} is set to {uri_capture}",hash_on:"hash_on",uri_capture:"uri_capture"},hash_on_query_arg:{text:"The name of the query string argument to take the value from as hash input. Only required when {hash_on} is set to {query_arg}",hash_on:"hash_on",query_arg:"query_arg"},hash_on_cookie:{text:"The cookie name to take the value from as hash input. Only required when {hash_on} or {hash_fallback} is set to {cookie}. If the specified cookie is not in the request, Kong will generate a value and set the cookie in the response.",hash_on:"hash_on",hash_fallback:"hash_fallback",cookie:"cookie"},hash_on_cookie_path:{text:"The cookie path to set in the response headers. Only required when {hash_on} or {hash_fallback} is set to {cookie}.",hash_on:"hash_on",hash_fallback:"hash_fallback",cookie:"cookie"},slots:{text:"The number of slots in the load balancer algorithm. If {algorithm} is set to {round_robin}, this setting determines the maximum number of slots. If {algorithm} is set to {consistent_hashing}, this setting determines the actual number of slots in the algorithm. Accepts an integer in the range {min}-{max}",algorithm:"algorithm",round_robin:"round-robin",consistent_hashing:"consistent-hashing"},tags:"An optional set of strings associated with the Upstream for grouping and filtering.",hash_fallback:{text:"What to use as hashing input if the primary {hash_on} does not return a hash (eg. header is missing, or no Consumer identified). Not available if {hash_on} is set to {cookie}",hash_on:"hash_on",cookie:"cookie"},hash_fallback_header:{text:"The header name to take the value from as hash input. Only required when {hash_fallback} is set to {header}",hash_fallback:"hash_fallback",header:"header"},hash_fallback_query_arg:{text:"The name of the query string argument to take the value from as hash input. Only required when {hash_fallback} is set to {query_arg}",hash_fallback:"hash_fallback",query_arg:"query_arg"},hash_fallback_uri_capture:{text:"The name of the route URI capture to take the value from as hash input. Only required when {hash_fallback} is set to {uri_capture}",hash_fallback:"hash_fallback",uri_capture:"uri_capture"},host_header:{text:"The hostname to be used as {host} header when proxying requests through Kong.",host:"Host"},client_certificate:"If set, the certificate to be used as client certificate while TLS handshaking to the upstream server."},healthcheck_type_labels:{http:"HTTP",https:"HTTPS",tcp:"TCP",grsp:"gRPC",grsps:"gRPCs"},healthy:{label:"Healthy",help:"The counter thresholds to determine whether targets are healthy."},unhealthy:{label:"Unhealthy",help:"The counter thresholds to determine whether targets are unhealthy."},passive_healthy:{label:"Healthy",help:"The counter thresholds to determine whether targets are healthy."},passive_unhealthy:{label:"Unhealthy",help:"The counter thresholds to determine whether targets are unhealthy."},fields:{name:{label:"Name",placeholder:"Enter or select a host",tooltip:"This is a hostname, which must be equal to the {host} of a Service.",host:"host"},host_header:{label:"Host Header"},client_certificate:{label:"Client Certificate",placeholder:"Select or enter a Certificate ID",tooltip:"If set, the certificate to be used as client certificate while TLS handshaking to the upstream server."},tags:{label:"Tags",placeholder:"Enter a list of tags separated by comma",help:"e.g. tag1, tag2, tag3",tooltip:"An optional set of strings associated with the Upstream for grouping and filtering."},algorithm:{label:"Algorithm",tooltip:"Which load balancing algorithm to use."},slots:{label:"Slots",help:"Accepts an integer in the range of 10 - 65536"},hash_on:{label:"Hash on",help:"What to use as hashing input.",tooltip:"What to use as hashing input. Using {result} results in a weighted-round-robin scheme with no hashing."},hash_fallback:{label:"Hash Fallback",help:"What to use as hashing input if the primary hash_on does not return a hash",tooltip:"What to use as hashing input if the primary {hash_on} does not return a hash (eg. header is missing, or no Consumer identified). Not available if {hash_on} is set to {cookie}.",hash_on:"hash_on",cookie:"cookie"},active_health_checks:{label:"Active Health Checks",help:"Actively probe the targets for their health."},passive_health_checks:{label:"Passive Health Checks / Circuit Breakers",help:"Checks performed based on the requests being proxied by Kong (HTTP/HTTPS/TCP), with no additional traffic being generated."},healthchecks_threshold:{label:"Healthchecks Threshold"},header:{label:"Header"},headers:{label:"Headers",tooltip_active:"Header values can be separated by commas (value1, value2, value3)."},cookie:{label:"Cookie"},cookie_path:{label:"Cookie Path"},query_argument:{label:"Query Argument"},uri_capture:{label:"URI Capture"},active_healthcheck_type:{label:"Active Health Check Type"},http_path:{label:"HTTP Path"},timeout:{label:"Timeout"},concurrency:{label:"Concurrency"},https_sni:{label:"HTTPS SNI"},verify_ssl:{label:"Verify the SSL certificate when performing active health checks using HTTPS"},interval:{label:"Interval",help:"A value of zero indicates that active probes for healthy targets are disabled."},successes:{label:"Successes"},http_statuses:{label:"HTTP Statuses"},http_failures:{label:"HTTP Failures"},tcp_failures:{label:"TCP Failures"},timeouts:{label:"Timeouts"},passive_health_check_type:{label:"Passive Health Check Type"}}},labels:{created_at:"Created at"}},targets:{list:{table_headers:{id:"ID",target_address:"Target Address",weight:"Weight",tags:"Tags"},empty_state:{title:"Configure a New Target",description:"A target is an IP address/hostname with a port that identifies an instance of a backend service."},toolbar_actions:{new_target:"New Target"}},title:"Targets",actions:{create:"New Target",copy_id:"Copy ID",copy_json:"Copy JSON",edit:"Edit",delete:"Delete",mark_healthy:"Mark Healthy",mark_unhealthy:"Mark Unhealthy"},delete:{title:"Delete a Target",description:"This action cannot be reversed so make sure to check target usage before deleting."},errors:{general:"Targets could not be retrieved",delete:"The target could not be deleted at this time.",copy:"Failed to copy to clipboard",weight:"Value must be in range 0 to 65535"},copy:{success:"Copied {val} to clipboard",success_brief:"Successfully copied to clipboard"},form:{create:{title:"New Target"},edit:{title:"Edit Target"},buttons:{save:"Save",cancel:"Cancel"},fields:{target:{label:"Target Address",placeholder:"Enter IP/hostname and port",tooltip:"The target address (IP or hostname) and port. If omitted the port defaults to 8000."},weight:{label:"Weight",tooltip:"The weight of this target in relation to other targets in the upstream. Value must be in range 0 to 65535, defaults to 100."},tags:{label:"Tags",placeholder:"Enter a list of tags separated by comma",help:"e.g. tag1, tag2, tag3"}}}}};function et(){const a=ge.createI18n("en-us",Ze);return{i18n:a,i18nT:ge.i18nTComponent(a)}}function se(a){const{replaceId:B=!1}=a,o=e.ref([]);return{addedItems:o,trackNewItems:(n,g)=>{if(g){const m={...n};B&&(m.value=n.label),o.value.push(m)}else o.value=o.value.filter(m=>m.value!==n.value)}}}const ie=[{label:"100",value:"100"},{label:"101",value:"101"},{label:"102",value:"102"},{label:"103",value:"103"},{label:"200",value:"200"},{label:"201",value:"201"},{label:"202",value:"202"},{label:"203",value:"203"},{label:"204",value:"204"},{label:"205",value:"205"},{label:"206",value:"206"},{label:"207",value:"207"},{label:"208",value:"208"},{label:"226",value:"226"},{label:"300",value:"300"},{label:"301",value:"301"},{label:"302",value:"302"},{label:"303",value:"303"},{label:"304",value:"304"},{label:"305",value:"305"},{label:"306",value:"306"},{label:"307",value:"307"},{label:"308",value:"308"},{label:"400",value:"400"},{label:"401",value:"401"},{label:"402",value:"402"},{label:"403",value:"403"},{label:"404",value:"404"},{label:"405",value:"405"},{label:"406",value:"406"},{label:"407",value:"407"},{label:"408",value:"408"},{label:"409",value:"409"},{label:"410",value:"410"},{label:"411",value:"411"},{label:"412",value:"412"},{label:"413",value:"413"},{label:"414",value:"414"},{label:"415",value:"415"},{label:"416",value:"416"},{label:"417",value:"417"},{label:"418",value:"418"},{label:"419",value:"419"},{label:"420",value:"420"},{label:"421",value:"421"},{label:"422",value:"422"},{label:"423",value:"423"},{label:"424",value:"424"},{label:"425",value:"425"},{label:"426",value:"426"},{label:"428",value:"428"},{label:"429",value:"429"},{label:"430",value:"430"},{label:"431",value:"431"},{label:"440",value:"440"},{label:"444",value:"444"},{label:"449",value:"449"},{label:"450",value:"450"},{label:"451",value:"451"},{label:"460",value:"460"},{label:"463",value:"463"},{label:"494",value:"494"},{label:"495",value:"495"},{label:"496",value:"496"},{label:"497",value:"497"},{label:"498",value:"498"},{label:"499",value:"499"},{label:"500",value:"500"},{label:"501",value:"501"},{label:"502",value:"502"},{label:"503",value:"503"},{label:"504",value:"504"},{label:"505",value:"505"},{label:"506",value:"506"},{label:"507",value:"507"},{label:"508",value:"508"},{label:"509",value:"509"},{label:"510",value:"510"},{label:"511",value:"511"},{label:"520",value:"520"},{label:"521",value:"521"},{label:"522",value:"522"},{label:"523",value:"523"},{label:"524",value:"524"},{label:"525",value:"525"},{label:"526",value:"526"},{label:"527",value:"527"},{label:"529",value:"529"},{label:"530",value:"530"},{label:"561",value:"561"},{label:"598",value:"598"},{label:"599",value:"599"}],fe=10,pe=65536,tt=0,at=65535,Y=0,Z=255,be=0,ke=255,lt=0,st=65535,Ce=0,_e=65535,rt=0,ot=2**31,we=["200","302"],Ve=["200","201","202","203","204","205","206","207","208","226","300","301","302","303","304","305","306","307","308"],Ne=["429","404","500","501","502","503","504","505"],xe=["429","500","503"];function ne(){const a=l=>/^\d+$/.test(l),B=(l,h,k)=>{if(a(l)){const u=Number(l);return u>=h&&u<=k}else return!1},o=l=>l.map(h=>Number(h)),s=l=>l.map(h=>h.toString()),n=l=>{var k,u,t,O,w,d,C,M,S,v,Q,y,_,H,N,f,D,A,J,W,T,I,P,$,R,b,F,c,r,i,V,U,K,E,j,X,re,le,Se,Te,Ue,Ie,Fe,qe,Ee,Be,Oe,De,$e,Pe,Ae,Me,Ke,Re,ve,je,Le,Qe,We,Je,ze,Ge,Xe,Ye;return{name:(l==null?void 0:l.name)||"",hostHeader:(l==null?void 0:l.host_header)||"",clientCertificate:((k=l==null?void 0:l.client_certificate)==null?void 0:k.id)||"",tags:((u=l==null?void 0:l.tags)==null?void 0:u.join(", "))||"",algorithm:(l==null?void 0:l.algorithm)||"round-robin",slots:((t=l==null?void 0:l.slots)==null?void 0:t.toString())||"10000",hashOn:(l==null?void 0:l.hash_on)||"none",hashFallback:(l==null?void 0:l.hash_fallback)||"none",hashOnHeader:(l==null?void 0:l.hash_on_header)||"",hashOnCookie:(l==null?void 0:l.hash_on_cookie)||"",hashOnCookiePath:(l==null?void 0:l.hash_on_cookie_path)||"/",hashOnQueryArgument:(l==null?void 0:l.hash_on_query_arg)||"",hashOnUriCapture:(l==null?void 0:l.hash_on_uri_capture)||"",hashFallbackHeader:(l==null?void 0:l.hash_fallback_header)||"",hashFallbackQueryArgument:(l==null?void 0:l.hash_fallback_query_arg)||"",hashFallbackUriCapture:(l==null?void 0:l.hash_fallback_uri_capture)||"",activeHealthSwitch:l?((w=(O=l.healthchecks.active)==null?void 0:O.healthy)==null?void 0:w.interval)!==0||((C=(d=l.healthchecks.active)==null?void 0:d.unhealthy)==null?void 0:C.interval)!==0:!1,passiveHealthSwitch:l?((S=(M=l.healthchecks.passive)==null?void 0:M.healthy)==null?void 0:S.successes)!==0||((Q=(v=l.healthchecks.passive)==null?void 0:v.unhealthy)==null?void 0:Q.timeouts)!==0||((_=(y=l.healthchecks.passive)==null?void 0:y.unhealthy)==null?void 0:_.tcp_failures)!==0||((N=(H=l.healthchecks.passive)==null?void 0:H.unhealthy)==null?void 0:N.http_failures)!==0:!1,healthchecksThreshold:((f=l==null?void 0:l.healthchecks.threshold)==null?void 0:f.toString())||"0",activeHealthCheck:{type:((D=l==null?void 0:l.healthchecks.active)==null?void 0:D.type)||"http",httpPath:((A=l==null?void 0:l.healthchecks.active)==null?void 0:A.http_path)||"/",timeout:((W=(J=l==null?void 0:l.healthchecks.active)==null?void 0:J.timeout)==null?void 0:W.toString())||"1",concurrency:((I=(T=l==null?void 0:l.healthchecks.active)==null?void 0:T.concurrency)==null?void 0:I.toString())||"10",httpsSni:((P=l==null?void 0:l.healthchecks.active)==null?void 0:P.https_sni)||"",verifySsl:(($=l==null?void 0:l.healthchecks.active)==null?void 0:$.https_verify_certificate)||!1,headers:(R=l==null?void 0:l.healthchecks.active)!=null&&R.headers&&Object.entries(l.healthchecks.active.headers).length>0?Object.entries(l.healthchecks.active.headers).map(([Lt,me])=>({key:Lt,values:me==null?void 0:me.join(", ")})):[{key:"",values:""}],interval:((c=(F=(b=l==null?void 0:l.healthchecks.active)==null?void 0:b.healthy)==null?void 0:F.interval)==null?void 0:c.toString())||"0",successes:((V=(i=(r=l==null?void 0:l.healthchecks.active)==null?void 0:r.healthy)==null?void 0:i.successes)==null?void 0:V.toString())||"5",httpStatuses:(K=(U=l==null?void 0:l.healthchecks.active)==null?void 0:U.healthy)!=null&&K.http_statuses?s(l.healthchecks.active.healthy.http_statuses):we,unhealthyInterval:((X=(j=(E=l==null?void 0:l.healthchecks.active)==null?void 0:E.unhealthy)==null?void 0:j.interval)==null?void 0:X.toString())||"0",httpFailures:((Se=(le=(re=l==null?void 0:l.healthchecks.active)==null?void 0:re.unhealthy)==null?void 0:le.http_failures)==null?void 0:Se.toString())||"5",tcpFailures:((Ie=(Ue=(Te=l==null?void 0:l.healthchecks.active)==null?void 0:Te.unhealthy)==null?void 0:Ue.tcp_failures)==null?void 0:Ie.toString())||"5",unhealthyHttpStatuses:(qe=(Fe=l==null?void 0:l.healthchecks.active)==null?void 0:Fe.unhealthy)!=null&&qe.http_statuses?s(l.healthchecks.active.unhealthy.http_statuses):Ne,unhealthyTimeouts:((Oe=(Be=(Ee=l==null?void 0:l.healthchecks.active)==null?void 0:Ee.unhealthy)==null?void 0:Be.timeouts)==null?void 0:Oe.toString())||"0"},passiveHealthCheck:{type:((De=l==null?void 0:l.healthchecks.passive)==null?void 0:De.type)||"http",successes:((Ae=(Pe=($e=l==null?void 0:l.healthchecks.passive)==null?void 0:$e.healthy)==null?void 0:Pe.successes)==null?void 0:Ae.toString())||"0",httpStatuses:(Ke=(Me=l==null?void 0:l.healthchecks.passive)==null?void 0:Me.healthy)!=null&&Ke.http_statuses?s(l.healthchecks.passive.healthy.http_statuses):Ve,timeouts:((je=(ve=(Re=l==null?void 0:l.healthchecks.passive)==null?void 0:Re.unhealthy)==null?void 0:ve.timeouts)==null?void 0:je.toString())||"0",httpFailures:((We=(Qe=(Le=l==null?void 0:l.healthchecks.passive)==null?void 0:Le.unhealthy)==null?void 0:Qe.http_failures)==null?void 0:We.toString())||"5",tcpFailures:((Ge=(ze=(Je=l==null?void 0:l.healthchecks.passive)==null?void 0:Je.unhealthy)==null?void 0:ze.tcp_failures)==null?void 0:Ge.toString())||"5",unhealthyHttpStatuses:(Ye=(Xe=l==null?void 0:l.healthchecks.passive)==null?void 0:Xe.unhealthy)!=null&&Ye.http_statuses?s(l.healthchecks.passive.unhealthy.http_statuses):xe}}};return{isInteger:a,inRange:B,stringToNumberArray:o,numberToStringArray:s,upstreamsResponseToFields:l=>n(l),getDefaultUpstreamFields:()=>n(),objectsAreEqual:(l,h)=>{try{return JSON.stringify(l)===JSON.stringify(h)}catch{return!1}},cloneDeep:l=>JSON.parse(JSON.stringify(l))}}const z={useI18n:et,useMultiselectCreation:se,useHelpers:ne},ee="/v2/control-planes/{controlPlaneId}/core-entities",te="/{workspace}",ae={list:{konnect:`${ee}/upstreams`,kongManager:`${te}/upstreams`},form:{konnect:{getServices:`${ee}/services`,getCertificates:`${ee}/certificates`,validate:`${ee}/v1/schemas/json/upstream/validate`,create:`${ee}/upstreams`,edit:`${ee}/upstreams/{id}`},kongManager:{getServices:`${te}/services`,getCertificates:`${te}/certificates`,validate:`${te}/schemas/upstreams/validate`,create:`${te}/upstreams`,edit:`${te}/upstreams/{id}`}}},it={class:"kong-ui-entities-upstreams-list"},nt={class:"upstream-name"},ht=e.defineComponent({__name:"UpstreamsList",props:{config:{type:Object,required:!0,validator:a=>!(!a||!["konnect","kongManager"].includes(a==null?void 0:a.app)||!a.createRoute||!a.getViewRoute||!a.getEditRoute||a.app==="kongManager"&&!a.isExactMatch&&!a.filterSchema)},cacheIdentifier:{type:String,default:""},canCreate:{type:Function,required:!1,default:async()=>!0},canDelete:{type:Function,required:!1,default:async()=>!0},canEdit:{type:Function,required:!1,default:async()=>!0},canRetrieve:{type:Function,required:!1,default:async()=>!0},useActionOutside:{type:Boolean,default:!1}},emits:["error","copy:success","copy:error","delete:success"],setup(a,{emit:B}){var R;const o=B,s=a,{i18n:{t:n}}=z.useI18n(),g=ye.useRouter(),{axiosInstance:m}=p.useAxios((R=s.config)==null?void 0:R.axiosRequestConfig),q=e.ref(1),x=e.computed(()=>s.config.app!=="kongManager"||!!s.config.disableSorting),l={name:{label:n("upstreams.list.table_headers.name"),searchable:!0,sortable:!0,hidable:!1},slots:{label:n("upstreams.list.table_headers.slots"),searchable:!0,sortable:!0},tags:{label:n("upstreams.list.table_headers.tags"),sortable:!1}},h=l,k=e.computed(()=>{var F,c;let b=`${s.config.apiBaseUrl}${ae.list[s.config.app]}`;return s.config.app==="konnect"?b=b.replace(/{controlPlaneId}/gi,((F=s.config)==null?void 0:F.controlPlaneId)||""):s.config.app==="kongManager"&&(b=b.replace(/\/{workspace}/gi,(c=s.config)!=null&&c.workspace?`/${s.config.workspace}`:"")),b}),u=e.ref(""),t=e.computed(()=>{const b=s.config.app==="konnect"||s.config.isExactMatch;if(b)return{isExactMatch:b,placeholder:n("upstreams.search.placeholder")};const{name:F,slots:c}=l;return{isExactMatch:b,fields:{name:F,slots:c},schema:s.config.filterSchema}}),{fetcher:O,fetcherState:w}=p.useFetcher(s.config,k.value),d=()=>{u.value=""},C=()=>{q.value++},M=e.ref(null),S=e.ref(!1),v=(b,F)=>{const c=b.id;if(!F(c)){o("copy:error",{entity:b,field:"id",message:n("upstreams.errors.copy")});return}o("copy:success",{entity:b,field:"id",message:n("upstreams.copy.success",{val:c})})},Q=(b,F)=>{const c=JSON.stringify(b);if(!F(c)){o("copy:error",{entity:b,message:n("upstreams.errors.copy")});return}o("copy:success",{entity:b,message:n("upstreams.copy.success_brief")})},y=async b=>{var c;await((c=s.canRetrieve)==null?void 0:c.call(s,b))&&g.push(s.config.getViewRoute(b.id))},_=b=>({label:n("upstreams.actions.view"),to:s.config.getViewRoute(b)}),H=b=>({label:n("upstreams.actions.edit"),to:s.config.getEditRoute(b)}),N=e.ref(void 0),f=e.ref(!1),D=e.ref(!1),A=e.ref(""),J=p.useDeleteUrlBuilder(s.config,k.value),W=b=>{N.value=b,f.value=!0},T=()=>{f.value=!1},I=async()=>{var b,F,c;if((b=N.value)!=null&&b.id){D.value=!0;try{await m.delete(J(N.value.id)),D.value=!1,f.value=!1,q.value++,o("delete:success",N.value)}catch(r){A.value=((c=(F=r.response)==null?void 0:F.data)==null?void 0:c.message)||r.message||n("upstreams.errors.delete"),o("error",r)}finally{D.value=!1}}},P=e.ref(!1);e.watch(w,b=>{var F,c,r,i;if(Array.isArray((F=b==null?void 0:b.response)==null?void 0:F.data)&&(P.value=b.response.data.length>0),b.status===p.FetcherStatus.NoRecords?S.value=!0:S.value=!1,b.status===p.FetcherStatus.Error){M.value={title:n("upstreams.errors.general")},(i=(r=(c=b.error)==null?void 0:c.response)==null?void 0:r.data)!=null&&i.message&&(M.value.message=b.error.response.data.message),o("error",b.error);return}M.value=null});const $=e.ref({ctaPath:s.config.createRoute,ctaText:void 0,message:`${n("upstreams.list.empty_state.description")}${s.config.additionMessageForEmptyState?` ${s.config.additionMessageForEmptyState}`:""}`,title:n("upstreams.title")});return e.onBeforeMount(async()=>{await s.canCreate()&&($.value.title=n("upstreams.list.empty_state.title"),$.value.ctaText=n("upstreams.actions.create"))}),(b,F)=>{const c=e.resolveComponent("KButton"),r=e.resolveComponent("KDropdownItem"),i=e.resolveComponent("KClipboardProvider");return e.openBlock(),e.createElementBlock("div",it,[e.createVNode(e.unref(p.EntityBaseTable),{"cache-identifier":a.cacheIdentifier,"disable-sorting":x.value,"empty-state-options":$.value,"enable-entity-actions":"","error-message":M.value,fetcher:e.unref(O),"fetcher-cache-key":q.value,"hide-toolbar":S.value,"pagination-type":"offset","preferences-storage-key":"kong-ui-entities-upstreams-list",query:u.value,"table-headers":e.unref(h),onClearSearchInput:d,"onClick:row":F[1]||(F[1]=V=>y(V)),onSort:C},{"toolbar-filter":e.withCtx(()=>[e.createVNode(e.unref(p.EntityFilter),{modelValue:u.value,"onUpdate:modelValue":F[0]||(F[0]=V=>u.value=V),config:t.value},null,8,["modelValue","config"])]),"toolbar-button":e.withCtx(()=>[(e.openBlock(),e.createBlock(e.Teleport,{disabled:!a.useActionOutside,to:"#kong-ui-app-page-header-action-button"},[e.createVNode(e.unref(p.PermissionsWrapper),{"auth-function":()=>a.canCreate()},{default:e.withCtx(()=>[e.withDirectives(e.createVNode(c,{appearance:"primary","data-testid":"toolbar-add-upstream",size:a.useActionOutside?"medium":"large",to:a.config.createRoute},{default:e.withCtx(()=>[e.createVNode(e.unref(oe.AddIcon)),e.createTextVNode(" "+e.toDisplayString(e.unref(n)("upstreams.list.toolbar_actions.new_upstream")),1)]),_:1},8,["size","to"]),[[e.vShow,P.value]])]),_:1},8,["auth-function"])],8,["disabled"]))]),name:e.withCtx(({rowValue:V})=>[e.createElementVNode("span",nt,e.toDisplayString(V),1)]),tags:e.withCtx(({rowValue:V})=>[e.createVNode(e.unref(p.TableTags),{"tag-max-width":"auto",tags:V},null,8,["tags"])]),actions:e.withCtx(({row:V})=>[e.createVNode(i,null,{default:e.withCtx(({copyToClipboard:U})=>[e.createVNode(r,{"data-testid":"action-entity-copy-id",onClick:K=>v(V,U)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)("upstreams.actions.copy_id")),1)]),_:2},1032,["onClick"])]),_:2},1024),e.createVNode(i,null,{default:e.withCtx(({copyToClipboard:U})=>[e.createVNode(r,{"data-testid":"action-entity-copy-json",onClick:K=>Q(V,U)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)("upstreams.actions.copy_json")),1)]),_:2},1032,["onClick"])]),_:2},1024),e.createVNode(e.unref(p.PermissionsWrapper),{"auth-function":()=>a.canRetrieve(V)},{default:e.withCtx(()=>[e.createVNode(r,{"data-testid":"action-entity-view","has-divider":"",item:_(V.id)},null,8,["item"])]),_:2},1032,["auth-function"]),e.createVNode(e.unref(p.PermissionsWrapper),{"auth-function":()=>a.canEdit(V)},{default:e.withCtx(()=>[e.createVNode(r,{"data-testid":"action-entity-edit",item:H(V.id)},null,8,["item"])]),_:2},1032,["auth-function"]),e.createVNode(e.unref(p.PermissionsWrapper),{"auth-function":()=>a.canDelete(V)},{default:e.withCtx(()=>[e.createVNode(r,{danger:"","data-testid":"action-entity-delete","has-divider":"",onClick:U=>W(V)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)("upstreams.actions.delete")),1)]),_:2},1032,["onClick"])]),_:2},1032,["auth-function"])]),_:1},8,["cache-identifier","disable-sorting","empty-state-options","error-message","fetcher","fetcher-cache-key","hide-toolbar","query","table-headers"]),e.createVNode(e.unref(p.EntityDeleteModal),{"action-pending":D.value,description:e.unref(n)("upstreams.delete.description"),"entity-name":N.value&&(N.value.name||N.value.id),"entity-type":e.unref(p.EntityTypes).Upstream,error:A.value,title:e.unref(n)("upstreams.delete.title"),visible:f.value,onCancel:T,onProceed:I},null,8,["action-pending","description","entity-name","entity-type","error","title","visible"])])}}}),G=(a,B)=>{const o=a.__vccOpts||a;for(const[s,n]of B)o[s]=n;return o},ct=G(ht,[["__scopeId","data-v-f1bada7c"]]),he="/v2/control-planes/{controlPlaneId}/core-entities",ce="/{workspace}",de={list:{konnect:`${he}/upstreams/{upstreamId}/targets`,kongManager:`${ce}/upstreams/{upstreamId}/targets`},form:{konnect:{create:`${he}/upstreams/{upstreamId}/targets`,edit:`${he}/upstreams/{upstreamId}/targets/{id}`,validate:`${he}/v1/schemas/json/target/validate`},kongManager:{create:`${ce}/upstreams/{upstreamId}/targets`,edit:`${ce}/upstreams/{upstreamId}/targets/{id}`,validate:`${ce}/schemas/targets/validate`}}},dt={class:"kong-ui-entities-target-form"},ut={class:"target-form-container"},ft={key:0,class:"target-form-info"},He=G(e.defineComponent({__name:"TargetForm",props:{config:{type:Object,required:!0,validator:a=>!(!a||!["konnect","kongManager"].includes(a==null?void 0:a.app)||a.app==="konnect"&&!a.controlPlaneId||a.app==="kongManager"&&typeof a.workspace!="string"||!a.upstreamId)},isVisible:{type:Boolean,required:!0,default:!1},targetId:{type:String,required:!1,default:""}},emits:["update","error","loading","cancel"],setup(a,{emit:B}){var Q;const o=B,s=a,{i18n:{t:n}}=z.useI18n(),{getMessageFromError:g}=p.useErrors(),{axiosInstance:m}=p.useAxios((Q=s.config)==null?void 0:Q.axiosRequestConfig),q=e.computed(()=>{var y;return de.form[s.config.app].edit.replace(/{upstreamId}/gi,((y=s.config)==null?void 0:y.upstreamId)||"")}),x=e.computed(()=>s.targetId?p.EntityBaseFormType.Edit:p.EntityBaseFormType.Create),l=e.computed(()=>x.value===p.EntityBaseFormType.Edit?n("targets.form.edit.title"):n("targets.form.create.title")),h=e.reactive({fields:{target:"",weight:100,tags:""},isReadonly:!1,errorMessage:""}),k=e.reactive({target:"",weight:100,tags:""}),u={target:"",weight:100,tags:""},t=e.computed(()=>{const y=parseInt(h.fields.weight.toString(),10);return y<0||y>65535}),O=e.computed(()=>JSON.stringify(h.fields)!==JSON.stringify(k)&&!!h.fields.target&&!!h.fields.weight&&!t.value),w=y=>{var _;h.fields.target=(y==null?void 0:y.target)||"",h.fields.weight=(y==null?void 0:y.weight)??"",h.fields.tags=((_=y==null?void 0:y.tags)==null?void 0:_.join(", "))||"",Object.assign(k,h.fields)},d=()=>{h.errorMessage="",o("cancel")},C=e.computed(()=>{var _,H;let y=`${s.config.apiBaseUrl}${de.form[s.config.app].validate}`;return s.config.app==="konnect"?y=y.replace(/{controlPlaneId}/gi,((_=s.config)==null?void 0:_.controlPlaneId)||""):s.config.app==="kongManager"&&(y=y.replace(/\/{workspace}/gi,(H=s.config)!=null&&H.workspace?`/${s.config.workspace}`:"")),y=y.replace(/{id}/gi,s.targetId),y}),M=e.computed(()=>{var _,H,N,f;let y=`${s.config.apiBaseUrl}${de.form[s.config.app][x.value]}`;return s.config.app==="konnect"?y=y.replace(/{controlPlaneId}/gi,((_=s.config)==null?void 0:_.controlPlaneId)||"").replace(/{upstreamId}/gi,((H=s.config)==null?void 0:H.upstreamId)||""):s.config.app==="kongManager"&&(y=y.replace(/\/{workspace}/gi,(N=s.config)!=null&&N.workspace?`/${s.config.workspace}`:"").replace(/{upstreamId}/gi,((f=s.config)==null?void 0:f.upstreamId)||"")),y=y.replace(/{id}/gi,s.targetId),y}),S=e.computed(()=>{var y,_,H;return{target:h.fields.target,weight:parseInt(h.fields.weight),tags:(H=(_=(y=h.fields.tags)==null?void 0:y.split(","))==null?void 0:_.map(N=>String(N||"").trim()))==null?void 0:H.filter(N=>N!==""),upstream:{id:s.config.upstreamId}}}),v=async()=>{var y,_;try{h.isReadonly=!0,h.errorMessage="";let H;if(await m.post(C.value,S.value),x.value==="create"?H=await m.post(M.value,S.value):x.value==="edit"&&(H=((y=s.config)==null?void 0:y.app)==="konnect"?await m.put(M.value,S.value):await m.patch(M.value,S.value)),H){const{data:N}=H;h.fields.target=(N==null?void 0:N.name)||"",h.fields.weight=(N==null?void 0:N.weight)??100,h.fields.tags=((_=N==null?void 0:N.tags)==null?void 0:_.join(", "))||"",o("update",N),Object.assign(h.fields,u)}}catch(H){h.errorMessage=g(H),o("error",H)}finally{h.isReadonly=!1}};return e.watch(()=>s.targetId,()=>{Object.assign(h.fields,u)}),(y,_)=>{const H=e.resolveComponent("KInput"),N=e.resolveComponent("KPrompt");return e.openBlock(),e.createBlock(N,{"action-button-disabled":!O.value||h.isReadonly,"action-button-text":e.unref(n)("targets.form.buttons.save"),"cancel-button-text":e.unref(n)("targets.form.buttons.cancel"),title:l.value,visible:a.isVisible,onCancel:d,onProceed:v},{default:e.withCtx(()=>[e.createElementVNode("div",dt,[e.createVNode(e.unref(p.EntityBaseForm),{config:a.config,"edit-id":a.targetId,"entity-type":e.unref(p.SupportedEntityType).Target,"error-message":h.errorMessage,"fetch-url":q.value,"form-fields":S.value,"is-readonly":h.isReadonly,onCancel:d,"onFetch:error":_[3]||(_[3]=f=>y.$emit("error",f)),"onFetch:success":w,onLoading:_[4]||(_[4]=f=>y.$emit("loading",f))},{default:e.withCtx(()=>[e.createElementVNode("div",ut,[y.$slots.info?(e.openBlock(),e.createElementBlock("div",ft,[e.renderSlot(y.$slots,"info",{},void 0,!0)])):e.createCommentVNode("",!0),e.createVNode(H,{modelValue:h.fields.target,"onUpdate:modelValue":_[0]||(_[0]=f=>h.fields.target=f),modelModifiers:{trim:!0},autocomplete:"off",class:"target-form-input","data-testid":"target-form-target",label:e.unref(n)("targets.form.fields.target.label"),"label-attributes":{info:e.unref(n)("targets.form.fields.target.tooltip"),tooltipAttributes:{maxWidth:"400"}},placeholder:e.unref(n)("targets.form.fields.target.placeholder"),readonly:h.isReadonly,required:"",type:"text"},null,8,["modelValue","label","label-attributes","placeholder","readonly"]),e.createVNode(H,{modelValue:h.fields.weight,"onUpdate:modelValue":_[1]||(_[1]=f=>h.fields.weight=f),autocomplete:"off",class:"target-form-input","data-testid":"target-form-weight",error:t.value,"error-message":e.unref(n)("targets.errors.weight"),label:e.unref(n)("targets.form.fields.weight.label"),"label-attributes":{info:e.unref(n)("targets.form.fields.weight.tooltip"),tooltipAttributes:{maxWidth:"400"}},max:"65535",min:"0",readonly:h.isReadonly,required:"",type:"number"},null,8,["modelValue","error","error-message","label","label-attributes","readonly"]),e.createVNode(H,{modelValue:h.fields.tags,"onUpdate:modelValue":_[2]||(_[2]=f=>h.fields.tags=f),modelModifiers:{trim:!0},autocomplete:"off",class:"target-form-input","data-testid":"target-form-tags",help:e.unref(n)("targets.form.fields.tags.help"),label:e.unref(n)("targets.form.fields.tags.label"),placeholder:e.unref(n)("targets.form.fields.tags.placeholder"),readonly:h.isReadonly,type:"text"},null,8,["modelValue","help","label","placeholder","readonly"])])]),_:3},8,["config","edit-id","entity-type","error-message","fetch-url","form-fields","is-readonly"])])]),_:3},8,["action-button-disabled","action-button-text","cancel-button-text","title","visible"])}}}),[["__scopeId","data-v-6a64b86e"]]),pt={class:"kong-ui-entities-targets-list"},mt={class:"target-address"},yt=G(e.defineComponent({__name:"TargetsList",props:{config:{type:Object,required:!0,validator:a=>!(!a||!["konnect","kongManager"].includes(a==null?void 0:a.app)||!a.upstreamId||a.app==="kongManager"&&(typeof a.canMarkHealthy>"u"||typeof a.canMarkUnhealthy>"u"))},cacheIdentifier:{type:String,default:""},canCreate:{type:Function,required:!1,default:async()=>!0},canDelete:{type:Function,required:!1,default:async()=>!0},canEdit:{type:Function,required:!1,default:async()=>!0},useActionOutside:{type:Boolean,default:!1}},emits:["error","copy:success","copy:error","delete:success","health-actions:healthy","health-actions:unhealthy","create:target","update:target"],setup(a,{emit:B}){var c;const o=B,s=a,{i18n:{t:n}}=z.useI18n(),{axiosInstance:g}=p.useAxios((c=s.config)==null?void 0:c.axiosRequestConfig),m=e.ref(1),q=e.computed(()=>s.config.app!=="kongManager"||!!s.config.disableSorting),l={target:{label:n("targets.list.table_headers.target_address"),sortable:!0,hidable:!1},weight:{label:n("targets.list.table_headers.weight"),sortable:!0},tags:{label:n("targets.list.table_headers.tags"),sortable:!1}},h=e.computed(()=>{var i,V,U,K;let r=`${s.config.apiBaseUrl}${de.list[s.config.app]}`;return s.config.app==="konnect"?r=r.replace(/{controlPlaneId}/gi,((i=s.config)==null?void 0:i.controlPlaneId)||"").replace(/{upstreamId}/gi,((V=s.config)==null?void 0:V.upstreamId)||""):s.config.app==="kongManager"&&(r=r.replace(/\/{workspace}/gi,(U=s.config)!=null&&U.workspace?`/${s.config.workspace}`:"").replace(/{upstreamId}/gi,((K=s.config)==null?void 0:K.upstreamId)||"")),r}),{fetcher:k,fetcherState:u}=p.useFetcher(s.config,h.value),t=()=>{m.value++},O=e.ref(null),w=e.ref(!1),d=()=>{$.value=!0},C=(r,i)=>{const V=r.id;if(!i(V)){o("copy:error",{entity:r,field:"id",message:n("targets.errors.copy")});return}o("copy:success",{entity:r,field:"id",message:n("targets.copy.success",{val:V})})},M=(r,i)=>{const V=JSON.stringify(r);if(!i(V)){o("copy:error",{entity:r,message:n("targets.errors.copy")});return}o("copy:success",{entity:r,message:n("targets.copy.success_brief")})},S=r=>{P.value=r,$.value=!0},v=r=>s.config.app==="konnect"?!1:s.config.canMarkHealthy(r),Q=r=>s.config.app==="konnect"?!1:s.config.canMarkUnhealthy(r),y=e.ref(void 0),_=e.ref(!1),H=e.ref(!1),N=e.ref(""),f=p.useDeleteUrlBuilder(s.config,h.value),D=r=>{y.value=r,_.value=!0},A=()=>{_.value=!1},J=async()=>{var r,i,V;if((r=y.value)!=null&&r.id){H.value=!0;try{await g.delete(f(y.value.id)),H.value=!1,_.value=!1,m.value++,o("delete:success",y.value)}catch(U){N.value=((V=(i=U.response)==null?void 0:i.data)==null?void 0:V.message)||U.message||n("targets.errors.delete"),o("error",U)}finally{H.value=!1}}},W=e.ref(!1);e.watch(u,r=>{var i,V,U,K;if(Array.isArray((i=r==null?void 0:r.response)==null?void 0:i.data)&&(W.value=r.response.data.length>0),r.status===p.FetcherStatus.NoRecords?w.value=!0:w.value=!1,r.status===p.FetcherStatus.Error){O.value={title:n("targets.errors.general")},(K=(U=(V=r.error)==null?void 0:V.response)==null?void 0:U.data)!=null&&K.message&&(O.value.message=r.error.response.data.message),o("error",r.error);return}O.value=null});const T=e.ref({ctaText:void 0,message:`${n("targets.list.empty_state.description")}${s.config.additionMessageForEmptyState?` ${s.config.additionMessageForEmptyState}`:""}`,title:n("targets.title"),...s.config.createRoute&&{ctaPath:s.config.createRoute}});e.onBeforeMount(async()=>{await s.canCreate()&&(T.value.title=n("targets.list.empty_state.title"),T.value.ctaText=n("targets.actions.create"))});const I=e.computed(()=>({app:s.config.app,apiBaseUrl:s.config.apiBaseUrl,upstreamId:s.config.upstreamId,axiosRequestConfig:s.config.axiosRequestConfig,...s.config.app==="konnect"&&{controlPlaneId:s.config.controlPlaneId},...s.config.app==="kongManager"&&{workspace:s.config.workspace}})),P=e.ref(""),$=e.ref(!1),R=r=>{P.value?o("update:target",r):o("create:target",r),b()},b=()=>{F(),m.value++},F=()=>{$.value=!1,P.value=""};return(r,i)=>{const V=e.resolveComponent("KButton"),U=e.resolveComponent("KDropdownItem"),K=e.resolveComponent("KClipboardProvider");return e.openBlock(),e.createElementBlock("div",pt,[e.createVNode(e.unref(p.EntityBaseTable),{"cache-identifier":a.cacheIdentifier,"disable-sorting":q.value,"empty-state-options":T.value,"enable-entity-actions":"","error-message":O.value,fetcher:e.unref(k),"fetcher-cache-key":m.value,"hide-toolbar":w.value,"pagination-type":"offset","preferences-storage-key":"kong-ui-entities-targets-list","table-headers":e.unref(l),onEmptyStateCtaClicked:i[1]||(i[1]=()=>s.config.createRoute?void 0:d()),onSort:t},{"toolbar-button":e.withCtx(()=>[(e.openBlock(),e.createBlock(e.Teleport,{disabled:!a.useActionOutside,to:"#kong-ui-app-page-header-action-button"},[e.createVNode(e.unref(p.PermissionsWrapper),{"auth-function":()=>a.canCreate()},{default:e.withCtx(()=>[e.withDirectives(e.createVNode(V,{appearance:"primary","data-testid":"toolbar-new-target",size:a.useActionOutside?"medium":"large",to:s.config.createRoute?s.config.createRoute:void 0,onClick:i[0]||(i[0]=()=>s.config.createRoute?void 0:d())},{default:e.withCtx(()=>[e.createVNode(e.unref(oe.AddIcon)),e.createTextVNode(" "+e.toDisplayString(e.unref(n)("targets.list.toolbar_actions.new_target")),1)]),_:1},8,["size","to"]),[[e.vShow,W.value]])]),_:1},8,["auth-function"])],8,["disabled"]))]),target:e.withCtx(({rowValue:E})=>[e.createElementVNode("span",mt,e.toDisplayString(E),1)]),tags:e.withCtx(({rowValue:E})=>[e.createVNode(e.unref(p.TableTags),{"tag-max-width":"auto",tags:E},null,8,["tags"])]),actions:e.withCtx(({row:E})=>[e.createVNode(K,null,{default:e.withCtx(({copyToClipboard:j})=>[e.createVNode(U,{"data-testid":"action-entity-copy-id",onClick:X=>C(E,j)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)("targets.actions.copy_id")),1)]),_:2},1032,["onClick"])]),_:2},1024),e.createVNode(K,null,{default:e.withCtx(({copyToClipboard:j})=>[e.createVNode(U,{"data-testid":"action-entity-copy-json",onClick:X=>M(E,j)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)("targets.actions.copy_json")),1)]),_:2},1032,["onClick"])]),_:2},1024),e.createVNode(e.unref(p.PermissionsWrapper),{"auth-function":()=>a.canEdit(E)},{default:e.withCtx(()=>[e.createVNode(U,{"data-testid":"action-entity-edit","has-divider":"",onClick:j=>S(E.id)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)("targets.actions.edit")),1)]),_:2},1032,["onClick"])]),_:2},1032,["auth-function"]),e.createVNode(e.unref(p.PermissionsWrapper),{"auth-function":()=>v(E)},{default:e.withCtx(()=>[e.createVNode(U,{"data-testid":"action-target-mark-healthy",onClick:j=>o("health-actions:healthy",E)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)("targets.actions.mark_healthy")),1)]),_:2},1032,["onClick"])]),_:2},1032,["auth-function"]),e.createVNode(e.unref(p.PermissionsWrapper),{"auth-function":()=>Q(E)},{default:e.withCtx(()=>[e.createVNode(U,{"data-testid":"action-target-mark-unhealthy",onClick:j=>o("health-actions:unhealthy",E)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)("targets.actions.mark_unhealthy")),1)]),_:2},1032,["onClick"])]),_:2},1032,["auth-function"]),e.createVNode(e.unref(p.PermissionsWrapper),{"auth-function":()=>a.canDelete(E)},{default:e.withCtx(()=>[e.createVNode(U,{danger:"","data-testid":"action-entity-delete","has-divider":"",onClick:j=>D(E)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)("targets.actions.delete")),1)]),_:2},1032,["onClick"])]),_:2},1032,["auth-function"])]),_:1},8,["cache-identifier","disable-sorting","empty-state-options","error-message","fetcher","fetcher-cache-key","hide-toolbar","table-headers"]),e.createVNode(e.unref(p.EntityDeleteModal),{"action-pending":H.value,description:e.unref(n)("targets.delete.description"),"entity-type":e.unref(p.EntityTypes).Target,error:N.value,"need-confirm":!1,title:e.unref(n)("targets.delete.title"),visible:_.value,onCancel:A,onProceed:J},null,8,["action-pending","description","entity-type","error","title","visible"]),e.createVNode(He,{config:I.value,"is-visible":$.value,"target-id":P.value,onCancel:F,onUpdate:R},e.createSlots({_:2},[r.$slots["form-info"]?{name:"info",fn:e.withCtx(()=>[e.renderSlot(r.$slots,"form-info",{},void 0,!0)]),key:"0"}:void 0]),1032,["config","is-visible","target-id"])])}}}),[["__scopeId","data-v-bdb1416b"]]),gt={key:1},bt=G(e.defineComponent({__name:"UpstreamsFormGeneralInfo",props:{config:{type:Object,required:!0},name:{type:String,required:!0},hostHeader:{type:String,required:!0},clientCertificate:{type:String,required:!0},tags:{type:String,required:!0},readonly:{type:Boolean,required:!1,default:!1}},emits:["update:name","update:host-header","update:client-certificate","update:tags"],setup(a,{emit:B}){var D,A,J,W;const{i18nT:o,i18n:{t:s}}=z.useI18n(),n=a,g=B,{debouncedQueryChange:m,loading:q,loadItems:x,results:l,allRecords:h}=p.useDebouncedFilter(n.config,(A=ae.form[(D=n.config)==null?void 0:D.app])==null?void 0:A.getServices,"",{fetchedItemsKey:"data",searchKeys:["host"]}),{debouncedQueryChange:k,loading:u,loadItems:t,results:O}=p.useDebouncedFilter(n.config,(W=ae.form[(J=n.config)==null?void 0:J.app])==null?void 0:W.getCertificates),w=e.ref(""),d=e.computed(()=>{var T;return!!n.name&&!((T=h.value)!=null&&T.some(I=>I.host===n.name))}),C=e.computed(()=>{var I,P,$;const T=d.value&&n.name.includes((I=w.value)==null?void 0:I.toLowerCase());return($=l.value)==null?void 0:$.map(R=>({label:R.host,value:R.id})).concat(T?[{label:n.name,value:((P=v.value)==null?void 0:P.value)||n.name}]:[])}),M=e.computed(()=>{var T;return(T=O.value)==null?void 0:T.map(I=>({label:I.id,value:I.id}))}),S=e.ref(""),v=e.ref({value:"",label:""}),Q=e.computed(()=>{var T,I;return((T=C.value.find(P=>P.value===S.value))==null?void 0:T.label)||((I=v.value)==null?void 0:I.label)}),y=T=>{w.value=T,m(T)},_=T=>{v.value=T},H=()=>{v.value={value:"",label:""}},N=T=>{S.value=T,g("update:name",Q.value)},f=e.ref(!1);return e.onBeforeMount(async()=>{var T,I;try{f.value=!0,await x(),n.name&&(S.value=((I=(T=C.value.find(P=>P.label===n.name))==null?void 0:T.value)==null?void 0:I.toString())||n.name),await t()}finally{f.value=!1}}),(T,I)=>{const P=e.resolveComponent("KSkeleton"),$=e.resolveComponent("KSelect"),R=e.resolveComponent("KInput");return e.openBlock(),e.createBlock(e.unref(p.EntityFormSection),{class:"kong-ui-entities-upstreams-general-info",description:e.unref(s)("upstreams.form.general_info.help"),title:e.unref(s)("upstreams.form.general_info.title")},{default:e.withCtx(()=>[f.value?(e.openBlock(),e.createBlock(P,{key:0,type:"form"})):(e.openBlock(),e.createElementBlock("div",gt,[e.createVNode($,{class:"name-select margin-bottom-6",clearable:"","data-testid":"upstreams-form-name","enable-filtering":"","enable-item-creation":"","filter-function":()=>!0,items:C.value,label:e.unref(s)("upstreams.form.fields.name.label"),"label-attributes":{tooltipAttributes:{"max-width":"400"}},loading:e.unref(q),"model-value":S.value,placeholder:e.unref(s)("upstreams.form.fields.name.placeholder"),readonly:a.readonly,required:"",width:"100%",onItemAdded:_,onItemRemoved:H,onQueryChange:y,"onUpdate:modelValue":N},{"label-tooltip":e.withCtx(()=>[e.createVNode(e.unref(o),{keypath:"upstreams.form.fields.name.tooltip",scope:"global"},{host:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(e.unref(s)("upstreams.form.fields.name.host")),1)]),_:1})]),_:1},8,["items","label","loading","model-value","placeholder","readonly","onUpdate:modelValue"]),e.createVNode(R,{autocomplete:"off",class:"margin-bottom-6","data-testid":"upstreams-form-host-header",label:e.unref(s)("upstreams.form.fields.host_header.label"),"model-value":a.hostHeader,readonly:a.readonly,type:"text","onUpdate:modelValue":I[0]||(I[0]=b=>g("update:host-header",b))},null,8,["label","model-value","readonly"]),e.createVNode($,{class:"certificate-select margin-bottom-6",clearable:"","data-testid":"upstreams-form-client-certificate","enable-filtering":"","filter-function":()=>!0,items:M.value,label:e.unref(s)("upstreams.form.fields.client_certificate.label"),"label-attributes":{info:e.unref(s)("upstreams.form.fields.client_certificate.tooltip"),tooltipAttributes:{maxWidth:"400"}},loading:e.unref(u),"model-value":a.clientCertificate,placeholder:e.unref(s)("upstreams.form.fields.client_certificate.placeholder"),readonly:a.readonly,width:"100%",onQueryChange:e.unref(k),"onUpdate:modelValue":I[1]||(I[1]=b=>g("update:client-certificate",b))},null,8,["items","label","label-attributes","loading","model-value","placeholder","readonly","onQueryChange"]),e.createVNode(R,{autocomplete:"off","data-testid":"upstreams-form-tags",help:e.unref(s)("upstreams.form.fields.tags.help"),label:e.unref(s)("upstreams.form.fields.tags.label"),"label-attributes":{info:e.unref(s)("upstreams.form.fields.tags.tooltip"),tooltipAttributes:{maxWidth:"400"}},"model-value":a.tags,placeholder:e.unref(s)("upstreams.form.fields.tags.placeholder"),readonly:a.readonly,type:"text","onUpdate:modelValue":I[2]||(I[2]=b=>g("update:tags",b))},null,8,["help","label","label-attributes","model-value","placeholder","readonly"])]))]),_:1},8,["description","title"])}}}),[["__scopeId","data-v-626ed41f"]]),ue={upstreamObject:"https://docs.konghq.com/gateway/latest/admin-api/#upstream-object",loadBalancing:"https://docs.konghq.com/gateway/latest/how-kong-works/load-balancing/#main"},kt={class:"fields-group-title"},Ct={class:"fields-group-text"},_t={class:"fields-group-title"},wt={class:"fields-group-text"},Vt=G(e.defineComponent({__name:"UpstreamsFormLoadBalancing",props:{algorithm:{type:String,required:!0},slots:{type:String,required:!0},hashOn:{type:String,required:!0},hashFallback:{type:String,required:!0},hashOnHeader:{type:String,required:!0},hashOnCookie:{type:String,required:!0},hashOnCookiePath:{type:String,required:!0},hashOnQueryArgument:{type:String,required:!0},hashOnUriCapture:{type:String,required:!0},hashFallbackHeader:{type:String,required:!0},hashFallbackQueryArgument:{type:String,required:!0},hashFallbackUriCapture:{type:String,required:!0},readonly:{type:Boolean,required:!1,default:!1}},emits:["update:algorithm","update:slots","update:hash-on","update:hash-fallback","update:hash-on-header","update:hash-on-cookie","update:hash-on-cookie-path","update:hash-on-query-argument","update:hash-on-uri-capture","update:hash-fallback-header","update:hash-fallback-query-argument","update:hash-fallback-uri-capture"],setup(a,{emit:B}){const{i18nT:o,i18n:{t:s}}=z.useI18n(),{inRange:n}=ne(),g=a,m=B,q=e.ref([{label:s("upstreams.form.algorithms.round_robin_label"),value:"round-robin",selected:!1},{label:s("upstreams.form.algorithms.least_connections_label"),value:"least-connections",selected:!1},{label:s("upstreams.form.algorithms.consistent_hashing_label"),value:"consistent-hashing",selected:!1},{label:s("upstreams.form.algorithms.latency_label"),value:"latency",selected:!1}]),x=e.ref([{label:s("upstreams.form.hash_labels.none"),value:"none",selected:!1},{label:s("upstreams.form.hash_labels.consumer"),value:"consumer",selected:!1},{label:s("upstreams.form.hash_labels.ip"),value:"ip",selected:!1},{label:s("upstreams.form.hash_labels.header"),value:"header",selected:!1},{label:s("upstreams.form.hash_labels.cookie"),value:"cookie",selected:!1},{label:s("upstreams.form.hash_labels.path"),value:"path",selected:!1},{label:s("upstreams.form.hash_labels.query_argument"),value:"query_arg",selected:!1},{label:s("upstreams.form.hash_labels.uri_capture"),value:"uri_capture",selected:!1}]);e.watch(()=>g.hashOn,(k,u)=>{u==="header"&&k!==u&&m("update:hash-on-header",""),u==="cookie"&&k!==u&&(m("update:hash-on-cookie",""),m("update:hash-on-cookie-path","/")),u==="query_arg"&&k!==u&&m("update:hash-on-query-argument",""),u==="uri_capture"&&k!==u&&m("update:hash-on-uri-capture",""),(k==="cookie"||k==="none")&&(m("update:hash-fallback","none"),m("update:hash-fallback-header",""),m("update:hash-fallback-query-argument",""),m("update:hash-fallback-uri-capture",""))}),e.watch(()=>g.hashFallback,(k,u)=>{u==="header"&&k!==u&&m("update:hash-fallback-header",""),u==="cookie"&&k!==u&&(m("update:hash-on-cookie",""),m("update:hash-on-cookie-path","/")),u==="query_arg"&&k!==u&&m("update:hash-fallback-query-argument",""),u==="uri_capture"&&k!==u&&m("update:hash-fallback-uri-capture","")});const l=e.computed(()=>g.hashOn==="cookie"||g.hashOn==="none"),h=e.computed(()=>g.slots?n(g.slots,fe,pe)?"":s("upstreams.form.errors.in_range"):"");return(k,u)=>{const t=e.resolveComponent("KExternalLink"),O=e.resolveComponent("KSelect"),w=e.resolveComponent("KInput"),d=e.resolveComponent("KCard");return e.openBlock(),e.createBlock(e.unref(p.EntityFormSection),{class:"kong-ui-entities-upstreams-load-balancing",title:e.unref(s)("upstreams.form.load_balancing.title")},{description:e.withCtx(()=>[e.createElementVNode("p",null,[e.createTextVNode(e.toDisplayString(e.unref(s)("upstreams.form.load_balancing.help"))+" ",1),e.createVNode(t,{"hide-icon":"",href:e.unref(ue).upstreamObject},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(s)("upstreams.form.buttons.view_documentation")),1)]),_:1},8,["href"])])]),default:e.withCtx(()=>[e.createVNode(O,{class:"algorithm-select",items:q.value,label:e.unref(s)("upstreams.form.fields.algorithm.label"),"model-value":a.algorithm,readonly:a.readonly,width:"100%","onUpdate:modelValue":u[0]||(u[0]=C=>m("update:algorithm",C))},null,8,["items","label","model-value","readonly"]),e.createVNode(w,{autocomplete:"off","data-testid":"upstreams-form-slots",error:!!h.value,"error-message":h.value,help:e.unref(s)("upstreams.form.fields.slots.help"),label:e.unref(s)("upstreams.form.fields.slots.label"),max:e.unref(pe),min:e.unref(fe),"model-value":a.slots,readonly:a.readonly,type:"number","onUpdate:modelValue":u[1]||(u[1]=C=>m("update:slots",C))},null,8,["error","error-message","help","label","max","min","model-value","readonly"]),e.createVNode(d,null,{default:e.withCtx(()=>[e.createElementVNode("h5",kt,e.toDisplayString(e.unref(s)("upstreams.form.fields.hash_on.label")),1),e.createElementVNode("p",Ct,e.toDisplayString(e.unref(s)("upstreams.form.fields.hash_on.help")),1),e.createVNode(O,{class:"hash-on-select",items:x.value,label:e.unref(s)("upstreams.form.fields.hash_on.label"),"model-value":a.hashOn,readonly:a.readonly,width:"100%","onUpdate:modelValue":u[2]||(u[2]=C=>m("update:hash-on",C))},null,8,["items","label","model-value","readonly"]),a.hashOn==="header"?(e.openBlock(),e.createBlock(w,{key:0,autocomplete:"off",class:"margin-top-6","data-testid":"upstreams-form-hash-on-header",label:e.unref(s)("upstreams.form.fields.header.label"),"model-value":a.hashOnHeader,readonly:a.readonly,required:"",type:"text","onUpdate:modelValue":u[3]||(u[3]=C=>m("update:hash-on-header",C))},null,8,["label","model-value","readonly"])):e.createCommentVNode("",!0),a.hashOn==="cookie"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createVNode(w,{autocomplete:"off",class:"margin-top-6","data-testid":"upstreams-form-hash-on-cookie",label:e.unref(s)("upstreams.form.fields.cookie.label"),"model-value":a.hashOnCookie,readonly:a.readonly,required:"",type:"text","onUpdate:modelValue":u[4]||(u[4]=C=>m("update:hash-on-cookie",C))},null,8,["label","model-value","readonly"]),e.createVNode(w,{autocomplete:"off",class:"margin-top-6","data-testid":"upstreams-form-hash-on-cookie-path",label:e.unref(s)("upstreams.form.fields.cookie_path.label"),"model-value":a.hashOnCookiePath,readonly:a.readonly,required:"",type:"text","onUpdate:modelValue":u[5]||(u[5]=C=>m("update:hash-on-cookie-path",C))},null,8,["label","model-value","readonly"])],64)):e.createCommentVNode("",!0),a.hashOn==="query_arg"?(e.openBlock(),e.createBlock(w,{key:2,autocomplete:"off",class:"margin-top-6","data-testid":"upstreams-form-query-argument",label:e.unref(s)("upstreams.form.fields.query_argument.label"),"model-value":a.hashOnQueryArgument,readonly:a.readonly,required:"",type:"text","onUpdate:modelValue":u[6]||(u[6]=C=>m("update:hash-on-query-argument",C))},null,8,["label","model-value","readonly"])):e.createCommentVNode("",!0),a.hashOn==="uri_capture"?(e.openBlock(),e.createBlock(w,{key:3,autocomplete:"off",class:"margin-top-6","data-testid":"upstreams-form-uri-capture",label:e.unref(s)("upstreams.form.fields.uri_capture.label"),"model-value":a.hashOnUriCapture,readonly:a.readonly,required:"",type:"text","onUpdate:modelValue":u[7]||(u[7]=C=>m("update:hash-on-uri-capture",C))},null,8,["label","model-value","readonly"])):e.createCommentVNode("",!0)]),_:1}),e.createVNode(d,null,{default:e.withCtx(()=>[e.createElementVNode("h5",_t,e.toDisplayString(e.unref(s)("upstreams.form.fields.hash_fallback.label")),1),e.createElementVNode("p",wt,e.toDisplayString(e.unref(s)("upstreams.form.fields.hash_fallback.help")),1),e.createVNode(O,{class:"hash-fallback-select",disabled:l.value,items:x.value,label:e.unref(s)("upstreams.form.fields.hash_fallback.label"),"label-attributes":{tooltipAttributes:{"max-width":"400"}},"model-value":a.hashFallback,readonly:a.readonly,width:"100%","onUpdate:modelValue":u[8]||(u[8]=C=>m("update:hash-fallback",C))},{"label-tooltip":e.withCtx(()=>[e.createVNode(e.unref(o),{keypath:"upstreams.form.fields.hash_fallback.tooltip",scope:"global"},{hash_on:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(e.unref(s)("upstreams.form.fields.hash_fallback.hash_on")),1)]),cookie:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(e.unref(s)("upstreams.form.fields.hash_fallback.cookie")),1)]),_:1})]),_:1},8,["disabled","items","label","model-value","readonly"]),a.hashFallback==="header"?(e.openBlock(),e.createBlock(w,{key:0,autocomplete:"off",class:"margin-top-6","data-testid":"upstreams-form-hash-fallback-header",label:e.unref(s)("upstreams.form.fields.header.label"),"model-value":a.hashFallbackHeader,readonly:a.readonly,required:"",type:"text","onUpdate:modelValue":u[9]||(u[9]=C=>m("update:hash-fallback-header",C))},null,8,["label","model-value","readonly"])):e.createCommentVNode("",!0),a.hashFallback==="cookie"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createVNode(w,{autocomplete:"off",class:"margin-top-6","data-testid":"upstreams-form-hash-on-cookie",label:e.unref(s)("upstreams.form.fields.cookie.label"),"model-value":a.hashOnCookie,readonly:a.readonly,required:"",type:"text","onUpdate:modelValue":u[10]||(u[10]=C=>m("update:hash-on-cookie",C))},null,8,["label","model-value","readonly"]),e.createVNode(w,{autocomplete:"off",class:"margin-top-6","data-testid":"upstreams-form-hash-on-cookie-path",label:e.unref(s)("upstreams.form.fields.cookie_path.label"),"model-value":a.hashOnCookiePath,readonly:a.readonly,required:"",type:"text","onUpdate:modelValue":u[11]||(u[11]=C=>m("update:hash-on-cookie-path",C))},null,8,["label","model-value","readonly"])],64)):e.createCommentVNode("",!0),a.hashFallback==="query_arg"?(e.openBlock(),e.createBlock(w,{key:2,autocomplete:"off",class:"margin-top-6","data-testid":"upstreams-form-hash-fallback-query-argument",label:e.unref(s)("upstreams.form.fields.query_argument.label"),"model-value":a.hashFallbackQueryArgument,readonly:a.readonly,required:"",type:"text","onUpdate:modelValue":u[12]||(u[12]=C=>m("update:hash-fallback-query-argument",C))},null,8,["label","model-value","readonly"])):e.createCommentVNode("",!0),a.hashFallback==="uri_capture"?(e.openBlock(),e.createBlock(w,{key:3,autocomplete:"off",class:"margin-top-6","data-testid":"upstreams-form-hash-fallback-uri-capture",label:e.unref(s)("upstreams.form.fields.uri_capture.label"),"model-value":a.hashFallbackUriCapture,readonly:a.readonly,required:"",type:"text","onUpdate:modelValue":u[13]||(u[13]=C=>m("update:hash-fallback-uri-capture",C))},null,8,["label","model-value","readonly"])):e.createCommentVNode("",!0)]),_:1})]),_:1},8,["title"])}}}),[["__scopeId","data-v-d662db8e"]]),Nt={class:"fields-group-title"},xt={class:"fields-group-text"},Ht={class:"fields-group-title"},St={class:"fields-group-text"},Tt=G(e.defineComponent({__name:"UpstreamsFormHealthChecks",props:{activeHealthSwitch:{type:Boolean,required:!0},passiveHealthSwitch:{type:Boolean,required:!0},healthchecksThreshold:{type:String,required:!0},readonly:{type:Boolean,required:!1,default:!1}},emits:["update:active-health-switch","update:passive-health-switch","update:healthchecks-threshold"],setup(a,{emit:B}){const{i18n:{t:o}}=z.useI18n(),s=B;return(n,g)=>{const m=e.resolveComponent("KExternalLink"),q=e.resolveComponent("KInputSwitch"),x=e.resolveComponent("KCard"),l=e.resolveComponent("KInput");return e.openBlock(),e.createBlock(e.unref(p.EntityFormSection),{class:"kong-ui-entities-upstreams-healthchecks",title:e.unref(o)("upstreams.form.health_check.title")},{description:e.withCtx(()=>[e.createElementVNode("p",null,[e.createTextVNode(e.toDisplayString(e.unref(o)("upstreams.form.health_check.help"))+" ",1),e.createVNode(m,{"hide-icon":"",href:e.unref(ue).loadBalancing},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)("upstreams.form.buttons.view_documentation")),1)]),_:1},8,["href"])])]),default:e.withCtx(()=>[e.createVNode(x,null,{default:e.withCtx(()=>[e.createElementVNode("h5",Nt,e.toDisplayString(e.unref(o)("upstreams.form.fields.active_health_checks.label")),1),e.createElementVNode("p",xt,e.toDisplayString(e.unref(o)("upstreams.form.fields.active_health_checks.help")),1),e.createVNode(q,{class:"active-health-switch","data-testid":"active-health-switch",disabled:a.readonly,"model-value":a.activeHealthSwitch,onChange:g[0]||(g[0]=h=>s("update:active-health-switch",h))},null,8,["disabled","model-value"])]),_:1}),e.createVNode(x,null,{default:e.withCtx(()=>[e.createElementVNode("h5",Ht,e.toDisplayString(e.unref(o)("upstreams.form.fields.passive_health_checks.label")),1),e.createElementVNode("p",St,e.toDisplayString(e.unref(o)("upstreams.form.fields.passive_health_checks.help")),1),e.createVNode(q,{class:"passive-health-switch","data-testid":"passive-health-switch",disabled:a.readonly,"model-value":a.passiveHealthSwitch,onChange:g[1]||(g[1]=h=>s("update:passive-health-switch",h))},null,8,["disabled","model-value"])]),_:1}),e.createVNode(l,{autocomplete:"off","data-testid":"upstreams-form-healthchecks-threshold",label:e.unref(o)("upstreams.form.fields.healthchecks_threshold.label"),max:e.unref(at),min:e.unref(tt),"model-value":a.healthchecksThreshold,readonly:a.readonly,type:"number","onUpdate:modelValue":g[2]||(g[2]=h=>s("update:healthchecks-threshold",h))},null,8,["label","max","min","model-value","readonly"])]),_:1},8,["title"])}}}),[["__scopeId","data-v-bfdc5a59"]]),Ut="#d60027",It={key:2},Ft={class:"fields-group-title"},qt={class:"fields-group-text"},Et={class:"fields-group-title"},Bt={class:"fields-group-text"},Ot=G(e.defineComponent({__name:"UpstreamsFormActiveHealthCheck",props:{config:{type:Object,required:!0},type:{type:String,required:!0},httpPath:{type:String,required:!0},timeout:{type:String,required:!0},concurrency:{type:String,required:!0},httpsSni:{type:String,required:!0},verifySsl:{type:Boolean,required:!0},headers:{type:Array,required:!0},interval:{type:String,required:!0},successes:{type:String,required:!0},httpStatuses:{type:Array,required:!0},unhealthyInterval:{type:String,required:!0},httpFailures:{type:String,required:!0},tcpFailures:{type:String,required:!0},unhealthyHttpStatuses:{type:Array,required:!0},unhealthyTimeouts:{type:String,required:!0},readonly:{type:Boolean,required:!1,default:!1}},emits:["update:type","update:http-path","update:timeout","update:concurrency","update:https-sni","update:verify-ssl","update:headers","update:interval","update:successes","update:http-statuses","update:unhealthy-interval","update:http-failures","update:tcp-failures","update:unhealthy-http-statuses","update:unhealthy-timeouts"],setup(a,{emit:B}){const{i18n:{t:o}}=z.useI18n(),{objectsAreEqual:s}=ne(),n=a,g=B,m=e.ref([{label:o("upstreams.form.healthcheck_type_labels.http"),value:"http",selected:!1},{label:o("upstreams.form.healthcheck_type_labels.https"),value:"https",selected:!1},{label:o("upstreams.form.healthcheck_type_labels.tcp"),value:"tcp",selected:!1},{label:o("upstreams.form.healthcheck_type_labels.grsp"),value:"grpc",selected:!1},{label:o("upstreams.form.healthcheck_type_labels.grsps"),value:"grpcs",selected:!1}]),q=e.computed(()=>n.type==="https"||n.type==="grpcs"),x=e.computed(()=>n.type==="tcp"),{trackNewItems:l}=se({replaceId:!0}),{trackNewItems:h}=se({replaceId:!0});e.watch(()=>n.type,(w,d)=>{d==="tcp"&&w!==d&&g("update:tcp-failures","5"),(d==="https"||d==="grpcs")&&w!==d&&(g("update:https-sni",""),g("update:verify-ssl",!1)),d!=="tcp"&&w==="tcp"&&(g("update:http-path","/"),g("update:http-statuses",we),g("update:unhealthy-http-statuses",Ne))});const k=e.ref([{key:"",values:""}]);e.watch(()=>n.headers,w=>{s(k.value,w)||(k.value=[...w])},{immediate:!0,deep:!0});const u=()=>{g("update:headers",k.value)},t=()=>{k.value.push({key:"",values:""}),u()},O=w=>{w===0&&k.value.length===1?k.value[0]={key:"",values:""}:k.value.splice(w,1),u()};return(w,d)=>{const C=e.resolveComponent("KExternalLink"),M=e.resolveComponent("KSelect"),S=e.resolveComponent("KInput"),v=e.resolveComponent("KCheckbox"),Q=e.resolveComponent("KLabel"),y=e.resolveComponent("KButton"),_=e.resolveComponent("KMultiselect"),H=e.resolveComponent("KCard");return e.openBlock(),e.createBlock(e.unref(p.EntityFormSection),{class:"kong-ui-entities-upstreams-active-healthcheck",title:e.unref(o)("upstreams.form.active_health_check.title")},{description:e.withCtx(()=>[e.createElementVNode("p",null,[e.createTextVNode(e.toDisplayString(e.unref(o)("upstreams.form.active_health_check.help"))+" ",1),e.createVNode(C,{"hide-icon":"",href:e.unref(ue).upstreamObject},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)("upstreams.form.buttons.view_documentation")),1)]),_:1},8,["href"])])]),default:e.withCtx(()=>{var N;return[e.createVNode(M,{class:"active-healthcheck-type-select",items:m.value,label:e.unref(o)("upstreams.form.fields.active_healthcheck_type.label"),"model-value":a.type,readonly:a.readonly,width:"100%","onUpdate:modelValue":d[0]||(d[0]=f=>g("update:type",f))},null,8,["items","label","model-value","readonly"]),x.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(S,{key:0,autocomplete:"off","data-testid":"active-healthcheck-http-path",label:e.unref(o)("upstreams.form.fields.http_path.label"),"model-value":a.httpPath,readonly:a.readonly,type:"text","onUpdate:modelValue":d[1]||(d[1]=f=>g("update:http-path",f))},null,8,["label","model-value","readonly"])),e.createVNode(S,{autocomplete:"off","data-testid":"active-healthcheck-timeout",label:e.unref(o)("upstreams.form.fields.timeout.label"),max:e.unref(st),min:e.unref(lt),"model-value":a.timeout,readonly:a.readonly,type:"number","onUpdate:modelValue":d[2]||(d[2]=f=>g("update:timeout",f))},null,8,["label","max","min","model-value","readonly"]),e.createVNode(S,{autocomplete:"off","data-testid":"active-healthcheck-concurrency",label:e.unref(o)("upstreams.form.fields.concurrency.label"),max:e.unref(ot),min:e.unref(rt),"model-value":a.concurrency,readonly:a.readonly,type:"number","onUpdate:modelValue":d[3]||(d[3]=f=>g("update:concurrency",f))},null,8,["label","max","min","model-value","readonly"]),q.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createVNode(S,{autocomplete:"off",class:"margin-bottom-6","data-testid":"active-healthcheck-https-sni",label:e.unref(o)("upstreams.form.fields.https_sni.label"),"model-value":a.httpsSni,readonly:a.readonly,type:"text","onUpdate:modelValue":d[4]||(d[4]=f=>g("update:https-sni",f))},null,8,["label","model-value","readonly"]),e.createVNode(v,{"data-testid":"active-healthcheck-verify-ssl",disabled:a.readonly,label:e.unref(o)("upstreams.form.fields.verify_ssl.label"),"model-value":a.verifySsl,"onUpdate:modelValue":d[5]||(d[5]=f=>g("update:verify-ssl",f))},null,8,["disabled","label","model-value"])],64)):e.createCommentVNode("",!0),((N=a.config)==null?void 0:N.app)==="kongManager"?(e.openBlock(),e.createElementBlock("div",It,[e.createVNode(Q,{info:e.unref(o)("upstreams.form.fields.headers.tooltip_active"),"tooltip-attributes":{maxWidth:"250px"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)("upstreams.form.fields.headers.label")),1)]),_:1},8,["info"]),e.createElementVNode("div",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(k.value,(f,D)=>(e.openBlock(),e.createElementBlock("div",{key:`${f.header}_${D}`,class:e.normalizeClass(["headers-row",{"margin-top-6":D>0}])},[e.createVNode(S,{modelValue:k.value[D].key,"onUpdate:modelValue":A=>k.value[D].key=A,autocomplete:"off","data-testid":`active-healthcheck-headers-header-${D+1}`,readonly:a.readonly,type:"text",onBlur:u},null,8,["modelValue","onUpdate:modelValue","data-testid","readonly"]),e.createVNode(S,{modelValue:k.value[D].values,"onUpdate:modelValue":A=>k.value[D].values=A,autocomplete:"off","data-testid":`active-healthcheck-headers-value-${D+1}`,readonly:a.readonly,type:"text",onBlur:u},null,8,["modelValue","onUpdate:modelValue","data-testid","readonly"]),e.createVNode(y,{appearance:"tertiary",class:"btn-remove","data-testid":"btn-remove-header",disabled:k.value.length===1,icon:"",onClick:A=>O(D)},{default:e.withCtx(()=>[e.createVNode(e.unref(oe.TrashIcon),{class:"delete-item",color:k.value.length>1?e.unref(Ut):void 0},null,8,["color"])]),_:2},1032,["disabled","onClick"]),k.value&&D===k.value.length-1?(e.openBlock(),e.createBlock(y,{key:0,appearance:"tertiary",class:"btn-add-header","data-testid":"btn-add-header",icon:"",onClick:t},{default:e.withCtx(()=>[e.createVNode(e.unref(oe.AddIcon))]),_:1})):e.createCommentVNode("",!0)],2))),128))])])):e.createCommentVNode("",!0),e.createVNode(H,null,{default:e.withCtx(()=>[e.createElementVNode("h5",Ft,e.toDisplayString(e.unref(o)("upstreams.form.healthy.label")),1),e.createElementVNode("p",qt,e.toDisplayString(e.unref(o)("upstreams.form.healthy.help")),1),e.createVNode(S,{autocomplete:"off",class:"margin-bottom-6","data-testid":"active-healthcheck-interval",help:e.unref(o)("upstreams.form.fields.interval.help"),label:e.unref(o)("upstreams.form.fields.interval.label"),max:e.unref(_e),min:e.unref(Ce),"model-value":a.interval,readonly:a.readonly,type:"number","onUpdate:modelValue":d[6]||(d[6]=f=>g("update:interval",f))},null,8,["help","label","max","min","model-value","readonly"]),e.createVNode(S,{autocomplete:"off","data-testid":"active-healthcheck-successes",label:e.unref(o)("upstreams.form.fields.successes.label"),max:e.unref(Z),min:e.unref(Y),"model-value":a.successes,readonly:a.readonly,type:"number","onUpdate:modelValue":d[7]||(d[7]=f=>g("update:successes",f))},null,8,["label","max","min","model-value","readonly"]),x.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(_,{key:0,autocomplete:"off",class:"margin-top-6 active-healthcheck-http-statuses","enable-item-creation":"",items:e.unref(ie),label:e.unref(o)("upstreams.form.fields.http_statuses.label"),"model-value":a.httpStatuses,readonly:a.readonly,width:"100%",onItemAdded:d[8]||(d[8]=f=>e.unref(l)(f,!0)),onItemRemoved:d[9]||(d[9]=f=>e.unref(l)(f,!1)),"onUpdate:modelValue":d[10]||(d[10]=f=>g("update:http-statuses",f))},null,8,["items","label","model-value","readonly"]))]),_:1}),e.createVNode(H,null,{default:e.withCtx(()=>[e.createElementVNode("h5",Et,e.toDisplayString(e.unref(o)("upstreams.form.unhealthy.label")),1),e.createElementVNode("p",Bt,e.toDisplayString(e.unref(o)("upstreams.form.unhealthy.help")),1),e.createVNode(S,{autocomplete:"off",class:"margin-bottom-6","data-testid":"active-healthcheck-unhealthy-interval",help:e.unref(o)("upstreams.form.fields.interval.help"),label:e.unref(o)("upstreams.form.fields.interval.label"),max:e.unref(_e),min:e.unref(Ce),"model-value":a.unhealthyInterval,readonly:a.readonly,type:"number","onUpdate:modelValue":d[11]||(d[11]=f=>g("update:unhealthy-interval",f))},null,8,["help","label","max","min","model-value","readonly"]),e.createVNode(S,{autocomplete:"off",class:"margin-bottom-6","data-testid":"active-healthcheck-tcp-failures",label:e.unref(o)("upstreams.form.fields.tcp_failures.label"),max:e.unref(Z),min:e.unref(Y),"model-value":a.tcpFailures,readonly:a.readonly,type:"number","onUpdate:modelValue":d[12]||(d[12]=f=>g("update:tcp-failures",f))},null,8,["label","max","min","model-value","readonly"]),x.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(S,{key:0,autocomplete:"off",class:"margin-bottom-6","data-testid":"active-healthcheck-http-failures",label:e.unref(o)("upstreams.form.fields.http_failures.label"),max:e.unref(Z),min:e.unref(Y),"model-value":a.httpFailures,readonly:a.readonly,type:"number","onUpdate:modelValue":d[13]||(d[13]=f=>g("update:http-failures",f))},null,8,["label","max","min","model-value","readonly"])),x.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(_,{key:1,autocomplete:"off",class:"margin-bottom-6 active-healthcheck-unhealthy-http-statuses","enable-item-creation":"",items:e.unref(ie),label:e.unref(o)("upstreams.form.fields.http_statuses.label"),"model-value":a.unhealthyHttpStatuses,readonly:a.readonly,width:"100%",onItemAdded:d[14]||(d[14]=f=>e.unref(h)(f,!0)),onItemRemoved:d[15]||(d[15]=f=>e.unref(h)(f,!1)),"onUpdate:modelValue":d[16]||(d[16]=f=>g("update:unhealthy-http-statuses",f))},null,8,["items","label","model-value","readonly"])),e.createVNode(S,{autocomplete:"off","data-testid":"active-healthcheck-unhealthy-timeouts",label:e.unref(o)("upstreams.form.fields.timeouts.label"),max:e.unref(ke),min:e.unref(be),"model-value":a.unhealthyTimeouts,readonly:a.readonly,type:"number","onUpdate:modelValue":d[17]||(d[17]=f=>g("update:unhealthy-timeouts",f))},null,8,["label","max","min","model-value","readonly"])]),_:1})]}),_:1},8,["title"])}}}),[["__scopeId","data-v-efccf560"]]),Dt={class:"fields-group-title"},$t={class:"fields-group-text"},Pt={class:"fields-group-title"},At={class:"fields-group-text"},Mt=G(e.defineComponent({__name:"UpstreamsFormPassiveHealthCheck",props:{type:{type:String,required:!0},successes:{type:String,required:!0},httpStatuses:{type:Array,required:!0},timeouts:{type:String,required:!0},httpFailures:{type:String,required:!0},unhealthyHttpStatuses:{type:Array,required:!0},tcpFailures:{type:String,required:!0},readonly:{type:Boolean,required:!1,default:!1}},emits:["update:type","update:successes","update:http-statuses","update:timeouts","update:http-failures","update:unhealthy-http-statuses","update:tcp-failures"],setup(a,{emit:B}){const{i18n:{t:o}}=z.useI18n(),s=a,n=B,g=e.ref([{label:o("upstreams.form.healthcheck_type_labels.http"),value:"http",selected:!1},{label:o("upstreams.form.healthcheck_type_labels.https"),value:"https",selected:!1},{label:o("upstreams.form.healthcheck_type_labels.tcp"),value:"tcp",selected:!1},{label:o("upstreams.form.healthcheck_type_labels.grsp"),value:"grpc",selected:!1},{label:o("upstreams.form.healthcheck_type_labels.grsps"),value:"grpcs",selected:!1}]),m=e.computed(()=>s.type==="tcp"),{trackNewItems:q}=se({replaceId:!0}),{trackNewItems:x}=se({replaceId:!0});return e.watch(()=>s.type,(l,h)=>{h==="tcp"&&l!==h&&n("update:tcp-failures","5"),h!=="tcp"&&l==="tcp"&&(n("update:http-statuses",Ve),n("update:unhealthy-http-statuses",xe))}),(l,h)=>{const k=e.resolveComponent("KExternalLink"),u=e.resolveComponent("KSelect"),t=e.resolveComponent("KInput"),O=e.resolveComponent("KMultiselect"),w=e.resolveComponent("KCard");return e.openBlock(),e.createBlock(e.unref(p.EntityFormSection),{class:"kong-ui-entities-upstreams-passive-healthcheck",title:e.unref(o)("upstreams.form.passive_health_check.title")},{description:e.withCtx(()=>[e.createElementVNode("p",null,[e.createTextVNode(e.toDisplayString(e.unref(o)("upstreams.form.passive_health_check.help"))+" ",1),e.createVNode(k,{"hide-icon":"",href:e.unref(ue).upstreamObject},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(o)("upstreams.form.buttons.view_documentation")),1)]),_:1},8,["href"])])]),default:e.withCtx(()=>[e.createVNode(u,{class:"passive-healthcheck-type-select",items:g.value,label:e.unref(o)("upstreams.form.fields.passive_health_check_type.label"),"model-value":a.type,readonly:a.readonly,width:"100%","onUpdate:modelValue":h[0]||(h[0]=d=>n("update:type",d))},null,8,["items","label","model-value","readonly"]),e.createVNode(w,null,{default:e.withCtx(()=>[e.createElementVNode("h5",Dt,e.toDisplayString(e.unref(o)("upstreams.form.passive_healthy.label")),1),e.createElementVNode("p",$t,e.toDisplayString(e.unref(o)("upstreams.form.passive_healthy.help")),1),e.createVNode(t,{autocomplete:"off","data-testid":"passive-healthcheck-successes",label:e.unref(o)("upstreams.form.fields.successes.label"),max:e.unref(Z),min:e.unref(Y),"model-value":a.successes,readonly:a.readonly,type:"number","onUpdate:modelValue":h[1]||(h[1]=d=>n("update:successes",d))},null,8,["label","max","min","model-value","readonly"]),m.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(O,{key:0,class:"margin-top-6 passive-healthcheck-http-statuses","enable-item-creation":"",items:e.unref(ie),label:e.unref(o)("upstreams.form.fields.http_statuses.label"),"model-value":a.httpStatuses,readonly:a.readonly,width:"100%",onItemAdded:h[2]||(h[2]=d=>e.unref(q)(d,!0)),onItemRemoved:h[3]||(h[3]=d=>e.unref(q)(d,!1)),"onUpdate:modelValue":h[4]||(h[4]=d=>n("update:http-statuses",d))},null,8,["items","label","model-value","readonly"]))]),_:1}),e.createVNode(w,null,{default:e.withCtx(()=>[e.createElementVNode("h5",Pt,e.toDisplayString(e.unref(o)("upstreams.form.passive_unhealthy.label")),1),e.createElementVNode("p",At,e.toDisplayString(e.unref(o)("upstreams.form.passive_unhealthy.help")),1),e.createVNode(t,{autocomplete:"off","data-testid":"passive-healthcheck-timeouts",label:e.unref(o)("upstreams.form.fields.timeouts.label"),max:e.unref(ke),min:e.unref(be),"model-value":a.timeouts,readonly:a.readonly,type:"number","onUpdate:modelValue":h[5]||(h[5]=d=>n("update:timeouts",d))},null,8,["label","max","min","model-value","readonly"]),e.createVNode(t,{autocomplete:"off",class:"margin-top-6","data-testid":"passive-healthcheck-tcp-failures",label:e.unref(o)("upstreams.form.fields.tcp_failures.label"),max:e.unref(Z),min:e.unref(Y),"model-value":a.tcpFailures,readonly:a.readonly,type:"number","onUpdate:modelValue":h[6]||(h[6]=d=>n("update:tcp-failures",d))},null,8,["label","max","min","model-value","readonly"]),m.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(t,{key:0,autocomplete:"off",class:"margin-top-6","data-testid":"passive-healthcheck-http-failures",label:e.unref(o)("upstreams.form.fields.http_failures.label"),max:e.unref(Z),min:e.unref(Y),"model-value":a.httpFailures,readonly:a.readonly,type:"number","onUpdate:modelValue":h[7]||(h[7]=d=>n("update:http-failures",d))},null,8,["label","max","min","model-value","readonly"])),m.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(O,{key:1,autocomplete:"off",class:"margin-top-6 passive-healthcheck-unhealthy-http-statuses","enable-item-creation":"",items:e.unref(ie),label:e.unref(o)("upstreams.form.fields.http_statuses.label"),"model-value":a.unhealthyHttpStatuses,readonly:a.readonly,width:"100%",onItemAdded:h[8]||(h[8]=d=>e.unref(x)(d,!0)),onItemRemoved:h[9]||(h[9]=d=>e.unref(x)(d,!1)),"onUpdate:modelValue":h[10]||(h[10]=d=>n("update:unhealthy-http-statuses",d))},null,8,["items","label","model-value","readonly"]))]),_:1})]),_:1},8,["title"])}}}),[["__scopeId","data-v-5bd9952e"]]),Kt={class:"kong-ui-entities-upstreams-form"},Rt=G(e.defineComponent({__name:"UpstreamsForm",props:{config:{type:Object,required:!0,validator:a=>!(!a||!["konnect","kongManager"].includes(a==null?void 0:a.app)||(a==null?void 0:a.app)==="konnect"&&!(a!=null&&a.controlPlaneId)||(a==null?void 0:a.app)==="kongManager"&&typeof(a==null?void 0:a.workspace)!="string"||!(a!=null&&a.cancelRoute))},upstreamId:{type:String,required:!1,default:""}},emits:["update","error","loading"],setup(a,{emit:B}){var F;const o=a,s=B,{inRange:n,stringToNumberArray:g,upstreamsResponseToFields:m,getDefaultUpstreamFields:q,objectsAreEqual:x,cloneDeep:l}=ne(),{axiosInstance:h}=p.useAxios((F=o.config)==null?void 0:F.axiosRequestConfig),{getMessageFromError:k}=p.useErrors(),u=ye.useRouter(),t=e.reactive({fields:q(),readonly:!1,errorMessage:""}),O=e.reactive(q()),w=e.computed(()=>!x(t.fields,O)),d=c=>{t.fields.activeHealthCheck.interval=c?"5":"0",t.fields.activeHealthCheck.successes=c?"5":"0",t.fields.activeHealthCheck.httpFailures=c?"5":"0",t.fields.activeHealthCheck.unhealthyInterval=c?"5":"0",t.fields.activeHealthCheck.tcpFailures=c?"5":"0"},C=c=>{t.fields.passiveHealthCheck.timeouts=c?"5":"0",t.fields.passiveHealthCheck.successes=c?"80":"0",t.fields.passiveHealthCheck.tcpFailures=c?"5":"0",t.fields.passiveHealthCheck.httpFailures=c?"5":"0"},M=e.computed(()=>t.fields.slots?n(t.fields.slots,fe,pe):!0),S=e.computed(()=>t.fields.hashOn==="header"?!!t.fields.hashOnHeader:!0),v=e.computed(()=>t.fields.hashOn==="cookie"||t.fields.hashFallback==="cookie"?!!t.fields.hashOnCookie:!0),Q=e.computed(()=>t.fields.hashOn==="cookie"||t.fields.hashFallback==="cookie"?!!t.fields.hashOnCookiePath:!0),y=e.computed(()=>t.fields.hashOn==="query_arg"?!!t.fields.hashOnQueryArgument:!0),_=e.computed(()=>t.fields.hashOn==="uri_capture"?!!t.fields.hashOnUriCapture:!0),H=e.computed(()=>t.fields.hashFallback==="header"?!!t.fields.hashFallbackHeader:!0),N=e.computed(()=>t.fields.hashFallback==="query_arg"?!!t.fields.hashFallbackQueryArgument:!0),f=e.computed(()=>t.fields.hashFallback==="uri_capture"?!!t.fields.hashFallbackUriCapture:!0),D=e.computed(()=>!!t.fields.name&&M.value&&S.value&&v.value&&Q.value&&y.value&&_.value&&H.value&&N.value&&f.value),A=e.computed(()=>o.upstreamId?p.EntityBaseFormType.Edit:p.EntityBaseFormType.Create),J=e.computed(()=>{var c,r;return(r=ae.form[(c=o.config)==null?void 0:c.app])==null?void 0:r.edit}),W=c=>{Object.assign(t.fields,m(c)),Object.assign(O,l(t.fields))},T=()=>{var c;u.push(((c=o.config)==null?void 0:c.cancelRoute)||{name:"upstreams-list"})},I=c=>{s("loading",c)},P=c=>{s("error",c)},$=e.computed(()=>{var r,i,V,U,K;const c={name:t.fields.name,slots:Number(t.fields.slots),algorithm:t.fields.algorithm,hash_on:t.fields.hashOn,hash_fallback:t.fields.hashFallback,healthchecks:{}};return t.fields.hostHeader&&(c.host_header=t.fields.hostHeader),t.fields.clientCertificate&&(c.client_certificate={id:t.fields.clientCertificate}),t.fields.healthchecksThreshold&&(c.healthchecks.threshold=Number(t.fields.healthchecksThreshold)),t.fields.tags&&(c.tags=(i=(r=t.fields.tags.split(","))==null?void 0:r.map(E=>String(E||"").trim()))==null?void 0:i.filter(E=>E!=="")),t.fields.hashOn==="header"&&(c.hash_on_header=t.fields.hashOnHeader),(t.fields.hashOn==="cookie"||t.fields.hashFallback==="cookie")&&(c.hash_on_cookie=t.fields.hashOnCookie,c.hash_on_cookie_path=t.fields.hashOnCookiePath),t.fields.hashOn==="query_arg"&&(c.hash_on_query_arg=t.fields.hashOnQueryArgument),t.fields.hashOn==="uri_capture"&&(c.hash_on_uri_capture=t.fields.hashOnUriCapture),t.fields.hashFallback==="header"&&(c.hash_fallback_header=t.fields.hashFallbackHeader),t.fields.hashFallback==="query_arg"&&(c.hash_fallback_query_arg=t.fields.hashFallbackQueryArgument),t.fields.hashFallback==="uri_capture"&&(c.hash_fallback_uri_capture=t.fields.hashFallbackUriCapture),t.fields.activeHealthSwitch?(c.healthchecks.active={type:t.fields.activeHealthCheck.type,healthy:{},unhealthy:{}},t.fields.activeHealthCheck.timeout&&(c.healthchecks.active.timeout=Number(t.fields.activeHealthCheck.timeout)),t.fields.activeHealthCheck.concurrency&&(c.healthchecks.active.concurrency=Number(t.fields.activeHealthCheck.concurrency)),t.fields.activeHealthCheck.type!=="tcp"&&t.fields.activeHealthCheck.httpPath&&(c.healthchecks.active.http_path=t.fields.activeHealthCheck.httpPath),((V=o.config)==null?void 0:V.app)==="kongManager"&&(t.fields.activeHealthCheck.headers.length===0?c.healthchecks.active.headers=[]:c.healthchecks.active.headers=t.fields.activeHealthCheck.headers.reduce((E,j)=>{var X,re;return j.key?{...E,[j.key]:(re=(X=j.values.split(","))==null?void 0:X.map(le=>String(le||"").trim()))==null?void 0:re.filter(le=>le!=="")}:{...E}},{})),(t.fields.activeHealthCheck.type==="https"||t.fields.activeHealthCheck.type==="grpcs")&&t.fields.activeHealthCheck.httpsSni&&(c.healthchecks.active.https_sni=t.fields.activeHealthCheck.httpsSni),(t.fields.activeHealthCheck.type==="https"||t.fields.activeHealthCheck.type==="grpcs")&&(c.healthchecks.active.https_verify_certificate=t.fields.activeHealthCheck.verifySsl),t.fields.activeHealthCheck.interval&&(c.healthchecks.active.healthy.interval=Number(t.fields.activeHealthCheck.interval)),t.fields.activeHealthCheck.successes&&(c.healthchecks.active.healthy.successes=Number(t.fields.activeHealthCheck.successes)),t.fields.activeHealthCheck.type!=="tcp"&&t.fields.activeHealthCheck.httpStatuses&&(c.healthchecks.active.healthy.http_statuses=g(t.fields.activeHealthCheck.httpStatuses)),t.fields.activeHealthCheck.unhealthyInterval&&(c.healthchecks.active.unhealthy.interval=Number(t.fields.activeHealthCheck.unhealthyInterval)),t.fields.activeHealthCheck.unhealthyTimeouts&&(c.healthchecks.active.unhealthy.timeouts=Number(t.fields.activeHealthCheck.unhealthyTimeouts)),t.fields.activeHealthCheck.type!=="tcp"&&t.fields.activeHealthCheck.unhealthyHttpStatuses&&(c.healthchecks.active.unhealthy.http_statuses=g(t.fields.activeHealthCheck.unhealthyHttpStatuses)),t.fields.activeHealthCheck.type!=="tcp"&&t.fields.activeHealthCheck.httpFailures&&(c.healthchecks.active.unhealthy.http_failures=Number(t.fields.activeHealthCheck.httpFailures)),t.fields.activeHealthCheck.tcpFailures&&(c.healthchecks.active.unhealthy.tcp_failures=Number(t.fields.activeHealthCheck.tcpFailures))):((U=o.config)==null?void 0:U.app)==="kongManager"&&A.value===p.EntityBaseFormType.Edit&&(c.healthchecks.active={type:t.fields.activeHealthCheck.type,headers:{},healthy:{interval:0,successes:0},unhealthy:{interval:0,http_failures:0,tcp_failures:0}}),t.fields.passiveHealthSwitch?(c.healthchecks.passive={type:t.fields.passiveHealthCheck.type,healthy:{},unhealthy:{}},t.fields.passiveHealthCheck.successes&&(c.healthchecks.passive.healthy.successes=Number(t.fields.passiveHealthCheck.successes)),t.fields.passiveHealthCheck.type!=="tcp"&&t.fields.passiveHealthCheck.httpStatuses&&(c.healthchecks.passive.healthy.http_statuses=g(t.fields.passiveHealthCheck.httpStatuses)),t.fields.passiveHealthCheck.timeouts&&(c.healthchecks.passive.unhealthy.timeouts=Number(t.fields.passiveHealthCheck.timeouts)),t.fields.passiveHealthCheck.type!=="tcp"&&t.fields.passiveHealthCheck.unhealthyHttpStatuses&&(c.healthchecks.passive.unhealthy.http_statuses=g(t.fields.passiveHealthCheck.unhealthyHttpStatuses)),t.fields.passiveHealthCheck.type!=="tcp"&&t.fields.passiveHealthCheck.httpFailures&&(c.healthchecks.passive.unhealthy.http_failures=Number(t.fields.passiveHealthCheck.httpFailures)),t.fields.passiveHealthCheck.tcpFailures&&(c.healthchecks.passive.unhealthy.tcp_failures=Number(t.fields.passiveHealthCheck.tcpFailures))):((K=o.config)==null?void 0:K.app)==="kongManager"&&A.value===p.EntityBaseFormType.Edit&&(c.healthchecks.passive={type:t.fields.passiveHealthCheck.type,healthy:{successes:0},unhealthy:{timeouts:0,tcp_failures:0,http_failures:0}}),c}),R=c=>{var i,V,U,K,E,j;let r=`${(i=o.config)==null?void 0:i.apiBaseUrl}${ae.form[(V=o.config)==null?void 0:V.app][c]}`;return((U=o.config)==null?void 0:U.app)==="konnect"?r=r.replace(/{controlPlaneId}/gi,((K=o.config)==null?void 0:K.controlPlaneId)||""):((E=o.config)==null?void 0:E.app)==="kongManager"&&(r=r.replace(/\/{workspace}/gi,(j=o.config)!=null&&j.workspace?`/${o.config.workspace}`:"")),r=r.replace(/{id}/gi,o.upstreamId),r},b=async()=>{var c;try{t.readonly=!0,await h.post(R("validate"),$.value);let r;A.value===p.EntityBaseFormType.Create?r=await h.post(R("create"),$.value):A.value===p.EntityBaseFormType.Edit&&(r=((c=o.config)==null?void 0:c.app)==="konnect"?await h.put(R("edit"),$.value):await h.patch(R("edit"),$.value)),s("update",r==null?void 0:r.data)}catch(r){t.errorMessage=k(r),s("error",r)}finally{t.readonly=!1}};return(c,r)=>(e.openBlock(),e.createElementBlock("div",Kt,[e.createVNode(e.unref(p.EntityBaseForm),{"can-submit":D.value&&w.value,config:a.config,"edit-id":a.upstreamId,"entity-type":e.unref(p.SupportedEntityType).Upstream,"error-message":t.errorMessage,"fetch-url":J.value,"form-fields":$.value,"is-readonly":t.readonly,onCancel:T,"onFetch:error":P,"onFetch:success":W,onLoading:I,onSubmit:b},{default:e.withCtx(()=>[e.createVNode(bt,{"client-certificate":t.fields.clientCertificate,"onUpdate:clientCertificate":r[0]||(r[0]=i=>t.fields.clientCertificate=i),"host-header":t.fields.hostHeader,"onUpdate:hostHeader":r[1]||(r[1]=i=>t.fields.hostHeader=i),name:t.fields.name,"onUpdate:name":r[2]||(r[2]=i=>t.fields.name=i),tags:t.fields.tags,"onUpdate:tags":r[3]||(r[3]=i=>t.fields.tags=i),config:a.config,readonly:t.readonly},null,8,["client-certificate","host-header","name","tags","config","readonly"]),e.createVNode(Vt,{algorithm:t.fields.algorithm,"onUpdate:algorithm":r[4]||(r[4]=i=>t.fields.algorithm=i),"hash-fallback":t.fields.hashFallback,"onUpdate:hashFallback":r[5]||(r[5]=i=>t.fields.hashFallback=i),"hash-fallback-header":t.fields.hashFallbackHeader,"onUpdate:hashFallbackHeader":r[6]||(r[6]=i=>t.fields.hashFallbackHeader=i),"hash-fallback-query-argument":t.fields.hashFallbackQueryArgument,"onUpdate:hashFallbackQueryArgument":r[7]||(r[7]=i=>t.fields.hashFallbackQueryArgument=i),"hash-fallback-uri-capture":t.fields.hashFallbackUriCapture,"onUpdate:hashFallbackUriCapture":r[8]||(r[8]=i=>t.fields.hashFallbackUriCapture=i),"hash-on":t.fields.hashOn,"onUpdate:hashOn":r[9]||(r[9]=i=>t.fields.hashOn=i),"hash-on-cookie":t.fields.hashOnCookie,"onUpdate:hashOnCookie":r[10]||(r[10]=i=>t.fields.hashOnCookie=i),"hash-on-cookie-path":t.fields.hashOnCookiePath,"onUpdate:hashOnCookiePath":r[11]||(r[11]=i=>t.fields.hashOnCookiePath=i),"hash-on-header":t.fields.hashOnHeader,"onUpdate:hashOnHeader":r[12]||(r[12]=i=>t.fields.hashOnHeader=i),"hash-on-query-argument":t.fields.hashOnQueryArgument,"onUpdate:hashOnQueryArgument":r[13]||(r[13]=i=>t.fields.hashOnQueryArgument=i),"hash-on-uri-capture":t.fields.hashOnUriCapture,"onUpdate:hashOnUriCapture":r[14]||(r[14]=i=>t.fields.hashOnUriCapture=i),slots:t.fields.slots,"onUpdate:slots":r[15]||(r[15]=i=>t.fields.slots=i),readonly:t.readonly},null,8,["algorithm","hash-fallback","hash-fallback-header","hash-fallback-query-argument","hash-fallback-uri-capture","hash-on","hash-on-cookie","hash-on-cookie-path","hash-on-header","hash-on-query-argument","hash-on-uri-capture","slots","readonly"]),e.createVNode(Tt,{"active-health-switch":t.fields.activeHealthSwitch,"onUpdate:activeHealthSwitch":[r[16]||(r[16]=i=>t.fields.activeHealthSwitch=i),d],"healthchecks-threshold":t.fields.healthchecksThreshold,"onUpdate:healthchecksThreshold":r[17]||(r[17]=i=>t.fields.healthchecksThreshold=i),"passive-health-switch":t.fields.passiveHealthSwitch,"onUpdate:passiveHealthSwitch":[r[18]||(r[18]=i=>t.fields.passiveHealthSwitch=i),C],readonly:t.readonly},null,8,["active-health-switch","healthchecks-threshold","passive-health-switch","readonly"]),t.fields.activeHealthSwitch?(e.openBlock(),e.createBlock(Ot,{key:0,concurrency:t.fields.activeHealthCheck.concurrency,"onUpdate:concurrency":r[19]||(r[19]=i=>t.fields.activeHealthCheck.concurrency=i),headers:t.fields.activeHealthCheck.headers,"onUpdate:headers":r[20]||(r[20]=i=>t.fields.activeHealthCheck.headers=i),"http-failures":t.fields.activeHealthCheck.httpFailures,"onUpdate:httpFailures":r[21]||(r[21]=i=>t.fields.activeHealthCheck.httpFailures=i),"http-path":t.fields.activeHealthCheck.httpPath,"onUpdate:httpPath":r[22]||(r[22]=i=>t.fields.activeHealthCheck.httpPath=i),"http-statuses":t.fields.activeHealthCheck.httpStatuses,"onUpdate:httpStatuses":r[23]||(r[23]=i=>t.fields.activeHealthCheck.httpStatuses=i),"https-sni":t.fields.activeHealthCheck.httpsSni,"onUpdate:httpsSni":r[24]||(r[24]=i=>t.fields.activeHealthCheck.httpsSni=i),interval:t.fields.activeHealthCheck.interval,"onUpdate:interval":r[25]||(r[25]=i=>t.fields.activeHealthCheck.interval=i),successes:t.fields.activeHealthCheck.successes,"onUpdate:successes":r[26]||(r[26]=i=>t.fields.activeHealthCheck.successes=i),"tcp-failures":t.fields.activeHealthCheck.tcpFailures,"onUpdate:tcpFailures":r[27]||(r[27]=i=>t.fields.activeHealthCheck.tcpFailures=i),timeout:t.fields.activeHealthCheck.timeout,"onUpdate:timeout":r[28]||(r[28]=i=>t.fields.activeHealthCheck.timeout=i),type:t.fields.activeHealthCheck.type,"onUpdate:type":r[29]||(r[29]=i=>t.fields.activeHealthCheck.type=i),"unhealthy-http-statuses":t.fields.activeHealthCheck.unhealthyHttpStatuses,"onUpdate:unhealthyHttpStatuses":r[30]||(r[30]=i=>t.fields.activeHealthCheck.unhealthyHttpStatuses=i),"unhealthy-interval":t.fields.activeHealthCheck.unhealthyInterval,"onUpdate:unhealthyInterval":r[31]||(r[31]=i=>t.fields.activeHealthCheck.unhealthyInterval=i),"unhealthy-timeouts":t.fields.activeHealthCheck.unhealthyTimeouts,"onUpdate:unhealthyTimeouts":r[32]||(r[32]=i=>t.fields.activeHealthCheck.unhealthyTimeouts=i),"verify-ssl":t.fields.activeHealthCheck.verifySsl,"onUpdate:verifySsl":r[33]||(r[33]=i=>t.fields.activeHealthCheck.verifySsl=i),config:a.config,readonly:t.readonly},null,8,["concurrency","headers","http-failures","http-path","http-statuses","https-sni","interval","successes","tcp-failures","timeout","type","unhealthy-http-statuses","unhealthy-interval","unhealthy-timeouts","verify-ssl","config","readonly"])):e.createCommentVNode("",!0),t.fields.passiveHealthSwitch?(e.openBlock(),e.createBlock(Mt,{key:1,"http-failures":t.fields.passiveHealthCheck.httpFailures,"onUpdate:httpFailures":r[34]||(r[34]=i=>t.fields.passiveHealthCheck.httpFailures=i),"http-statuses":t.fields.passiveHealthCheck.httpStatuses,"onUpdate:httpStatuses":r[35]||(r[35]=i=>t.fields.passiveHealthCheck.httpStatuses=i),successes:t.fields.passiveHealthCheck.successes,"onUpdate:successes":r[36]||(r[36]=i=>t.fields.passiveHealthCheck.successes=i),"tcp-failures":t.fields.passiveHealthCheck.tcpFailures,"onUpdate:tcpFailures":r[37]||(r[37]=i=>t.fields.passiveHealthCheck.tcpFailures=i),timeouts:t.fields.passiveHealthCheck.timeouts,"onUpdate:timeouts":r[38]||(r[38]=i=>t.fields.passiveHealthCheck.timeouts=i),type:t.fields.passiveHealthCheck.type,"onUpdate:type":r[39]||(r[39]=i=>t.fields.passiveHealthCheck.type=i),"unhealthy-http-statuses":t.fields.passiveHealthCheck.unhealthyHttpStatuses,"onUpdate:unhealthyHttpStatuses":r[40]||(r[40]=i=>t.fields.passiveHealthCheck.unhealthyHttpStatuses=i),readonly:t.readonly},null,8,["http-failures","http-statuses","successes","tcp-failures","timeouts","type","unhealthy-http-statuses","readonly"])):e.createCommentVNode("",!0)]),_:1},8,["can-submit","config","edit-id","entity-type","error-message","fetch-url","form-fields","is-readonly"])]))}}),[["__scopeId","data-v-0669debc"]]),vt={"data-testid":"client_certificate-plain-text"},jt=e.defineComponent({__name:"UpstreamsConfigCard",props:{config:{type:Object,required:!0,validator:a=>!(!a||!["konnect","kongManager"].includes(a==null?void 0:a.app)||a.app==="konnect"&&!a.controlPlaneId||a.app==="kongManager"&&typeof a.workspace!="string"||!a.entityId)},configCardDoc:{type:String,default:"",required:!1},hideTitle:{type:Boolean,default:!1}},emits:["loading","fetch:error","fetch:success"],setup(a){const B=a,{i18n:{t:o},i18nT:s}=z.useI18n(),{getPropValue:n}=p.useHelpers(),g=e.computed(()=>ae.form[B.config.app].edit),m=e.ref({id:{},name:{},created_at:{},updated_at:{},algorithm:{order:5,section:p.ConfigurationSchemaSection.Basic,tooltip:o("upstreams.form.fields.algorithm.tooltip")},slots:{order:6,section:p.ConfigurationSchemaSection.Basic},hash_on:{order:7,section:p.ConfigurationSchemaSection.Basic},hash_on_header:{order:8,section:p.ConfigurationSchemaSection.Basic},hash_on_uri_capture:{order:9,section:p.ConfigurationSchemaSection.Basic},hash_on_query_arg:{order:10,section:p.ConfigurationSchemaSection.Basic,label:`${o("upstreams.form.fields.hash_on.label")} ${o("upstreams.form.hash_labels.query_argument")}`},hash_on_cookie:{order:11,section:p.ConfigurationSchemaSection.Basic},hash_on_cookie_path:{order:12,section:p.ConfigurationSchemaSection.Basic},healthchecks:{order:13,section:p.ConfigurationSchemaSection.Basic,type:p.ConfigurationSchemaType.Json},tags:{order:14,tooltip:o("upstreams.form.hash_tooltips.tags")},hash_fallback:{order:1},hash_fallback_header:{order:2},hash_fallback_query_arg:{order:3,label:`${o("upstreams.form.fields.hash_fallback.label")} ${o("upstreams.form.hash_labels.query_argument")}`},hash_fallback_uri_capture:{order:4},host_header:{order:5},use_srv_name:{order:6},client_certificate:{order:7,tooltip:o("upstreams.form.hash_tooltips.client_certificate")}});return(q,x)=>(e.openBlock(),e.createElementBlock("div",null,[e.createVNode(e.unref(p.EntityBaseConfigCard),{config:a.config,"config-card-doc":a.configCardDoc,"config-schema":m.value,"entity-type":e.unref(p.SupportedEntityType).Upstream,"fetch-url":g.value,"hide-title":a.hideTitle,"onFetch:error":x[0]||(x[0]=l=>q.$emit("fetch:error",l)),"onFetch:success":x[1]||(x[1]=l=>q.$emit("fetch:success",l)),onLoading:x[2]||(x[2]=l=>q.$emit("loading",l))},{"name-label-tooltip":e.withCtx(()=>[e.createVNode(e.unref(s),{keypath:"upstreams.form.fields.name.tooltip",scope:"global"},{host:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(e.unref(o)("upstreams.form.fields.name.host")),1)]),_:1})]),"hash_on-label-tooltip":e.withCtx(({row:l})=>[e.createVNode(e.unref(s),{keypath:"upstreams.form.fields.hash_on.tooltip",scope:"global"},{result:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(l.value),1)]),_:2},1024)]),"hash_on_header-label-tooltip":e.withCtx(()=>[e.createVNode(e.unref(s),{keypath:"upstreams.form.hash_tooltips.hash_on_header.text",scope:"global"},{hash_on:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(e.unref(o)("upstreams.form.hash_tooltips.hash_on_header.hash_on")),1)]),header:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(e.unref(o)("upstreams.form.hash_tooltips.hash_on_header.header")),1)]),_:1})]),"hash_on_uri_capture-label-tooltip":e.withCtx(()=>[e.createVNode(e.unref(s),{keypath:"upstreams.form.hash_tooltips.hash_on_uri_capture.text",scope:"global"},{hash_on:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(e.unref(o)("upstreams.form.hash_tooltips.hash_on_uri_capture.hash_on")),1)]),uri_capture:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(e.unref(o)("upstreams.form.hash_tooltips.hash_on_uri_capture.uri_capture")),1)]),_:1})]),"hash_on_query_arg-label-tooltip":e.withCtx(()=>[e.createVNode(e.unref(s),{keypath:"upstreams.form.hash_tooltips.hash_on_query_arg.text",scope:"global"},{hash_on:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(e.unref(o)("upstreams.form.hash_tooltips.hash_on_query_arg.hash_on")),1)]),query_arg:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(e.unref(o)("upstreams.form.hash_tooltips.hash_on_query_arg.query_arg")),1)]),_:1})]),"hash_on_cookie-label-tooltip":e.withCtx(()=>[e.createVNode(e.unref(s),{keypath:"upstreams.form.hash_tooltips.hash_on_cookie.text",scope:"global"},{hash_on:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(e.unref(o)("upstreams.form.hash_tooltips.hash_on_cookie.hash_on")),1)]),hash_fallback:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(e.unref(o)("upstreams.form.hash_tooltips.hash_on_cookie.hash_fallback")),1)]),cookie:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(e.unref(o)("upstreams.form.hash_tooltips.hash_on_cookie.cookie")),1)]),_:1})]),"hash_on_cookie_path-label-tooltip":e.withCtx(()=>[e.createVNode(e.unref(s),{keypath:"upstreams.form.hash_tooltips.hash_on_cookie_path.text",scope:"global"},{hash_on:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(e.unref(o)("upstreams.form.hash_tooltips.hash_on_cookie_path.hash_on")),1)]),hash_fallback:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(e.unref(o)("upstreams.form.hash_tooltips.hash_on_cookie_path.hash_fallback")),1)]),cookie:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(e.unref(o)("upstreams.form.hash_tooltips.hash_on_cookie_path.cookie")),1)]),_:1})]),"slots-label-tooltip":e.withCtx(()=>[e.createVNode(e.unref(s),{keypath:"upstreams.form.hash_tooltips.slots.text",scope:"global"},{algorithm:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(e.unref(o)("upstreams.form.hash_tooltips.slots.algorithm")),1)]),round_robin:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(e.unref(o)("upstreams.form.hash_tooltips.slots.round_robin")),1)]),consistent_hashing:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(e.unref(o)("upstreams.form.hash_tooltips.slots.consistent_hashing")),1)]),min:e.withCtx(()=>x[3]||(x[3]=[e.createElementVNode("code",null,"10",-1)])),max:e.withCtx(()=>x[4]||(x[4]=[e.createElementVNode("code",null,"65536",-1)])),_:1})]),"hash_fallback-label-tooltip":e.withCtx(()=>[e.createVNode(e.unref(s),{keypath:"upstreams.form.hash_tooltips.hash_fallback.text",scope:"global"},{hash_on:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(e.unref(o)("upstreams.form.hash_tooltips.hash_fallback.hash_on")),1)]),cookie:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(e.unref(o)("upstreams.form.hash_tooltips.hash_fallback.cookie")),1)]),_:1})]),"hash_fallback_header-label-tooltip":e.withCtx(()=>[e.createVNode(e.unref(s),{keypath:"upstreams.form.hash_tooltips.hash_fallback_header.text",scope:"global"},{hash_fallback:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(e.unref(o)("upstreams.form.hash_tooltips.hash_fallback_header.hash_fallback")),1)]),header:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(e.unref(o)("upstreams.form.hash_tooltips.hash_fallback_header.header")),1)]),_:1})]),"hash_fallback_query_arg-label-tooltip":e.withCtx(()=>[e.createVNode(e.unref(s),{keypath:"upstreams.form.hash_tooltips.hash_fallback_query_arg.text",scope:"global"},{hash_fallback:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(e.unref(o)("upstreams.form.hash_tooltips.hash_fallback_query_arg.hash_fallback")),1)]),query_arg:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(e.unref(o)("upstreams.form.hash_tooltips.hash_fallback_query_arg.query_arg")),1)]),_:1})]),"hash_fallback_uri_capture-label-tooltip":e.withCtx(()=>[e.createVNode(e.unref(s),{keypath:"upstreams.form.hash_tooltips.hash_fallback_uri_capture.text",scope:"global"},{hash_fallback:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(e.unref(o)("upstreams.form.hash_tooltips.hash_fallback_uri_capture.hash_fallback")),1)]),uri_capture:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(e.unref(o)("upstreams.form.hash_tooltips.hash_fallback_uri_capture.uri_capture")),1)]),_:1})]),"host_header-label-tooltip":e.withCtx(()=>[e.createVNode(e.unref(s),{keypath:"upstreams.form.hash_tooltips.host_header.text",scope:"global"},{host:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(e.unref(o)("upstreams.form.hash_tooltips.host_header.host")),1)]),_:1})]),client_certificate:e.withCtx(l=>{var h;return[e.createElementVNode("div",null,[e.createElementVNode("div",vt,[e.createElementVNode("span",null,e.toDisplayString((h=e.unref(n)("rowValue",l))==null?void 0:h.id),1)])])]}),_:1},8,["config","config-card-doc","config-schema","entity-type","fetch-url","hide-title"])]))}});L.TargetForm=He,L.TargetsList=yt,L.UpstreamsConfigCard=jt,L.UpstreamsForm=Rt,L.UpstreamsList=ct,Object.defineProperty(L,Symbol.toStringTag,{value:"Module"})});
1
+ (function(j,e){typeof exports=="object"&&typeof module<"u"?e(exports,require("vue"),require("@kong-ui-public/entities-shared"),require("vue-router"),require("@kong/icons"),require("@kong-ui-public/i18n")):typeof define=="function"&&define.amd?define(["exports","vue","@kong-ui-public/entities-shared","vue-router","@kong/icons","@kong-ui-public/i18n"],e):(j=typeof globalThis<"u"?globalThis:j||self,e(j["kong-ui-entities-upstreams-targets"]={},j.Vue,j["kong-ui-public-entities-shared"],j.VueRouter,j.KongIcons,j["kong-ui-public-i18n"]))})(this,function(j,e,p,ye,oe,ge){"use strict";const Ze={upstreams:{list:{table_headers:{id:"ID",name:"Name",slots:"Slots",tags:"Tags"},empty_state:{title:"Configure a New Upstream",description:"Upstreams are used to load balance incoming requests."},toolbar_actions:{new_upstream:"New Upstream"}},title:"Upstreams",search:{placeholder:"Filter by exact name or ID"},actions:{create:"New Upstream",copy_id:"Copy ID",copy_json:"Copy JSON",edit:"Edit",delete:"Delete",view:"View Details"},delete:{title:"Delete an Upstream",description:"This action cannot be reversed so make sure to check upstream usage before deleting."},errors:{general:"Upstreams could not be retrieved",delete:"The upstream could not be deleted at this time.",copy:"Failed to copy to clipboard"},copy:{success:"Copied {val} to clipboard",success_brief:"Successfully copied to clipboard"},form:{errors:{name_required:"Name is required",should_be_integer:"Field should contain an integer",in_range:"Accepts an integer in the range of 10 - 65536"},general_info:{title:"General Information",help:"General information will help identify and manage this Upstream."},load_balancing:{title:"Load Balancing",help:"Active health checks actively probe targets for their health. Currently only support HTTP/HTTPS targets."},health_check:{title:"Health Checks & Circuit Breakers",help:"Active health checks actively probe targets for their health. Currently only support HTTP/HTTPS targets."},active_health_check:{title:"Active Health Checks",help:"Active health checks actively probe targets for their health. Currently only support HTTP/HTTPS targets."},passive_health_check:{title:"Passive Health Checks",help:"Passive health checks, also known as circuit breakers, are checks performed based on the requests being proxied by Kong (HTTP/HTTPS/TCP), with no additional traffic being generated."},buttons:{view_documentation:"View documentation"},algorithms:{round_robin_label:"Round Robin",least_connections_label:"Least Connections",consistent_hashing_label:"Consistent Hashing",latency_label:"Latency"},hash_labels:{none:"None",consumer:"Consumer",ip:"IP",header:"Header",cookie:"Cookie",path:"Path",query_argument:"Query Argument",uri_capture:"URI Capture"},hash_tooltips:{hash_on_header:{text:"The header name to take the value from as hash input. Only required when {hash_on} is set to {header}",hash_on:"hash_on",header:"header"},hash_on_uri_capture:{text:"The name of the route URI capture to take the value from as hash input. Only required when {hash_on} is set to {uri_capture}",hash_on:"hash_on",uri_capture:"uri_capture"},hash_on_query_arg:{text:"The name of the query string argument to take the value from as hash input. Only required when {hash_on} is set to {query_arg}",hash_on:"hash_on",query_arg:"query_arg"},hash_on_cookie:{text:"The cookie name to take the value from as hash input. Only required when {hash_on} or {hash_fallback} is set to {cookie}. If the specified cookie is not in the request, Kong will generate a value and set the cookie in the response.",hash_on:"hash_on",hash_fallback:"hash_fallback",cookie:"cookie"},hash_on_cookie_path:{text:"The cookie path to set in the response headers. Only required when {hash_on} or {hash_fallback} is set to {cookie}.",hash_on:"hash_on",hash_fallback:"hash_fallback",cookie:"cookie"},slots:{text:"The number of slots in the load balancer algorithm. If {algorithm} is set to {round_robin}, this setting determines the maximum number of slots. If {algorithm} is set to {consistent_hashing}, this setting determines the actual number of slots in the algorithm. Accepts an integer in the range {min}-{max}",algorithm:"algorithm",round_robin:"round-robin",consistent_hashing:"consistent-hashing"},tags:"An optional set of strings associated with the Upstream for grouping and filtering.",hash_fallback:{text:"What to use as hashing input if the primary {hash_on} does not return a hash (eg. header is missing, or no Consumer identified). Not available if {hash_on} is set to {cookie}",hash_on:"hash_on",cookie:"cookie"},hash_fallback_header:{text:"The header name to take the value from as hash input. Only required when {hash_fallback} is set to {header}",hash_fallback:"hash_fallback",header:"header"},hash_fallback_query_arg:{text:"The name of the query string argument to take the value from as hash input. Only required when {hash_fallback} is set to {query_arg}",hash_fallback:"hash_fallback",query_arg:"query_arg"},hash_fallback_uri_capture:{text:"The name of the route URI capture to take the value from as hash input. Only required when {hash_fallback} is set to {uri_capture}",hash_fallback:"hash_fallback",uri_capture:"uri_capture"},host_header:{text:"The hostname to be used as {host} header when proxying requests through Kong.",host:"Host"},client_certificate:"If set, the certificate to be used as client certificate while TLS handshaking to the upstream server."},healthcheck_type_labels:{http:"HTTP",https:"HTTPS",tcp:"TCP",grsp:"gRPC",grsps:"gRPCs"},healthy:{label:"Healthy",help:"The counter thresholds to determine whether targets are healthy."},unhealthy:{label:"Unhealthy",help:"The counter thresholds to determine whether targets are unhealthy."},passive_healthy:{label:"Healthy",help:"The counter thresholds to determine whether targets are healthy."},passive_unhealthy:{label:"Unhealthy",help:"The counter thresholds to determine whether targets are unhealthy."},fields:{name:{label:"Name",placeholder:"Enter or select a host",tooltip:"This is a hostname, which must be equal to the {host} of a Service.",host:"host"},host_header:{label:"Host Header"},client_certificate:{label:"Client Certificate",placeholder:"Select or enter a Certificate ID",tooltip:"If set, the certificate to be used as client certificate while TLS handshaking to the upstream server."},tags:{label:"Tags",placeholder:"Enter a list of tags separated by comma",help:"e.g. tag1, tag2, tag3",tooltip:"An optional set of strings associated with the Upstream for grouping and filtering."},algorithm:{label:"Algorithm",tooltip:"Which load balancing algorithm to use."},slots:{label:"Slots",help:"Accepts an integer in the range of 10 - 65536"},hash_on:{label:"Hash on",help:"What to use as hashing input.",tooltip:"What to use as hashing input. Using {result} results in a weighted-round-robin scheme with no hashing."},hash_fallback:{label:"Hash Fallback",help:"What to use as hashing input if the primary hash_on does not return a hash",tooltip:"What to use as hashing input if the primary {hash_on} does not return a hash (eg. header is missing, or no Consumer identified). Not available if {hash_on} is set to {cookie}.",hash_on:"hash_on",cookie:"cookie"},active_health_checks:{label:"Active Health Checks",help:"Actively probe the targets for their health."},passive_health_checks:{label:"Passive Health Checks / Circuit Breakers",help:"Checks performed based on the requests being proxied by Kong (HTTP/HTTPS/TCP), with no additional traffic being generated."},healthchecks_threshold:{label:"Healthchecks Threshold"},header:{label:"Header"},headers:{label:"Headers",tooltip_active:"Header values can be separated by commas (value1, value2, value3)."},cookie:{label:"Cookie"},cookie_path:{label:"Cookie Path"},query_argument:{label:"Query Argument"},uri_capture:{label:"URI Capture"},active_healthcheck_type:{label:"Active Health Check Type"},http_path:{label:"HTTP Path"},timeout:{label:"Timeout"},concurrency:{label:"Concurrency"},https_sni:{label:"HTTPS SNI"},verify_ssl:{label:"Verify the SSL certificate when performing active health checks using HTTPS"},interval:{label:"Interval",help:"A value of zero indicates that active probes for healthy targets are disabled."},successes:{label:"Successes"},http_statuses:{label:"HTTP Statuses"},http_failures:{label:"HTTP Failures"},tcp_failures:{label:"TCP Failures"},timeouts:{label:"Timeouts"},passive_health_check_type:{label:"Passive Health Check Type"}}},labels:{created_at:"Created at"}},targets:{list:{table_headers:{id:"ID",target_address:"Target Address",weight:"Weight",tags:"Tags"},empty_state:{title:"Configure a New Target",description:"A target is an IP address/hostname with a port that identifies an instance of a backend service."},toolbar_actions:{new_target:"New Target"}},title:"Targets",actions:{create:"New Target",copy_id:"Copy ID",copy_json:"Copy JSON",edit:"Edit",delete:"Delete",mark_healthy:"Mark Healthy",mark_unhealthy:"Mark Unhealthy"},delete:{title:"Delete a Target",description:"This action cannot be reversed so make sure to check target usage before deleting."},errors:{general:"Targets could not be retrieved",delete:"The target could not be deleted at this time.",copy:"Failed to copy to clipboard",weight:"Value must be in range 0 to 65535"},copy:{success:"Copied {val} to clipboard",success_brief:"Successfully copied to clipboard"},form:{create:{title:"New Target"},edit:{title:"Edit Target"},buttons:{save:"Save",cancel:"Cancel"},fields:{target:{label:"Target Address",placeholder:"Enter IP/hostname and port",tooltip:"The target address (IP or hostname) and port. If omitted the port defaults to 8000."},weight:{label:"Weight",tooltip:"The weight of this target in relation to other targets in the upstream. Value must be in range 0 to 65535, defaults to 100."},tags:{label:"Tags",placeholder:"Enter a list of tags separated by comma",help:"e.g. tag1, tag2, tag3"}}}}};function et(){const a=ge.createI18n("en-us",Ze);return{i18n:a,i18nT:ge.i18nTComponent(a)}}function le(a){const{replaceId:E=!1}=a,r=e.ref([]);return{addedItems:r,trackNewItems:(n,g)=>{if(g){const m={...n};E&&(m.value=n.label),r.value.push(m)}else r.value=r.value.filter(m=>m.value!==n.value)}}}const ie=[{label:"100",value:"100"},{label:"101",value:"101"},{label:"102",value:"102"},{label:"103",value:"103"},{label:"200",value:"200"},{label:"201",value:"201"},{label:"202",value:"202"},{label:"203",value:"203"},{label:"204",value:"204"},{label:"205",value:"205"},{label:"206",value:"206"},{label:"207",value:"207"},{label:"208",value:"208"},{label:"226",value:"226"},{label:"300",value:"300"},{label:"301",value:"301"},{label:"302",value:"302"},{label:"303",value:"303"},{label:"304",value:"304"},{label:"305",value:"305"},{label:"306",value:"306"},{label:"307",value:"307"},{label:"308",value:"308"},{label:"400",value:"400"},{label:"401",value:"401"},{label:"402",value:"402"},{label:"403",value:"403"},{label:"404",value:"404"},{label:"405",value:"405"},{label:"406",value:"406"},{label:"407",value:"407"},{label:"408",value:"408"},{label:"409",value:"409"},{label:"410",value:"410"},{label:"411",value:"411"},{label:"412",value:"412"},{label:"413",value:"413"},{label:"414",value:"414"},{label:"415",value:"415"},{label:"416",value:"416"},{label:"417",value:"417"},{label:"418",value:"418"},{label:"419",value:"419"},{label:"420",value:"420"},{label:"421",value:"421"},{label:"422",value:"422"},{label:"423",value:"423"},{label:"424",value:"424"},{label:"425",value:"425"},{label:"426",value:"426"},{label:"428",value:"428"},{label:"429",value:"429"},{label:"430",value:"430"},{label:"431",value:"431"},{label:"440",value:"440"},{label:"444",value:"444"},{label:"449",value:"449"},{label:"450",value:"450"},{label:"451",value:"451"},{label:"460",value:"460"},{label:"463",value:"463"},{label:"494",value:"494"},{label:"495",value:"495"},{label:"496",value:"496"},{label:"497",value:"497"},{label:"498",value:"498"},{label:"499",value:"499"},{label:"500",value:"500"},{label:"501",value:"501"},{label:"502",value:"502"},{label:"503",value:"503"},{label:"504",value:"504"},{label:"505",value:"505"},{label:"506",value:"506"},{label:"507",value:"507"},{label:"508",value:"508"},{label:"509",value:"509"},{label:"510",value:"510"},{label:"511",value:"511"},{label:"520",value:"520"},{label:"521",value:"521"},{label:"522",value:"522"},{label:"523",value:"523"},{label:"524",value:"524"},{label:"525",value:"525"},{label:"526",value:"526"},{label:"527",value:"527"},{label:"529",value:"529"},{label:"530",value:"530"},{label:"561",value:"561"},{label:"598",value:"598"},{label:"599",value:"599"}],fe=10,pe=65536,tt=0,at=65535,X=0,Y=255,be=0,ke=255,lt=0,st=65535,Ce=0,_e=65535,rt=0,ot=2**31,we=["200","302"],Ve=["200","201","202","203","204","205","206","207","208","226","300","301","302","303","304","305","306","307","308"],Ne=["429","404","500","501","502","503","504","505"],xe=["429","500","503"];function ne(){const a=l=>/^\d+$/.test(l),E=(l,h,C)=>{if(a(l)){const u=Number(l);return u>=h&&u<=C}else return!1},r=l=>l.map(h=>Number(h)),s=l=>l.map(h=>h.toString()),n=l=>{var C,u,t,B,N,d,_,$,F,K,M,y,w,V,S,f,O,P,Q,W,I,T,A,k,H,U,b,c,o,i,R,D,v,L,G,se,re,ae,Se,Te,Ue,Ie,Fe,qe,Ee,Be,Oe,De,$e,Pe,Me,Ae,Ke,Re,ve,je,Le,Qe,We,Je,ze,Ge,Xe,Ye;return{name:(l==null?void 0:l.name)||"",hostHeader:(l==null?void 0:l.host_header)||"",clientCertificate:((C=l==null?void 0:l.client_certificate)==null?void 0:C.id)||"",tags:((u=l==null?void 0:l.tags)==null?void 0:u.join(", "))||"",algorithm:(l==null?void 0:l.algorithm)||"round-robin",slots:((t=l==null?void 0:l.slots)==null?void 0:t.toString())||"10000",hashOn:(l==null?void 0:l.hash_on)||"none",hashFallback:(l==null?void 0:l.hash_fallback)||"none",hashOnHeader:(l==null?void 0:l.hash_on_header)||"",hashOnCookie:(l==null?void 0:l.hash_on_cookie)||"",hashOnCookiePath:(l==null?void 0:l.hash_on_cookie_path)||"/",hashOnQueryArgument:(l==null?void 0:l.hash_on_query_arg)||"",hashOnUriCapture:(l==null?void 0:l.hash_on_uri_capture)||"",hashFallbackHeader:(l==null?void 0:l.hash_fallback_header)||"",hashFallbackQueryArgument:(l==null?void 0:l.hash_fallback_query_arg)||"",hashFallbackUriCapture:(l==null?void 0:l.hash_fallback_uri_capture)||"",activeHealthSwitch:l?((N=(B=l.healthchecks.active)==null?void 0:B.healthy)==null?void 0:N.interval)!==0||((_=(d=l.healthchecks.active)==null?void 0:d.unhealthy)==null?void 0:_.interval)!==0:!1,passiveHealthSwitch:l?((F=($=l.healthchecks.passive)==null?void 0:$.healthy)==null?void 0:F.successes)!==0||((M=(K=l.healthchecks.passive)==null?void 0:K.unhealthy)==null?void 0:M.timeouts)!==0||((w=(y=l.healthchecks.passive)==null?void 0:y.unhealthy)==null?void 0:w.tcp_failures)!==0||((S=(V=l.healthchecks.passive)==null?void 0:V.unhealthy)==null?void 0:S.http_failures)!==0:!1,healthchecksThreshold:((f=l==null?void 0:l.healthchecks.threshold)==null?void 0:f.toString())||"0",activeHealthCheck:{type:((O=l==null?void 0:l.healthchecks.active)==null?void 0:O.type)||"http",httpPath:((P=l==null?void 0:l.healthchecks.active)==null?void 0:P.http_path)||"/",timeout:((W=(Q=l==null?void 0:l.healthchecks.active)==null?void 0:Q.timeout)==null?void 0:W.toString())||"1",concurrency:((T=(I=l==null?void 0:l.healthchecks.active)==null?void 0:I.concurrency)==null?void 0:T.toString())||"10",httpsSni:((A=l==null?void 0:l.healthchecks.active)==null?void 0:A.https_sni)||"",verifySsl:((k=l==null?void 0:l.healthchecks.active)==null?void 0:k.https_verify_certificate)||!1,headers:(H=l==null?void 0:l.healthchecks.active)!=null&&H.headers&&Object.entries(l.healthchecks.active.headers).length>0?Object.entries(l.healthchecks.active.headers).map(([Lt,me])=>({key:Lt,values:me==null?void 0:me.join(", ")})):[{key:"",values:""}],interval:((c=(b=(U=l==null?void 0:l.healthchecks.active)==null?void 0:U.healthy)==null?void 0:b.interval)==null?void 0:c.toString())||"0",successes:((R=(i=(o=l==null?void 0:l.healthchecks.active)==null?void 0:o.healthy)==null?void 0:i.successes)==null?void 0:R.toString())||"5",httpStatuses:(v=(D=l==null?void 0:l.healthchecks.active)==null?void 0:D.healthy)!=null&&v.http_statuses?s(l.healthchecks.active.healthy.http_statuses):we,unhealthyInterval:((se=(G=(L=l==null?void 0:l.healthchecks.active)==null?void 0:L.unhealthy)==null?void 0:G.interval)==null?void 0:se.toString())||"0",httpFailures:((Se=(ae=(re=l==null?void 0:l.healthchecks.active)==null?void 0:re.unhealthy)==null?void 0:ae.http_failures)==null?void 0:Se.toString())||"5",tcpFailures:((Ie=(Ue=(Te=l==null?void 0:l.healthchecks.active)==null?void 0:Te.unhealthy)==null?void 0:Ue.tcp_failures)==null?void 0:Ie.toString())||"5",unhealthyHttpStatuses:(qe=(Fe=l==null?void 0:l.healthchecks.active)==null?void 0:Fe.unhealthy)!=null&&qe.http_statuses?s(l.healthchecks.active.unhealthy.http_statuses):Ne,unhealthyTimeouts:((Oe=(Be=(Ee=l==null?void 0:l.healthchecks.active)==null?void 0:Ee.unhealthy)==null?void 0:Be.timeouts)==null?void 0:Oe.toString())||"0"},passiveHealthCheck:{type:((De=l==null?void 0:l.healthchecks.passive)==null?void 0:De.type)||"http",successes:((Me=(Pe=($e=l==null?void 0:l.healthchecks.passive)==null?void 0:$e.healthy)==null?void 0:Pe.successes)==null?void 0:Me.toString())||"0",httpStatuses:(Ke=(Ae=l==null?void 0:l.healthchecks.passive)==null?void 0:Ae.healthy)!=null&&Ke.http_statuses?s(l.healthchecks.passive.healthy.http_statuses):Ve,timeouts:((je=(ve=(Re=l==null?void 0:l.healthchecks.passive)==null?void 0:Re.unhealthy)==null?void 0:ve.timeouts)==null?void 0:je.toString())||"0",httpFailures:((We=(Qe=(Le=l==null?void 0:l.healthchecks.passive)==null?void 0:Le.unhealthy)==null?void 0:Qe.http_failures)==null?void 0:We.toString())||"5",tcpFailures:((Ge=(ze=(Je=l==null?void 0:l.healthchecks.passive)==null?void 0:Je.unhealthy)==null?void 0:ze.tcp_failures)==null?void 0:Ge.toString())||"5",unhealthyHttpStatuses:(Ye=(Xe=l==null?void 0:l.healthchecks.passive)==null?void 0:Xe.unhealthy)!=null&&Ye.http_statuses?s(l.healthchecks.passive.unhealthy.http_statuses):xe}}};return{isInteger:a,inRange:E,stringToNumberArray:r,numberToStringArray:s,upstreamsResponseToFields:l=>n(l),getDefaultUpstreamFields:()=>n(),objectsAreEqual:(l,h)=>{try{return JSON.stringify(l)===JSON.stringify(h)}catch{return!1}},cloneDeep:l=>JSON.parse(JSON.stringify(l))}}const J={useI18n:et,useMultiselectCreation:le,useHelpers:ne},Z="/v2/control-planes/{controlPlaneId}/core-entities",ee="/{workspace}",te={list:{konnect:`${Z}/upstreams`,kongManager:`${ee}/upstreams`},form:{konnect:{getServices:`${Z}/services`,getCertificates:`${Z}/certificates`,validate:`${Z}/v1/schemas/json/upstream/validate`,create:`${Z}/upstreams`,edit:`${Z}/upstreams/{id}`},kongManager:{getServices:`${ee}/services`,getCertificates:`${ee}/certificates`,validate:`${ee}/schemas/upstreams/validate`,create:`${ee}/upstreams`,edit:`${ee}/upstreams/{id}`}}},it={class:"kong-ui-entities-upstreams-list"},nt={class:"upstream-name"},ht=e.defineComponent({__name:"UpstreamsList",props:{config:{type:Object,required:!0,validator:a=>!(!a||!["konnect","kongManager"].includes(a==null?void 0:a.app)||!a.createRoute||!a.getViewRoute||!a.getEditRoute||a.app==="kongManager"&&!a.isExactMatch&&!a.filterSchema)},cacheIdentifier:{type:String,default:""},canCreate:{type:Function,required:!1,default:async()=>!0},canDelete:{type:Function,required:!1,default:async()=>!0},canEdit:{type:Function,required:!1,default:async()=>!0},canRetrieve:{type:Function,required:!1,default:async()=>!0},useActionOutside:{type:Boolean,default:!1}},emits:["error","copy:success","copy:error","delete:success"],setup(a,{emit:E}){var A;const r=E,s=a,{i18n:{t:n}}=J.useI18n(),g=ye.useRouter(),{axiosInstance:m}=p.useAxios((A=s.config)==null?void 0:A.axiosRequestConfig),q=e.ref(1),x=e.computed(()=>s.config.app!=="kongManager"||!!s.config.disableSorting),l={name:{label:n("upstreams.list.table_headers.name"),searchable:!0,sortable:!0,hidable:!1},slots:{label:n("upstreams.list.table_headers.slots"),searchable:!0,sortable:!0},tags:{label:n("upstreams.list.table_headers.tags"),sortable:!1}},h=l,C=e.computed(()=>{var H,U;let k=`${s.config.apiBaseUrl}${te.list[s.config.app]}`;return s.config.app==="konnect"?k=k.replace(/{controlPlaneId}/gi,((H=s.config)==null?void 0:H.controlPlaneId)||""):s.config.app==="kongManager"&&(k=k.replace(/\/{workspace}/gi,(U=s.config)!=null&&U.workspace?`/${s.config.workspace}`:"")),k}),u=e.ref(""),t=e.computed(()=>{const k=s.config.app==="konnect"||s.config.isExactMatch;if(k)return{isExactMatch:k,placeholder:n("upstreams.search.placeholder")};const{name:H,slots:U}=l;return{isExactMatch:k,fields:{name:H,slots:U},schema:s.config.filterSchema}}),{fetcher:B,fetcherState:N}=p.useFetcher(s.config,C.value),d=()=>{u.value=""},_=()=>{q.value++},$=e.ref(null),F=(k,H)=>{const U=k.id;if(!H(U)){r("copy:error",{entity:k,field:"id",message:n("upstreams.errors.copy")});return}r("copy:success",{entity:k,field:"id",message:n("upstreams.copy.success",{val:U})})},K=(k,H)=>{const U=JSON.stringify(k);if(!H(U)){r("copy:error",{entity:k,message:n("upstreams.errors.copy")});return}r("copy:success",{entity:k,message:n("upstreams.copy.success_brief")})},M=async k=>{var U;await((U=s.canRetrieve)==null?void 0:U.call(s,k))&&g.push(s.config.getViewRoute(k.id))},y=k=>({label:n("upstreams.actions.view"),to:s.config.getViewRoute(k)}),w=k=>({label:n("upstreams.actions.edit"),to:s.config.getEditRoute(k)}),V=e.ref(void 0),S=e.ref(!1),f=e.ref(!1),O=e.ref(""),P=p.useDeleteUrlBuilder(s.config,C.value),Q=k=>{V.value=k,S.value=!0},W=()=>{S.value=!1},I=async()=>{var k,H,U;if((k=V.value)!=null&&k.id){f.value=!0;try{await m.delete(P(V.value.id)),f.value=!1,S.value=!1,q.value++,r("delete:success",V.value)}catch(b){O.value=((U=(H=b.response)==null?void 0:H.data)==null?void 0:U.message)||b.message||n("upstreams.errors.delete"),r("error",b)}finally{f.value=!1}}};e.watch(N,k=>{var H,U,b;if(k.status===p.FetcherStatus.Error){$.value={title:n("upstreams.errors.general")},(b=(U=(H=k.error)==null?void 0:H.response)==null?void 0:U.data)!=null&&b.message&&($.value.message=k.error.response.data.message),r("error",k.error);return}$.value=null});const T=e.ref({ctaPath:s.config.createRoute,ctaText:void 0,message:`${n("upstreams.list.empty_state.description")}${s.config.additionMessageForEmptyState?` ${s.config.additionMessageForEmptyState}`:""}`,title:n("upstreams.title")});return e.onBeforeMount(async()=>{await s.canCreate()&&(T.value.title=n("upstreams.list.empty_state.title"),T.value.ctaText=n("upstreams.actions.create"))}),(k,H)=>{const U=e.resolveComponent("KButton"),b=e.resolveComponent("KDropdownItem"),c=e.resolveComponent("KClipboardProvider");return e.openBlock(),e.createElementBlock("div",it,[e.createVNode(e.unref(p.EntityBaseTable),{"cache-identifier":a.cacheIdentifier,"disable-sorting":x.value,"empty-state-options":T.value,"enable-entity-actions":"","error-message":$.value,fetcher:e.unref(B),"fetcher-cache-key":q.value,"pagination-type":"offset","preferences-storage-key":"kong-ui-entities-upstreams-list",query:u.value,"table-headers":e.unref(h),onClearSearchInput:d,"onClick:row":H[1]||(H[1]=o=>M(o)),onSort:_},{"toolbar-filter":e.withCtx(()=>[e.createVNode(e.unref(p.EntityFilter),{modelValue:u.value,"onUpdate:modelValue":H[0]||(H[0]=o=>u.value=o),config:t.value},null,8,["modelValue","config"])]),"toolbar-button":e.withCtx(()=>[(e.openBlock(),e.createBlock(e.Teleport,{disabled:!a.useActionOutside,to:"#kong-ui-app-page-header-action-button"},[e.createVNode(e.unref(p.PermissionsWrapper),{"auth-function":()=>a.canCreate()},{default:e.withCtx(()=>[e.createVNode(U,{appearance:"primary","data-testid":"toolbar-add-upstream",size:a.useActionOutside?"medium":"large",to:a.config.createRoute},{default:e.withCtx(()=>[e.createVNode(e.unref(oe.AddIcon)),e.createTextVNode(" "+e.toDisplayString(e.unref(n)("upstreams.list.toolbar_actions.new_upstream")),1)]),_:1},8,["size","to"])]),_:1},8,["auth-function"])],8,["disabled"]))]),name:e.withCtx(({rowValue:o})=>[e.createElementVNode("span",nt,e.toDisplayString(o),1)]),tags:e.withCtx(({rowValue:o})=>[e.createVNode(e.unref(p.TableTags),{"tag-max-width":"auto",tags:o},null,8,["tags"])]),actions:e.withCtx(({row:o})=>[e.createVNode(c,null,{default:e.withCtx(({copyToClipboard:i})=>[e.createVNode(b,{"data-testid":"action-entity-copy-id",onClick:R=>F(o,i)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)("upstreams.actions.copy_id")),1)]),_:2},1032,["onClick"])]),_:2},1024),e.createVNode(c,null,{default:e.withCtx(({copyToClipboard:i})=>[e.createVNode(b,{"data-testid":"action-entity-copy-json",onClick:R=>K(o,i)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)("upstreams.actions.copy_json")),1)]),_:2},1032,["onClick"])]),_:2},1024),e.createVNode(e.unref(p.PermissionsWrapper),{"auth-function":()=>a.canRetrieve(o)},{default:e.withCtx(()=>[e.createVNode(b,{"data-testid":"action-entity-view","has-divider":"",item:y(o.id)},null,8,["item"])]),_:2},1032,["auth-function"]),e.createVNode(e.unref(p.PermissionsWrapper),{"auth-function":()=>a.canEdit(o)},{default:e.withCtx(()=>[e.createVNode(b,{"data-testid":"action-entity-edit",item:w(o.id)},null,8,["item"])]),_:2},1032,["auth-function"]),e.createVNode(e.unref(p.PermissionsWrapper),{"auth-function":()=>a.canDelete(o)},{default:e.withCtx(()=>[e.createVNode(b,{danger:"","data-testid":"action-entity-delete","has-divider":"",onClick:i=>Q(o)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)("upstreams.actions.delete")),1)]),_:2},1032,["onClick"])]),_:2},1032,["auth-function"])]),_:1},8,["cache-identifier","disable-sorting","empty-state-options","error-message","fetcher","fetcher-cache-key","query","table-headers"]),e.createVNode(e.unref(p.EntityDeleteModal),{"action-pending":f.value,description:e.unref(n)("upstreams.delete.description"),"entity-name":V.value&&(V.value.name||V.value.id),"entity-type":e.unref(p.EntityTypes).Upstream,error:O.value,title:e.unref(n)("upstreams.delete.title"),visible:S.value,onCancel:W,onProceed:I},null,8,["action-pending","description","entity-name","entity-type","error","title","visible"])])}}}),z=(a,E)=>{const r=a.__vccOpts||a;for(const[s,n]of E)r[s]=n;return r},ct=z(ht,[["__scopeId","data-v-abc61ea4"]]),he="/v2/control-planes/{controlPlaneId}/core-entities",ce="/{workspace}",de={list:{konnect:`${he}/upstreams/{upstreamId}/targets`,kongManager:`${ce}/upstreams/{upstreamId}/targets`},form:{konnect:{create:`${he}/upstreams/{upstreamId}/targets`,edit:`${he}/upstreams/{upstreamId}/targets/{id}`,validate:`${he}/v1/schemas/json/target/validate`},kongManager:{create:`${ce}/upstreams/{upstreamId}/targets`,edit:`${ce}/upstreams/{upstreamId}/targets/{id}`,validate:`${ce}/schemas/targets/validate`}}},dt={class:"kong-ui-entities-target-form"},ut={class:"target-form-container"},ft={key:0,class:"target-form-info"},He=z(e.defineComponent({__name:"TargetForm",props:{config:{type:Object,required:!0,validator:a=>!(!a||!["konnect","kongManager"].includes(a==null?void 0:a.app)||a.app==="konnect"&&!a.controlPlaneId||a.app==="kongManager"&&typeof a.workspace!="string"||!a.upstreamId)},isVisible:{type:Boolean,required:!0,default:!1},targetId:{type:String,required:!1,default:""}},emits:["update","error","loading","cancel"],setup(a,{emit:E}){var M;const r=E,s=a,{i18n:{t:n}}=J.useI18n(),{getMessageFromError:g}=p.useErrors(),{axiosInstance:m}=p.useAxios((M=s.config)==null?void 0:M.axiosRequestConfig),q=e.computed(()=>{var y;return de.form[s.config.app].edit.replace(/{upstreamId}/gi,((y=s.config)==null?void 0:y.upstreamId)||"")}),x=e.computed(()=>s.targetId?p.EntityBaseFormType.Edit:p.EntityBaseFormType.Create),l=e.computed(()=>x.value===p.EntityBaseFormType.Edit?n("targets.form.edit.title"):n("targets.form.create.title")),h=e.reactive({fields:{target:"",weight:100,tags:""},isReadonly:!1,errorMessage:""}),C=e.reactive({target:"",weight:100,tags:""}),u={target:"",weight:100,tags:""},t=e.computed(()=>{const y=parseInt(h.fields.weight.toString(),10);return y<0||y>65535}),B=e.computed(()=>JSON.stringify(h.fields)!==JSON.stringify(C)&&!!h.fields.target&&!!h.fields.weight&&!t.value),N=y=>{var w;h.fields.target=(y==null?void 0:y.target)||"",h.fields.weight=(y==null?void 0:y.weight)??"",h.fields.tags=((w=y==null?void 0:y.tags)==null?void 0:w.join(", "))||"",Object.assign(C,h.fields)},d=()=>{h.errorMessage="",r("cancel")},_=e.computed(()=>{var w,V;let y=`${s.config.apiBaseUrl}${de.form[s.config.app].validate}`;return s.config.app==="konnect"?y=y.replace(/{controlPlaneId}/gi,((w=s.config)==null?void 0:w.controlPlaneId)||""):s.config.app==="kongManager"&&(y=y.replace(/\/{workspace}/gi,(V=s.config)!=null&&V.workspace?`/${s.config.workspace}`:"")),y=y.replace(/{id}/gi,s.targetId),y}),$=e.computed(()=>{var w,V,S,f;let y=`${s.config.apiBaseUrl}${de.form[s.config.app][x.value]}`;return s.config.app==="konnect"?y=y.replace(/{controlPlaneId}/gi,((w=s.config)==null?void 0:w.controlPlaneId)||"").replace(/{upstreamId}/gi,((V=s.config)==null?void 0:V.upstreamId)||""):s.config.app==="kongManager"&&(y=y.replace(/\/{workspace}/gi,(S=s.config)!=null&&S.workspace?`/${s.config.workspace}`:"").replace(/{upstreamId}/gi,((f=s.config)==null?void 0:f.upstreamId)||"")),y=y.replace(/{id}/gi,s.targetId),y}),F=e.computed(()=>{var y,w,V;return{target:h.fields.target,weight:parseInt(h.fields.weight),tags:(V=(w=(y=h.fields.tags)==null?void 0:y.split(","))==null?void 0:w.map(S=>String(S||"").trim()))==null?void 0:V.filter(S=>S!==""),upstream:{id:s.config.upstreamId}}}),K=async()=>{var y,w;try{h.isReadonly=!0,h.errorMessage="";let V;if(await m.post(_.value,F.value),x.value==="create"?V=await m.post($.value,F.value):x.value==="edit"&&(V=((y=s.config)==null?void 0:y.app)==="konnect"?await m.put($.value,F.value):await m.patch($.value,F.value)),V){const{data:S}=V;h.fields.target=(S==null?void 0:S.name)||"",h.fields.weight=(S==null?void 0:S.weight)??100,h.fields.tags=((w=S==null?void 0:S.tags)==null?void 0:w.join(", "))||"",r("update",S),Object.assign(h.fields,u)}}catch(V){h.errorMessage=g(V),r("error",V)}finally{h.isReadonly=!1}};return e.watch(()=>s.targetId,()=>{Object.assign(h.fields,u)}),(y,w)=>{const V=e.resolveComponent("KInput"),S=e.resolveComponent("KPrompt");return e.openBlock(),e.createBlock(S,{"action-button-disabled":!B.value||h.isReadonly,"action-button-text":e.unref(n)("targets.form.buttons.save"),"cancel-button-text":e.unref(n)("targets.form.buttons.cancel"),title:l.value,visible:a.isVisible,onCancel:d,onProceed:K},{default:e.withCtx(()=>[e.createElementVNode("div",dt,[e.createVNode(e.unref(p.EntityBaseForm),{config:a.config,"edit-id":a.targetId,"entity-type":e.unref(p.SupportedEntityType).Target,"error-message":h.errorMessage,"fetch-url":q.value,"form-fields":F.value,"is-readonly":h.isReadonly,onCancel:d,"onFetch:error":w[3]||(w[3]=f=>y.$emit("error",f)),"onFetch:success":N,onLoading:w[4]||(w[4]=f=>y.$emit("loading",f))},{default:e.withCtx(()=>[e.createElementVNode("div",ut,[y.$slots.info?(e.openBlock(),e.createElementBlock("div",ft,[e.renderSlot(y.$slots,"info",{},void 0,!0)])):e.createCommentVNode("",!0),e.createVNode(V,{modelValue:h.fields.target,"onUpdate:modelValue":w[0]||(w[0]=f=>h.fields.target=f),modelModifiers:{trim:!0},autocomplete:"off",class:"target-form-input","data-testid":"target-form-target",label:e.unref(n)("targets.form.fields.target.label"),"label-attributes":{info:e.unref(n)("targets.form.fields.target.tooltip"),tooltipAttributes:{maxWidth:"400"}},placeholder:e.unref(n)("targets.form.fields.target.placeholder"),readonly:h.isReadonly,required:"",type:"text"},null,8,["modelValue","label","label-attributes","placeholder","readonly"]),e.createVNode(V,{modelValue:h.fields.weight,"onUpdate:modelValue":w[1]||(w[1]=f=>h.fields.weight=f),autocomplete:"off",class:"target-form-input","data-testid":"target-form-weight",error:t.value,"error-message":e.unref(n)("targets.errors.weight"),label:e.unref(n)("targets.form.fields.weight.label"),"label-attributes":{info:e.unref(n)("targets.form.fields.weight.tooltip"),tooltipAttributes:{maxWidth:"400"}},max:"65535",min:"0",readonly:h.isReadonly,required:"",type:"number"},null,8,["modelValue","error","error-message","label","label-attributes","readonly"]),e.createVNode(V,{modelValue:h.fields.tags,"onUpdate:modelValue":w[2]||(w[2]=f=>h.fields.tags=f),modelModifiers:{trim:!0},autocomplete:"off",class:"target-form-input","data-testid":"target-form-tags",help:e.unref(n)("targets.form.fields.tags.help"),label:e.unref(n)("targets.form.fields.tags.label"),placeholder:e.unref(n)("targets.form.fields.tags.placeholder"),readonly:h.isReadonly,type:"text"},null,8,["modelValue","help","label","placeholder","readonly"])])]),_:3},8,["config","edit-id","entity-type","error-message","fetch-url","form-fields","is-readonly"])])]),_:3},8,["action-button-disabled","action-button-text","cancel-button-text","title","visible"])}}}),[["__scopeId","data-v-6a64b86e"]]),pt={class:"kong-ui-entities-targets-list"},mt={class:"target-address"},yt=z(e.defineComponent({__name:"TargetsList",props:{config:{type:Object,required:!0,validator:a=>!(!a||!["konnect","kongManager"].includes(a==null?void 0:a.app)||!a.upstreamId||a.app==="kongManager"&&(typeof a.canMarkHealthy>"u"||typeof a.canMarkUnhealthy>"u"))},cacheIdentifier:{type:String,default:""},canCreate:{type:Function,required:!1,default:async()=>!0},canDelete:{type:Function,required:!1,default:async()=>!0},canEdit:{type:Function,required:!1,default:async()=>!0},useActionOutside:{type:Boolean,default:!1}},emits:["error","copy:success","copy:error","delete:success","health-actions:healthy","health-actions:unhealthy","create:target","update:target"],setup(a,{emit:E}){var U;const r=E,s=a,{i18n:{t:n}}=J.useI18n(),{axiosInstance:g}=p.useAxios((U=s.config)==null?void 0:U.axiosRequestConfig),m=e.ref(1),q=e.computed(()=>s.config.app!=="kongManager"||!!s.config.disableSorting),l={target:{label:n("targets.list.table_headers.target_address"),sortable:!0,hidable:!1},weight:{label:n("targets.list.table_headers.weight"),sortable:!0},tags:{label:n("targets.list.table_headers.tags"),sortable:!1}},h=e.computed(()=>{var c,o,i,R;let b=`${s.config.apiBaseUrl}${de.list[s.config.app]}`;return s.config.app==="konnect"?b=b.replace(/{controlPlaneId}/gi,((c=s.config)==null?void 0:c.controlPlaneId)||"").replace(/{upstreamId}/gi,((o=s.config)==null?void 0:o.upstreamId)||""):s.config.app==="kongManager"&&(b=b.replace(/\/{workspace}/gi,(i=s.config)!=null&&i.workspace?`/${s.config.workspace}`:"").replace(/{upstreamId}/gi,((R=s.config)==null?void 0:R.upstreamId)||"")),b}),{fetcher:C,fetcherState:u}=p.useFetcher(s.config,h.value),t=()=>{m.value++},B=e.ref(null),N=()=>{T.value=!0},d=(b,c)=>{const o=b.id;if(!c(o)){r("copy:error",{entity:b,field:"id",message:n("targets.errors.copy")});return}r("copy:success",{entity:b,field:"id",message:n("targets.copy.success",{val:o})})},_=(b,c)=>{const o=JSON.stringify(b);if(!c(o)){r("copy:error",{entity:b,message:n("targets.errors.copy")});return}r("copy:success",{entity:b,message:n("targets.copy.success_brief")})},$=b=>{I.value=b,T.value=!0},F=b=>s.config.app==="konnect"?!1:s.config.canMarkHealthy(b),K=b=>s.config.app==="konnect"?!1:s.config.canMarkUnhealthy(b),M=e.ref(void 0),y=e.ref(!1),w=e.ref(!1),V=e.ref(""),S=p.useDeleteUrlBuilder(s.config,h.value),f=b=>{M.value=b,y.value=!0},O=()=>{y.value=!1},P=async()=>{var b,c,o;if((b=M.value)!=null&&b.id){w.value=!0;try{await g.delete(S(M.value.id)),w.value=!1,y.value=!1,m.value++,r("delete:success",M.value)}catch(i){V.value=((o=(c=i.response)==null?void 0:c.data)==null?void 0:o.message)||i.message||n("targets.errors.delete"),r("error",i)}finally{w.value=!1}}};e.watch(u,b=>{var c,o,i;if(b.status===p.FetcherStatus.Error){B.value={title:n("targets.errors.general")},(i=(o=(c=b.error)==null?void 0:c.response)==null?void 0:o.data)!=null&&i.message&&(B.value.message=b.error.response.data.message),r("error",b.error);return}B.value=null});const Q=e.ref({ctaText:void 0,message:`${n("targets.list.empty_state.description")}${s.config.additionMessageForEmptyState?` ${s.config.additionMessageForEmptyState}`:""}`,title:n("targets.title"),...s.config.createRoute&&{ctaPath:s.config.createRoute}});e.onBeforeMount(async()=>{await s.canCreate()&&(Q.value.title=n("targets.list.empty_state.title"),Q.value.ctaText=n("targets.actions.create"))});const W=e.computed(()=>({app:s.config.app,apiBaseUrl:s.config.apiBaseUrl,upstreamId:s.config.upstreamId,axiosRequestConfig:s.config.axiosRequestConfig,...s.config.app==="konnect"&&{controlPlaneId:s.config.controlPlaneId},...s.config.app==="kongManager"&&{workspace:s.config.workspace}})),I=e.ref(""),T=e.ref(!1),A=b=>{I.value?r("update:target",b):r("create:target",b),k()},k=()=>{H(),m.value++},H=()=>{T.value=!1,I.value=""};return(b,c)=>{const o=e.resolveComponent("KButton"),i=e.resolveComponent("KDropdownItem"),R=e.resolveComponent("KClipboardProvider");return e.openBlock(),e.createElementBlock("div",pt,[e.createVNode(e.unref(p.EntityBaseTable),{"cache-identifier":a.cacheIdentifier,"disable-sorting":q.value,"empty-state-options":Q.value,"enable-entity-actions":"","error-message":B.value,fetcher:e.unref(C),"fetcher-cache-key":m.value,"pagination-type":"offset","preferences-storage-key":"kong-ui-entities-targets-list","table-headers":e.unref(l),onEmptyStateCtaClicked:c[1]||(c[1]=()=>s.config.createRoute?void 0:N()),onSort:t},{"toolbar-button":e.withCtx(()=>[(e.openBlock(),e.createBlock(e.Teleport,{disabled:!a.useActionOutside,to:"#kong-ui-app-page-header-action-button"},[e.createVNode(e.unref(p.PermissionsWrapper),{"auth-function":()=>a.canCreate()},{default:e.withCtx(()=>[e.createVNode(o,{appearance:"primary","data-testid":"toolbar-new-target",size:a.useActionOutside?"medium":"large",to:s.config.createRoute?s.config.createRoute:void 0,onClick:c[0]||(c[0]=()=>s.config.createRoute?void 0:N())},{default:e.withCtx(()=>[e.createVNode(e.unref(oe.AddIcon)),e.createTextVNode(" "+e.toDisplayString(e.unref(n)("targets.list.toolbar_actions.new_target")),1)]),_:1},8,["size","to"])]),_:1},8,["auth-function"])],8,["disabled"]))]),target:e.withCtx(({rowValue:D})=>[e.createElementVNode("span",mt,e.toDisplayString(D),1)]),tags:e.withCtx(({rowValue:D})=>[e.createVNode(e.unref(p.TableTags),{"tag-max-width":"auto",tags:D},null,8,["tags"])]),actions:e.withCtx(({row:D})=>[e.createVNode(R,null,{default:e.withCtx(({copyToClipboard:v})=>[e.createVNode(i,{"data-testid":"action-entity-copy-id",onClick:L=>d(D,v)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)("targets.actions.copy_id")),1)]),_:2},1032,["onClick"])]),_:2},1024),e.createVNode(R,null,{default:e.withCtx(({copyToClipboard:v})=>[e.createVNode(i,{"data-testid":"action-entity-copy-json",onClick:L=>_(D,v)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)("targets.actions.copy_json")),1)]),_:2},1032,["onClick"])]),_:2},1024),e.createVNode(e.unref(p.PermissionsWrapper),{"auth-function":()=>a.canEdit(D)},{default:e.withCtx(()=>[e.createVNode(i,{"data-testid":"action-entity-edit","has-divider":"",onClick:v=>$(D.id)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)("targets.actions.edit")),1)]),_:2},1032,["onClick"])]),_:2},1032,["auth-function"]),e.createVNode(e.unref(p.PermissionsWrapper),{"auth-function":()=>F(D)},{default:e.withCtx(()=>[e.createVNode(i,{"data-testid":"action-target-mark-healthy",onClick:v=>r("health-actions:healthy",D)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)("targets.actions.mark_healthy")),1)]),_:2},1032,["onClick"])]),_:2},1032,["auth-function"]),e.createVNode(e.unref(p.PermissionsWrapper),{"auth-function":()=>K(D)},{default:e.withCtx(()=>[e.createVNode(i,{"data-testid":"action-target-mark-unhealthy",onClick:v=>r("health-actions:unhealthy",D)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)("targets.actions.mark_unhealthy")),1)]),_:2},1032,["onClick"])]),_:2},1032,["auth-function"]),e.createVNode(e.unref(p.PermissionsWrapper),{"auth-function":()=>a.canDelete(D)},{default:e.withCtx(()=>[e.createVNode(i,{danger:"","data-testid":"action-entity-delete","has-divider":"",onClick:v=>f(D)},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)("targets.actions.delete")),1)]),_:2},1032,["onClick"])]),_:2},1032,["auth-function"])]),_:1},8,["cache-identifier","disable-sorting","empty-state-options","error-message","fetcher","fetcher-cache-key","table-headers"]),e.createVNode(e.unref(p.EntityDeleteModal),{"action-pending":w.value,description:e.unref(n)("targets.delete.description"),"entity-type":e.unref(p.EntityTypes).Target,error:V.value,"need-confirm":!1,title:e.unref(n)("targets.delete.title"),visible:y.value,onCancel:O,onProceed:P},null,8,["action-pending","description","entity-type","error","title","visible"]),e.createVNode(He,{config:W.value,"is-visible":T.value,"target-id":I.value,onCancel:H,onUpdate:A},e.createSlots({_:2},[b.$slots["form-info"]?{name:"info",fn:e.withCtx(()=>[e.renderSlot(b.$slots,"form-info",{},void 0,!0)]),key:"0"}:void 0]),1032,["config","is-visible","target-id"])])}}}),[["__scopeId","data-v-9826b7b2"]]),gt={key:1},bt=z(e.defineComponent({__name:"UpstreamsFormGeneralInfo",props:{config:{type:Object,required:!0},name:{type:String,required:!0},hostHeader:{type:String,required:!0},clientCertificate:{type:String,required:!0},tags:{type:String,required:!0},readonly:{type:Boolean,required:!1,default:!1}},emits:["update:name","update:host-header","update:client-certificate","update:tags"],setup(a,{emit:E}){var O,P,Q,W;const{i18nT:r,i18n:{t:s}}=J.useI18n(),n=a,g=E,{debouncedQueryChange:m,loading:q,loadItems:x,results:l,allRecords:h}=p.useDebouncedFilter(n.config,(P=te.form[(O=n.config)==null?void 0:O.app])==null?void 0:P.getServices,"",{fetchedItemsKey:"data",searchKeys:["host"]}),{debouncedQueryChange:C,loading:u,loadItems:t,results:B}=p.useDebouncedFilter(n.config,(W=te.form[(Q=n.config)==null?void 0:Q.app])==null?void 0:W.getCertificates),N=e.ref(""),d=e.computed(()=>{var I;return!!n.name&&!((I=h.value)!=null&&I.some(T=>T.host===n.name))}),_=e.computed(()=>{var T,A,k;const I=d.value&&n.name.includes((T=N.value)==null?void 0:T.toLowerCase());return(k=l.value)==null?void 0:k.map(H=>({label:H.host,value:H.id})).concat(I?[{label:n.name,value:((A=K.value)==null?void 0:A.value)||n.name}]:[])}),$=e.computed(()=>{var I;return(I=B.value)==null?void 0:I.map(T=>({label:T.id,value:T.id}))}),F=e.ref(""),K=e.ref({value:"",label:""}),M=e.computed(()=>{var I,T;return((I=_.value.find(A=>A.value===F.value))==null?void 0:I.label)||((T=K.value)==null?void 0:T.label)}),y=I=>{N.value=I,m(I)},w=I=>{K.value=I},V=()=>{K.value={value:"",label:""}},S=I=>{F.value=I,g("update:name",M.value)},f=e.ref(!1);return e.onBeforeMount(async()=>{var I,T;try{f.value=!0,await x(),n.name&&(F.value=((T=(I=_.value.find(A=>A.label===n.name))==null?void 0:I.value)==null?void 0:T.toString())||n.name),await t()}finally{f.value=!1}}),(I,T)=>{const A=e.resolveComponent("KSkeleton"),k=e.resolveComponent("KSelect"),H=e.resolveComponent("KInput");return e.openBlock(),e.createBlock(e.unref(p.EntityFormSection),{class:"kong-ui-entities-upstreams-general-info",description:e.unref(s)("upstreams.form.general_info.help"),title:e.unref(s)("upstreams.form.general_info.title")},{default:e.withCtx(()=>[f.value?(e.openBlock(),e.createBlock(A,{key:0,type:"form"})):(e.openBlock(),e.createElementBlock("div",gt,[e.createVNode(k,{class:"name-select margin-bottom-6",clearable:"","data-testid":"upstreams-form-name","enable-filtering":"","enable-item-creation":"","filter-function":()=>!0,items:_.value,label:e.unref(s)("upstreams.form.fields.name.label"),"label-attributes":{tooltipAttributes:{"max-width":"400"}},loading:e.unref(q),"model-value":F.value,placeholder:e.unref(s)("upstreams.form.fields.name.placeholder"),readonly:a.readonly,required:"",width:"100%",onItemAdded:w,onItemRemoved:V,onQueryChange:y,"onUpdate:modelValue":S},{"label-tooltip":e.withCtx(()=>[e.createVNode(e.unref(r),{keypath:"upstreams.form.fields.name.tooltip",scope:"global"},{host:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(e.unref(s)("upstreams.form.fields.name.host")),1)]),_:1})]),_:1},8,["items","label","loading","model-value","placeholder","readonly","onUpdate:modelValue"]),e.createVNode(H,{autocomplete:"off",class:"margin-bottom-6","data-testid":"upstreams-form-host-header",label:e.unref(s)("upstreams.form.fields.host_header.label"),"model-value":a.hostHeader,readonly:a.readonly,type:"text","onUpdate:modelValue":T[0]||(T[0]=U=>g("update:host-header",U))},null,8,["label","model-value","readonly"]),e.createVNode(k,{class:"certificate-select margin-bottom-6",clearable:"","data-testid":"upstreams-form-client-certificate","enable-filtering":"","filter-function":()=>!0,items:$.value,label:e.unref(s)("upstreams.form.fields.client_certificate.label"),"label-attributes":{info:e.unref(s)("upstreams.form.fields.client_certificate.tooltip"),tooltipAttributes:{maxWidth:"400"}},loading:e.unref(u),"model-value":a.clientCertificate,placeholder:e.unref(s)("upstreams.form.fields.client_certificate.placeholder"),readonly:a.readonly,width:"100%",onQueryChange:e.unref(C),"onUpdate:modelValue":T[1]||(T[1]=U=>g("update:client-certificate",U))},null,8,["items","label","label-attributes","loading","model-value","placeholder","readonly","onQueryChange"]),e.createVNode(H,{autocomplete:"off","data-testid":"upstreams-form-tags",help:e.unref(s)("upstreams.form.fields.tags.help"),label:e.unref(s)("upstreams.form.fields.tags.label"),"label-attributes":{info:e.unref(s)("upstreams.form.fields.tags.tooltip"),tooltipAttributes:{maxWidth:"400"}},"model-value":a.tags,placeholder:e.unref(s)("upstreams.form.fields.tags.placeholder"),readonly:a.readonly,type:"text","onUpdate:modelValue":T[2]||(T[2]=U=>g("update:tags",U))},null,8,["help","label","label-attributes","model-value","placeholder","readonly"])]))]),_:1},8,["description","title"])}}}),[["__scopeId","data-v-626ed41f"]]),ue={upstreamObject:"https://docs.konghq.com/gateway/latest/admin-api/#upstream-object",loadBalancing:"https://docs.konghq.com/gateway/latest/how-kong-works/load-balancing/#main"},kt={class:"fields-group-title"},Ct={class:"fields-group-text"},_t={class:"fields-group-title"},wt={class:"fields-group-text"},Vt=z(e.defineComponent({__name:"UpstreamsFormLoadBalancing",props:{algorithm:{type:String,required:!0},slots:{type:String,required:!0},hashOn:{type:String,required:!0},hashFallback:{type:String,required:!0},hashOnHeader:{type:String,required:!0},hashOnCookie:{type:String,required:!0},hashOnCookiePath:{type:String,required:!0},hashOnQueryArgument:{type:String,required:!0},hashOnUriCapture:{type:String,required:!0},hashFallbackHeader:{type:String,required:!0},hashFallbackQueryArgument:{type:String,required:!0},hashFallbackUriCapture:{type:String,required:!0},readonly:{type:Boolean,required:!1,default:!1}},emits:["update:algorithm","update:slots","update:hash-on","update:hash-fallback","update:hash-on-header","update:hash-on-cookie","update:hash-on-cookie-path","update:hash-on-query-argument","update:hash-on-uri-capture","update:hash-fallback-header","update:hash-fallback-query-argument","update:hash-fallback-uri-capture"],setup(a,{emit:E}){const{i18nT:r,i18n:{t:s}}=J.useI18n(),{inRange:n}=ne(),g=a,m=E,q=e.ref([{label:s("upstreams.form.algorithms.round_robin_label"),value:"round-robin",selected:!1},{label:s("upstreams.form.algorithms.least_connections_label"),value:"least-connections",selected:!1},{label:s("upstreams.form.algorithms.consistent_hashing_label"),value:"consistent-hashing",selected:!1},{label:s("upstreams.form.algorithms.latency_label"),value:"latency",selected:!1}]),x=e.ref([{label:s("upstreams.form.hash_labels.none"),value:"none",selected:!1},{label:s("upstreams.form.hash_labels.consumer"),value:"consumer",selected:!1},{label:s("upstreams.form.hash_labels.ip"),value:"ip",selected:!1},{label:s("upstreams.form.hash_labels.header"),value:"header",selected:!1},{label:s("upstreams.form.hash_labels.cookie"),value:"cookie",selected:!1},{label:s("upstreams.form.hash_labels.path"),value:"path",selected:!1},{label:s("upstreams.form.hash_labels.query_argument"),value:"query_arg",selected:!1},{label:s("upstreams.form.hash_labels.uri_capture"),value:"uri_capture",selected:!1}]);e.watch(()=>g.hashOn,(C,u)=>{u==="header"&&C!==u&&m("update:hash-on-header",""),u==="cookie"&&C!==u&&(m("update:hash-on-cookie",""),m("update:hash-on-cookie-path","/")),u==="query_arg"&&C!==u&&m("update:hash-on-query-argument",""),u==="uri_capture"&&C!==u&&m("update:hash-on-uri-capture",""),(C==="cookie"||C==="none")&&(m("update:hash-fallback","none"),m("update:hash-fallback-header",""),m("update:hash-fallback-query-argument",""),m("update:hash-fallback-uri-capture",""))}),e.watch(()=>g.hashFallback,(C,u)=>{u==="header"&&C!==u&&m("update:hash-fallback-header",""),u==="cookie"&&C!==u&&(m("update:hash-on-cookie",""),m("update:hash-on-cookie-path","/")),u==="query_arg"&&C!==u&&m("update:hash-fallback-query-argument",""),u==="uri_capture"&&C!==u&&m("update:hash-fallback-uri-capture","")});const l=e.computed(()=>g.hashOn==="cookie"||g.hashOn==="none"),h=e.computed(()=>g.slots?n(g.slots,fe,pe)?"":s("upstreams.form.errors.in_range"):"");return(C,u)=>{const t=e.resolveComponent("KExternalLink"),B=e.resolveComponent("KSelect"),N=e.resolveComponent("KInput"),d=e.resolveComponent("KCard");return e.openBlock(),e.createBlock(e.unref(p.EntityFormSection),{class:"kong-ui-entities-upstreams-load-balancing",title:e.unref(s)("upstreams.form.load_balancing.title")},{description:e.withCtx(()=>[e.createElementVNode("p",null,[e.createTextVNode(e.toDisplayString(e.unref(s)("upstreams.form.load_balancing.help"))+" ",1),e.createVNode(t,{"hide-icon":"",href:e.unref(ue).upstreamObject},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(s)("upstreams.form.buttons.view_documentation")),1)]),_:1},8,["href"])])]),default:e.withCtx(()=>[e.createVNode(B,{class:"algorithm-select",items:q.value,label:e.unref(s)("upstreams.form.fields.algorithm.label"),"model-value":a.algorithm,readonly:a.readonly,width:"100%","onUpdate:modelValue":u[0]||(u[0]=_=>m("update:algorithm",_))},null,8,["items","label","model-value","readonly"]),e.createVNode(N,{autocomplete:"off","data-testid":"upstreams-form-slots",error:!!h.value,"error-message":h.value,help:e.unref(s)("upstreams.form.fields.slots.help"),label:e.unref(s)("upstreams.form.fields.slots.label"),max:e.unref(pe),min:e.unref(fe),"model-value":a.slots,readonly:a.readonly,type:"number","onUpdate:modelValue":u[1]||(u[1]=_=>m("update:slots",_))},null,8,["error","error-message","help","label","max","min","model-value","readonly"]),e.createVNode(d,null,{default:e.withCtx(()=>[e.createElementVNode("h5",kt,e.toDisplayString(e.unref(s)("upstreams.form.fields.hash_on.label")),1),e.createElementVNode("p",Ct,e.toDisplayString(e.unref(s)("upstreams.form.fields.hash_on.help")),1),e.createVNode(B,{class:"hash-on-select",items:x.value,label:e.unref(s)("upstreams.form.fields.hash_on.label"),"model-value":a.hashOn,readonly:a.readonly,width:"100%","onUpdate:modelValue":u[2]||(u[2]=_=>m("update:hash-on",_))},null,8,["items","label","model-value","readonly"]),a.hashOn==="header"?(e.openBlock(),e.createBlock(N,{key:0,autocomplete:"off",class:"margin-top-6","data-testid":"upstreams-form-hash-on-header",label:e.unref(s)("upstreams.form.fields.header.label"),"model-value":a.hashOnHeader,readonly:a.readonly,required:"",type:"text","onUpdate:modelValue":u[3]||(u[3]=_=>m("update:hash-on-header",_))},null,8,["label","model-value","readonly"])):e.createCommentVNode("",!0),a.hashOn==="cookie"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createVNode(N,{autocomplete:"off",class:"margin-top-6","data-testid":"upstreams-form-hash-on-cookie",label:e.unref(s)("upstreams.form.fields.cookie.label"),"model-value":a.hashOnCookie,readonly:a.readonly,required:"",type:"text","onUpdate:modelValue":u[4]||(u[4]=_=>m("update:hash-on-cookie",_))},null,8,["label","model-value","readonly"]),e.createVNode(N,{autocomplete:"off",class:"margin-top-6","data-testid":"upstreams-form-hash-on-cookie-path",label:e.unref(s)("upstreams.form.fields.cookie_path.label"),"model-value":a.hashOnCookiePath,readonly:a.readonly,required:"",type:"text","onUpdate:modelValue":u[5]||(u[5]=_=>m("update:hash-on-cookie-path",_))},null,8,["label","model-value","readonly"])],64)):e.createCommentVNode("",!0),a.hashOn==="query_arg"?(e.openBlock(),e.createBlock(N,{key:2,autocomplete:"off",class:"margin-top-6","data-testid":"upstreams-form-query-argument",label:e.unref(s)("upstreams.form.fields.query_argument.label"),"model-value":a.hashOnQueryArgument,readonly:a.readonly,required:"",type:"text","onUpdate:modelValue":u[6]||(u[6]=_=>m("update:hash-on-query-argument",_))},null,8,["label","model-value","readonly"])):e.createCommentVNode("",!0),a.hashOn==="uri_capture"?(e.openBlock(),e.createBlock(N,{key:3,autocomplete:"off",class:"margin-top-6","data-testid":"upstreams-form-uri-capture",label:e.unref(s)("upstreams.form.fields.uri_capture.label"),"model-value":a.hashOnUriCapture,readonly:a.readonly,required:"",type:"text","onUpdate:modelValue":u[7]||(u[7]=_=>m("update:hash-on-uri-capture",_))},null,8,["label","model-value","readonly"])):e.createCommentVNode("",!0)]),_:1}),e.createVNode(d,null,{default:e.withCtx(()=>[e.createElementVNode("h5",_t,e.toDisplayString(e.unref(s)("upstreams.form.fields.hash_fallback.label")),1),e.createElementVNode("p",wt,e.toDisplayString(e.unref(s)("upstreams.form.fields.hash_fallback.help")),1),e.createVNode(B,{class:"hash-fallback-select",disabled:l.value,items:x.value,label:e.unref(s)("upstreams.form.fields.hash_fallback.label"),"label-attributes":{tooltipAttributes:{"max-width":"400"}},"model-value":a.hashFallback,readonly:a.readonly,width:"100%","onUpdate:modelValue":u[8]||(u[8]=_=>m("update:hash-fallback",_))},{"label-tooltip":e.withCtx(()=>[e.createVNode(e.unref(r),{keypath:"upstreams.form.fields.hash_fallback.tooltip",scope:"global"},{hash_on:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(e.unref(s)("upstreams.form.fields.hash_fallback.hash_on")),1)]),cookie:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(e.unref(s)("upstreams.form.fields.hash_fallback.cookie")),1)]),_:1})]),_:1},8,["disabled","items","label","model-value","readonly"]),a.hashFallback==="header"?(e.openBlock(),e.createBlock(N,{key:0,autocomplete:"off",class:"margin-top-6","data-testid":"upstreams-form-hash-fallback-header",label:e.unref(s)("upstreams.form.fields.header.label"),"model-value":a.hashFallbackHeader,readonly:a.readonly,required:"",type:"text","onUpdate:modelValue":u[9]||(u[9]=_=>m("update:hash-fallback-header",_))},null,8,["label","model-value","readonly"])):e.createCommentVNode("",!0),a.hashFallback==="cookie"?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createVNode(N,{autocomplete:"off",class:"margin-top-6","data-testid":"upstreams-form-hash-on-cookie",label:e.unref(s)("upstreams.form.fields.cookie.label"),"model-value":a.hashOnCookie,readonly:a.readonly,required:"",type:"text","onUpdate:modelValue":u[10]||(u[10]=_=>m("update:hash-on-cookie",_))},null,8,["label","model-value","readonly"]),e.createVNode(N,{autocomplete:"off",class:"margin-top-6","data-testid":"upstreams-form-hash-on-cookie-path",label:e.unref(s)("upstreams.form.fields.cookie_path.label"),"model-value":a.hashOnCookiePath,readonly:a.readonly,required:"",type:"text","onUpdate:modelValue":u[11]||(u[11]=_=>m("update:hash-on-cookie-path",_))},null,8,["label","model-value","readonly"])],64)):e.createCommentVNode("",!0),a.hashFallback==="query_arg"?(e.openBlock(),e.createBlock(N,{key:2,autocomplete:"off",class:"margin-top-6","data-testid":"upstreams-form-hash-fallback-query-argument",label:e.unref(s)("upstreams.form.fields.query_argument.label"),"model-value":a.hashFallbackQueryArgument,readonly:a.readonly,required:"",type:"text","onUpdate:modelValue":u[12]||(u[12]=_=>m("update:hash-fallback-query-argument",_))},null,8,["label","model-value","readonly"])):e.createCommentVNode("",!0),a.hashFallback==="uri_capture"?(e.openBlock(),e.createBlock(N,{key:3,autocomplete:"off",class:"margin-top-6","data-testid":"upstreams-form-hash-fallback-uri-capture",label:e.unref(s)("upstreams.form.fields.uri_capture.label"),"model-value":a.hashFallbackUriCapture,readonly:a.readonly,required:"",type:"text","onUpdate:modelValue":u[13]||(u[13]=_=>m("update:hash-fallback-uri-capture",_))},null,8,["label","model-value","readonly"])):e.createCommentVNode("",!0)]),_:1})]),_:1},8,["title"])}}}),[["__scopeId","data-v-d662db8e"]]),Nt={class:"fields-group-title"},xt={class:"fields-group-text"},Ht={class:"fields-group-title"},St={class:"fields-group-text"},Tt=z(e.defineComponent({__name:"UpstreamsFormHealthChecks",props:{activeHealthSwitch:{type:Boolean,required:!0},passiveHealthSwitch:{type:Boolean,required:!0},healthchecksThreshold:{type:String,required:!0},readonly:{type:Boolean,required:!1,default:!1}},emits:["update:active-health-switch","update:passive-health-switch","update:healthchecks-threshold"],setup(a,{emit:E}){const{i18n:{t:r}}=J.useI18n(),s=E;return(n,g)=>{const m=e.resolveComponent("KExternalLink"),q=e.resolveComponent("KInputSwitch"),x=e.resolveComponent("KCard"),l=e.resolveComponent("KInput");return e.openBlock(),e.createBlock(e.unref(p.EntityFormSection),{class:"kong-ui-entities-upstreams-healthchecks",title:e.unref(r)("upstreams.form.health_check.title")},{description:e.withCtx(()=>[e.createElementVNode("p",null,[e.createTextVNode(e.toDisplayString(e.unref(r)("upstreams.form.health_check.help"))+" ",1),e.createVNode(m,{"hide-icon":"",href:e.unref(ue).loadBalancing},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)("upstreams.form.buttons.view_documentation")),1)]),_:1},8,["href"])])]),default:e.withCtx(()=>[e.createVNode(x,null,{default:e.withCtx(()=>[e.createElementVNode("h5",Nt,e.toDisplayString(e.unref(r)("upstreams.form.fields.active_health_checks.label")),1),e.createElementVNode("p",xt,e.toDisplayString(e.unref(r)("upstreams.form.fields.active_health_checks.help")),1),e.createVNode(q,{class:"active-health-switch","data-testid":"active-health-switch",disabled:a.readonly,"model-value":a.activeHealthSwitch,onChange:g[0]||(g[0]=h=>s("update:active-health-switch",h))},null,8,["disabled","model-value"])]),_:1}),e.createVNode(x,null,{default:e.withCtx(()=>[e.createElementVNode("h5",Ht,e.toDisplayString(e.unref(r)("upstreams.form.fields.passive_health_checks.label")),1),e.createElementVNode("p",St,e.toDisplayString(e.unref(r)("upstreams.form.fields.passive_health_checks.help")),1),e.createVNode(q,{class:"passive-health-switch","data-testid":"passive-health-switch",disabled:a.readonly,"model-value":a.passiveHealthSwitch,onChange:g[1]||(g[1]=h=>s("update:passive-health-switch",h))},null,8,["disabled","model-value"])]),_:1}),e.createVNode(l,{autocomplete:"off","data-testid":"upstreams-form-healthchecks-threshold",label:e.unref(r)("upstreams.form.fields.healthchecks_threshold.label"),max:e.unref(at),min:e.unref(tt),"model-value":a.healthchecksThreshold,readonly:a.readonly,type:"number","onUpdate:modelValue":g[2]||(g[2]=h=>s("update:healthchecks-threshold",h))},null,8,["label","max","min","model-value","readonly"])]),_:1},8,["title"])}}}),[["__scopeId","data-v-bfdc5a59"]]),Ut="#d60027",It={key:2},Ft={class:"fields-group-title"},qt={class:"fields-group-text"},Et={class:"fields-group-title"},Bt={class:"fields-group-text"},Ot=z(e.defineComponent({__name:"UpstreamsFormActiveHealthCheck",props:{config:{type:Object,required:!0},type:{type:String,required:!0},httpPath:{type:String,required:!0},timeout:{type:String,required:!0},concurrency:{type:String,required:!0},httpsSni:{type:String,required:!0},verifySsl:{type:Boolean,required:!0},headers:{type:Array,required:!0},interval:{type:String,required:!0},successes:{type:String,required:!0},httpStatuses:{type:Array,required:!0},unhealthyInterval:{type:String,required:!0},httpFailures:{type:String,required:!0},tcpFailures:{type:String,required:!0},unhealthyHttpStatuses:{type:Array,required:!0},unhealthyTimeouts:{type:String,required:!0},readonly:{type:Boolean,required:!1,default:!1}},emits:["update:type","update:http-path","update:timeout","update:concurrency","update:https-sni","update:verify-ssl","update:headers","update:interval","update:successes","update:http-statuses","update:unhealthy-interval","update:http-failures","update:tcp-failures","update:unhealthy-http-statuses","update:unhealthy-timeouts"],setup(a,{emit:E}){const{i18n:{t:r}}=J.useI18n(),{objectsAreEqual:s}=ne(),n=a,g=E,m=e.ref([{label:r("upstreams.form.healthcheck_type_labels.http"),value:"http",selected:!1},{label:r("upstreams.form.healthcheck_type_labels.https"),value:"https",selected:!1},{label:r("upstreams.form.healthcheck_type_labels.tcp"),value:"tcp",selected:!1},{label:r("upstreams.form.healthcheck_type_labels.grsp"),value:"grpc",selected:!1},{label:r("upstreams.form.healthcheck_type_labels.grsps"),value:"grpcs",selected:!1}]),q=e.computed(()=>n.type==="https"||n.type==="grpcs"),x=e.computed(()=>n.type==="tcp"),{trackNewItems:l}=le({replaceId:!0}),{trackNewItems:h}=le({replaceId:!0});e.watch(()=>n.type,(N,d)=>{d==="tcp"&&N!==d&&g("update:tcp-failures","5"),(d==="https"||d==="grpcs")&&N!==d&&(g("update:https-sni",""),g("update:verify-ssl",!1)),d!=="tcp"&&N==="tcp"&&(g("update:http-path","/"),g("update:http-statuses",we),g("update:unhealthy-http-statuses",Ne))});const C=e.ref([{key:"",values:""}]);e.watch(()=>n.headers,N=>{s(C.value,N)||(C.value=[...N])},{immediate:!0,deep:!0});const u=()=>{g("update:headers",C.value)},t=()=>{C.value.push({key:"",values:""}),u()},B=N=>{N===0&&C.value.length===1?C.value[0]={key:"",values:""}:C.value.splice(N,1),u()};return(N,d)=>{const _=e.resolveComponent("KExternalLink"),$=e.resolveComponent("KSelect"),F=e.resolveComponent("KInput"),K=e.resolveComponent("KCheckbox"),M=e.resolveComponent("KLabel"),y=e.resolveComponent("KButton"),w=e.resolveComponent("KMultiselect"),V=e.resolveComponent("KCard");return e.openBlock(),e.createBlock(e.unref(p.EntityFormSection),{class:"kong-ui-entities-upstreams-active-healthcheck",title:e.unref(r)("upstreams.form.active_health_check.title")},{description:e.withCtx(()=>[e.createElementVNode("p",null,[e.createTextVNode(e.toDisplayString(e.unref(r)("upstreams.form.active_health_check.help"))+" ",1),e.createVNode(_,{"hide-icon":"",href:e.unref(ue).upstreamObject},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)("upstreams.form.buttons.view_documentation")),1)]),_:1},8,["href"])])]),default:e.withCtx(()=>{var S;return[e.createVNode($,{class:"active-healthcheck-type-select",items:m.value,label:e.unref(r)("upstreams.form.fields.active_healthcheck_type.label"),"model-value":a.type,readonly:a.readonly,width:"100%","onUpdate:modelValue":d[0]||(d[0]=f=>g("update:type",f))},null,8,["items","label","model-value","readonly"]),x.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(F,{key:0,autocomplete:"off","data-testid":"active-healthcheck-http-path",label:e.unref(r)("upstreams.form.fields.http_path.label"),"model-value":a.httpPath,readonly:a.readonly,type:"text","onUpdate:modelValue":d[1]||(d[1]=f=>g("update:http-path",f))},null,8,["label","model-value","readonly"])),e.createVNode(F,{autocomplete:"off","data-testid":"active-healthcheck-timeout",label:e.unref(r)("upstreams.form.fields.timeout.label"),max:e.unref(st),min:e.unref(lt),"model-value":a.timeout,readonly:a.readonly,type:"number","onUpdate:modelValue":d[2]||(d[2]=f=>g("update:timeout",f))},null,8,["label","max","min","model-value","readonly"]),e.createVNode(F,{autocomplete:"off","data-testid":"active-healthcheck-concurrency",label:e.unref(r)("upstreams.form.fields.concurrency.label"),max:e.unref(ot),min:e.unref(rt),"model-value":a.concurrency,readonly:a.readonly,type:"number","onUpdate:modelValue":d[3]||(d[3]=f=>g("update:concurrency",f))},null,8,["label","max","min","model-value","readonly"]),q.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createVNode(F,{autocomplete:"off",class:"margin-bottom-6","data-testid":"active-healthcheck-https-sni",label:e.unref(r)("upstreams.form.fields.https_sni.label"),"model-value":a.httpsSni,readonly:a.readonly,type:"text","onUpdate:modelValue":d[4]||(d[4]=f=>g("update:https-sni",f))},null,8,["label","model-value","readonly"]),e.createVNode(K,{"data-testid":"active-healthcheck-verify-ssl",disabled:a.readonly,label:e.unref(r)("upstreams.form.fields.verify_ssl.label"),"model-value":a.verifySsl,"onUpdate:modelValue":d[5]||(d[5]=f=>g("update:verify-ssl",f))},null,8,["disabled","label","model-value"])],64)):e.createCommentVNode("",!0),((S=a.config)==null?void 0:S.app)==="kongManager"?(e.openBlock(),e.createElementBlock("div",It,[e.createVNode(M,{info:e.unref(r)("upstreams.form.fields.headers.tooltip_active"),"tooltip-attributes":{maxWidth:"250px"}},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)("upstreams.form.fields.headers.label")),1)]),_:1},8,["info"]),e.createElementVNode("div",null,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(C.value,(f,O)=>(e.openBlock(),e.createElementBlock("div",{key:`${f.header}_${O}`,class:e.normalizeClass(["headers-row",{"margin-top-6":O>0}])},[e.createVNode(F,{modelValue:C.value[O].key,"onUpdate:modelValue":P=>C.value[O].key=P,autocomplete:"off","data-testid":`active-healthcheck-headers-header-${O+1}`,readonly:a.readonly,type:"text",onBlur:u},null,8,["modelValue","onUpdate:modelValue","data-testid","readonly"]),e.createVNode(F,{modelValue:C.value[O].values,"onUpdate:modelValue":P=>C.value[O].values=P,autocomplete:"off","data-testid":`active-healthcheck-headers-value-${O+1}`,readonly:a.readonly,type:"text",onBlur:u},null,8,["modelValue","onUpdate:modelValue","data-testid","readonly"]),e.createVNode(y,{appearance:"tertiary",class:"btn-remove","data-testid":"btn-remove-header",disabled:C.value.length===1,icon:"",onClick:P=>B(O)},{default:e.withCtx(()=>[e.createVNode(e.unref(oe.TrashIcon),{class:"delete-item",color:C.value.length>1?e.unref(Ut):void 0},null,8,["color"])]),_:2},1032,["disabled","onClick"]),C.value&&O===C.value.length-1?(e.openBlock(),e.createBlock(y,{key:0,appearance:"tertiary",class:"btn-add-header","data-testid":"btn-add-header",icon:"",onClick:t},{default:e.withCtx(()=>[e.createVNode(e.unref(oe.AddIcon))]),_:1})):e.createCommentVNode("",!0)],2))),128))])])):e.createCommentVNode("",!0),e.createVNode(V,null,{default:e.withCtx(()=>[e.createElementVNode("h5",Ft,e.toDisplayString(e.unref(r)("upstreams.form.healthy.label")),1),e.createElementVNode("p",qt,e.toDisplayString(e.unref(r)("upstreams.form.healthy.help")),1),e.createVNode(F,{autocomplete:"off",class:"margin-bottom-6","data-testid":"active-healthcheck-interval",help:e.unref(r)("upstreams.form.fields.interval.help"),label:e.unref(r)("upstreams.form.fields.interval.label"),max:e.unref(_e),min:e.unref(Ce),"model-value":a.interval,readonly:a.readonly,type:"number","onUpdate:modelValue":d[6]||(d[6]=f=>g("update:interval",f))},null,8,["help","label","max","min","model-value","readonly"]),e.createVNode(F,{autocomplete:"off","data-testid":"active-healthcheck-successes",label:e.unref(r)("upstreams.form.fields.successes.label"),max:e.unref(Y),min:e.unref(X),"model-value":a.successes,readonly:a.readonly,type:"number","onUpdate:modelValue":d[7]||(d[7]=f=>g("update:successes",f))},null,8,["label","max","min","model-value","readonly"]),x.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(w,{key:0,autocomplete:"off",class:"margin-top-6 active-healthcheck-http-statuses","enable-item-creation":"",items:e.unref(ie),label:e.unref(r)("upstreams.form.fields.http_statuses.label"),"model-value":a.httpStatuses,readonly:a.readonly,width:"100%",onItemAdded:d[8]||(d[8]=f=>e.unref(l)(f,!0)),onItemRemoved:d[9]||(d[9]=f=>e.unref(l)(f,!1)),"onUpdate:modelValue":d[10]||(d[10]=f=>g("update:http-statuses",f))},null,8,["items","label","model-value","readonly"]))]),_:1}),e.createVNode(V,null,{default:e.withCtx(()=>[e.createElementVNode("h5",Et,e.toDisplayString(e.unref(r)("upstreams.form.unhealthy.label")),1),e.createElementVNode("p",Bt,e.toDisplayString(e.unref(r)("upstreams.form.unhealthy.help")),1),e.createVNode(F,{autocomplete:"off",class:"margin-bottom-6","data-testid":"active-healthcheck-unhealthy-interval",help:e.unref(r)("upstreams.form.fields.interval.help"),label:e.unref(r)("upstreams.form.fields.interval.label"),max:e.unref(_e),min:e.unref(Ce),"model-value":a.unhealthyInterval,readonly:a.readonly,type:"number","onUpdate:modelValue":d[11]||(d[11]=f=>g("update:unhealthy-interval",f))},null,8,["help","label","max","min","model-value","readonly"]),e.createVNode(F,{autocomplete:"off",class:"margin-bottom-6","data-testid":"active-healthcheck-tcp-failures",label:e.unref(r)("upstreams.form.fields.tcp_failures.label"),max:e.unref(Y),min:e.unref(X),"model-value":a.tcpFailures,readonly:a.readonly,type:"number","onUpdate:modelValue":d[12]||(d[12]=f=>g("update:tcp-failures",f))},null,8,["label","max","min","model-value","readonly"]),x.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(F,{key:0,autocomplete:"off",class:"margin-bottom-6","data-testid":"active-healthcheck-http-failures",label:e.unref(r)("upstreams.form.fields.http_failures.label"),max:e.unref(Y),min:e.unref(X),"model-value":a.httpFailures,readonly:a.readonly,type:"number","onUpdate:modelValue":d[13]||(d[13]=f=>g("update:http-failures",f))},null,8,["label","max","min","model-value","readonly"])),x.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(w,{key:1,autocomplete:"off",class:"margin-bottom-6 active-healthcheck-unhealthy-http-statuses","enable-item-creation":"",items:e.unref(ie),label:e.unref(r)("upstreams.form.fields.http_statuses.label"),"model-value":a.unhealthyHttpStatuses,readonly:a.readonly,width:"100%",onItemAdded:d[14]||(d[14]=f=>e.unref(h)(f,!0)),onItemRemoved:d[15]||(d[15]=f=>e.unref(h)(f,!1)),"onUpdate:modelValue":d[16]||(d[16]=f=>g("update:unhealthy-http-statuses",f))},null,8,["items","label","model-value","readonly"])),e.createVNode(F,{autocomplete:"off","data-testid":"active-healthcheck-unhealthy-timeouts",label:e.unref(r)("upstreams.form.fields.timeouts.label"),max:e.unref(ke),min:e.unref(be),"model-value":a.unhealthyTimeouts,readonly:a.readonly,type:"number","onUpdate:modelValue":d[17]||(d[17]=f=>g("update:unhealthy-timeouts",f))},null,8,["label","max","min","model-value","readonly"])]),_:1})]}),_:1},8,["title"])}}}),[["__scopeId","data-v-efccf560"]]),Dt={class:"fields-group-title"},$t={class:"fields-group-text"},Pt={class:"fields-group-title"},Mt={class:"fields-group-text"},At=z(e.defineComponent({__name:"UpstreamsFormPassiveHealthCheck",props:{type:{type:String,required:!0},successes:{type:String,required:!0},httpStatuses:{type:Array,required:!0},timeouts:{type:String,required:!0},httpFailures:{type:String,required:!0},unhealthyHttpStatuses:{type:Array,required:!0},tcpFailures:{type:String,required:!0},readonly:{type:Boolean,required:!1,default:!1}},emits:["update:type","update:successes","update:http-statuses","update:timeouts","update:http-failures","update:unhealthy-http-statuses","update:tcp-failures"],setup(a,{emit:E}){const{i18n:{t:r}}=J.useI18n(),s=a,n=E,g=e.ref([{label:r("upstreams.form.healthcheck_type_labels.http"),value:"http",selected:!1},{label:r("upstreams.form.healthcheck_type_labels.https"),value:"https",selected:!1},{label:r("upstreams.form.healthcheck_type_labels.tcp"),value:"tcp",selected:!1},{label:r("upstreams.form.healthcheck_type_labels.grsp"),value:"grpc",selected:!1},{label:r("upstreams.form.healthcheck_type_labels.grsps"),value:"grpcs",selected:!1}]),m=e.computed(()=>s.type==="tcp"),{trackNewItems:q}=le({replaceId:!0}),{trackNewItems:x}=le({replaceId:!0});return e.watch(()=>s.type,(l,h)=>{h==="tcp"&&l!==h&&n("update:tcp-failures","5"),h!=="tcp"&&l==="tcp"&&(n("update:http-statuses",Ve),n("update:unhealthy-http-statuses",xe))}),(l,h)=>{const C=e.resolveComponent("KExternalLink"),u=e.resolveComponent("KSelect"),t=e.resolveComponent("KInput"),B=e.resolveComponent("KMultiselect"),N=e.resolveComponent("KCard");return e.openBlock(),e.createBlock(e.unref(p.EntityFormSection),{class:"kong-ui-entities-upstreams-passive-healthcheck",title:e.unref(r)("upstreams.form.passive_health_check.title")},{description:e.withCtx(()=>[e.createElementVNode("p",null,[e.createTextVNode(e.toDisplayString(e.unref(r)("upstreams.form.passive_health_check.help"))+" ",1),e.createVNode(C,{"hide-icon":"",href:e.unref(ue).upstreamObject},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(r)("upstreams.form.buttons.view_documentation")),1)]),_:1},8,["href"])])]),default:e.withCtx(()=>[e.createVNode(u,{class:"passive-healthcheck-type-select",items:g.value,label:e.unref(r)("upstreams.form.fields.passive_health_check_type.label"),"model-value":a.type,readonly:a.readonly,width:"100%","onUpdate:modelValue":h[0]||(h[0]=d=>n("update:type",d))},null,8,["items","label","model-value","readonly"]),e.createVNode(N,null,{default:e.withCtx(()=>[e.createElementVNode("h5",Dt,e.toDisplayString(e.unref(r)("upstreams.form.passive_healthy.label")),1),e.createElementVNode("p",$t,e.toDisplayString(e.unref(r)("upstreams.form.passive_healthy.help")),1),e.createVNode(t,{autocomplete:"off","data-testid":"passive-healthcheck-successes",label:e.unref(r)("upstreams.form.fields.successes.label"),max:e.unref(Y),min:e.unref(X),"model-value":a.successes,readonly:a.readonly,type:"number","onUpdate:modelValue":h[1]||(h[1]=d=>n("update:successes",d))},null,8,["label","max","min","model-value","readonly"]),m.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(B,{key:0,class:"margin-top-6 passive-healthcheck-http-statuses","enable-item-creation":"",items:e.unref(ie),label:e.unref(r)("upstreams.form.fields.http_statuses.label"),"model-value":a.httpStatuses,readonly:a.readonly,width:"100%",onItemAdded:h[2]||(h[2]=d=>e.unref(q)(d,!0)),onItemRemoved:h[3]||(h[3]=d=>e.unref(q)(d,!1)),"onUpdate:modelValue":h[4]||(h[4]=d=>n("update:http-statuses",d))},null,8,["items","label","model-value","readonly"]))]),_:1}),e.createVNode(N,null,{default:e.withCtx(()=>[e.createElementVNode("h5",Pt,e.toDisplayString(e.unref(r)("upstreams.form.passive_unhealthy.label")),1),e.createElementVNode("p",Mt,e.toDisplayString(e.unref(r)("upstreams.form.passive_unhealthy.help")),1),e.createVNode(t,{autocomplete:"off","data-testid":"passive-healthcheck-timeouts",label:e.unref(r)("upstreams.form.fields.timeouts.label"),max:e.unref(ke),min:e.unref(be),"model-value":a.timeouts,readonly:a.readonly,type:"number","onUpdate:modelValue":h[5]||(h[5]=d=>n("update:timeouts",d))},null,8,["label","max","min","model-value","readonly"]),e.createVNode(t,{autocomplete:"off",class:"margin-top-6","data-testid":"passive-healthcheck-tcp-failures",label:e.unref(r)("upstreams.form.fields.tcp_failures.label"),max:e.unref(Y),min:e.unref(X),"model-value":a.tcpFailures,readonly:a.readonly,type:"number","onUpdate:modelValue":h[6]||(h[6]=d=>n("update:tcp-failures",d))},null,8,["label","max","min","model-value","readonly"]),m.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(t,{key:0,autocomplete:"off",class:"margin-top-6","data-testid":"passive-healthcheck-http-failures",label:e.unref(r)("upstreams.form.fields.http_failures.label"),max:e.unref(Y),min:e.unref(X),"model-value":a.httpFailures,readonly:a.readonly,type:"number","onUpdate:modelValue":h[7]||(h[7]=d=>n("update:http-failures",d))},null,8,["label","max","min","model-value","readonly"])),m.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(B,{key:1,autocomplete:"off",class:"margin-top-6 passive-healthcheck-unhealthy-http-statuses","enable-item-creation":"",items:e.unref(ie),label:e.unref(r)("upstreams.form.fields.http_statuses.label"),"model-value":a.unhealthyHttpStatuses,readonly:a.readonly,width:"100%",onItemAdded:h[8]||(h[8]=d=>e.unref(x)(d,!0)),onItemRemoved:h[9]||(h[9]=d=>e.unref(x)(d,!1)),"onUpdate:modelValue":h[10]||(h[10]=d=>n("update:unhealthy-http-statuses",d))},null,8,["items","label","model-value","readonly"]))]),_:1})]),_:1},8,["title"])}}}),[["__scopeId","data-v-5bd9952e"]]),Kt={class:"kong-ui-entities-upstreams-form"},Rt=z(e.defineComponent({__name:"UpstreamsForm",props:{config:{type:Object,required:!0,validator:a=>!(!a||!["konnect","kongManager"].includes(a==null?void 0:a.app)||(a==null?void 0:a.app)==="konnect"&&!(a!=null&&a.controlPlaneId)||(a==null?void 0:a.app)==="kongManager"&&typeof(a==null?void 0:a.workspace)!="string"||!(a!=null&&a.cancelRoute))},upstreamId:{type:String,required:!1,default:""}},emits:["update","error","loading"],setup(a,{emit:E}){var b;const r=a,s=E,{inRange:n,stringToNumberArray:g,upstreamsResponseToFields:m,getDefaultUpstreamFields:q,objectsAreEqual:x,cloneDeep:l}=ne(),{axiosInstance:h}=p.useAxios((b=r.config)==null?void 0:b.axiosRequestConfig),{getMessageFromError:C}=p.useErrors(),u=ye.useRouter(),t=e.reactive({fields:q(),readonly:!1,errorMessage:""}),B=e.reactive(q()),N=e.computed(()=>!x(t.fields,B)),d=c=>{t.fields.activeHealthCheck.interval=c?"5":"0",t.fields.activeHealthCheck.successes=c?"5":"0",t.fields.activeHealthCheck.httpFailures=c?"5":"0",t.fields.activeHealthCheck.unhealthyInterval=c?"5":"0",t.fields.activeHealthCheck.tcpFailures=c?"5":"0"},_=c=>{t.fields.passiveHealthCheck.timeouts=c?"5":"0",t.fields.passiveHealthCheck.successes=c?"80":"0",t.fields.passiveHealthCheck.tcpFailures=c?"5":"0",t.fields.passiveHealthCheck.httpFailures=c?"5":"0"},$=e.computed(()=>t.fields.slots?n(t.fields.slots,fe,pe):!0),F=e.computed(()=>t.fields.hashOn==="header"?!!t.fields.hashOnHeader:!0),K=e.computed(()=>t.fields.hashOn==="cookie"||t.fields.hashFallback==="cookie"?!!t.fields.hashOnCookie:!0),M=e.computed(()=>t.fields.hashOn==="cookie"||t.fields.hashFallback==="cookie"?!!t.fields.hashOnCookiePath:!0),y=e.computed(()=>t.fields.hashOn==="query_arg"?!!t.fields.hashOnQueryArgument:!0),w=e.computed(()=>t.fields.hashOn==="uri_capture"?!!t.fields.hashOnUriCapture:!0),V=e.computed(()=>t.fields.hashFallback==="header"?!!t.fields.hashFallbackHeader:!0),S=e.computed(()=>t.fields.hashFallback==="query_arg"?!!t.fields.hashFallbackQueryArgument:!0),f=e.computed(()=>t.fields.hashFallback==="uri_capture"?!!t.fields.hashFallbackUriCapture:!0),O=e.computed(()=>!!t.fields.name&&$.value&&F.value&&K.value&&M.value&&y.value&&w.value&&V.value&&S.value&&f.value),P=e.computed(()=>r.upstreamId?p.EntityBaseFormType.Edit:p.EntityBaseFormType.Create),Q=e.computed(()=>{var c,o;return(o=te.form[(c=r.config)==null?void 0:c.app])==null?void 0:o.edit}),W=c=>{Object.assign(t.fields,m(c)),Object.assign(B,l(t.fields))},I=()=>{var c;u.push(((c=r.config)==null?void 0:c.cancelRoute)||{name:"upstreams-list"})},T=c=>{s("loading",c)},A=c=>{s("error",c)},k=e.computed(()=>{var o,i,R,D,v;const c={name:t.fields.name,slots:Number(t.fields.slots),algorithm:t.fields.algorithm,hash_on:t.fields.hashOn,hash_fallback:t.fields.hashFallback,healthchecks:{}};return t.fields.hostHeader&&(c.host_header=t.fields.hostHeader),t.fields.clientCertificate&&(c.client_certificate={id:t.fields.clientCertificate}),t.fields.healthchecksThreshold&&(c.healthchecks.threshold=Number(t.fields.healthchecksThreshold)),t.fields.tags&&(c.tags=(i=(o=t.fields.tags.split(","))==null?void 0:o.map(L=>String(L||"").trim()))==null?void 0:i.filter(L=>L!=="")),t.fields.hashOn==="header"&&(c.hash_on_header=t.fields.hashOnHeader),(t.fields.hashOn==="cookie"||t.fields.hashFallback==="cookie")&&(c.hash_on_cookie=t.fields.hashOnCookie,c.hash_on_cookie_path=t.fields.hashOnCookiePath),t.fields.hashOn==="query_arg"&&(c.hash_on_query_arg=t.fields.hashOnQueryArgument),t.fields.hashOn==="uri_capture"&&(c.hash_on_uri_capture=t.fields.hashOnUriCapture),t.fields.hashFallback==="header"&&(c.hash_fallback_header=t.fields.hashFallbackHeader),t.fields.hashFallback==="query_arg"&&(c.hash_fallback_query_arg=t.fields.hashFallbackQueryArgument),t.fields.hashFallback==="uri_capture"&&(c.hash_fallback_uri_capture=t.fields.hashFallbackUriCapture),t.fields.activeHealthSwitch?(c.healthchecks.active={type:t.fields.activeHealthCheck.type,healthy:{},unhealthy:{}},t.fields.activeHealthCheck.timeout&&(c.healthchecks.active.timeout=Number(t.fields.activeHealthCheck.timeout)),t.fields.activeHealthCheck.concurrency&&(c.healthchecks.active.concurrency=Number(t.fields.activeHealthCheck.concurrency)),t.fields.activeHealthCheck.type!=="tcp"&&t.fields.activeHealthCheck.httpPath&&(c.healthchecks.active.http_path=t.fields.activeHealthCheck.httpPath),((R=r.config)==null?void 0:R.app)==="kongManager"&&(t.fields.activeHealthCheck.headers.length===0?c.healthchecks.active.headers=[]:c.healthchecks.active.headers=t.fields.activeHealthCheck.headers.reduce((L,G)=>{var se,re;return G.key?{...L,[G.key]:(re=(se=G.values.split(","))==null?void 0:se.map(ae=>String(ae||"").trim()))==null?void 0:re.filter(ae=>ae!=="")}:{...L}},{})),(t.fields.activeHealthCheck.type==="https"||t.fields.activeHealthCheck.type==="grpcs")&&t.fields.activeHealthCheck.httpsSni&&(c.healthchecks.active.https_sni=t.fields.activeHealthCheck.httpsSni),(t.fields.activeHealthCheck.type==="https"||t.fields.activeHealthCheck.type==="grpcs")&&(c.healthchecks.active.https_verify_certificate=t.fields.activeHealthCheck.verifySsl),t.fields.activeHealthCheck.interval&&(c.healthchecks.active.healthy.interval=Number(t.fields.activeHealthCheck.interval)),t.fields.activeHealthCheck.successes&&(c.healthchecks.active.healthy.successes=Number(t.fields.activeHealthCheck.successes)),t.fields.activeHealthCheck.type!=="tcp"&&t.fields.activeHealthCheck.httpStatuses&&(c.healthchecks.active.healthy.http_statuses=g(t.fields.activeHealthCheck.httpStatuses)),t.fields.activeHealthCheck.unhealthyInterval&&(c.healthchecks.active.unhealthy.interval=Number(t.fields.activeHealthCheck.unhealthyInterval)),t.fields.activeHealthCheck.unhealthyTimeouts&&(c.healthchecks.active.unhealthy.timeouts=Number(t.fields.activeHealthCheck.unhealthyTimeouts)),t.fields.activeHealthCheck.type!=="tcp"&&t.fields.activeHealthCheck.unhealthyHttpStatuses&&(c.healthchecks.active.unhealthy.http_statuses=g(t.fields.activeHealthCheck.unhealthyHttpStatuses)),t.fields.activeHealthCheck.type!=="tcp"&&t.fields.activeHealthCheck.httpFailures&&(c.healthchecks.active.unhealthy.http_failures=Number(t.fields.activeHealthCheck.httpFailures)),t.fields.activeHealthCheck.tcpFailures&&(c.healthchecks.active.unhealthy.tcp_failures=Number(t.fields.activeHealthCheck.tcpFailures))):((D=r.config)==null?void 0:D.app)==="kongManager"&&P.value===p.EntityBaseFormType.Edit&&(c.healthchecks.active={type:t.fields.activeHealthCheck.type,headers:{},healthy:{interval:0,successes:0},unhealthy:{interval:0,http_failures:0,tcp_failures:0}}),t.fields.passiveHealthSwitch?(c.healthchecks.passive={type:t.fields.passiveHealthCheck.type,healthy:{},unhealthy:{}},t.fields.passiveHealthCheck.successes&&(c.healthchecks.passive.healthy.successes=Number(t.fields.passiveHealthCheck.successes)),t.fields.passiveHealthCheck.type!=="tcp"&&t.fields.passiveHealthCheck.httpStatuses&&(c.healthchecks.passive.healthy.http_statuses=g(t.fields.passiveHealthCheck.httpStatuses)),t.fields.passiveHealthCheck.timeouts&&(c.healthchecks.passive.unhealthy.timeouts=Number(t.fields.passiveHealthCheck.timeouts)),t.fields.passiveHealthCheck.type!=="tcp"&&t.fields.passiveHealthCheck.unhealthyHttpStatuses&&(c.healthchecks.passive.unhealthy.http_statuses=g(t.fields.passiveHealthCheck.unhealthyHttpStatuses)),t.fields.passiveHealthCheck.type!=="tcp"&&t.fields.passiveHealthCheck.httpFailures&&(c.healthchecks.passive.unhealthy.http_failures=Number(t.fields.passiveHealthCheck.httpFailures)),t.fields.passiveHealthCheck.tcpFailures&&(c.healthchecks.passive.unhealthy.tcp_failures=Number(t.fields.passiveHealthCheck.tcpFailures))):((v=r.config)==null?void 0:v.app)==="kongManager"&&P.value===p.EntityBaseFormType.Edit&&(c.healthchecks.passive={type:t.fields.passiveHealthCheck.type,healthy:{successes:0},unhealthy:{timeouts:0,tcp_failures:0,http_failures:0}}),c}),H=c=>{var i,R,D,v,L,G;let o=`${(i=r.config)==null?void 0:i.apiBaseUrl}${te.form[(R=r.config)==null?void 0:R.app][c]}`;return((D=r.config)==null?void 0:D.app)==="konnect"?o=o.replace(/{controlPlaneId}/gi,((v=r.config)==null?void 0:v.controlPlaneId)||""):((L=r.config)==null?void 0:L.app)==="kongManager"&&(o=o.replace(/\/{workspace}/gi,(G=r.config)!=null&&G.workspace?`/${r.config.workspace}`:"")),o=o.replace(/{id}/gi,r.upstreamId),o},U=async()=>{var c;try{t.readonly=!0,await h.post(H("validate"),k.value);let o;P.value===p.EntityBaseFormType.Create?o=await h.post(H("create"),k.value):P.value===p.EntityBaseFormType.Edit&&(o=((c=r.config)==null?void 0:c.app)==="konnect"?await h.put(H("edit"),k.value):await h.patch(H("edit"),k.value)),s("update",o==null?void 0:o.data)}catch(o){t.errorMessage=C(o),s("error",o)}finally{t.readonly=!1}};return(c,o)=>(e.openBlock(),e.createElementBlock("div",Kt,[e.createVNode(e.unref(p.EntityBaseForm),{"can-submit":O.value&&N.value,config:a.config,"edit-id":a.upstreamId,"entity-type":e.unref(p.SupportedEntityType).Upstream,"error-message":t.errorMessage,"fetch-url":Q.value,"form-fields":k.value,"is-readonly":t.readonly,onCancel:I,"onFetch:error":A,"onFetch:success":W,onLoading:T,onSubmit:U},{default:e.withCtx(()=>[e.createVNode(bt,{"client-certificate":t.fields.clientCertificate,"onUpdate:clientCertificate":o[0]||(o[0]=i=>t.fields.clientCertificate=i),"host-header":t.fields.hostHeader,"onUpdate:hostHeader":o[1]||(o[1]=i=>t.fields.hostHeader=i),name:t.fields.name,"onUpdate:name":o[2]||(o[2]=i=>t.fields.name=i),tags:t.fields.tags,"onUpdate:tags":o[3]||(o[3]=i=>t.fields.tags=i),config:a.config,readonly:t.readonly},null,8,["client-certificate","host-header","name","tags","config","readonly"]),e.createVNode(Vt,{algorithm:t.fields.algorithm,"onUpdate:algorithm":o[4]||(o[4]=i=>t.fields.algorithm=i),"hash-fallback":t.fields.hashFallback,"onUpdate:hashFallback":o[5]||(o[5]=i=>t.fields.hashFallback=i),"hash-fallback-header":t.fields.hashFallbackHeader,"onUpdate:hashFallbackHeader":o[6]||(o[6]=i=>t.fields.hashFallbackHeader=i),"hash-fallback-query-argument":t.fields.hashFallbackQueryArgument,"onUpdate:hashFallbackQueryArgument":o[7]||(o[7]=i=>t.fields.hashFallbackQueryArgument=i),"hash-fallback-uri-capture":t.fields.hashFallbackUriCapture,"onUpdate:hashFallbackUriCapture":o[8]||(o[8]=i=>t.fields.hashFallbackUriCapture=i),"hash-on":t.fields.hashOn,"onUpdate:hashOn":o[9]||(o[9]=i=>t.fields.hashOn=i),"hash-on-cookie":t.fields.hashOnCookie,"onUpdate:hashOnCookie":o[10]||(o[10]=i=>t.fields.hashOnCookie=i),"hash-on-cookie-path":t.fields.hashOnCookiePath,"onUpdate:hashOnCookiePath":o[11]||(o[11]=i=>t.fields.hashOnCookiePath=i),"hash-on-header":t.fields.hashOnHeader,"onUpdate:hashOnHeader":o[12]||(o[12]=i=>t.fields.hashOnHeader=i),"hash-on-query-argument":t.fields.hashOnQueryArgument,"onUpdate:hashOnQueryArgument":o[13]||(o[13]=i=>t.fields.hashOnQueryArgument=i),"hash-on-uri-capture":t.fields.hashOnUriCapture,"onUpdate:hashOnUriCapture":o[14]||(o[14]=i=>t.fields.hashOnUriCapture=i),slots:t.fields.slots,"onUpdate:slots":o[15]||(o[15]=i=>t.fields.slots=i),readonly:t.readonly},null,8,["algorithm","hash-fallback","hash-fallback-header","hash-fallback-query-argument","hash-fallback-uri-capture","hash-on","hash-on-cookie","hash-on-cookie-path","hash-on-header","hash-on-query-argument","hash-on-uri-capture","slots","readonly"]),e.createVNode(Tt,{"active-health-switch":t.fields.activeHealthSwitch,"onUpdate:activeHealthSwitch":[o[16]||(o[16]=i=>t.fields.activeHealthSwitch=i),d],"healthchecks-threshold":t.fields.healthchecksThreshold,"onUpdate:healthchecksThreshold":o[17]||(o[17]=i=>t.fields.healthchecksThreshold=i),"passive-health-switch":t.fields.passiveHealthSwitch,"onUpdate:passiveHealthSwitch":[o[18]||(o[18]=i=>t.fields.passiveHealthSwitch=i),_],readonly:t.readonly},null,8,["active-health-switch","healthchecks-threshold","passive-health-switch","readonly"]),t.fields.activeHealthSwitch?(e.openBlock(),e.createBlock(Ot,{key:0,concurrency:t.fields.activeHealthCheck.concurrency,"onUpdate:concurrency":o[19]||(o[19]=i=>t.fields.activeHealthCheck.concurrency=i),headers:t.fields.activeHealthCheck.headers,"onUpdate:headers":o[20]||(o[20]=i=>t.fields.activeHealthCheck.headers=i),"http-failures":t.fields.activeHealthCheck.httpFailures,"onUpdate:httpFailures":o[21]||(o[21]=i=>t.fields.activeHealthCheck.httpFailures=i),"http-path":t.fields.activeHealthCheck.httpPath,"onUpdate:httpPath":o[22]||(o[22]=i=>t.fields.activeHealthCheck.httpPath=i),"http-statuses":t.fields.activeHealthCheck.httpStatuses,"onUpdate:httpStatuses":o[23]||(o[23]=i=>t.fields.activeHealthCheck.httpStatuses=i),"https-sni":t.fields.activeHealthCheck.httpsSni,"onUpdate:httpsSni":o[24]||(o[24]=i=>t.fields.activeHealthCheck.httpsSni=i),interval:t.fields.activeHealthCheck.interval,"onUpdate:interval":o[25]||(o[25]=i=>t.fields.activeHealthCheck.interval=i),successes:t.fields.activeHealthCheck.successes,"onUpdate:successes":o[26]||(o[26]=i=>t.fields.activeHealthCheck.successes=i),"tcp-failures":t.fields.activeHealthCheck.tcpFailures,"onUpdate:tcpFailures":o[27]||(o[27]=i=>t.fields.activeHealthCheck.tcpFailures=i),timeout:t.fields.activeHealthCheck.timeout,"onUpdate:timeout":o[28]||(o[28]=i=>t.fields.activeHealthCheck.timeout=i),type:t.fields.activeHealthCheck.type,"onUpdate:type":o[29]||(o[29]=i=>t.fields.activeHealthCheck.type=i),"unhealthy-http-statuses":t.fields.activeHealthCheck.unhealthyHttpStatuses,"onUpdate:unhealthyHttpStatuses":o[30]||(o[30]=i=>t.fields.activeHealthCheck.unhealthyHttpStatuses=i),"unhealthy-interval":t.fields.activeHealthCheck.unhealthyInterval,"onUpdate:unhealthyInterval":o[31]||(o[31]=i=>t.fields.activeHealthCheck.unhealthyInterval=i),"unhealthy-timeouts":t.fields.activeHealthCheck.unhealthyTimeouts,"onUpdate:unhealthyTimeouts":o[32]||(o[32]=i=>t.fields.activeHealthCheck.unhealthyTimeouts=i),"verify-ssl":t.fields.activeHealthCheck.verifySsl,"onUpdate:verifySsl":o[33]||(o[33]=i=>t.fields.activeHealthCheck.verifySsl=i),config:a.config,readonly:t.readonly},null,8,["concurrency","headers","http-failures","http-path","http-statuses","https-sni","interval","successes","tcp-failures","timeout","type","unhealthy-http-statuses","unhealthy-interval","unhealthy-timeouts","verify-ssl","config","readonly"])):e.createCommentVNode("",!0),t.fields.passiveHealthSwitch?(e.openBlock(),e.createBlock(At,{key:1,"http-failures":t.fields.passiveHealthCheck.httpFailures,"onUpdate:httpFailures":o[34]||(o[34]=i=>t.fields.passiveHealthCheck.httpFailures=i),"http-statuses":t.fields.passiveHealthCheck.httpStatuses,"onUpdate:httpStatuses":o[35]||(o[35]=i=>t.fields.passiveHealthCheck.httpStatuses=i),successes:t.fields.passiveHealthCheck.successes,"onUpdate:successes":o[36]||(o[36]=i=>t.fields.passiveHealthCheck.successes=i),"tcp-failures":t.fields.passiveHealthCheck.tcpFailures,"onUpdate:tcpFailures":o[37]||(o[37]=i=>t.fields.passiveHealthCheck.tcpFailures=i),timeouts:t.fields.passiveHealthCheck.timeouts,"onUpdate:timeouts":o[38]||(o[38]=i=>t.fields.passiveHealthCheck.timeouts=i),type:t.fields.passiveHealthCheck.type,"onUpdate:type":o[39]||(o[39]=i=>t.fields.passiveHealthCheck.type=i),"unhealthy-http-statuses":t.fields.passiveHealthCheck.unhealthyHttpStatuses,"onUpdate:unhealthyHttpStatuses":o[40]||(o[40]=i=>t.fields.passiveHealthCheck.unhealthyHttpStatuses=i),readonly:t.readonly},null,8,["http-failures","http-statuses","successes","tcp-failures","timeouts","type","unhealthy-http-statuses","readonly"])):e.createCommentVNode("",!0)]),_:1},8,["can-submit","config","edit-id","entity-type","error-message","fetch-url","form-fields","is-readonly"])]))}}),[["__scopeId","data-v-0669debc"]]),vt={"data-testid":"client_certificate-plain-text"},jt=e.defineComponent({__name:"UpstreamsConfigCard",props:{config:{type:Object,required:!0,validator:a=>!(!a||!["konnect","kongManager"].includes(a==null?void 0:a.app)||a.app==="konnect"&&!a.controlPlaneId||a.app==="kongManager"&&typeof a.workspace!="string"||!a.entityId)},configCardDoc:{type:String,default:"",required:!1},hideTitle:{type:Boolean,default:!1}},emits:["loading","fetch:error","fetch:success"],setup(a){const E=a,{i18n:{t:r},i18nT:s}=J.useI18n(),{getPropValue:n}=p.useHelpers(),g=e.computed(()=>te.form[E.config.app].edit),m=e.ref({id:{},name:{},created_at:{},updated_at:{},algorithm:{order:5,section:p.ConfigurationSchemaSection.Basic,tooltip:r("upstreams.form.fields.algorithm.tooltip")},slots:{order:6,section:p.ConfigurationSchemaSection.Basic},hash_on:{order:7,section:p.ConfigurationSchemaSection.Basic},hash_on_header:{order:8,section:p.ConfigurationSchemaSection.Basic},hash_on_uri_capture:{order:9,section:p.ConfigurationSchemaSection.Basic},hash_on_query_arg:{order:10,section:p.ConfigurationSchemaSection.Basic,label:`${r("upstreams.form.fields.hash_on.label")} ${r("upstreams.form.hash_labels.query_argument")}`},hash_on_cookie:{order:11,section:p.ConfigurationSchemaSection.Basic},hash_on_cookie_path:{order:12,section:p.ConfigurationSchemaSection.Basic},healthchecks:{order:13,section:p.ConfigurationSchemaSection.Basic,type:p.ConfigurationSchemaType.Json},tags:{order:14,tooltip:r("upstreams.form.hash_tooltips.tags")},hash_fallback:{order:1},hash_fallback_header:{order:2},hash_fallback_query_arg:{order:3,label:`${r("upstreams.form.fields.hash_fallback.label")} ${r("upstreams.form.hash_labels.query_argument")}`},hash_fallback_uri_capture:{order:4},host_header:{order:5},use_srv_name:{order:6},client_certificate:{order:7,tooltip:r("upstreams.form.hash_tooltips.client_certificate")}});return(q,x)=>(e.openBlock(),e.createElementBlock("div",null,[e.createVNode(e.unref(p.EntityBaseConfigCard),{config:a.config,"config-card-doc":a.configCardDoc,"config-schema":m.value,"entity-type":e.unref(p.SupportedEntityType).Upstream,"fetch-url":g.value,"hide-title":a.hideTitle,"onFetch:error":x[0]||(x[0]=l=>q.$emit("fetch:error",l)),"onFetch:success":x[1]||(x[1]=l=>q.$emit("fetch:success",l)),onLoading:x[2]||(x[2]=l=>q.$emit("loading",l))},{"name-label-tooltip":e.withCtx(()=>[e.createVNode(e.unref(s),{keypath:"upstreams.form.fields.name.tooltip",scope:"global"},{host:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(e.unref(r)("upstreams.form.fields.name.host")),1)]),_:1})]),"hash_on-label-tooltip":e.withCtx(({row:l})=>[e.createVNode(e.unref(s),{keypath:"upstreams.form.fields.hash_on.tooltip",scope:"global"},{result:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(l.value),1)]),_:2},1024)]),"hash_on_header-label-tooltip":e.withCtx(()=>[e.createVNode(e.unref(s),{keypath:"upstreams.form.hash_tooltips.hash_on_header.text",scope:"global"},{hash_on:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(e.unref(r)("upstreams.form.hash_tooltips.hash_on_header.hash_on")),1)]),header:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(e.unref(r)("upstreams.form.hash_tooltips.hash_on_header.header")),1)]),_:1})]),"hash_on_uri_capture-label-tooltip":e.withCtx(()=>[e.createVNode(e.unref(s),{keypath:"upstreams.form.hash_tooltips.hash_on_uri_capture.text",scope:"global"},{hash_on:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(e.unref(r)("upstreams.form.hash_tooltips.hash_on_uri_capture.hash_on")),1)]),uri_capture:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(e.unref(r)("upstreams.form.hash_tooltips.hash_on_uri_capture.uri_capture")),1)]),_:1})]),"hash_on_query_arg-label-tooltip":e.withCtx(()=>[e.createVNode(e.unref(s),{keypath:"upstreams.form.hash_tooltips.hash_on_query_arg.text",scope:"global"},{hash_on:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(e.unref(r)("upstreams.form.hash_tooltips.hash_on_query_arg.hash_on")),1)]),query_arg:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(e.unref(r)("upstreams.form.hash_tooltips.hash_on_query_arg.query_arg")),1)]),_:1})]),"hash_on_cookie-label-tooltip":e.withCtx(()=>[e.createVNode(e.unref(s),{keypath:"upstreams.form.hash_tooltips.hash_on_cookie.text",scope:"global"},{hash_on:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(e.unref(r)("upstreams.form.hash_tooltips.hash_on_cookie.hash_on")),1)]),hash_fallback:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(e.unref(r)("upstreams.form.hash_tooltips.hash_on_cookie.hash_fallback")),1)]),cookie:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(e.unref(r)("upstreams.form.hash_tooltips.hash_on_cookie.cookie")),1)]),_:1})]),"hash_on_cookie_path-label-tooltip":e.withCtx(()=>[e.createVNode(e.unref(s),{keypath:"upstreams.form.hash_tooltips.hash_on_cookie_path.text",scope:"global"},{hash_on:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(e.unref(r)("upstreams.form.hash_tooltips.hash_on_cookie_path.hash_on")),1)]),hash_fallback:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(e.unref(r)("upstreams.form.hash_tooltips.hash_on_cookie_path.hash_fallback")),1)]),cookie:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(e.unref(r)("upstreams.form.hash_tooltips.hash_on_cookie_path.cookie")),1)]),_:1})]),"slots-label-tooltip":e.withCtx(()=>[e.createVNode(e.unref(s),{keypath:"upstreams.form.hash_tooltips.slots.text",scope:"global"},{algorithm:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(e.unref(r)("upstreams.form.hash_tooltips.slots.algorithm")),1)]),round_robin:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(e.unref(r)("upstreams.form.hash_tooltips.slots.round_robin")),1)]),consistent_hashing:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(e.unref(r)("upstreams.form.hash_tooltips.slots.consistent_hashing")),1)]),min:e.withCtx(()=>x[3]||(x[3]=[e.createElementVNode("code",null,"10",-1)])),max:e.withCtx(()=>x[4]||(x[4]=[e.createElementVNode("code",null,"65536",-1)])),_:1})]),"hash_fallback-label-tooltip":e.withCtx(()=>[e.createVNode(e.unref(s),{keypath:"upstreams.form.hash_tooltips.hash_fallback.text",scope:"global"},{hash_on:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(e.unref(r)("upstreams.form.hash_tooltips.hash_fallback.hash_on")),1)]),cookie:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(e.unref(r)("upstreams.form.hash_tooltips.hash_fallback.cookie")),1)]),_:1})]),"hash_fallback_header-label-tooltip":e.withCtx(()=>[e.createVNode(e.unref(s),{keypath:"upstreams.form.hash_tooltips.hash_fallback_header.text",scope:"global"},{hash_fallback:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(e.unref(r)("upstreams.form.hash_tooltips.hash_fallback_header.hash_fallback")),1)]),header:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(e.unref(r)("upstreams.form.hash_tooltips.hash_fallback_header.header")),1)]),_:1})]),"hash_fallback_query_arg-label-tooltip":e.withCtx(()=>[e.createVNode(e.unref(s),{keypath:"upstreams.form.hash_tooltips.hash_fallback_query_arg.text",scope:"global"},{hash_fallback:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(e.unref(r)("upstreams.form.hash_tooltips.hash_fallback_query_arg.hash_fallback")),1)]),query_arg:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(e.unref(r)("upstreams.form.hash_tooltips.hash_fallback_query_arg.query_arg")),1)]),_:1})]),"hash_fallback_uri_capture-label-tooltip":e.withCtx(()=>[e.createVNode(e.unref(s),{keypath:"upstreams.form.hash_tooltips.hash_fallback_uri_capture.text",scope:"global"},{hash_fallback:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(e.unref(r)("upstreams.form.hash_tooltips.hash_fallback_uri_capture.hash_fallback")),1)]),uri_capture:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(e.unref(r)("upstreams.form.hash_tooltips.hash_fallback_uri_capture.uri_capture")),1)]),_:1})]),"host_header-label-tooltip":e.withCtx(()=>[e.createVNode(e.unref(s),{keypath:"upstreams.form.hash_tooltips.host_header.text",scope:"global"},{host:e.withCtx(()=>[e.createElementVNode("code",null,e.toDisplayString(e.unref(r)("upstreams.form.hash_tooltips.host_header.host")),1)]),_:1})]),client_certificate:e.withCtx(l=>{var h;return[e.createElementVNode("div",null,[e.createElementVNode("div",vt,[e.createElementVNode("span",null,e.toDisplayString((h=e.unref(n)("rowValue",l))==null?void 0:h.id),1)])])]}),_:1},8,["config","config-card-doc","config-schema","entity-type","fetch-url","hide-title"])]))}});j.TargetForm=He,j.TargetsList=yt,j.UpstreamsConfigCard=jt,j.UpstreamsForm=Rt,j.UpstreamsList=ct,Object.defineProperty(j,Symbol.toStringTag,{value:"Module"})});