@kong-ui-public/entities-shared 3.45.1 → 3.45.2-pr.3235.1ca65bc7d.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- "use strict";const j=require("axios"),i=require("vue"),F=require("@kong-ui-public/i18n");var C=(e=>(e[e.InitialLoad=0]="InitialLoad",e[e.Loading=1]="Loading",e[e.Idle=2]="Idle",e[e.NoResults=3]="NoResults",e[e.NoRecords=4]="NoRecords",e[e.Error=5]="Error",e))(C||{}),R=(e=>(e.CaCertificate="ca_certificate",e.Certificate="certificate",e.Consumer="consumer",e.ConsumerGroup="consumer_group",e.GatewayService="service",e.Key="key",e.KeySet="set",e.Plugin="plugin",e.Route="route",e.SNI="sni",e.Upstream="upstream",e.Target="target",e.Vault="vault",e.Partial="partial",e.CloudGatewayAddon="cloud_gateway_addon",e.BackendCluster="backend_cluster",e.VirtualCluster="virtual_cluster",e.Listener="listener",e.ProducePolicy="produce_policy",e.ConsumePolicy="consume_policy",e.ClusterPolicy="cluster_policy",e.ListenerPolicy="listener_policy",e.SchemaRegistry="schema_registry",e.StaticKey="static_key",e.TlsTrustBundle="tls_trust_bundle",e.AuthServer="auth_server",e.AuthServerScopes="auth_server_scopes",e.AuthServerClaims="auth_server_claims",e.AuthServerClients="auth_server_clients",e.Other="other",e))(R||{});const ae=Object.values(R),J=["ca_certificate","certificate","consumer","consumer_group","service","key","set","plugin","route","upstream","target","vault","partial"];function M(e){return J.includes(e)}const se=["backend_cluster","virtual_cluster","listener","produce_policy","consume_policy","cluster_policy","listener_policy","schema_registry","static_key","tls_trust_bundle"],ne=["auth_server","auth_server_scopes","auth_server_claims","auth_server_clients"];var q=(e=>(e.ID="id",e.IdArray="id-array",e.Text="plain-text",e.Date="date",e.Redacted="redacted",e.RedactedArray="redacted-array",e.Json="json",e.JsonArray="json-array",e.BadgeTag="badge-tag",e.CopyBadge="copy-badge",e.BadgeStatus="badge-status",e.BadgeMethod="badge-method",e.LinkInternal="link-internal",e.LinkExternal="link-external",e))(q||{}),H=(e=>(e.Basic="basic",e.Advanced="advanced",e.Plugin="plugin",e.Policy="policy",e))(H||{});const oe=["structured","yaml","json","terraform","deck"];function re(){return{getAxiosInstance:(e={})=>{try{const s=i.inject("get-axios-instance",void 0);return typeof s=="function"?s(e):j.create({withCredentials:!0,timeout:3e4,...e})}catch(s){return console.warn("getAxiosInstance:",s.message||s),j.create({withCredentials:!0,timeout:3e4,...e})}},getTraceIdFromError:e=>{var s;return((s=e==null?void 0:e.response)==null?void 0:s.headers["x-datadog-trace-id"])||""}}}function ie(){return{debounce:(e,s)=>{let o;return(...t)=>{clearTimeout(o),o=window==null?void 0:window.setTimeout(()=>{e(...t)},s)}}}}const E="khcp-user-table-preferences",ce={pageSize:30,sortColumnKey:void 0,sortColumnOrder:void 0,columnVisibility:{}};function le(){const e=o=>{if(typeof o=="string")try{return JSON.parse(o)}catch(t){console.error("useTablePreferences(tryParseJson)",t);return}},s=()=>{const o=e(localStorage.getItem(E));return!o||!Object.keys(o).length?new Map:new Map(Object.entries(o))};return{setTablePreferences:(o,t)=>{try{const r=s();r.set(o,t),localStorage.setItem(E,JSON.stringify(Object.fromEntries(r.entries())))}catch(r){console.error("useTablePreferences(setTablePreferences)",r)}},getTablePreferences:(o,t)=>{const r=s();return(r==null?void 0:r.get(o))||void 0||t||ce},deleteAllTablePreferences:()=>{localStorage.removeItem(E)}}}function K(e={}){const{getAxiosInstance:s}=re();return{axiosInstance:s(e)}}const ue={actions:{copyId:"Copy ID",copied_id:'Copied "{id}" to the clipboard',copyToClipboard:"Copied successfully!",copyToClipboardFailed:"Failed to copy to the clipboard"}},de={message:"Are you sure you want to delete this {entityType}?",messageWithName:"Are you sure you want to delete this {entityType} {entityName}?"},fe={actions:{viewConfiguration:"View configuration",hideConfiguration:"Hide configuration",save:"Save",cancel:"Cancel",back:"Back"},configuration:{title:"Configuration",message:"Export configurations for core Kong Gateway objects, like services, routes, and plugins, to either YAML or JSON. This allows for straightforward importing into APIOps tools like decK with YAML, or Insomnia and cURL with JSON.",yaml:"YAML",json:"JSON",terraform:"Terraform",deck:"decK"},errors:{edit:"The entity could not be edited at this time."}},pe={emptyState:{noSearchResultsTitle:"No results found",noSearchResultsMessage:"Please adjust the criteria and try again.",noSearchResultsCtaText:"Clear"}},ge={title:"Configuration",actions:{copy:"Copy JSON",deck_customize:"Customize before copying to CLI",deck_customize_cancel:"Cancel",sensitive_fields:"Show sensitive fields"},sections:{advanced:"Advanced",plugin:"Plugin specific configuration",policy:"Policy specific configuration"},commonFields:{id_label:"ID",name_label:"Name",enabled_label:"Enabled",enabled_tooltip:"Enabled is FTW",updated_at_label:"Last updated",created_at_label:"Created",tags_label:"Tags",link:"Link",partial_label:"Redis configuration"},statusBadge:{enabledLabel:"Enabled",disabledLabel:"Disabled"},copy:{tooltip:"Copy {label}",success:"Copied!"},errors:{load:"The entity configuration data could not be loaded at this time.",copy:"Failed to copy to clipboard"},general:{entryTitle:"Entry {index}",structuredFormat:"Structured"}},me={learnMore:"Learn more",pricingTitle:"Pricing: "},he={filterButtonText:"Filter",fieldLabel:"Filter by:",inputPlaceholder:"Enter a value",selectPlaceholder:"Select an item",applyButtonText:"Apply",clearButtonText:"Clear",clearAllButtonText:"Clear all filters"},ve={errors:{fetch:"Could not fetch available items",invalid:"Please select a valid value"}},be={unexpected:"An unexpected error has occurred",dataKeyUndefined:'The data key "{dataKey}" does not exist in the response.'},ye={utf8Name:"The name can be any string containing characters, letters, numbers, or the following characters: ., -, _, or ~. Do not use spaces."},_e={enable:{title:"Enable {entityType}",message:"Are you sure you want to enable the {entityType} {entityName}?",confirmText:"Yes, enable"},disable:{title:"Disable {entityType}",message:"Are you sure you want to disable the {entityType} {entityName}?",confirmText:"Yes, disable"}},Ce={hint:{konnect:"The {token} environment variable must be added first. See {link} for details.",kongManager:"If your Admin API is secured, set up authentication following {link}."},documentation:"the documentation",steps:{step_1:"Step 1: Export token",step_2:"Step 2: Apply configuration"},customization:{title:"Customize before copying to CLI",copy_pat:"Make sure to copy your personal access token now. You won't be able to see it again.",reuse_pat:"Use an existing PAT if you've already generated one.",generate_pat:"Generate PAT",footer_reminder:"Changes made here won't affect your configuration."},copy_tooltip:"Copy"},ke={body:"Want a ready-to-use CLI command? {cta} to view this configuration as a decK sync snippet you can copy directly.",cta:"Switch to decK format"},we={title:"Generate a Personal Access Token",description:"Personal access tokens are used to authenticate decK commands and Konnect API requests.",fields:{name:{label:"Name",placeholder:"Enter token name"},expiresAt:{label:"Expiration date",placeholder:"Select an expiration date",n_days:"{n} days"}},actions:{cancel:"Cancel",generate:"Generate",generating:"Generating…"}},Ae={global:ue,deleteModal:de,baseForm:fe,baseTable:pe,baseConfigCard:ge,emptyState:me,filter:he,debouncedFilter:ve,errors:be,validationErrors:ye,toggleModal:_e,deckCodeBlock:Ce,deckCallout:ke,generatePatModal:we};function D(){const e=F.createI18n("en-us",Ae);return{i18n:e,i18nT:F.i18nTComponent(e)}}function Q(){const e=(n,a)=>(a==null?void 0:a[n])??void 0,s=(n,a)=>{if(n.length!==a.length)return!1;const u=new Set([...n,...a]);for(const l of u){const c=n.filter(d=>d===l).length,p=a.filter(d=>d===l).length;if(c!==p)return!1}return!0};return{getPropValue:e,objectsAreEqual:(n,a,u)=>{if(u){if(Object.keys(n).length===Object.keys(a).length)for(const l in n)if(Array.isArray(n[l])&&Array.isArray(a[l])){if(s(n[l],a[l]))continue;return!1}else{if(n[l]===a[l])continue;return!1}else return!1;return!0}try{return JSON.stringify(n)===JSON.stringify(a)}catch{return!1}},sortAlpha:n=>(a,u)=>{let l=a[n]===void 0||a[n]===null?"":a[n],c=u[n]===void 0||u[n]===null?"":u[n];return Array.isArray(a[n])&&(l=a[n][0]),Array.isArray(u[n])&&(c=u[n][0]),l.localeCompare(c)},isValidUuid:n=>n?/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/.test(n):!1}}function Ie(e,s,o,t={fetchedItemsKey:"data",searchKeys:["id"]}){o||(o="1000");const{axiosInstance:r}=K(e.axiosRequestConfig),{i18n:{t:n}}=D(),{debounce:a}=ie(),u=a(async f=>{await I(f)},200),l=i.ref(!1),c=i.ref(""),p=i.ref(""),d=i.ref([]),k=i.ref([]),_=i.ref(void 0),g=i.computed(()=>{let f=`${e.apiBaseUrl}${i.unref(s)}`;return e.app==="konnect"&&(f=f.replace(/{controlPlaneId}/gi,(e==null?void 0:e.controlPlaneId)||"")),f.replace(/\/{workspace}/gi,e!=null&&e.workspace?`/${e.workspace}`:"")}),{isValidUuid:y}=Q(),b=async()=>{try{l.value=!0;const{data:f}=await r.get(`${g.value}?size=${o}`);f!=null&&f.next||(_.value=t.fetchedItemsKey in f?f[t.fetchedItemsKey]:[]),k.value=t.fetchedItemsKey in f?f[t.fetchedItemsKey]:[],d.value=k.value}catch{d.value=[],c.value=n("debouncedFilter.errors.fetch")}finally{l.value=!1}},A=i.ref(""),I=async f=>{var L,P,U;if(A.value!==f){if(A.value=f??"",!f){d.value=k.value;return}if(_.value===void 0)try{if(l.value=!0,c.value="",p.value="",e.app==="konnect"){const v=`${g.value}/${f}`,{data:h}=await r.get(`${v}?size=${o}`);t.fetchedItemsKey in h?d.value=h[t.fetchedItemsKey]:h!=null&&h[t.exactMatchKey??"id"]?d.value=[h]:d.value=[]}else{const v=[];y(f)&&t.searchKeys.includes("id")?v.push((async()=>{const{data:m}=await r.get(`${g.value}/${f}`);return[m[t.fetchedItemsKey]??m]})()):v.push(...t.searchKeys.filter(m=>m!=="id").map(async m=>{const{data:w}=await r.get(`${g.value}?${m}=${f}`);return w[t.fetchedItemsKey]}));const h=await Promise.all(v),x=new Set;d.value=[],(L=h==null?void 0:h.forEach)==null||L.call(h,m=>{var w;(w=m==null?void 0:m.forEach)==null||w.call(m,O=>{x.has(O.id)||(x.add(O.id),d.value.push(O))})})}}catch(v){((P=v==null?void 0:v.response)==null?void 0:P.status)===404?p.value=n("debouncedFilter.errors.invalid"):(d.value=[],c.value=n("debouncedFilter.errors.fetch"))}finally{l.value=!1}else l.value=!0,p.value="",d.value=(U=_.value)==null?void 0:U.filter(v=>{var x;let h=!1;for(const m of t.searchKeys){const w=typeof v[m]=="string"?(x=v[m])==null?void 0:x.toLowerCase():v[m];w!=null&&w.includes(f.toLowerCase())&&(h=!0)}return h}),(!d.value||!d.value.length)&&(p.value=n("debouncedFilter.errors.invalid")),l.value=!1}};return{loading:l,error:c,validationError:p,results:d,allRecords:_,loadItems:b,debouncedQueryChange:u}}const xe=Symbol("PLUGIN_FORM_LAYOUT_STATE"),N=Symbol("DECK_COMMAND_EDITOR"),$="[entities-shared] DeckCommandEditor was not provided. Provide it via the `DECK_COMMAND_EDITOR_KEY` injection key or the `provideDeckCommandEditor` helper (see @kong-ui-public/entities-shared/deck-editor).";function De(e,s){const o=i.inject(N,null),t=i.computed(()=>{const a=i.toValue(e);return(a.app==="kongManager"||!!(a.app==="konnect"&&a.enableDeckConfig))&&M(i.toValue(s))}),r=i.computed(()=>{const a=i.toValue(e),u=a.app==="konnect"&&a.enableDeckConfig&&typeof a.enableDeckConfig!="boolean"?a.enableDeckConfig.customization:void 0;if(u&&!o){console.warn($);return}return u}),n=i.computed(()=>{const a=i.toValue(e);return a.app==="konnect"&&a.enableDeckConfig&&typeof a.enableDeckConfig!="boolean"?a.enableDeckConfig.calloutPreferenceKey:a.app==="kongManager"?a.deckCalloutPreferenceKey:void 0});return{isDeckEnabled:t,deckCustomizationOptions:r,deckCalloutPreferenceKey:n}}function Oe(e,s){const o=i.inject(N,null),t=i.computed(()=>{const a=i.toValue(e);return(a.app==="kongManager"||!!(a.app==="konnect"&&a.enableDeckTab))&&M(i.toValue(s))}),r=i.computed(()=>{const a=i.toValue(e),u=a.app==="konnect"&&a.enableDeckTab&&typeof a.enableDeckTab!="boolean"?a.enableDeckTab.customization:void 0;if(u&&!o){console.warn($);return}return u}),n=i.computed(()=>{const a=i.toValue(e);return a.app==="konnect"&&a.enableDeckTab&&typeof a.enableDeckTab!="boolean"?a.enableDeckTab.calloutPreferenceKey:a.app==="kongManager"?a.deckCalloutPreferenceKey:void 0});return{isDeckEnabled:t,deckCustomizationOptions:r,deckCalloutPreferenceKey:n}}function Ee(e,s){const o=i.unref(s),t=i.computed(()=>e.apiBaseUrl.startsWith("/")?new URL(`${window.location.origin}${o}`):new URL(o));return t.value.search="",r=>`${t.value.href}/${r}`}function Te(){const{i18n:{t:e}}=D();return{getErrorFieldsFromError:t=>{var a,u,l;if(!t)return{messages:[e("errors.unexpected")],fields:[]};if(((a=t==null?void 0:t.response)==null?void 0:a.status)===401)return{messages:[],fields:[]};let r=[e("errors.unexpected")];const n=[];if((u=t==null?void 0:t.response)!=null&&u.data){if((l=t.response.data.details)!=null&&l.length)return r=[],t.response.data.details.forEach(c=>{let p=e("errors.unexpected");c.messages&&Array.isArray(c.messages)&&c.messages.length&&(p=c.messages.join(", ")),c.field&&n.push({field:c.field,message:p}),r.push(`${c.field??""} ${p}`)}),{messages:r,fields:n};if(t.response.data.message&&Array.isArray(t.response.data.message))return r=[],t.response.data.message.forEach(c=>{if(c!=null&&c.constraints){const p=Object.values(c.constraints).join(", ");r.push(p),c.property&&n.push({field:c.property,message:p})}else c!=null&&c.property&&(c!=null&&c.message)?(n.push({field:c.property,message:c.message}),r.push(c.message)):r.push(c)}),{messages:r,fields:n};if(typeof t.response.data.message=="string"||typeof t.response.data=="string")return{messages:[t.response.data.message],fields:[]};if(typeof t.response.data=="object")return r=[],Object.keys(t.response.data).forEach(c=>{n.push({field:c,message:t.response.data[c]}),r.push(t.response.data[c])}),{messages:r,fields:n}}return{messages:[t.message||e("errors.unexpected")],fields:[]}},getMessageFromError:t=>{var r,n,a,u;if(!t)return e("errors.unexpected");if(((r=t==null?void 0:t.response)==null?void 0:r.status)===401)return console.warn("getMessageFromError: User auth token is expired or missing, returning empty message."),"";if((n=t==null?void 0:t.response)!=null&&n.data){if(t.response.data.detail)return t.response.data.detail;if((a=t.response.data.details)!=null&&a.length)return t.response.data.details.map(l=>{let c=e("errors.unexpected");return l.messages&&typeof l.messages=="object"&&l.messages.length&&(c=l.messages.join(", ")),l.field?`${l.field} - ${c}`:c}).join("; ");if(t.response.data.message){const{message:l}=t.response.data;return Array.isArray(l)?(u=l[0])!=null&&u.constraints?Object.values(l[0].constraints)[0]:l[0]:l}if(typeof t.response.data=="string")return t.response.data;if(typeof t.response.data=="object")return Object.keys(t.response.data).map(l=>`${l} ${t.response.data[l]}`).join(", ")}return t.message||e("errors.unexpected")}}}function Re(e){const s=window.location.origin,o=s.endsWith("/")?s:`${s}/`;try{const t=e.join("/"),r=`${o}${t}`,n=e.some(u=>u.trim()==="");if(/^(https:\/\/(www\.)?([a-zA-Z0-9-]+\.){1,}[a-zA-Z]{2,}(:[0-9]+)?(\/[^\/]+)*)$|^(https|http):\/\/localhost(:[0-9]+)?(\/[^\/]+)*$/.test(r)&&!n&&new URL(r))return`${o}${t}`;throw new Error("Invalid url")}catch(t){return console.warn("Failed to build valid URL:",t),""}}function Z(e,s){const o=i.computed(()=>{const r=i.toValue(e);return r.app==="konnect"||!!r.isExactMatch}),t=i.computed(()=>{const r=i.toValue(s);return r.startsWith("/")?new URL(`${window.location.origin}${r}`):new URL(r)});return r=>{const{page:n,pageSize:a,offset:u,sortColumnKey:l,sortColumnOrder:c,query:p}=r;try{let d=new URL(t.value.href);return o.value&&p?(d.search="",d=i.toValue(e).isExactMatch?new URL(`${d.href}/${p}`):new URL(`${d.href}?filter[name][contains]=${p}`)):(o.value||new URLSearchParams(p).forEach((k,_)=>{d.searchParams.append(_,k)}),l&&d.searchParams.append("sort_by",l),c==="desc"&&d.searchParams.append("sort_desc","1"),d.searchParams.append("size",String(a))),u&&n!==1&&d.searchParams.append("offset",String(u)),d.href}catch(d){return console.error("RouteList(fetcher)",d),i.toValue(s)}}}const V=new Map;function Me(e,s,o){const t=i.ref(!0),r=i.toValue(e),{axiosInstance:n}=K(r.axiosRequestConfig),a=Z(e,s),u=i.ref({status:C.Idle}),l=async d=>{var _;const k=i.toValue(o)||"data";try{u.value=t.value?{status:C.InitialLoad}:{status:C.Loading},t.value=!1;let g=a(d);g.includes("filter[name]")&&(g=`${g}&page[size]=${d.pageSize}&page[number]=${d.page}`);const y=await n.get(g);if(y.status>=400)throw y;const b=y.data,A=k&&k.replace(/[^\w-_]/gi,"");let I;b[A]?I=Array.isArray(b[A])?b[A]:[b[A]]:Array.isArray(b)?I=b:I=Object.keys(b).length?[b]:[];const f={data:I,total:I.length,...b.offset?{pagination:{offset:b.offset}}:null};return f.data.length===0&&!d.query?u.value={status:C.NoRecords,response:f}:u.value={status:C.Idle,response:f},f}catch(g){const y={data:[],total:0};return d.query&&(((_=g.response)==null?void 0:_.status)===404||g.status===404)?(u.value={status:C.NoResults,response:y,error:g.response?g:{response:g}},y):(u.value={status:C.Error,response:y,error:g.response?g:{response:g}},y)}},c=r.cacheIdentifier,p=X(c);return{fetcher:l,fetcherState:u,fetcherCacheKey:p}}function X(e){if(e){let s=V.get(e);return s||(s=i.ref(1),V.set(e,s)),s}return i.ref(1)}function Ke(){const e=(t,r="_")=>t?t.split(r).map(n=>n.toLowerCase()==="id"?n.toUpperCase():n.charAt(0).toUpperCase()+n.substring(1)).join(" "):"",s=/(?:^|[\s-:'"])\w/g;return{capitalize:t=>t?t.replace(s,r=>r.toUpperCase()):"",convertKeyToTitle:e}}const ee=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,B=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");const s=e.match(ee);if(!s)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return s.shift(),s},S=e=>e==="*"||e==="x"||e==="X",z=e=>{const s=parseInt(e,10);return isNaN(s)?e:s},Ne=(e,s)=>typeof e!=typeof s?[String(e),String(s)]:[e,s],$e=(e,s)=>{if(S(e)||S(s))return 0;const[o,t]=Ne(z(e),z(s));return o>t?1:o<t?-1:0},G=(e,s)=>{for(let o=0;o<Math.max(e.length,s.length);o++){const t=$e(e[o]||"0",s[o]||"0");if(t!==0)return t}return 0},Le=(e,s)=>{const o=B(e),t=B(s),r=o.pop(),n=t.pop(),a=G(o,t);return a!==0?a:r&&n?G(r.split("."),n.split(".")):r||n?r?-1:1:0},W=(e,s,o)=>{Pe(o);const t=Le(e,s);return te[o].includes(t)},te={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]},Y=Object.keys(te),Pe=e=>{if(typeof e!="string")throw new TypeError(`Invalid operator type, expected string but got ${typeof e}`);if(Y.indexOf(e)===-1)throw new Error(`Invalid operator, expected one of ${Y.join("|")}`)},Ue=e=>typeof e=="string"&&/^[v\d]/.test(e)&&ee.test(e);function je(e){const{gatewayInfo:s,supportedRange:o}=e;if(!s)return!0;const{edition:t,version:r}=s;if(!Ue(r))return console.error("Invalid version"),!1;const n=o[t];if(!n)return!1;const[a,u]=n;return!(a&&W(r,a,"<")||u&&W(r,u,">"))}function Fe(e){const s=i.ref(0),o=i.ref(0),t=i.ref(!1);return i.watch(e,n=>{n&&!t.value&&(s.value=n.offsetWidth,o.value=n.scrollWidth,t.value=!0)}),{isTruncated:i.computed(()=>s.value<o.value)}}function Ve(){const{i18n:{t:e}}=D();return{utf8Name:o=>/^[\p{N}\p{L}.\-_~]*$/u.test(o)?"":e("validationErrors.utf8Name")}}const T=Symbol("schema"),Be=e=>{i.provide(T,e)},Se=e=>{var r,n;const s=i.inject(T,void 0),o=(n=(r=s==null?void 0:s.value)==null?void 0:r.fields)==null?void 0:n.find(a=>Object.keys(a)[0]===e),t=i.toRef(o==null?void 0:o[e]);return i.provide(T,t),t};function ze(e){let s="";const o=i.ref(!1),t=i.ref(null),r=i.computed(()=>{let a;return o.value?a=!0:t.value?a=t.value.hasData||e&&i.toValue(e):a=!1,!a});return{tableState:t,hasRecords:o,hideTableToolbar:r,handleStateChange:a=>{a.hasData?o.value=!0:a.state==="success"&&!a.hasData&&(!e||!s)&&(o.value=!1),e&&(s=i.toValue(e)),t.value={...a}}}}const Ge={useAxios:K,useDebouncedFilter:Ie,useDeleteUrlBuilder:Ee,useBaseEntityDeckOptions:De,useBaseFormDeckOptions:Oe,useErrors:Te,useExternalLinkCreator:Re,useFetcher:Me,useFetcherCacheKey:X,useFetchUrlBuilder:Z,useHelpers:Q,useStringHelpers:Ke,useI18n:D,useGatewayFeatureSupported:je,useTruncationDetector:Fe,useValidators:Ve,useSchemaProvider:Be,useSubSchema:Se,useTableState:ze},We=(e,s)=>{const o=e.__vccOpts||e;for(const[t,r]of s)o[t]=r;return o};exports.CONFIG_CARD_FORMATS=oe;exports.ConfigurationSchemaSection=H;exports.ConfigurationSchemaType=q;exports.DECK_COMMAND_EDITOR_KEY=N;exports.DECK_COMMAND_EDITOR_MISSING_WARNING=$;exports.EventGatewayTypesArray=se;exports.FetcherStatus=C;exports.IdentityTypesArray=ne;exports.PLUGIN_FORM_LAYOUT_STATE=xe;exports.SupportedEntityDeckArray=J;exports.SupportedEntityType=R;exports.SupportedEntityTypesArray=ae;exports._export_sfc=We;exports.composables=Ge;exports.ft=le;exports.isSupportedDeckEntityType=M;
1
+ "use strict";const j=require("axios"),i=require("vue"),F=require("@kong-ui-public/i18n");var w=(e=>(e[e.InitialLoad=0]="InitialLoad",e[e.Loading=1]="Loading",e[e.Idle=2]="Idle",e[e.NoResults=3]="NoResults",e[e.NoRecords=4]="NoRecords",e[e.Error=5]="Error",e))(w||{}),R=(e=>(e.CaCertificate="ca_certificate",e.Certificate="certificate",e.Consumer="consumer",e.ConsumerGroup="consumer_group",e.GatewayService="service",e.Key="key",e.KeySet="set",e.Plugin="plugin",e.Route="route",e.SNI="sni",e.Upstream="upstream",e.Target="target",e.Vault="vault",e.Partial="partial",e.CloudGatewayAddon="cloud_gateway_addon",e.BackendCluster="backend_cluster",e.VirtualCluster="virtual_cluster",e.Listener="listener",e.ProducePolicy="produce_policy",e.ConsumePolicy="consume_policy",e.ClusterPolicy="cluster_policy",e.ListenerPolicy="listener_policy",e.SchemaRegistry="schema_registry",e.StaticKey="static_key",e.TlsTrustBundle="tls_trust_bundle",e.AuthServer="auth_server",e.AuthServerScopes="auth_server_scopes",e.AuthServerClaims="auth_server_claims",e.AuthServerClients="auth_server_clients",e.Other="other",e))(R||{});const ae=Object.values(R),J=["ca_certificate","certificate","consumer","consumer_group","service","key","set","plugin","route","upstream","target","vault","partial"];function M(e){return J.includes(e)}const se=["backend_cluster","virtual_cluster","listener","produce_policy","consume_policy","cluster_policy","listener_policy","schema_registry","static_key","tls_trust_bundle"],ne=["auth_server","auth_server_scopes","auth_server_claims","auth_server_clients"];var q=(e=>(e.ID="id",e.IdArray="id-array",e.Text="plain-text",e.Date="date",e.Redacted="redacted",e.RedactedArray="redacted-array",e.Json="json",e.JsonArray="json-array",e.BadgeTag="badge-tag",e.CopyBadge="copy-badge",e.BadgeStatus="badge-status",e.BadgeMethod="badge-method",e.LinkInternal="link-internal",e.LinkExternal="link-external",e))(q||{}),H=(e=>(e.Basic="basic",e.Advanced="advanced",e.Plugin="plugin",e.Policy="policy",e))(H||{});const re=["structured","yaml","json","terraform","deck"];function oe(){return{getAxiosInstance:(e={})=>{try{const s=i.inject("get-axios-instance",void 0);return typeof s=="function"?s(e):j.create({withCredentials:!0,timeout:3e4,...e})}catch(s){return console.warn("getAxiosInstance:",s.message||s),j.create({withCredentials:!0,timeout:3e4,...e})}},getTraceIdFromError:e=>{var s;return((s=e==null?void 0:e.response)==null?void 0:s.headers["x-datadog-trace-id"])||""}}}function ie(){return{debounce:(e,s)=>{let r;return(...t)=>{clearTimeout(r),r=window==null?void 0:window.setTimeout(()=>{e(...t)},s)}}}}const O="khcp-user-table-preferences",ce={pageSize:30,sortColumnKey:void 0,sortColumnOrder:void 0,columnVisibility:{}};function le(){const e=r=>{if(typeof r=="string")try{return JSON.parse(r)}catch(t){console.error("useTablePreferences(tryParseJson)",t);return}},s=()=>{const r=e(localStorage.getItem(O));return!r||!Object.keys(r).length?new Map:new Map(Object.entries(r))};return{setTablePreferences:(r,t)=>{try{const o=s();o.set(r,t),localStorage.setItem(O,JSON.stringify(Object.fromEntries(o.entries())))}catch(o){console.error("useTablePreferences(setTablePreferences)",o)}},getTablePreferences:(r,t)=>{const o=s();return(o==null?void 0:o.get(r))||void 0||t||ce},deleteAllTablePreferences:()=>{localStorage.removeItem(O)}}}function K(e={}){const{getAxiosInstance:s}=oe();return{axiosInstance:s(e)}}const ue={actions:{copyId:"Copy ID",copied_id:'Copied "{id}" to the clipboard',copyToClipboard:"Copied successfully!",copyToClipboardFailed:"Failed to copy to the clipboard"}},de={message:"Are you sure you want to delete this {entityType}?",messageWithName:"Are you sure you want to delete this {entityType} {entityName}?"},fe={actions:{viewConfiguration:"View configuration",hideConfiguration:"Hide configuration",save:"Save",cancel:"Cancel",back:"Back"},configuration:{title:"Configuration",message:"Export configurations for core Kong Gateway objects, like services, routes, and plugins, to either YAML or JSON. This allows for straightforward importing into APIOps tools like decK with YAML, or Insomnia and cURL with JSON.",yaml:"YAML",json:"JSON",terraform:"Terraform",deck:"decK"},errors:{edit:"The entity could not be edited at this time."}},pe={emptyState:{noSearchResultsTitle:"No results found",noSearchResultsMessage:"Please adjust the criteria and try again.",noSearchResultsCtaText:"Clear"}},ge={title:"Configuration",actions:{copy:"Copy JSON",deck_customize:"Customize before copying to CLI",deck_customize_cancel:"Cancel",sensitive_fields:"Show sensitive fields"},sections:{advanced:"Advanced",plugin:"Plugin specific configuration",policy:"Policy specific configuration"},commonFields:{id_label:"ID",name_label:"Name",enabled_label:"Enabled",enabled_tooltip:"Enabled is FTW",updated_at_label:"Last updated",created_at_label:"Created",tags_label:"Tags",link:"Link",partial_label:"Redis configuration"},statusBadge:{enabledLabel:"Enabled",disabledLabel:"Disabled"},copy:{tooltip:"Copy {label}",success:"Copied!"},errors:{load:"The entity configuration data could not be loaded at this time.",copy:"Failed to copy to clipboard"},general:{entryTitle:"Entry {index}",structuredFormat:"Structured"}},me={learnMore:"Learn more",pricingTitle:"Pricing: "},he={filterButtonText:"Filter",fieldLabel:"Filter by:",inputPlaceholder:"Enter a value",selectPlaceholder:"Select an item",applyButtonText:"Apply",clearButtonText:"Clear",clearAllButtonText:"Clear all filters"},ve={errors:{fetch:"Could not fetch available items",invalid:"Please select a valid value"}},be={unexpected:"An unexpected error has occurred",dataKeyUndefined:'The data key "{dataKey}" does not exist in the response.'},ye={utf8Name:"The name can be any string containing characters, letters, numbers, or the following characters: ., -, _, or ~. Do not use spaces."},_e={enable:{title:"Enable {entityType}",message:"Are you sure you want to enable the {entityType} {entityName}?",confirmText:"Yes, enable"},disable:{title:"Disable {entityType}",message:"Are you sure you want to disable the {entityType} {entityName}?",confirmText:"Yes, disable"}},Ce={hint:{konnect:"The {token} environment variable must be added first. See {link} for details.",kongManager:"If your Admin API is secured, set up authentication following {link}."},documentation:"the documentation",steps:{step_1:"Step 1: Export token",step_2:"Step 2: Apply configuration"},customization:{title:"Customize before copying to CLI",copy_pat:"Make sure to copy your personal access token now. You won't be able to see it again.",reuse_pat:"Use an existing PAT if you've already generated one.",generate_pat:"Generate PAT",footer_reminder:"Changes made here won't affect your configuration."},copy_tooltip:"Copy"},we={body:"Want a ready-to-use CLI command? {cta} to view this configuration as a decK sync snippet you can copy directly.",cta:"Switch to decK format"},ke={title:"Generate a Personal Access Token",description:"Personal access tokens are used to authenticate decK commands and Konnect API requests.",fields:{name:{label:"Name",placeholder:"Enter token name"},expiresAt:{label:"Expiration date",placeholder:"Select an expiration date",n_days:"{n} days"}},actions:{cancel:"Cancel",generate:"Generate",generating:"Generating…"}},Ae={global:ue,deleteModal:de,baseForm:fe,baseTable:pe,baseConfigCard:ge,emptyState:me,filter:he,debouncedFilter:ve,errors:be,validationErrors:ye,toggleModal:_e,deckCodeBlock:Ce,deckCallout:we,generatePatModal:ke};function D(){const e=F.createI18n("en-us",Ae);return{i18n:e,i18nT:F.i18nTComponent(e)}}function Q(){const e=(n,a)=>(a==null?void 0:a[n])??void 0,s=(n,a)=>{if(n.length!==a.length)return!1;const u=new Set([...n,...a]);for(const l of u){const c=n.filter(d=>d===l).length,p=a.filter(d=>d===l).length;if(c!==p)return!1}return!0};return{getPropValue:e,objectsAreEqual:(n,a,u)=>{if(u){if(Object.keys(n).length===Object.keys(a).length)for(const l in n)if(Array.isArray(n[l])&&Array.isArray(a[l])){if(s(n[l],a[l]))continue;return!1}else{if(n[l]===a[l])continue;return!1}else return!1;return!0}try{return JSON.stringify(n)===JSON.stringify(a)}catch{return!1}},sortAlpha:n=>(a,u)=>{let l=a[n]===void 0||a[n]===null?"":a[n],c=u[n]===void 0||u[n]===null?"":u[n];return Array.isArray(a[n])&&(l=a[n][0]),Array.isArray(u[n])&&(c=u[n][0]),l.localeCompare(c)},isValidUuid:n=>n?/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/.test(n):!1}}function Ie(e,s,r,t={fetchedItemsKey:"data",searchKeys:["id"]}){r||(r="1000");const{axiosInstance:o}=K(e.axiosRequestConfig),{i18n:{t:n}}=D(),{debounce:a}=ie(),u=a(async f=>{await I(f)},200),l=i.ref(!1),c=i.ref(""),p=i.ref(""),d=i.ref([]),_=i.ref([]),y=i.ref(void 0),g=i.computed(()=>{let f=`${e.apiBaseUrl}${i.unref(s)}`;return e.app==="konnect"&&(f=f.replace(/{controlPlaneId}/gi,(e==null?void 0:e.controlPlaneId)||"")),f.replace(/\/{workspace}/gi,e!=null&&e.workspace?`/${e.workspace}`:"")}),{isValidUuid:C}=Q(),b=async()=>{try{l.value=!0;const{data:f}=await o.get(`${g.value}?size=${r}`);f!=null&&f.next||(y.value=t.fetchedItemsKey in f?f[t.fetchedItemsKey]:[]),_.value=t.fetchedItemsKey in f?f[t.fetchedItemsKey]:[],d.value=_.value}catch{d.value=[],c.value=n("debouncedFilter.errors.fetch")}finally{l.value=!1}},A=i.ref(""),I=async f=>{var L,$,U;if(A.value!==f){if(A.value=f??"",!f){d.value=_.value;return}if(y.value===void 0)try{if(l.value=!0,c.value="",p.value="",e.app==="konnect"){const v=`${g.value}/${f}`,{data:h}=await o.get(`${v}?size=${r}`);t.fetchedItemsKey in h?d.value=h[t.fetchedItemsKey]:h!=null&&h[t.exactMatchKey??"id"]?d.value=[h]:d.value=[]}else{const v=[];C(f)&&t.searchKeys.includes("id")?v.push((async()=>{const{data:m}=await o.get(`${g.value}/${f}`);return[m[t.fetchedItemsKey]??m]})()):v.push(...t.searchKeys.filter(m=>m!=="id").map(async m=>{const{data:k}=await o.get(`${g.value}?${m}=${f}`);return k[t.fetchedItemsKey]}));const h=await Promise.all(v),x=new Set;d.value=[],(L=h==null?void 0:h.forEach)==null||L.call(h,m=>{var k;(k=m==null?void 0:m.forEach)==null||k.call(m,E=>{x.has(E.id)||(x.add(E.id),d.value.push(E))})})}}catch(v){(($=v==null?void 0:v.response)==null?void 0:$.status)===404?p.value=n("debouncedFilter.errors.invalid"):(d.value=[],c.value=n("debouncedFilter.errors.fetch"))}finally{l.value=!1}else l.value=!0,p.value="",d.value=(U=y.value)==null?void 0:U.filter(v=>{var x;let h=!1;for(const m of t.searchKeys){const k=typeof v[m]=="string"?(x=v[m])==null?void 0:x.toLowerCase():v[m];k!=null&&k.includes(f.toLowerCase())&&(h=!0)}return h}),(!d.value||!d.value.length)&&(p.value=n("debouncedFilter.errors.invalid")),l.value=!1}};return{loading:l,error:c,validationError:p,results:d,allRecords:y,loadItems:b,debouncedQueryChange:u}}const xe=Symbol("PLUGIN_FORM_LAYOUT_STATE"),N=Symbol("DECK_COMMAND_EDITOR"),P="[entities-shared] DeckCommandEditor was not provided. Provide it via the `DECK_COMMAND_EDITOR_KEY` injection key or the `provideDeckCommandEditor` helper (see @kong-ui-public/entities-shared/deck-editor).";function De(e,s){const r=i.inject(N,null),t=i.computed(()=>{const a=i.toValue(e);return(a.app==="kongManager"||!!(a.app==="konnect"&&a.enableDeckConfig))&&M(i.toValue(s))}),o=i.computed(()=>{const a=i.toValue(e),u=a.app==="konnect"&&a.enableDeckConfig&&typeof a.enableDeckConfig!="boolean"?a.enableDeckConfig.customization:void 0;if(u&&!r){console.warn(P);return}return u}),n=i.computed(()=>{const a=i.toValue(e);return a.app==="konnect"&&a.enableDeckConfig&&typeof a.enableDeckConfig!="boolean"?a.enableDeckConfig.calloutPreferenceKey:a.app==="kongManager"?a.deckCalloutPreferenceKey:void 0});return{isDeckEnabled:t,deckCustomizationOptions:o,deckCalloutPreferenceKey:n}}function Ee(e,s){const r=i.inject(N,null),t=i.computed(()=>{const a=i.toValue(e);return(a.app==="kongManager"||!!(a.app==="konnect"&&a.enableDeckTab))&&M(i.toValue(s))}),o=i.computed(()=>{const a=i.toValue(e),u=a.app==="konnect"&&a.enableDeckTab&&typeof a.enableDeckTab!="boolean"?a.enableDeckTab.customization:void 0;if(u&&!r){console.warn(P);return}return u}),n=i.computed(()=>{const a=i.toValue(e);return a.app==="konnect"&&a.enableDeckTab&&typeof a.enableDeckTab!="boolean"?a.enableDeckTab.calloutPreferenceKey:a.app==="kongManager"?a.deckCalloutPreferenceKey:void 0});return{isDeckEnabled:t,deckCustomizationOptions:o,deckCalloutPreferenceKey:n}}function Oe(e,s){const r=i.unref(s),t=i.computed(()=>e.apiBaseUrl.startsWith("/")?new URL(`${window.location.origin}${r}`):new URL(r));return t.value.search="",o=>`${t.value.href}/${o}`}function Te(){const{i18n:{t:e}}=D();return{getErrorFieldsFromError:t=>{var a,u,l;if(!t)return{messages:[e("errors.unexpected")],fields:[]};if(((a=t==null?void 0:t.response)==null?void 0:a.status)===401)return{messages:[],fields:[]};let o=[e("errors.unexpected")];const n=[];if((u=t==null?void 0:t.response)!=null&&u.data){if((l=t.response.data.details)!=null&&l.length)return o=[],t.response.data.details.forEach(c=>{let p=e("errors.unexpected");c.messages&&Array.isArray(c.messages)&&c.messages.length&&(p=c.messages.join(", ")),c.field&&n.push({field:c.field,message:p}),o.push(`${c.field??""} ${p}`)}),{messages:o,fields:n};if(t.response.data.message&&Array.isArray(t.response.data.message))return o=[],t.response.data.message.forEach(c=>{if(c!=null&&c.constraints){const p=Object.values(c.constraints).join(", ");o.push(p),c.property&&n.push({field:c.property,message:p})}else c!=null&&c.property&&(c!=null&&c.message)?(n.push({field:c.property,message:c.message}),o.push(c.message)):o.push(c)}),{messages:o,fields:n};if(typeof t.response.data.message=="string"||typeof t.response.data=="string")return{messages:[t.response.data.message],fields:[]};if(typeof t.response.data=="object")return o=[],Object.keys(t.response.data).forEach(c=>{n.push({field:c,message:t.response.data[c]}),o.push(t.response.data[c])}),{messages:o,fields:n}}return{messages:[t.message||e("errors.unexpected")],fields:[]}},getMessageFromError:t=>{var o,n,a,u;if(!t)return e("errors.unexpected");if(((o=t==null?void 0:t.response)==null?void 0:o.status)===401)return console.warn("getMessageFromError: User auth token is expired or missing, returning empty message."),"";if((n=t==null?void 0:t.response)!=null&&n.data){if(t.response.data.detail)return t.response.data.detail;if((a=t.response.data.details)!=null&&a.length)return t.response.data.details.map(l=>{let c=e("errors.unexpected");return l.messages&&typeof l.messages=="object"&&l.messages.length&&(c=l.messages.join(", ")),l.field?`${l.field} - ${c}`:c}).join("; ");if(t.response.data.message){const{message:l}=t.response.data;return Array.isArray(l)?(u=l[0])!=null&&u.constraints?Object.values(l[0].constraints)[0]:l[0]:l}if(typeof t.response.data=="string")return t.response.data;if(typeof t.response.data=="object")return Object.keys(t.response.data).map(l=>`${l} ${t.response.data[l]}`).join(", ")}return t.message||e("errors.unexpected")}}}function Re(e){const s=window.location.origin,r=s.endsWith("/")?s:`${s}/`;try{const t=e.join("/"),o=`${r}${t}`,n=e.some(u=>u.trim()==="");if(/^(https:\/\/(www\.)?([a-zA-Z0-9-]+\.){1,}[a-zA-Z]{2,}(:[0-9]+)?(\/[^\/]+)*)$|^(https|http):\/\/localhost(:[0-9]+)?(\/[^\/]+)*$/.test(o)&&!n&&new URL(o))return`${r}${t}`;throw new Error("Invalid url")}catch(t){return console.warn("Failed to build valid URL:",t),""}}function Z(e,s){const r=i.computed(()=>{const o=i.toValue(e);return o.app==="konnect"||!!o.isExactMatch}),t=i.computed(()=>{const o=i.toValue(s);return o.startsWith("/")?new URL(`${window.location.origin}${o}`):new URL(o)});return o=>{const{page:n,pageSize:a,offset:u,sortColumnKey:l,sortColumnOrder:c,query:p}=o;try{let d=new URL(t.value.href);if(r.value&&p){const _=new URLSearchParams(t.value.search);d.search="",d=i.toValue(e).isExactMatch?new URL(`${d.href}/${p}`):new URL(`${d.href}?filter[name][contains]=${p}`),_.forEach((y,g)=>d.searchParams.append(g,y))}else r.value||new URLSearchParams(p).forEach((_,y)=>{d.searchParams.append(y,_)}),l&&d.searchParams.append("sort_by",l),c==="desc"&&d.searchParams.append("sort_desc","1"),d.searchParams.append("size",String(a));return u&&n!==1&&d.searchParams.append("offset",String(u)),d.href}catch(d){return console.error("RouteList(fetcher)",d),i.toValue(s)}}}const V=new Map;function Me(e,s,r){const t=i.ref(!0),o=i.toValue(e),{axiosInstance:n}=K(o.axiosRequestConfig),a=Z(e,s),u=i.ref({status:w.Idle}),l=async d=>{var y;const _=i.toValue(r)||"data";try{u.value=t.value?{status:w.InitialLoad}:{status:w.Loading},t.value=!1;let g=a(d);g.includes("filter[name]")&&(g=`${g}&page[size]=${d.pageSize}&page[number]=${d.page}`);const C=await n.get(g);if(C.status>=400)throw C;const b=C.data,A=_&&_.replace(/[^\w-_]/gi,"");let I;b[A]?I=Array.isArray(b[A])?b[A]:[b[A]]:Array.isArray(b)?I=b:I=Object.keys(b).length?[b]:[];const f={data:I,total:I.length,...b.offset?{pagination:{offset:b.offset}}:null};return f.data.length===0&&!d.query?u.value={status:w.NoRecords,response:f}:u.value={status:w.Idle,response:f},f}catch(g){const C={data:[],total:0};return d.query&&(((y=g.response)==null?void 0:y.status)===404||g.status===404)?(u.value={status:w.NoResults,response:C,error:g.response?g:{response:g}},C):(u.value={status:w.Error,response:C,error:g.response?g:{response:g}},C)}},c=o.cacheIdentifier,p=X(c);return{fetcher:l,fetcherState:u,fetcherCacheKey:p}}function X(e){if(e){let s=V.get(e);return s||(s=i.ref(1),V.set(e,s)),s}return i.ref(1)}function Ke(){const e=(t,o="_")=>t?t.split(o).map(n=>n.toLowerCase()==="id"?n.toUpperCase():n.charAt(0).toUpperCase()+n.substring(1)).join(" "):"",s=/(?:^|[\s-:'"])\w/g;return{capitalize:t=>t?t.replace(s,o=>o.toUpperCase()):"",convertKeyToTitle:e}}const ee=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,S=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");const s=e.match(ee);if(!s)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return s.shift(),s},B=e=>e==="*"||e==="x"||e==="X",z=e=>{const s=parseInt(e,10);return isNaN(s)?e:s},Ne=(e,s)=>typeof e!=typeof s?[String(e),String(s)]:[e,s],Pe=(e,s)=>{if(B(e)||B(s))return 0;const[r,t]=Ne(z(e),z(s));return r>t?1:r<t?-1:0},G=(e,s)=>{for(let r=0;r<Math.max(e.length,s.length);r++){const t=Pe(e[r]||"0",s[r]||"0");if(t!==0)return t}return 0},Le=(e,s)=>{const r=S(e),t=S(s),o=r.pop(),n=t.pop(),a=G(r,t);return a!==0?a:o&&n?G(o.split("."),n.split(".")):o||n?o?-1:1:0},W=(e,s,r)=>{$e(r);const t=Le(e,s);return te[r].includes(t)},te={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]},Y=Object.keys(te),$e=e=>{if(typeof e!="string")throw new TypeError(`Invalid operator type, expected string but got ${typeof e}`);if(Y.indexOf(e)===-1)throw new Error(`Invalid operator, expected one of ${Y.join("|")}`)},Ue=e=>typeof e=="string"&&/^[v\d]/.test(e)&&ee.test(e);function je(e){const{gatewayInfo:s,supportedRange:r}=e;if(!s)return!0;const{edition:t,version:o}=s;if(!Ue(o))return console.error("Invalid version"),!1;const n=r[t];if(!n)return!1;const[a,u]=n;return!(a&&W(o,a,"<")||u&&W(o,u,">"))}function Fe(e){const s=i.ref(0),r=i.ref(0),t=i.ref(!1);return i.watch(e,n=>{n&&!t.value&&(s.value=n.offsetWidth,r.value=n.scrollWidth,t.value=!0)}),{isTruncated:i.computed(()=>s.value<r.value)}}function Ve(){const{i18n:{t:e}}=D();return{utf8Name:r=>/^[\p{N}\p{L}.\-_~]*$/u.test(r)?"":e("validationErrors.utf8Name")}}const T=Symbol("schema"),Se=e=>{i.provide(T,e)},Be=e=>{var o,n;const s=i.inject(T,void 0),r=(n=(o=s==null?void 0:s.value)==null?void 0:o.fields)==null?void 0:n.find(a=>Object.keys(a)[0]===e),t=i.toRef(r==null?void 0:r[e]);return i.provide(T,t),t};function ze(e){let s="";const r=i.ref(!1),t=i.ref(null),o=i.computed(()=>{let a;return r.value?a=!0:t.value?a=t.value.hasData||e&&i.toValue(e):a=!1,!a});return{tableState:t,hasRecords:r,hideTableToolbar:o,handleStateChange:a=>{a.hasData?r.value=!0:a.state==="success"&&!a.hasData&&(!e||!s)&&(r.value=!1),e&&(s=i.toValue(e)),t.value={...a}}}}const Ge={useAxios:K,useDebouncedFilter:Ie,useDeleteUrlBuilder:Oe,useBaseEntityDeckOptions:De,useBaseFormDeckOptions:Ee,useErrors:Te,useExternalLinkCreator:Re,useFetcher:Me,useFetcherCacheKey:X,useFetchUrlBuilder:Z,useHelpers:Q,useStringHelpers:Ke,useI18n:D,useGatewayFeatureSupported:je,useTruncationDetector:Fe,useValidators:Ve,useSchemaProvider:Se,useSubSchema:Be,useTableState:ze},We=(e,s)=>{const r=e.__vccOpts||e;for(const[t,o]of s)r[t]=o;return r};exports.CONFIG_CARD_FORMATS=re;exports.ConfigurationSchemaSection=H;exports.ConfigurationSchemaType=q;exports.DECK_COMMAND_EDITOR_KEY=N;exports.DECK_COMMAND_EDITOR_MISSING_WARNING=P;exports.EventGatewayTypesArray=se;exports.FetcherStatus=w;exports.IdentityTypesArray=ne;exports.PLUGIN_FORM_LAYOUT_STATE=xe;exports.SupportedEntityDeckArray=J;exports.SupportedEntityType=R;exports.SupportedEntityTypesArray=ae;exports._export_sfc=We;exports.composables=Ge;exports.ft=le;exports.isSupportedDeckEntityType=M;
@@ -1,5 +1,5 @@
1
- import U from "axios";
2
- import { inject as R, ref as h, computed as _, unref as W, toValue as m, watch as se, toRef as ne, provide as J } from "vue";
1
+ import N from "axios";
2
+ import { inject as P, ref as h, computed as _, unref as W, toValue as m, watch as se, toRef as ne, provide as J } from "vue";
3
3
  import { createI18n as re, i18nTComponent as oe } from "@kong-ui-public/i18n";
4
4
  var x = /* @__PURE__ */ ((e) => (e[e.InitialLoad = 0] = "InitialLoad", e[e.Loading = 1] = "Loading", e[e.Idle = 2] = "Idle", e[e.NoResults = 3] = "NoResults", e[e.NoRecords = 4] = "NoRecords", e[e.Error = 5] = "Error", e))(x || {}), Y = /* @__PURE__ */ ((e) => (e.CaCertificate = "ca_certificate", e.Certificate = "certificate", e.Consumer = "consumer", e.ConsumerGroup = "consumer_group", e.GatewayService = "service", e.Key = "key", e.KeySet = "set", e.Plugin = "plugin", e.Route = "route", e.SNI = "sni", e.Upstream = "upstream", e.Target = "target", e.Vault = "vault", e.Partial = "partial", e.CloudGatewayAddon = "cloud_gateway_addon", e.BackendCluster = "backend_cluster", e.VirtualCluster = "virtual_cluster", e.Listener = "listener", e.ProducePolicy = "produce_policy", e.ConsumePolicy = "consume_policy", e.ClusterPolicy = "cluster_policy", e.ListenerPolicy = "listener_policy", e.SchemaRegistry = "schema_registry", e.StaticKey = "static_key", e.TlsTrustBundle = "tls_trust_bundle", e.AuthServer = "auth_server", e.AuthServerScopes = "auth_server_scopes", e.AuthServerClaims = "auth_server_claims", e.AuthServerClients = "auth_server_clients", e.Other = "other", e))(Y || {});
5
5
  const Qe = Object.values(Y), ie = [
@@ -28,14 +28,14 @@ function ue() {
28
28
  return {
29
29
  getAxiosInstance: (e = {}) => {
30
30
  try {
31
- const s = R("get-axios-instance", void 0);
32
- return typeof s == "function" ? s(e) : U.create({
31
+ const s = P("get-axios-instance", void 0);
32
+ return typeof s == "function" ? s(e) : N.create({
33
33
  withCredentials: !0,
34
34
  timeout: 3e4,
35
35
  ...e
36
36
  });
37
37
  } catch (s) {
38
- return console.warn("getAxiosInstance:", s.message || s), U.create({
38
+ return console.warn("getAxiosInstance:", s.message || s), N.create({
39
39
  withCredentials: !0,
40
40
  timeout: 3e4,
41
41
  ...e
@@ -60,7 +60,7 @@ function de() {
60
60
  }
61
61
  };
62
62
  }
63
- const E = "khcp-user-table-preferences", fe = {
63
+ const K = "khcp-user-table-preferences", fe = {
64
64
  pageSize: 30,
65
65
  sortColumnKey: void 0,
66
66
  sortColumnOrder: void 0,
@@ -76,14 +76,14 @@ function et() {
76
76
  return;
77
77
  }
78
78
  }, s = () => {
79
- const r = e(localStorage.getItem(E));
79
+ const r = e(localStorage.getItem(K));
80
80
  return !r || !Object.keys(r).length ? /* @__PURE__ */ new Map() : new Map(Object.entries(r));
81
81
  };
82
82
  return {
83
83
  setTablePreferences: (r, t) => {
84
84
  try {
85
85
  const o = s();
86
- o.set(r, t), localStorage.setItem(E, JSON.stringify(Object.fromEntries(o.entries())));
86
+ o.set(r, t), localStorage.setItem(K, JSON.stringify(Object.fromEntries(o.entries())));
87
87
  } catch (o) {
88
88
  console.error("useTablePreferences(setTablePreferences)", o);
89
89
  }
@@ -93,7 +93,7 @@ function et() {
93
93
  return (o == null ? void 0 : o.get(r)) || void 0 || t || fe;
94
94
  },
95
95
  deleteAllTablePreferences: () => {
96
- localStorage.removeItem(E);
96
+ localStorage.removeItem(K);
97
97
  }
98
98
  };
99
99
  }
@@ -266,7 +266,7 @@ const pe = {
266
266
  deckCallout: xe,
267
267
  generatePatModal: Ie
268
268
  };
269
- function K() {
269
+ function R() {
270
270
  const e = re("en-us", De);
271
271
  return {
272
272
  i18n: e,
@@ -321,36 +321,36 @@ function Oe(e, s, r, t = {
321
321
  searchKeys: ["id"]
322
322
  }) {
323
323
  r || (r = "1000");
324
- const { axiosInstance: o } = L(e.axiosRequestConfig), { i18n: { t: n } } = K(), { debounce: a } = de(), c = a(async (d) => {
324
+ const { axiosInstance: o } = L(e.axiosRequestConfig), { i18n: { t: n } } = R(), { debounce: a } = de(), c = a(async (d) => {
325
325
  await D(d);
326
- }, 200), l = h(!1), i = h(""), f = h(""), u = h([]), C = h([]), k = h(void 0), p = _(() => {
326
+ }, 200), l = h(!1), i = h(""), f = h(""), u = h([]), k = h([]), w = h(void 0), p = _(() => {
327
327
  let d = `${e.apiBaseUrl}${W(s)}`;
328
328
  return e.app === "konnect" && (d = d.replace(/{controlPlaneId}/gi, (e == null ? void 0 : e.controlPlaneId) || "")), d.replace(/\/{workspace}/gi, e != null && e.workspace ? `/${e.workspace}` : "");
329
- }), { isValidUuid: w } = Q(), y = async () => {
329
+ }), { isValidUuid: C } = Q(), y = async () => {
330
330
  try {
331
331
  l.value = !0;
332
332
  const { data: d } = await o.get(`${p.value}?size=${r}`);
333
- d != null && d.next || (k.value = t.fetchedItemsKey in d ? d[t.fetchedItemsKey] : []), C.value = t.fetchedItemsKey in d ? d[t.fetchedItemsKey] : [], u.value = C.value;
333
+ d != null && d.next || (w.value = t.fetchedItemsKey in d ? d[t.fetchedItemsKey] : []), k.value = t.fetchedItemsKey in d ? d[t.fetchedItemsKey] : [], u.value = k.value;
334
334
  } catch {
335
335
  u.value = [], i.value = n("debouncedFilter.errors.fetch");
336
336
  } finally {
337
337
  l.value = !1;
338
338
  }
339
339
  }, I = h(""), D = async (d) => {
340
- var M, T, N;
340
+ var M, T, U;
341
341
  if (I.value !== d) {
342
342
  if (I.value = d ?? "", !d) {
343
- u.value = C.value;
343
+ u.value = k.value;
344
344
  return;
345
345
  }
346
- if (k.value === void 0)
346
+ if (w.value === void 0)
347
347
  try {
348
348
  if (l.value = !0, i.value = "", f.value = "", e.app === "konnect") {
349
349
  const b = `${p.value}/${d}`, { data: v } = await o.get(`${b}?size=${r}`);
350
350
  t.fetchedItemsKey in v ? u.value = v[t.fetchedItemsKey] : v != null && v[t.exactMatchKey ?? "id"] ? u.value = [v] : u.value = [];
351
351
  } else {
352
352
  const b = [];
353
- w(d) && t.searchKeys.includes("id") ? b.push((async () => {
353
+ C(d) && t.searchKeys.includes("id") ? b.push((async () => {
354
354
  const { data: g } = await o.get(`${p.value}/${d}`);
355
355
  return [g[t.fetchedItemsKey] ?? g];
356
356
  })()) : b.push(
@@ -362,8 +362,8 @@ function Oe(e, s, r, t = {
362
362
  const v = await Promise.all(b), O = /* @__PURE__ */ new Set();
363
363
  u.value = [], (M = v == null ? void 0 : v.forEach) == null || M.call(v, (g) => {
364
364
  var A;
365
- (A = g == null ? void 0 : g.forEach) == null || A.call(g, ($) => {
366
- O.has($.id) || (O.add($.id), u.value.push($));
365
+ (A = g == null ? void 0 : g.forEach) == null || A.call(g, (E) => {
366
+ O.has(E.id) || (O.add(E.id), u.value.push(E));
367
367
  });
368
368
  });
369
369
  }
@@ -373,7 +373,7 @@ function Oe(e, s, r, t = {
373
373
  l.value = !1;
374
374
  }
375
375
  else
376
- l.value = !0, f.value = "", u.value = (N = k.value) == null ? void 0 : N.filter((b) => {
376
+ l.value = !0, f.value = "", u.value = (U = w.value) == null ? void 0 : U.filter((b) => {
377
377
  var O;
378
378
  let v = !1;
379
379
  for (const g of t.searchKeys) {
@@ -389,14 +389,14 @@ function Oe(e, s, r, t = {
389
389
  error: i,
390
390
  validationError: f,
391
391
  results: u,
392
- allRecords: k,
392
+ allRecords: w,
393
393
  loadItems: y,
394
394
  debouncedQueryChange: c
395
395
  };
396
396
  }
397
397
  const tt = Symbol("PLUGIN_FORM_LAYOUT_STATE"), q = Symbol("DECK_COMMAND_EDITOR"), Z = "[entities-shared] DeckCommandEditor was not provided. Provide it via the `DECK_COMMAND_EDITOR_KEY` injection key or the `provideDeckCommandEditor` helper (see @kong-ui-public/entities-shared/deck-editor).";
398
- function Re(e, s) {
399
- const r = R(q, null), t = _(() => {
398
+ function Pe(e, s) {
399
+ const r = P(q, null), t = _(() => {
400
400
  const a = m(e);
401
401
  return (a.app === "kongManager" || !!(a.app === "konnect" && a.enableDeckConfig)) && H(m(s));
402
402
  }), o = _(() => {
@@ -416,8 +416,8 @@ function Re(e, s) {
416
416
  deckCalloutPreferenceKey: n
417
417
  };
418
418
  }
419
- function Ke(e, s) {
420
- const r = R(q, null), t = _(() => {
419
+ function Re(e, s) {
420
+ const r = P(q, null), t = _(() => {
421
421
  const a = m(e);
422
422
  return (a.app === "kongManager" || !!(a.app === "konnect" && a.enableDeckTab)) && H(m(s));
423
423
  }), o = _(() => {
@@ -437,14 +437,14 @@ function Ke(e, s) {
437
437
  deckCalloutPreferenceKey: n
438
438
  };
439
439
  }
440
- function $e(e, s) {
440
+ function Ee(e, s) {
441
441
  const r = W(s), t = _(
442
442
  () => e.apiBaseUrl.startsWith("/") ? new URL(`${window.location.origin}${r}`) : new URL(r)
443
443
  );
444
444
  return t.value.search = "", (o) => `${t.value.href}/${o}`;
445
445
  }
446
- function Ee() {
447
- const { i18n: { t: e } } = K();
446
+ function Ke() {
447
+ const { i18n: { t: e } } = R();
448
448
  return {
449
449
  getErrorFieldsFromError: (t) => {
450
450
  var a, c, l;
@@ -515,7 +515,7 @@ function Ee() {
515
515
  }
516
516
  };
517
517
  }
518
- function Pe(e) {
518
+ function $e(e) {
519
519
  const s = window.location.origin, r = s.endsWith("/") ? s : `${s}/`;
520
520
  try {
521
521
  const t = e.join("/"), o = `${r}${t}`, n = e.some((c) => c.trim() === "");
@@ -538,9 +538,14 @@ function X(e, s) {
538
538
  const { page: n, pageSize: a, offset: c, sortColumnKey: l, sortColumnOrder: i, query: f } = o;
539
539
  try {
540
540
  let u = new URL(t.value.href);
541
- return r.value && f ? (u.search = "", u = m(e).isExactMatch ? new URL(`${u.href}/${f}`) : new URL(`${u.href}?filter[name][contains]=${f}`)) : (r.value || new URLSearchParams(f).forEach((C, k) => {
542
- u.searchParams.append(k, C);
543
- }), l && u.searchParams.append("sort_by", l), i === "desc" && u.searchParams.append("sort_desc", "1"), u.searchParams.append("size", String(a))), c && n !== 1 && u.searchParams.append("offset", String(c)), u.href;
541
+ if (r.value && f) {
542
+ const k = new URLSearchParams(t.value.search);
543
+ u.search = "", u = m(e).isExactMatch ? new URL(`${u.href}/${f}`) : new URL(`${u.href}?filter[name][contains]=${f}`), k.forEach((w, p) => u.searchParams.append(p, w));
544
+ } else
545
+ r.value || new URLSearchParams(f).forEach((k, w) => {
546
+ u.searchParams.append(w, k);
547
+ }), l && u.searchParams.append("sort_by", l), i === "desc" && u.searchParams.append("sort_desc", "1"), u.searchParams.append("size", String(a));
548
+ return c && n !== 1 && u.searchParams.append("offset", String(c)), u.href;
544
549
  } catch (u) {
545
550
  return console.error("RouteList(fetcher)", u), m(s);
546
551
  }
@@ -551,16 +556,16 @@ function Le(e, s, r) {
551
556
  const t = h(!0), o = m(e), { axiosInstance: n } = L(o.axiosRequestConfig), a = X(e, s), c = h({
552
557
  status: x.Idle
553
558
  }), l = async (u) => {
554
- var k;
555
- const C = m(r) || "data";
559
+ var w;
560
+ const k = m(r) || "data";
556
561
  try {
557
562
  c.value = t.value ? { status: x.InitialLoad } : { status: x.Loading }, t.value = !1;
558
563
  let p = a(u);
559
564
  p.includes("filter[name]") && (p = `${p}&page[size]=${u.pageSize}&page[number]=${u.page}`);
560
- const w = await n.get(p);
561
- if (w.status >= 400)
562
- throw w;
563
- const y = w.data, I = C && C.replace(/[^\w-_]/gi, "");
565
+ const C = await n.get(p);
566
+ if (C.status >= 400)
567
+ throw C;
568
+ const y = C.data, I = k && k.replace(/[^\w-_]/gi, "");
564
569
  let D;
565
570
  y[I] ? D = Array.isArray(y[I]) ? y[I] : [y[I]] : Array.isArray(y) ? D = y : D = Object.keys(y).length ? [y] : [];
566
571
  const d = {
@@ -580,19 +585,19 @@ function Le(e, s, r) {
580
585
  response: d
581
586
  }, d;
582
587
  } catch (p) {
583
- const w = {
588
+ const C = {
584
589
  data: [],
585
590
  total: 0
586
591
  };
587
- return u.query && (((k = p.response) == null ? void 0 : k.status) === 404 || p.status === 404) ? (c.value = {
592
+ return u.query && (((w = p.response) == null ? void 0 : w.status) === 404 || p.status === 404) ? (c.value = {
588
593
  status: x.NoResults,
589
- response: w,
594
+ response: C,
590
595
  error: p.response ? p : { response: p }
591
- }, w) : (c.value = {
596
+ }, C) : (c.value = {
592
597
  status: x.Error,
593
- response: w,
598
+ response: C,
594
599
  error: p.response ? p : { response: p }
595
- }, w);
600
+ }, C);
596
601
  }
597
602
  }, i = o.cacheIdentifier, f = ee(i);
598
603
  return { fetcher: l, fetcherState: c, fetcherCacheKey: f };
@@ -621,24 +626,24 @@ const te = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-(
621
626
  }, B = (e) => e === "*" || e === "x" || e === "X", z = (e) => {
622
627
  const s = parseInt(e, 10);
623
628
  return isNaN(s) ? e : s;
624
- }, Te = (e, s) => typeof e != typeof s ? [String(e), String(s)] : [e, s], Ne = (e, s) => {
629
+ }, Te = (e, s) => typeof e != typeof s ? [String(e), String(s)] : [e, s], Ue = (e, s) => {
625
630
  if (B(e) || B(s))
626
631
  return 0;
627
632
  const [r, t] = Te(z(e), z(s));
628
633
  return r > t ? 1 : r < t ? -1 : 0;
629
634
  }, V = (e, s) => {
630
635
  for (let r = 0; r < Math.max(e.length, s.length); r++) {
631
- const t = Ne(e[r] || "0", s[r] || "0");
636
+ const t = Ue(e[r] || "0", s[r] || "0");
632
637
  if (t !== 0)
633
638
  return t;
634
639
  }
635
640
  return 0;
636
- }, Ue = (e, s) => {
641
+ }, Ne = (e, s) => {
637
642
  const r = F(e), t = F(s), o = r.pop(), n = t.pop(), a = V(r, t);
638
643
  return a !== 0 ? a : o && n ? V(o.split("."), n.split(".")) : o || n ? o ? -1 : 1 : 0;
639
644
  }, G = (e, s, r) => {
640
645
  je(r);
641
- const t = Ue(e, s);
646
+ const t = Ne(e, s);
642
647
  return ae[r].includes(t);
643
648
  }, ae = {
644
649
  ">": [1],
@@ -675,17 +680,17 @@ function ze(e) {
675
680
  };
676
681
  }
677
682
  function Ve() {
678
- const { i18n: { t: e } } = K();
683
+ const { i18n: { t: e } } = R();
679
684
  return {
680
685
  utf8Name: (r) => /^[\p{N}\p{L}.\-_~]*$/u.test(r) ? "" : e("validationErrors.utf8Name")
681
686
  };
682
687
  }
683
- const P = Symbol("schema"), Ge = (e) => {
684
- J(P, e);
688
+ const $ = Symbol("schema"), Ge = (e) => {
689
+ J($, e);
685
690
  }, Se = (e) => {
686
691
  var o, n;
687
- const s = R(P, void 0), r = (n = (o = s == null ? void 0 : s.value) == null ? void 0 : o.fields) == null ? void 0 : n.find((a) => Object.keys(a)[0] === e), t = ne(r == null ? void 0 : r[e]);
688
- return J(P, t), t;
692
+ const s = P($, void 0), r = (n = (o = s == null ? void 0 : s.value) == null ? void 0 : o.fields) == null ? void 0 : n.find((a) => Object.keys(a)[0] === e), t = ne(r == null ? void 0 : r[e]);
693
+ return J($, t), t;
689
694
  };
690
695
  function We(e) {
691
696
  let s = "";
@@ -705,17 +710,17 @@ function We(e) {
705
710
  const at = {
706
711
  useAxios: L,
707
712
  useDebouncedFilter: Oe,
708
- useDeleteUrlBuilder: $e,
709
- useBaseEntityDeckOptions: Re,
710
- useBaseFormDeckOptions: Ke,
711
- useErrors: Ee,
712
- useExternalLinkCreator: Pe,
713
+ useDeleteUrlBuilder: Ee,
714
+ useBaseEntityDeckOptions: Pe,
715
+ useBaseFormDeckOptions: Re,
716
+ useErrors: Ke,
717
+ useExternalLinkCreator: $e,
713
718
  useFetcher: Le,
714
719
  useFetcherCacheKey: ee,
715
720
  useFetchUrlBuilder: X,
716
721
  useHelpers: Q,
717
722
  useStringHelpers: Me,
718
- useI18n: K,
723
+ useI18n: R,
719
724
  useGatewayFeatureSupported: Be,
720
725
  useTruncationDetector: ze,
721
726
  useValidators: Ve,
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),a=require("./_plugin-vue_export-helper-B3S5Tx0x.cjs"),k=require("@kong-ui-public/monaco-editor"),y=require("@kong/icons"),_=require("@kong/kongponents");require("@kong-ui-public/monaco-editor/dist/runtime/style.css");const f={class:"deck-command-editor-wrapper"},C={class:"deck-command-copy-button"},g=e.defineComponent({__name:"DeckCommandEditor",props:e.mergeModels({language:{}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const n=e.useModel(r,"modelValue"),{i18n:{t:c}}=a.composables.useI18n(),d={scrollbar:{alwaysConsumeMouseWheel:!1},autoIndent:"keep",editContext:!1};async function m(){await p(n.value)}async function p(l){var i,s;if(navigator.clipboard)try{return await navigator.clipboard.writeText(l),!0}catch{}const o=document==null?void 0:document.createElement("textarea");o&&(o.style.position="fixed",o.style.top="0",o.style.left="0",o.style.width="32px",o.style.height="32px",o.style.padding="0",o.style.border="none",o.style.outline="none",o.style.boxShadow="none",o.style.background="transparent",o.value=l,(i=document==null?void 0:document.body)==null||i.appendChild(o),o.focus(),o.select());let t;try{t=document==null?void 0:document.execCommand("copy")}catch{t=!1}finally{(s=document==null?void 0:document.body)==null||s.removeChild(o)}return t}return(l,o)=>(e.openBlock(),e.createElementBlock("div",f,[e.createVNode(e.unref(k.MonacoEditor),{modelValue:n.value,"onUpdate:modelValue":o[0]||(o[0]=t=>n.value=t),appearance:"standalone",class:"deck-command-editor",language:r.language,options:d,theme:"light"},null,8,["modelValue","language"]),e.createElementVNode("div",C,[e.createVNode(e.unref(_.KCodeBlockIconButton),{"aria-label":e.unref(c)("deckCodeBlock.copy_tooltip"),"copy-tooltip":e.unref(c)("deckCodeBlock.copy_tooltip"),theme:"light",onClick:o[1]||(o[1]=t=>m())},{default:e.withCtx(()=>[e.createVNode(e.unref(y.CopyIcon),{decorative:""})]),_:1},8,["aria-label","copy-tooltip"])])]))}}),u=a._export_sfc(g,[["__scopeId","data-v-c024a8eb"]]),v={},b={class:"editor-skeleton"};function E(r,n){const c=e.resolveComponent("KSkeleton");return e.openBlock(),e.createElementBlock("div",b,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(5,d=>e.createVNode(c,{key:d})),64))])}const h=a._export_sfc(v,[["render",E],["__scopeId","data-v-ec59bbd1"]]);function x(){e.provide(a.DECK_COMMAND_EDITOR_KEY,u)}exports.DeckCommandEditor=u;exports.DeckCommandEditorLoading=h;exports.provideDeckCommandEditor=x;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),a=require("./_plugin-vue_export-helper-B2WhlBkH.cjs"),k=require("@kong-ui-public/monaco-editor"),y=require("@kong/icons"),_=require("@kong/kongponents");require("@kong-ui-public/monaco-editor/dist/runtime/style.css");const f={class:"deck-command-editor-wrapper"},C={class:"deck-command-copy-button"},g=e.defineComponent({__name:"DeckCommandEditor",props:e.mergeModels({language:{}},{modelValue:{required:!0},modelModifiers:{}}),emits:["update:modelValue"],setup(r){const n=e.useModel(r,"modelValue"),{i18n:{t:c}}=a.composables.useI18n(),d={scrollbar:{alwaysConsumeMouseWheel:!1},autoIndent:"keep",editContext:!1};async function m(){await p(n.value)}async function p(l){var i,s;if(navigator.clipboard)try{return await navigator.clipboard.writeText(l),!0}catch{}const o=document==null?void 0:document.createElement("textarea");o&&(o.style.position="fixed",o.style.top="0",o.style.left="0",o.style.width="32px",o.style.height="32px",o.style.padding="0",o.style.border="none",o.style.outline="none",o.style.boxShadow="none",o.style.background="transparent",o.value=l,(i=document==null?void 0:document.body)==null||i.appendChild(o),o.focus(),o.select());let t;try{t=document==null?void 0:document.execCommand("copy")}catch{t=!1}finally{(s=document==null?void 0:document.body)==null||s.removeChild(o)}return t}return(l,o)=>(e.openBlock(),e.createElementBlock("div",f,[e.createVNode(e.unref(k.MonacoEditor),{modelValue:n.value,"onUpdate:modelValue":o[0]||(o[0]=t=>n.value=t),appearance:"standalone",class:"deck-command-editor",language:r.language,options:d,theme:"light"},null,8,["modelValue","language"]),e.createElementVNode("div",C,[e.createVNode(e.unref(_.KCodeBlockIconButton),{"aria-label":e.unref(c)("deckCodeBlock.copy_tooltip"),"copy-tooltip":e.unref(c)("deckCodeBlock.copy_tooltip"),theme:"light",onClick:o[1]||(o[1]=t=>m())},{default:e.withCtx(()=>[e.createVNode(e.unref(y.CopyIcon),{decorative:""})]),_:1},8,["aria-label","copy-tooltip"])])]))}}),u=a._export_sfc(g,[["__scopeId","data-v-c024a8eb"]]),v={},b={class:"editor-skeleton"};function E(r,n){const c=e.resolveComponent("KSkeleton");return e.openBlock(),e.createElementBlock("div",b,[(e.openBlock(),e.createElementBlock(e.Fragment,null,e.renderList(5,d=>e.createVNode(c,{key:d})),64))])}const h=a._export_sfc(v,[["render",E],["__scopeId","data-v-ec59bbd1"]]);function x(){e.provide(a.DECK_COMMAND_EDITOR_KEY,u)}exports.DeckCommandEditor=u;exports.DeckCommandEditorLoading=h;exports.provideDeckCommandEditor=x;
@@ -1,5 +1,5 @@
1
1
  import { defineComponent as f, useModel as k, openBlock as s, createElementBlock as i, createVNode as c, unref as t, createElementVNode as C, withCtx as g, mergeModels as v, resolveComponent as b, Fragment as h, renderList as x, provide as E } from "vue";
2
- import { c as D, _ as u, D as w } from "./_plugin-vue_export-helper-CEsKLHt5.js";
2
+ import { c as D, _ as u, D as w } from "./_plugin-vue_export-helper-BuUBqezl.js";
3
3
  import { MonacoEditor as V } from "@kong-ui-public/monaco-editor";
4
4
  import { CopyIcon as I } from "@kong/icons";
5
5
  import { KCodeBlockIconButton as M } from "@kong/kongponents";
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),f=require("./_plugin-vue_export-helper-B3S5Tx0x.cjs"),fe=require("@kong/kongponents"),un=require("@shikijs/core"),dn=require("@shikijs/engine-javascript"),fn=require("@shikijs/langs/json"),pn=require("@shikijs/langs/yaml"),mn=require("@shikijs/langs/terraform"),yn=require("@shikijs/langs/shellscript"),gn=require("@shikijs/langs/powershell"),hn=require("@shikijs/themes/catppuccin-mocha"),vn=require("@shikijs/themes/catppuccin-latte"),X=require("@kong/icons"),kn=require("vue-router");var mt=(e=>(e.GatewayService="service",e.Route="route",e.Consumer="consumer",e.ConsumerGroup="consumer group",e.Plugin="plugin",e.Upstream="upstream",e.Certificate="certificate",e.CACertificate="ca certificate",e.SNI="SNI",e.Key="key",e.KeySet="key set",e.Vault="vault",e.Application="application",e.Developer="developer",e.acls="ACL Credential",e["basic-auth"]="Basic Auth Credential",e["key-auth"]="Key Auth Credential",e["key-auth-enc"]="Key Auth Encrypted Credential",e.oauth2="OAuth 2.0 Credential",e["hmac-auth"]="HMAC Credential",e.jwt="JWT Credential",e.Target="target",e.Policy="policy",e.Secret="secret",e.RedisConfiguration="redis configuration",e))(mt||{}),yt=(e=>(e.Edit="edit",e.Create="create",e))(yt||{});const Fe=["primary","secondary"],Cn={key:0,class:"config-card-fieldset-title"},bn=t.defineComponent({__name:"JsonCardItem",props:{item:{type:Object,required:!0},index:{type:Number,default:-1},isArrayItem:{type:Boolean,default:!1}},setup(e){const n=e,{i18n:{t:o}}=f.composables.useI18n(),{convertKeyToTitle:r}=f.composables.useStringHelpers(),i=t.computed(()=>n.item.key??"json-array-item"),l=t.computed(()=>n.item.value??n.item),a=t.computed(()=>{const s=JSON.parse(JSON.stringify(l.value));return n.isArrayItem&&delete s.name,s}),c=t.computed(()=>{var s;return n.isArrayItem?(s=l.value)!=null&&s.name?r(l.value.name,"_"):o("baseConfigCard.general.entryTitle",{index:n.index}):""});return(s,d)=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(e.isArrayItem?"fieldset":"div"),{class:t.normalizeClass(e.isArrayItem?"config-card-fieldset":"config-card-json-item")},{default:t.withCtx(()=>[e.isArrayItem?(t.openBlock(),t.createElementBlock("legend",Cn,[t.createElementVNode("b",null,t.toDisplayString(c.value),1)])):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Object.keys(a.value),(y,u)=>(t.openBlock(),t.createBlock(Ke,{key:`${i.value}-property-${u}`,item:{key:y,label:t.unref(r)(y),value:a.value[y]}},null,8,["item"]))),128))]),_:1},8,["class"]))}}),gt=f._export_sfc(bn,[["__scopeId","data-v-5baf64ca"]]),xn=t.defineComponent({__name:"InternalLinkItem",props:{item:{type:Object,required:!0}},emits:["navigation-click"],setup(e){const{i18n:{t:n}}=f.composables.useI18n();return(o,r)=>{const i=t.resolveComponent("KButton");return t.openBlock(),t.createElementBlock("div",null,[t.createVNode(i,{appearance:"tertiary",class:"navigation-button",onClick:r[0]||(r[0]=l=>o.$emit("navigation-click",e.item))},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.item.value||t.unref(n)("baseConfigCard.commonFields.link")),1)]),_:1})])}}}),ht=f._export_sfc(xn,[["__scopeId","data-v-2feb8c2e"]]),Sn=t.defineComponent({__name:"StatusBadge",props:{status:{type:Boolean,default:!1}},setup(e){const{i18n:{t:n}}=f.composables.useI18n();return(o,r)=>{const i=t.resolveComponent("KBadge");return t.openBlock(),t.createBlock(i,{appearance:e.status?"success":"neutral"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.status?t.unref(n)("baseConfigCard.statusBadge.enabledLabel"):t.unref(n)("baseConfigCard.statusBadge.disabledLabel")),1)]),_:1},8,["appearance"])}}}),Bn="#0044f4",An="#e0e4ea",En="#afb7c5",Tn="#0044f4",wn="1px",_n="16px",Nn="20px";let Te=null;function $n(){return Te||(Te=un.createHighlighterCoreSync({langs:[fn,pn,mn,yn,gn],themes:[hn,vn],engine:dn.createJavaScriptRegexEngine(),langAlias:{bash:"shellscript",sh:"shellscript",shell:"shellscript",zsh:"shellscript"}})),Te}function Fn(e,n){return $n().codeToHtml(e,n)}function ae({codeElement:e,code:n,language:o,theme:r}){e.innerHTML=Fn(n,{lang:o,theme:r==="dark"?"catppuccin-mocha":"catppuccin-latte",structure:"inline"})}const In={class:"config-card-details-row"},On=["data-testid"],Dn=["data-testid"],Vn=["data-testid"],Rn=["data-testid"],Kn={key:1},Ln=["data-testid"],Mn=["data-testid"],Pn=["data-testid"],jn=["data-testid"],qn={name:"ConfigCardItem",components:{JsonCardItem:gt,StatusBadge:Sn,InternalLinkItem:ht}},Un=t.defineComponent({...qn,props:{item:{type:Object,required:!0},slim:{type:Boolean,required:!1,default:!1},truncated:{type:Boolean,required:!1,default:!1}},emits:["navigation-click"],setup(e,{emit:n}){t.useCssVars(I=>({v25a763c4:v.value?"none":`solid ${t.unref(wn)} ${t.unref(An)}`,v1ac90e12:u.value&&d.value?"block":"flex",v45a716ee:u.value&&d.value?"100%":o.slim?"50%":"25%",v45a28b38:u.value&&d.value?"100%":o.slim?"50%":"75%"}));const o=e,r=n,i=t.useId(),l=t.useSlots(),{i18n:{t:a,formatIsoDate:c,formatUnixTimeStamp:s}}=f.composables.useI18n(),d=t.computed(()=>o.item.value!==void 0&&o.item.value!==null&&o.item.value!==""),y=t.computed(()=>!!(o.item.tooltip||l["label-tooltip"])),u=t.computed(()=>o.item.type===f.ConfigurationSchemaType.Json||o.item.type===f.ConfigurationSchemaType.JsonArray),v=t.computed(()=>o.item.type===f.ConfigurationSchemaType.JsonArray),g=f.composables.useSubSchema(o.item.key),x=t.computed(()=>{var I;return o.item.type?o.item.type:(I=g==null?void 0:g.value)!=null&&I.encrypted?f.ConfigurationSchemaType.Redacted:void 0}),h=t.computed(()=>{switch(x.value){case f.ConfigurationSchemaType.ID:return{tag:"KCopy",attrs:{"data-testid":`${o.item.key}-copy-uuid`,"copy-tooltip":a("baseConfigCard.copy.tooltip",{label:o.item.label}),text:o.item.value}};case f.ConfigurationSchemaType.IdArray:return{tag:"div",additionalComponent:"KCopy",childAttrs:{"copy-tooltip":a("baseConfigCard.copy.tooltip",{label:o.item.label})}};case f.ConfigurationSchemaType.Redacted:return{tag:"KCopy",attrs:{"data-testid":`${o.item.key}-copy-uuid-redacted`,format:"redacted","copy-tooltip":a("baseConfigCard.copy.tooltip",{label:o.item.label}),text:o.item.value}};case f.ConfigurationSchemaType.RedactedArray:return{tag:"div",additionalComponent:"KCopy",childAttrs:{format:"redacted","copy-tooltip":a("baseConfigCard.copy.tooltip",{label:o.item.label})}};case f.ConfigurationSchemaType.Date:return{tag:"div",attrs:{"data-testid":`${o.item.key}-date`},text:isNaN(Number(o.item.value))?c(o.item.value):s(o.item.value)};case f.ConfigurationSchemaType.BadgeStatus:return{tag:"StatusBadge",attrs:{"data-testid":`${o.item.key}-badge-status`,status:o.item.value}};case f.ConfigurationSchemaType.BadgeTag:return{tag:"div",additionalComponent:"KBadge"};case f.ConfigurationSchemaType.CopyBadge:return{tag:"div",additionalComponent:"KCopy",childAttrs:{badge:!0,truncate:!0,truncationLimit:"auto",text:o.item.value}};case f.ConfigurationSchemaType.BadgeMethod:return{tag:"div",additionalComponent:"KMethodBadge"};case f.ConfigurationSchemaType.LinkInternal:return{tag:"InternalLinkItem",attrs:{"data-testid":`${o.item.key}-internal-link`,item:o.item,onNavigationClick:I=>{r("navigation-click",I)}}};case f.ConfigurationSchemaType.LinkExternal:return{tag:"KExternalLink",attrs:{"data-testid":`${o.item.key}-external-link`,href:o.item.value},text:o.item.value};case f.ConfigurationSchemaType.Json:return{tag:"JsonCardItem",attrs:{"data-testid":`${o.item.key}-json-content`,item:o.item}};case f.ConfigurationSchemaType.JsonArray:return{tag:"div",additionalComponent:"JsonCardItem",attrs:{"data-testid":`${o.item.key}-json-array-content`,item:o.item}};default:return o.item.value!=null&&typeof o.item.value=="object"?{tag:"KCodeBlock",attrs:{"data-testid":`${o.item.key}-json-code`,id:`json-code-${i}`,language:"json",code:JSON.stringify(o.item.value,null," "),maxHeight:"480px",showLineNumbers:!1,onCodeBlockRender:ae}}:{tag:"div",attrs:{"data-testid":`${o.item.key}-plain-text`},text:o.item.value}}}),m=t.ref(),B=t.ref(),{isTruncated:p}=f.composables.useTruncationDetector(m),{isTruncated:k}=f.composables.useTruncationDetector(B);return(I,F)=>{const E=t.resolveComponent("KTooltip"),b=t.resolveComponent("KLabel"),N=t.resolveComponent("KBadge"),C=t.resolveComponent("KCopy");return t.openBlock(),t.createElementBlock("div",In,[t.createElementVNode("div",{class:"config-card-details-label","data-testid":`${e.item.key}-label`},[t.renderSlot(I.$slots,"label",{item:e.item},()=>[t.createVNode(b,{"tooltip-attributes":{maxWidth:"500px"}},t.createSlots({default:t.withCtx(()=>[t.createVNode(E,{text:t.unref(p)?e.item.label:""},{default:t.withCtx(()=>[t.createElementVNode("span",{ref_key:"labelContent",ref:m,class:"label-content"},t.toDisplayString(e.item.label),513)]),_:1},8,["text"])]),_:2},[y.value?{name:"tooltip",fn:t.withCtx(()=>[t.createElementVNode("div",{"data-testid":`${e.item.key}-label-tooltip`},[t.renderSlot(I.$slots,"label-tooltip",{},()=>[t.createTextVNode(t.toDisplayString(e.item.tooltip),1)],!0)],8,Dn)]),key:"0"}:void 0]),1024)],!0)],8,On),t.createElementVNode("div",{class:"config-card-details-value","data-testid":`${e.item.key}-property-value`},[t.renderSlot(I.$slots,e.item.key,{rowValue:e.item.value},()=>[d.value?(t.openBlock(),t.createElementBlock("div",Kn,[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(h.value.tag),t.normalizeProps(t.guardReactiveProps(h.value.attrs)),{default:t.withCtx(()=>[h.value.additionalComponent==="KBadge"?(t.openBlock(),t.createElementBlock("div",{key:0,"data-testid":`${e.item.key}-badge-tags`},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.item.value,(T,_)=>(t.openBlock(),t.createBlock(N,{key:`${e.item.key}-badge-tag-${_}`,class:"config-badge","data-testid":`${e.item.key}-badge-tag-${_}`,tooltip:T,"truncation-tooltip":""},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(T),1)]),_:2},1032,["data-testid","tooltip"]))),128))],8,Ln)):h.value.additionalComponent==="KCopy"?(t.openBlock(),t.createElementBlock("div",{key:1,class:"copy-uuid-array","data-testid":`${e.item.key}-copy-uuid-array`},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.item.value,(T,_)=>(t.openBlock(),t.createBlock(C,t.mergeProps({ref_for:!0},h.value.childAttrs,{key:`${e.item.key}-copy-uuid-${_}`,"data-testid":`${e.item.key}-copy-uuid-${_}`,text:T}),null,16,["data-testid","text"]))),128))],8,Mn)):h.value.additionalComponent==="KMethodBadge"?(t.openBlock(),t.createElementBlock("div",{key:2,class:"method-badge-array","data-testid":`${e.item.key}-badge-methods`},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.item.value,(T,_)=>(t.openBlock(),t.createBlock(N,{key:`${e.item.key}-badge-method-${_}`,appearance:Object.values(t.unref(fe.BadgeMethodAppearances)).includes(T.toLowerCase())?T.toLowerCase():"custom",class:"config-badge","data-testid":`${e.item.key}-badge-method-${_}`},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(T),1)]),_:2},1032,["appearance","data-testid"]))),128))],8,Pn)):h.value.additionalComponent==="JsonCardItem"?(t.openBlock(),t.createElementBlock("div",{key:3,"data-testid":`${o.item.key}-json-array-content`},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.item.value,(T,_)=>(t.openBlock(),t.createBlock(gt,{key:`json-array-item-${_}`,index:Number(_),"is-array-item":"",item:T},null,8,["index","item"]))),128))],8,jn)):(t.openBlock(),t.createBlock(E,{key:4,text:t.unref(k)?e.item.value:""},{default:t.withCtx(()=>[t.createElementVNode("span",{ref_key:"textContent",ref:B,class:t.normalizeClass(["attrs-data-text",{truncated:e.truncated}])},t.toDisplayString(h.value.text),3)]),_:1},8,["text"]))]),_:1},16))])):(t.openBlock(),t.createElementBlock("div",{key:0,"data-testid":`${e.item.key}-no-value`}," – ",8,Rn))],!0)],8,Vn)])}}}),Ke=f._export_sfc(Un,[["__scopeId","data-v-b6987b3c"]]),zn={class:"json-config config-card-code-block"},Hn={key:0,class:"json-endpoint"},Le=t.defineComponent({__name:"JsonCodeBlock",props:{config:{type:Object,required:!1,default:()=>({})},fetcherUrl:{type:String,required:!1,default:""},requestMethod:{type:String,required:!1,default:""},entityRecord:{type:Object,required:!0},unredactedRecord:{type:Object,default:null}},setup(e){t.useCssVars(i=>({c7479fcc:`${r.value}ch`}));const n=e,o=t.computed(()=>n.entityRecord),r=t.computed(()=>{var a;if(!n.fetcherUrl)return 0;const i=(a=n.fetcherUrl)==null?void 0:a.split("/");return i.length<2?0:41+(n.requestMethod==="post"?i[i.length-1]:i[i.length-2]).length});return(i,l)=>{const a=t.resolveComponent("KBadge"),c=t.resolveComponent("KCodeBlock");return t.openBlock(),t.createElementBlock("div",zn,[e.fetcherUrl?(t.openBlock(),t.createElementBlock("div",Hn,[t.createVNode(a,{appearance:e.requestMethod},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.requestMethod),1)]),_:1},8,["appearance"]),t.createVNode(c,{id:"json-endpoint-codeblock",code:e.fetcherUrl,language:"plaintext","single-line":"",theme:"dark"},null,8,["code"])])):t.createCommentVNode("",!0),e.entityRecord?(t.openBlock(),t.createBlock(c,{key:1,id:"json-codeblock",class:t.normalizeClass({"json-content":e.fetcherUrl}),code:JSON.stringify(o.value,null,2),"copy-code":JSON.stringify(e.unredactedRecord||o.value,null,2),"data-dd-privacy":"mask",language:"json",theme:"dark",onCodeBlockRender:t.unref(ae)},null,8,["class","code","copy-code","onCodeBlockRender"])):t.createCommentVNode("",!0)])}}});/*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT */function vt(e){return typeof e>"u"||e===null}function Yn(e){return typeof e=="object"&&e!==null}function Gn(e){return Array.isArray(e)?e:vt(e)?[]:[e]}function Wn(e,n){var o,r,i,l;if(n)for(l=Object.keys(n),o=0,r=l.length;o<r;o+=1)i=l[o],e[i]=n[i];return e}function Jn(e,n){var o="",r;for(r=0;r<n;r+=1)o+=e;return o}function Qn(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var Xn=vt,Zn=Yn,eo=Gn,to=Jn,no=Qn,oo=Wn,U={isNothing:Xn,isObject:Zn,toArray:eo,repeat:to,isNegativeZero:no,extend:oo};function kt(e,n){var o="",r=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(o+='in "'+e.mark.name+'" '),o+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!n&&e.mark.snippet&&(o+=`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("vue"),f=require("./_plugin-vue_export-helper-B2WhlBkH.cjs"),fe=require("@kong/kongponents"),un=require("@shikijs/core"),dn=require("@shikijs/engine-javascript"),fn=require("@shikijs/langs/json"),pn=require("@shikijs/langs/yaml"),mn=require("@shikijs/langs/terraform"),yn=require("@shikijs/langs/shellscript"),gn=require("@shikijs/langs/powershell"),hn=require("@shikijs/themes/catppuccin-mocha"),vn=require("@shikijs/themes/catppuccin-latte"),X=require("@kong/icons"),kn=require("vue-router");var mt=(e=>(e.GatewayService="service",e.Route="route",e.Consumer="consumer",e.ConsumerGroup="consumer group",e.Plugin="plugin",e.Upstream="upstream",e.Certificate="certificate",e.CACertificate="ca certificate",e.SNI="SNI",e.Key="key",e.KeySet="key set",e.Vault="vault",e.Application="application",e.Developer="developer",e.acls="ACL Credential",e["basic-auth"]="Basic Auth Credential",e["key-auth"]="Key Auth Credential",e["key-auth-enc"]="Key Auth Encrypted Credential",e.oauth2="OAuth 2.0 Credential",e["hmac-auth"]="HMAC Credential",e.jwt="JWT Credential",e.Target="target",e.Policy="policy",e.Secret="secret",e.RedisConfiguration="redis configuration",e))(mt||{}),yt=(e=>(e.Edit="edit",e.Create="create",e))(yt||{});const Fe=["primary","secondary"],Cn={key:0,class:"config-card-fieldset-title"},bn=t.defineComponent({__name:"JsonCardItem",props:{item:{type:Object,required:!0},index:{type:Number,default:-1},isArrayItem:{type:Boolean,default:!1}},setup(e){const n=e,{i18n:{t:o}}=f.composables.useI18n(),{convertKeyToTitle:r}=f.composables.useStringHelpers(),i=t.computed(()=>n.item.key??"json-array-item"),l=t.computed(()=>n.item.value??n.item),a=t.computed(()=>{const s=JSON.parse(JSON.stringify(l.value));return n.isArrayItem&&delete s.name,s}),c=t.computed(()=>{var s;return n.isArrayItem?(s=l.value)!=null&&s.name?r(l.value.name,"_"):o("baseConfigCard.general.entryTitle",{index:n.index}):""});return(s,d)=>(t.openBlock(),t.createBlock(t.resolveDynamicComponent(e.isArrayItem?"fieldset":"div"),{class:t.normalizeClass(e.isArrayItem?"config-card-fieldset":"config-card-json-item")},{default:t.withCtx(()=>[e.isArrayItem?(t.openBlock(),t.createElementBlock("legend",Cn,[t.createElementVNode("b",null,t.toDisplayString(c.value),1)])):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Object.keys(a.value),(y,u)=>(t.openBlock(),t.createBlock(Ke,{key:`${i.value}-property-${u}`,item:{key:y,label:t.unref(r)(y),value:a.value[y]}},null,8,["item"]))),128))]),_:1},8,["class"]))}}),gt=f._export_sfc(bn,[["__scopeId","data-v-5baf64ca"]]),xn=t.defineComponent({__name:"InternalLinkItem",props:{item:{type:Object,required:!0}},emits:["navigation-click"],setup(e){const{i18n:{t:n}}=f.composables.useI18n();return(o,r)=>{const i=t.resolveComponent("KButton");return t.openBlock(),t.createElementBlock("div",null,[t.createVNode(i,{appearance:"tertiary",class:"navigation-button",onClick:r[0]||(r[0]=l=>o.$emit("navigation-click",e.item))},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.item.value||t.unref(n)("baseConfigCard.commonFields.link")),1)]),_:1})])}}}),ht=f._export_sfc(xn,[["__scopeId","data-v-2feb8c2e"]]),Sn=t.defineComponent({__name:"StatusBadge",props:{status:{type:Boolean,default:!1}},setup(e){const{i18n:{t:n}}=f.composables.useI18n();return(o,r)=>{const i=t.resolveComponent("KBadge");return t.openBlock(),t.createBlock(i,{appearance:e.status?"success":"neutral"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.status?t.unref(n)("baseConfigCard.statusBadge.enabledLabel"):t.unref(n)("baseConfigCard.statusBadge.disabledLabel")),1)]),_:1},8,["appearance"])}}}),Bn="#0044f4",An="#e0e4ea",En="#afb7c5",Tn="#0044f4",wn="1px",_n="16px",Nn="20px";let Te=null;function $n(){return Te||(Te=un.createHighlighterCoreSync({langs:[fn,pn,mn,yn,gn],themes:[hn,vn],engine:dn.createJavaScriptRegexEngine(),langAlias:{bash:"shellscript",sh:"shellscript",shell:"shellscript",zsh:"shellscript"}})),Te}function Fn(e,n){return $n().codeToHtml(e,n)}function ae({codeElement:e,code:n,language:o,theme:r}){e.innerHTML=Fn(n,{lang:o,theme:r==="dark"?"catppuccin-mocha":"catppuccin-latte",structure:"inline"})}const In={class:"config-card-details-row"},On=["data-testid"],Dn=["data-testid"],Vn=["data-testid"],Rn=["data-testid"],Kn={key:1},Ln=["data-testid"],Mn=["data-testid"],Pn=["data-testid"],jn=["data-testid"],qn={name:"ConfigCardItem",components:{JsonCardItem:gt,StatusBadge:Sn,InternalLinkItem:ht}},Un=t.defineComponent({...qn,props:{item:{type:Object,required:!0},slim:{type:Boolean,required:!1,default:!1},truncated:{type:Boolean,required:!1,default:!1}},emits:["navigation-click"],setup(e,{emit:n}){t.useCssVars(I=>({v25a763c4:v.value?"none":`solid ${t.unref(wn)} ${t.unref(An)}`,v1ac90e12:u.value&&d.value?"block":"flex",v45a716ee:u.value&&d.value?"100%":o.slim?"50%":"25%",v45a28b38:u.value&&d.value?"100%":o.slim?"50%":"75%"}));const o=e,r=n,i=t.useId(),l=t.useSlots(),{i18n:{t:a,formatIsoDate:c,formatUnixTimeStamp:s}}=f.composables.useI18n(),d=t.computed(()=>o.item.value!==void 0&&o.item.value!==null&&o.item.value!==""),y=t.computed(()=>!!(o.item.tooltip||l["label-tooltip"])),u=t.computed(()=>o.item.type===f.ConfigurationSchemaType.Json||o.item.type===f.ConfigurationSchemaType.JsonArray),v=t.computed(()=>o.item.type===f.ConfigurationSchemaType.JsonArray),g=f.composables.useSubSchema(o.item.key),x=t.computed(()=>{var I;return o.item.type?o.item.type:(I=g==null?void 0:g.value)!=null&&I.encrypted?f.ConfigurationSchemaType.Redacted:void 0}),h=t.computed(()=>{switch(x.value){case f.ConfigurationSchemaType.ID:return{tag:"KCopy",attrs:{"data-testid":`${o.item.key}-copy-uuid`,"copy-tooltip":a("baseConfigCard.copy.tooltip",{label:o.item.label}),text:o.item.value}};case f.ConfigurationSchemaType.IdArray:return{tag:"div",additionalComponent:"KCopy",childAttrs:{"copy-tooltip":a("baseConfigCard.copy.tooltip",{label:o.item.label})}};case f.ConfigurationSchemaType.Redacted:return{tag:"KCopy",attrs:{"data-testid":`${o.item.key}-copy-uuid-redacted`,format:"redacted","copy-tooltip":a("baseConfigCard.copy.tooltip",{label:o.item.label}),text:o.item.value}};case f.ConfigurationSchemaType.RedactedArray:return{tag:"div",additionalComponent:"KCopy",childAttrs:{format:"redacted","copy-tooltip":a("baseConfigCard.copy.tooltip",{label:o.item.label})}};case f.ConfigurationSchemaType.Date:return{tag:"div",attrs:{"data-testid":`${o.item.key}-date`},text:isNaN(Number(o.item.value))?c(o.item.value):s(o.item.value)};case f.ConfigurationSchemaType.BadgeStatus:return{tag:"StatusBadge",attrs:{"data-testid":`${o.item.key}-badge-status`,status:o.item.value}};case f.ConfigurationSchemaType.BadgeTag:return{tag:"div",additionalComponent:"KBadge"};case f.ConfigurationSchemaType.CopyBadge:return{tag:"div",additionalComponent:"KCopy",childAttrs:{badge:!0,truncate:!0,truncationLimit:"auto",text:o.item.value}};case f.ConfigurationSchemaType.BadgeMethod:return{tag:"div",additionalComponent:"KMethodBadge"};case f.ConfigurationSchemaType.LinkInternal:return{tag:"InternalLinkItem",attrs:{"data-testid":`${o.item.key}-internal-link`,item:o.item,onNavigationClick:I=>{r("navigation-click",I)}}};case f.ConfigurationSchemaType.LinkExternal:return{tag:"KExternalLink",attrs:{"data-testid":`${o.item.key}-external-link`,href:o.item.value},text:o.item.value};case f.ConfigurationSchemaType.Json:return{tag:"JsonCardItem",attrs:{"data-testid":`${o.item.key}-json-content`,item:o.item}};case f.ConfigurationSchemaType.JsonArray:return{tag:"div",additionalComponent:"JsonCardItem",attrs:{"data-testid":`${o.item.key}-json-array-content`,item:o.item}};default:return o.item.value!=null&&typeof o.item.value=="object"?{tag:"KCodeBlock",attrs:{"data-testid":`${o.item.key}-json-code`,id:`json-code-${i}`,language:"json",code:JSON.stringify(o.item.value,null," "),maxHeight:"480px",showLineNumbers:!1,onCodeBlockRender:ae}}:{tag:"div",attrs:{"data-testid":`${o.item.key}-plain-text`},text:o.item.value}}}),m=t.ref(),B=t.ref(),{isTruncated:p}=f.composables.useTruncationDetector(m),{isTruncated:k}=f.composables.useTruncationDetector(B);return(I,F)=>{const E=t.resolveComponent("KTooltip"),b=t.resolveComponent("KLabel"),N=t.resolveComponent("KBadge"),C=t.resolveComponent("KCopy");return t.openBlock(),t.createElementBlock("div",In,[t.createElementVNode("div",{class:"config-card-details-label","data-testid":`${e.item.key}-label`},[t.renderSlot(I.$slots,"label",{item:e.item},()=>[t.createVNode(b,{"tooltip-attributes":{maxWidth:"500px"}},t.createSlots({default:t.withCtx(()=>[t.createVNode(E,{text:t.unref(p)?e.item.label:""},{default:t.withCtx(()=>[t.createElementVNode("span",{ref_key:"labelContent",ref:m,class:"label-content"},t.toDisplayString(e.item.label),513)]),_:1},8,["text"])]),_:2},[y.value?{name:"tooltip",fn:t.withCtx(()=>[t.createElementVNode("div",{"data-testid":`${e.item.key}-label-tooltip`},[t.renderSlot(I.$slots,"label-tooltip",{},()=>[t.createTextVNode(t.toDisplayString(e.item.tooltip),1)],!0)],8,Dn)]),key:"0"}:void 0]),1024)],!0)],8,On),t.createElementVNode("div",{class:"config-card-details-value","data-testid":`${e.item.key}-property-value`},[t.renderSlot(I.$slots,e.item.key,{rowValue:e.item.value},()=>[d.value?(t.openBlock(),t.createElementBlock("div",Kn,[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(h.value.tag),t.normalizeProps(t.guardReactiveProps(h.value.attrs)),{default:t.withCtx(()=>[h.value.additionalComponent==="KBadge"?(t.openBlock(),t.createElementBlock("div",{key:0,"data-testid":`${e.item.key}-badge-tags`},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.item.value,(T,_)=>(t.openBlock(),t.createBlock(N,{key:`${e.item.key}-badge-tag-${_}`,class:"config-badge","data-testid":`${e.item.key}-badge-tag-${_}`,tooltip:T,"truncation-tooltip":""},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(T),1)]),_:2},1032,["data-testid","tooltip"]))),128))],8,Ln)):h.value.additionalComponent==="KCopy"?(t.openBlock(),t.createElementBlock("div",{key:1,class:"copy-uuid-array","data-testid":`${e.item.key}-copy-uuid-array`},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.item.value,(T,_)=>(t.openBlock(),t.createBlock(C,t.mergeProps({ref_for:!0},h.value.childAttrs,{key:`${e.item.key}-copy-uuid-${_}`,"data-testid":`${e.item.key}-copy-uuid-${_}`,text:T}),null,16,["data-testid","text"]))),128))],8,Mn)):h.value.additionalComponent==="KMethodBadge"?(t.openBlock(),t.createElementBlock("div",{key:2,class:"method-badge-array","data-testid":`${e.item.key}-badge-methods`},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.item.value,(T,_)=>(t.openBlock(),t.createBlock(N,{key:`${e.item.key}-badge-method-${_}`,appearance:Object.values(t.unref(fe.BadgeMethodAppearances)).includes(T.toLowerCase())?T.toLowerCase():"custom",class:"config-badge","data-testid":`${e.item.key}-badge-method-${_}`},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(T),1)]),_:2},1032,["appearance","data-testid"]))),128))],8,Pn)):h.value.additionalComponent==="JsonCardItem"?(t.openBlock(),t.createElementBlock("div",{key:3,"data-testid":`${o.item.key}-json-array-content`},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.item.value,(T,_)=>(t.openBlock(),t.createBlock(gt,{key:`json-array-item-${_}`,index:Number(_),"is-array-item":"",item:T},null,8,["index","item"]))),128))],8,jn)):(t.openBlock(),t.createBlock(E,{key:4,text:t.unref(k)?e.item.value:""},{default:t.withCtx(()=>[t.createElementVNode("span",{ref_key:"textContent",ref:B,class:t.normalizeClass(["attrs-data-text",{truncated:e.truncated}])},t.toDisplayString(h.value.text),3)]),_:1},8,["text"]))]),_:1},16))])):(t.openBlock(),t.createElementBlock("div",{key:0,"data-testid":`${e.item.key}-no-value`}," – ",8,Rn))],!0)],8,Vn)])}}}),Ke=f._export_sfc(Un,[["__scopeId","data-v-b6987b3c"]]),zn={class:"json-config config-card-code-block"},Hn={key:0,class:"json-endpoint"},Le=t.defineComponent({__name:"JsonCodeBlock",props:{config:{type:Object,required:!1,default:()=>({})},fetcherUrl:{type:String,required:!1,default:""},requestMethod:{type:String,required:!1,default:""},entityRecord:{type:Object,required:!0},unredactedRecord:{type:Object,default:null}},setup(e){t.useCssVars(i=>({c7479fcc:`${r.value}ch`}));const n=e,o=t.computed(()=>n.entityRecord),r=t.computed(()=>{var a;if(!n.fetcherUrl)return 0;const i=(a=n.fetcherUrl)==null?void 0:a.split("/");return i.length<2?0:41+(n.requestMethod==="post"?i[i.length-1]:i[i.length-2]).length});return(i,l)=>{const a=t.resolveComponent("KBadge"),c=t.resolveComponent("KCodeBlock");return t.openBlock(),t.createElementBlock("div",zn,[e.fetcherUrl?(t.openBlock(),t.createElementBlock("div",Hn,[t.createVNode(a,{appearance:e.requestMethod},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.requestMethod),1)]),_:1},8,["appearance"]),t.createVNode(c,{id:"json-endpoint-codeblock",code:e.fetcherUrl,language:"plaintext","single-line":"",theme:"dark"},null,8,["code"])])):t.createCommentVNode("",!0),e.entityRecord?(t.openBlock(),t.createBlock(c,{key:1,id:"json-codeblock",class:t.normalizeClass({"json-content":e.fetcherUrl}),code:JSON.stringify(o.value,null,2),"copy-code":JSON.stringify(e.unredactedRecord||o.value,null,2),"data-dd-privacy":"mask",language:"json",theme:"dark",onCodeBlockRender:t.unref(ae)},null,8,["class","code","copy-code","onCodeBlockRender"])):t.createCommentVNode("",!0)])}}});/*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT */function vt(e){return typeof e>"u"||e===null}function Yn(e){return typeof e=="object"&&e!==null}function Gn(e){return Array.isArray(e)?e:vt(e)?[]:[e]}function Wn(e,n){var o,r,i,l;if(n)for(l=Object.keys(n),o=0,r=l.length;o<r;o+=1)i=l[o],e[i]=n[i];return e}function Jn(e,n){var o="",r;for(r=0;r<n;r+=1)o+=e;return o}function Qn(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var Xn=vt,Zn=Yn,eo=Gn,to=Jn,no=Qn,oo=Wn,U={isNothing:Xn,isObject:Zn,toArray:eo,repeat:to,isNegativeZero:no,extend:oo};function kt(e,n){var o="",r=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(o+='in "'+e.mark.name+'" '),o+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!n&&e.mark.snippet&&(o+=`
2
2
 
3
3
  `+e.mark.snippet),r+" "+o):r}function ye(e,n){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=n,this.message=kt(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}ye.prototype=Object.create(Error.prototype);ye.prototype.constructor=ye;ye.prototype.toString=function(n){return this.name+": "+kt(this,n)};var W=ye;function we(e,n,o,r,i){var l="",a="",c=Math.floor(i/2)-1;return r-n>c&&(l=" ... ",n=r-c+l.length),o-r>c&&(a=" ...",o=r+c-a.length),{str:l+e.slice(n,o).replace(/\t/g,"→")+a,pos:r-n+l.length}}function _e(e,n){return U.repeat(" ",n-e.length)+e}function ro(e,n){if(n=Object.create(n||null),!e.buffer)return null;n.maxLength||(n.maxLength=79),typeof n.indent!="number"&&(n.indent=1),typeof n.linesBefore!="number"&&(n.linesBefore=3),typeof n.linesAfter!="number"&&(n.linesAfter=2);for(var o=/\r?\n|\r|\0/g,r=[0],i=[],l,a=-1;l=o.exec(e.buffer);)i.push(l.index),r.push(l.index+l[0].length),e.position<=l.index&&a<0&&(a=r.length-2);a<0&&(a=r.length-1);var c="",s,d,y=Math.min(e.line+n.linesAfter,i.length).toString().length,u=n.maxLength-(n.indent+y+3);for(s=1;s<=n.linesBefore&&!(a-s<0);s++)d=we(e.buffer,r[a-s],i[a-s],e.position-(r[a]-r[a-s]),u),c=U.repeat(" ",n.indent)+_e((e.line-s+1).toString(),y)+" | "+d.str+`
4
4
  `+c;for(d=we(e.buffer,r[a],i[a],e.position,u),c+=U.repeat(" ",n.indent)+_e((e.line+1).toString(),y)+" | "+d.str+`
@@ -1,6 +1,6 @@
1
1
  import { defineComponent as ee, computed as T, openBlock as d, createBlock as E, resolveDynamicComponent as Ue, normalizeClass as ue, withCtx as C, createElementBlock as w, createElementVNode as O, toDisplayString as _, createCommentVNode as K, Fragment as pe, renderList as he, unref as y, resolveComponent as P, createVNode as D, createTextVNode as U, useCssVars as Ut, useId as qn, useSlots as qe, ref as j, renderSlot as H, createSlots as _e, normalizeProps as Hn, guardReactiveProps as Vn, mergeProps as He, watch as xe, inject as qt, watchEffect as zn, onMounted as dt, onBeforeMount as ft, withModifiers as Ye, Teleport as Ht, onUnmounted as Yn, withDirectives as Ee, vShow as Ie, withKeys as Wn, warn as Gn } from "vue";
2
- import { c as G, _ as ce, C as Z, S as Te, E as Jn, I as Qn, a as Ze, D as Xn, b as Zn, d as ei, e as me, P as ti, f as ni } from "./_plugin-vue_export-helper-CEsKLHt5.js";
3
- import { F as Uc, g as qc, i as Hc } from "./_plugin-vue_export-helper-CEsKLHt5.js";
2
+ import { c as G, _ as ce, C as Z, S as Te, E as Jn, I as Qn, a as Ze, D as Xn, b as Zn, d as ei, e as me, P as ti, f as ni } from "./_plugin-vue_export-helper-BuUBqezl.js";
3
+ import { F as Uc, g as qc, i as Hc } from "./_plugin-vue_export-helper-BuUBqezl.js";
4
4
  import { BadgeMethodAppearances as ii, KExternalLink as ri, KButton as bt, KTruncate as oi, KBadge as ai } from "@kong/kongponents";
5
5
  import { createHighlighterCoreSync as li } from "@shikijs/core";
6
6
  import { createJavaScriptRegexEngine as ci } from "@shikijs/engine-javascript";
@@ -1 +1 @@
1
- {"version":3,"file":"useFetchUrlBuilder.d.ts","sourceRoot":"","sources":["../../../src/composables/useFetchUrlBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,gBAAgB,EAAE,MAAM,KAAK,CAAA;AAC9D,OAAO,KAAK,EACV,0BAA0B,EAC1B,sBAAsB,EACvB,MAAM,UAAU,CAAA;AACjB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAC9C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAA;AAE/D,MAAM,CAAC,OAAO,UAAU,kBAAkB,CACxC,MAAM,EAAE,gBAAgB,CAAC,sBAAsB,GAAG,0BAA0B,CAAC,EAC7E,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,IAejB,eAAe,sBAAsB,YA8C9C"}
1
+ {"version":3,"file":"useFetchUrlBuilder.d.ts","sourceRoot":"","sources":["../../../src/composables/useFetchUrlBuilder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,gBAAgB,EAAE,MAAM,KAAK,CAAA;AAC9D,OAAO,KAAK,EACV,0BAA0B,EAC1B,sBAAsB,EACvB,MAAM,UAAU,CAAA;AACjB,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAC9C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAA;AAE/D,MAAM,CAAC,OAAO,UAAU,kBAAkB,CACxC,MAAM,EAAE,gBAAgB,CAAC,sBAAsB,GAAG,0BAA0B,CAAC,EAC7E,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,IAejB,eAAe,sBAAsB,YAiD9C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kong-ui-public/entities-shared",
3
- "version": "3.45.1",
3
+ "version": "3.45.2-pr.3235.1ca65bc7d.0",
4
4
  "type": "module",
5
5
  "main": "./dist/entities-shared.umd.js",
6
6
  "module": "./dist/entities-shared.es.js",
@@ -49,8 +49,8 @@
49
49
  "shiki": "^3.23.0",
50
50
  "vue": "^3.5.33",
51
51
  "vue-router": "^5.0.6",
52
- "@kong-ui-public/monaco-editor": "^0.22.9",
53
- "@kong-ui-public/i18n": "^2.4.6"
52
+ "@kong-ui-public/i18n": "^2.4.6",
53
+ "@kong-ui-public/monaco-editor": "^0.22.9"
54
54
  },
55
55
  "repository": {
56
56
  "type": "git",