@kong-ui-public/entities-shared 3.53.0 → 3.53.1-pr.3551.4ec32fb2f.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 k=(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))(k||{}),E=(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.PluginSchema="plugin_schema",e.CustomPlugin="custom_plugin",e.ClonedPlugin="cloned_plugin",e))(E||{});const ae=Object.values(E),J=["ca_certificate","certificate","consumer","consumer_group","service","key","set","plugin","plugin_schema","custom_plugin","cloned_plugin","route","upstream","target","vault","partial"];function K(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 H=(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))(H||{}),q=(e=>(e.Basic="basic",e.Advanced="advanced",e.Plugin="plugin",e.Policy="policy",e))(q||{});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 R="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(R));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(R,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(R)}}}function M(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"}},he={learnMore:"Learn more",pricingTitle:"Pricing: "},me={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"}},ye={unexpected:"An unexpected error has occurred",dataKeyUndefined:'The data key "{dataKey}" does not exist in the response.'},be={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 you make here won't affect your configuration. After you apply changes with decK in the CLI, refresh the page to view them.",secret_advise:"Command may contain sensitive values. Treat it as a secret."},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={rotateKey:"Rotate key",generateKey:"Generate key",placeholder:"Enter or generate a key",oneTimeHint:"The key is shown only once. Copy it now and store it securely.",copy:"Copy",showKey:"Show key",hideKey:"Hide key"},Ie={global:ue,deleteModal:de,baseForm:fe,baseTable:pe,baseConfigCard:ge,emptyState:he,filter:me,debouncedFilter:ve,errors:ye,validationErrors:be,toggleModal:_e,deckCodeBlock:Ce,deckCallout:ke,generatePatModal:we,sensitiveInput:Ae};function D(){const e=F.createI18n("en-us",Ie);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 xe(e,s,o,t={fetchedItemsKey:"data",searchKeys:["id"]}){o||(o="1000");const{axiosInstance:r}=M(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([]),b=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(),y=async()=>{try{l.value=!0;const{data:f}=await r.get(`${g.value}?size=${o}`);f!=null&&f.next||(b.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 N,$,U;if(A.value!==f){if(A.value=f??"",!f){d.value=_.value;return}if(b.value===void 0)try{if(l.value=!0,c.value="",p.value="",e.app==="konnect"){const v=`${g.value}/${f}`,{data:m}=await r.get(`${v}?size=${o}`);t.fetchedItemsKey in m?d.value=m[t.fetchedItemsKey]:m!=null&&m[t.exactMatchKey??"id"]?d.value=[m]:d.value=[]}else{const v=[];C(f)&&t.searchKeys.includes("id")?v.push((async()=>{const{data:h}=await r.get(`${g.value}/${f}`);return[h[t.fetchedItemsKey]??h]})()):v.push(...t.searchKeys.filter(h=>h!=="id").map(async h=>{const{data:w}=await r.get(`${g.value}?${h}=${f}`);return w[t.fetchedItemsKey]}));const m=await Promise.all(v),x=new Set;d.value=[],(N=m==null?void 0:m.forEach)==null||N.call(m,h=>{var w;(w=h==null?void 0:h.forEach)==null||w.call(h,O=>{x.has(O.id)||(x.add(O.id),d.value.push(O))})})}}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=b.value)==null?void 0:U.filter(v=>{var x;let m=!1;for(const h of t.searchKeys){const w=typeof v[h]=="string"?(x=v[h])==null?void 0:x.toLowerCase():v[h];w!=null&&w.includes(f.toLowerCase())&&(m=!0)}return m}),(!d.value||!d.value.length)&&(p.value=n("debouncedFilter.errors.invalid")),l.value=!1}};return{loading:l,error:c,validationError:p,results:d,allRecords:b,loadItems:y,debouncedQueryChange:u}}const De=Symbol("PLUGIN_FORM_LAYOUT_STATE"),P=Symbol("DECK_COMMAND_EDITOR"),L="[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 Oe(e,s){const o=i.inject(P,null),t=i.computed(()=>{const a=i.toValue(e);return(a.app==="kongManager"||!!(a.app==="konnect"&&a.enableDeckConfig))&&K(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(L);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 Re(e,s){const o=i.inject(P,null),t=i.computed(()=>{const a=i.toValue(e);return(a.app==="kongManager"||!!(a.app==="konnect"&&a.enableDeckTab))&&K(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(L);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 Te(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 Ee(){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 Ke(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);if(o.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((b,g)=>d.searchParams.append(g,b))}else o.value||new URLSearchParams(p).forEach((_,b)=>{d.searchParams.append(b,_)}),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,o){const t=i.ref(!0),r=i.toValue(e),{axiosInstance:n}=M(r.axiosRequestConfig),a=Z(e,s),u=i.ref({status:k.Idle}),l=async d=>{var b;const _=i.toValue(o)||"data";try{u.value=t.value?{status:k.InitialLoad}:{status:k.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 y=C.data,A=_&&_.replace(/[^\w-_]/gi,"");let I;y[A]?I=Array.isArray(y[A])?y[A]:[y[A]]:Array.isArray(y)?I=y:I=Object.keys(y).length?[y]:[];const f={data:I,total:I.length,...y.offset?{pagination:{offset:y.offset}}:null};return f.data.length===0&&!d.query?u.value={status:k.NoRecords,response:f}:u.value={status:k.Idle,response:f},f}catch(g){const C={data:[],total:0};return d.query&&(((b=g.response)==null?void 0:b.status)===404||g.status===404)?(u.value={status:k.NoResults,response:C,error:g.response?g:{response:g}},C):(u.value={status:k.Error,response:C,error:g.response?g:{response:g}},C)}},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 Pe(){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},Le=(e,s)=>typeof e!=typeof s?[String(e),String(s)]:[e,s],Ne=(e,s)=>{if(S(e)||S(s))return 0;const[o,t]=Le(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=Ne(e[o]||"0",s[o]||"0");if(t!==0)return t}return 0},$e=(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)=>{Ue(o);const t=$e(e,s);return te[o].includes(t)},te={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]},Y=Object.keys(te),Ue=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("|")}`)},je=e=>typeof e=="string"&&/^[v\d]/.test(e)&&ee.test(e);function Fe(e){const{gatewayInfo:s,supportedRange:o}=e;if(!s)return!0;const{edition:t,version:r}=s;if(!je(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 Ve(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 Be(){const{i18n:{t:e}}=D();return{utf8Name:o=>/^[\p{N}\p{L}.\-_~]*$/u.test(o)?"":e("validationErrors.utf8Name")}}const T=Symbol("schema"),Se=e=>{i.provide(T,e)},ze=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 Ge(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 We={useAxios:M,useDebouncedFilter:xe,useDeleteUrlBuilder:Te,useBaseEntityDeckOptions:Oe,useBaseFormDeckOptions:Re,useErrors:Ee,useExternalLinkCreator:Ke,useFetcher:Me,useFetcherCacheKey:X,useFetchUrlBuilder:Z,useHelpers:Q,useStringHelpers:Pe,useI18n:D,useGatewayFeatureSupported:Fe,useTruncationDetector:Ve,useValidators:Be,useSchemaProvider:Se,useSubSchema:ze,useTableState:Ge},Ye=(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=q;exports.ConfigurationSchemaType=H;exports.DECK_COMMAND_EDITOR_KEY=P;exports.DECK_COMMAND_EDITOR_MISSING_WARNING=L;exports.EventGatewayTypesArray=se;exports.FetcherStatus=k;exports.IdentityTypesArray=ne;exports.PLUGIN_FORM_LAYOUT_STATE=De;exports.SupportedEntityDeckArray=J;exports.SupportedEntityType=E;exports.SupportedEntityTypesArray=ae;exports._export_sfc=Ye;exports.composables=We;exports.ft=le;exports.isSupportedDeckEntityType=K;
1
+ "use strict";const j=require("axios"),i=require("vue"),F=require("@kong-ui-public/i18n");var k=(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))(k||{}),T=(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.PluginSchema="plugin_schema",e.CustomPlugin="custom_plugin",e.ClonedPlugin="cloned_plugin",e))(T||{});const ae=Object.values(T),J=["ca_certificate","certificate","consumer","consumer_group","service","key","set","plugin","plugin_schema","custom_plugin","cloned_plugin","route","upstream","target","vault","partial"];function K(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 H=(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))(H||{}),q=(e=>(e.Basic="basic",e.Advanced="advanced",e.Plugin="plugin",e.Policy="policy",e))(q||{});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 r;return(...t)=>{clearTimeout(r),r=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=r=>{if(typeof r=="string")try{return JSON.parse(r)}catch(t){console.error("useTablePreferences(tryParseJson)",t);return}},s=()=>{const r=e(localStorage.getItem(E));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(E,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(E)}}}function M(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"}},he={learnMore:"Learn more",pricingTitle:"Pricing: "},me={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"}},ye={unexpected:"An unexpected error has occurred",dataKeyUndefined:'The data key "{dataKey}" does not exist in the response.'},be={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 you make here won't affect your configuration. After you apply changes with decK in the CLI, refresh the page to view them.",secret_advise:"Command may contain sensitive values. Treat it as a secret."},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={rotateKey:"Rotate key",generateKey:"Generate key",placeholder:"Enter or generate a key",oneTimeHint:"The key is shown only once. Copy it now and store it securely.",copy:"Copy",showKey:"Show key",hideKey:"Hide key"},Ie={global:ue,deleteModal:de,baseForm:fe,baseTable:pe,baseConfigCard:ge,emptyState:he,filter:me,debouncedFilter:ve,errors:ye,validationErrors:be,toggleModal:_e,deckCodeBlock:Ce,deckCallout:ke,generatePatModal:we,sensitiveInput:Ae};function D(){const e=F.createI18n("en-us",Ie);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 xe(e,s,r,t={fetchedItemsKey:"data",searchKeys:["id"]}){r||(r="1000");const{axiosInstance:o}=M(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([]),b=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(),y=async()=>{try{l.value=!0;const{data:f}=await o.get(`${g.value}?size=${r}`);f!=null&&f.next||(b.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 N,$,U;if(A.value!==f){if(A.value=f??"",!f){d.value=_.value;return}if(b.value===void 0)try{if(l.value=!0,c.value="",p.value="",e.app==="konnect"){const v=`${g.value}/${f}`,{data:m}=await o.get(`${v}?size=${r}`);t.fetchedItemsKey in m?d.value=m[t.fetchedItemsKey]:m!=null&&m[t.exactMatchKey??"id"]?d.value=[m]:d.value=[]}else{const v=[];C(f)&&t.searchKeys.includes("id")?v.push((async()=>{const{data:h}=await o.get(`${g.value}/${f}`);return[h[t.fetchedItemsKey]??h]})()):v.push(...t.searchKeys.filter(h=>h!=="id").map(async h=>{const{data:w}=await o.get(`${g.value}?${h}=${f}`);return w[t.fetchedItemsKey]}));const m=await Promise.all(v),x=new Set;d.value=[],(N=m==null?void 0:m.forEach)==null||N.call(m,h=>{var w;(w=h==null?void 0:h.forEach)==null||w.call(h,O=>{x.has(O.id)||(x.add(O.id),d.value.push(O))})})}}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=b.value)==null?void 0:U.filter(v=>{var x;let m=!1;for(const h of t.searchKeys){const w=typeof v[h]=="string"?(x=v[h])==null?void 0:x.toLowerCase():v[h];w!=null&&w.includes(f.toLowerCase())&&(m=!0)}return m}),(!d.value||!d.value.length)&&(p.value=n("debouncedFilter.errors.invalid")),l.value=!1}};return{loading:l,error:c,validationError:p,results:d,allRecords:b,loadItems:y,debouncedQueryChange:u}}const De=Symbol("PLUGIN_FORM_LAYOUT_STATE"),P=Symbol("DECK_COMMAND_EDITOR"),L="[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 Oe(e,s){const r=i.inject(P,null),t=i.computed(()=>{const a=i.toValue(e);return(a.app==="kongManager"||!!(a.app==="konnect"&&a.enableDeckConfig))&&K(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(L);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(P,null),t=i.computed(()=>{const a=i.toValue(e);return(a.app==="kongManager"||!!(a.app==="konnect"&&a.enableDeckTab))&&K(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(L);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 Re(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 Ke(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 typeof o.isExactMatch=="boolean"?o.isExactMatch:o.app==="konnect"}),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((b,g)=>d.searchParams.append(g,b))}else r.value||new URLSearchParams(p).forEach((_,b)=>{d.searchParams.append(b,_)}),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}=M(o.axiosRequestConfig),a=Z(e,s),u=i.ref({status:k.Idle}),l=async d=>{var b;const _=i.toValue(r)||"data";try{u.value=t.value?{status:k.InitialLoad}:{status:k.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 y=C.data,A=_&&_.replace(/[^\w-_]/gi,"");let I;y[A]?I=Array.isArray(y[A])?y[A]:[y[A]]:Array.isArray(y)?I=y:I=Object.keys(y).length?[y]:[];const f={data:I,total:I.length,...y.offset?{pagination:{offset:y.offset}}:null};return f.data.length===0&&!d.query?u.value={status:k.NoRecords,response:f}:u.value={status:k.Idle,response:f},f}catch(g){const C={data:[],total:0};return d.query&&(((b=g.response)==null?void 0:b.status)===404||g.status===404)?(u.value={status:k.NoResults,response:C,error:g.response?g:{response:g}},C):(u.value={status:k.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 Pe(){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,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},Le=(e,s)=>typeof e!=typeof s?[String(e),String(s)]:[e,s],Ne=(e,s)=>{if(S(e)||S(s))return 0;const[r,t]=Le(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=Ne(e[r]||"0",s[r]||"0");if(t!==0)return t}return 0},$e=(e,s)=>{const r=B(e),t=B(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)=>{Ue(r);const t=$e(e,s);return te[r].includes(t)},te={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]},Y=Object.keys(te),Ue=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("|")}`)},je=e=>typeof e=="string"&&/^[v\d]/.test(e)&&ee.test(e);function Fe(e){const{gatewayInfo:s,supportedRange:r}=e;if(!s)return!0;const{edition:t,version:o}=s;if(!je(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 Ve(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 Be(){const{i18n:{t:e}}=D();return{utf8Name:r=>/^[\p{N}\p{L}.\-_~]*$/u.test(r)?"":e("validationErrors.utf8Name")}}const R=Symbol("schema"),Se=e=>{i.provide(R,e)},ze=e=>{var o,n;const s=i.inject(R,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(R,t),t};function Ge(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 We={useAxios:M,useDebouncedFilter:xe,useDeleteUrlBuilder:Re,useBaseEntityDeckOptions:Oe,useBaseFormDeckOptions:Ee,useErrors:Te,useExternalLinkCreator:Ke,useFetcher:Me,useFetcherCacheKey:X,useFetchUrlBuilder:Z,useHelpers:Q,useStringHelpers:Pe,useI18n:D,useGatewayFeatureSupported:Fe,useTruncationDetector:Ve,useValidators:Be,useSchemaProvider:Se,useSubSchema:ze,useTableState:Ge},Ye=(e,s)=>{const r=e.__vccOpts||e;for(const[t,o]of s)r[t]=o;return r};exports.CONFIG_CARD_FORMATS=oe;exports.ConfigurationSchemaSection=q;exports.ConfigurationSchemaType=H;exports.DECK_COMMAND_EDITOR_KEY=P;exports.DECK_COMMAND_EDITOR_MISSING_WARNING=L;exports.EventGatewayTypesArray=se;exports.FetcherStatus=k;exports.IdentityTypesArray=ne;exports.PLUGIN_FORM_LAYOUT_STATE=De;exports.SupportedEntityDeckArray=J;exports.SupportedEntityType=T;exports.SupportedEntityTypesArray=ae;exports._export_sfc=Ye;exports.composables=We;exports.ft=le;exports.isSupportedDeckEntityType=K;
@@ -54,9 +54,9 @@ function ue() {
54
54
  function de() {
55
55
  return {
56
56
  debounce: (e, s) => {
57
- let o;
57
+ let r;
58
58
  return (...t) => {
59
- clearTimeout(o), o = window == null ? void 0 : window.setTimeout(() => {
59
+ clearTimeout(r), r = window == null ? void 0 : window.setTimeout(() => {
60
60
  e(...t);
61
61
  }, s);
62
62
  };
@@ -70,30 +70,30 @@ const L = "khcp-user-table-preferences", fe = {
70
70
  columnVisibility: {}
71
71
  };
72
72
  function tt() {
73
- const e = (o) => {
74
- if (typeof o == "string")
73
+ const e = (r) => {
74
+ if (typeof r == "string")
75
75
  try {
76
- return JSON.parse(o);
76
+ return JSON.parse(r);
77
77
  } catch (t) {
78
78
  console.error("useTablePreferences(tryParseJson)", t);
79
79
  return;
80
80
  }
81
81
  }, s = () => {
82
- const o = e(localStorage.getItem(L));
83
- return !o || !Object.keys(o).length ? /* @__PURE__ */ new Map() : new Map(Object.entries(o));
82
+ const r = e(localStorage.getItem(L));
83
+ return !r || !Object.keys(r).length ? /* @__PURE__ */ new Map() : new Map(Object.entries(r));
84
84
  };
85
85
  return {
86
- setTablePreferences: (o, t) => {
86
+ setTablePreferences: (r, t) => {
87
87
  try {
88
- const r = s();
89
- r.set(o, t), localStorage.setItem(L, JSON.stringify(Object.fromEntries(r.entries())));
90
- } catch (r) {
91
- console.error("useTablePreferences(setTablePreferences)", r);
88
+ const o = s();
89
+ o.set(r, t), localStorage.setItem(L, JSON.stringify(Object.fromEntries(o.entries())));
90
+ } catch (o) {
91
+ console.error("useTablePreferences(setTablePreferences)", o);
92
92
  }
93
93
  },
94
- getTablePreferences: (o, t) => {
95
- const r = s();
96
- return (r == null ? void 0 : r.get(o)) || void 0 || t || fe;
94
+ getTablePreferences: (r, t) => {
95
+ const o = s();
96
+ return (o == null ? void 0 : o.get(r)) || void 0 || t || fe;
97
97
  },
98
98
  deleteAllTablePreferences: () => {
99
99
  localStorage.removeItem(L);
@@ -329,12 +329,12 @@ function Q() {
329
329
  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
330
330
  };
331
331
  }
332
- function De(e, s, o, t = {
332
+ function De(e, s, r, t = {
333
333
  fetchedItemsKey: "data",
334
334
  searchKeys: ["id"]
335
335
  }) {
336
- o || (o = "1000");
337
- const { axiosInstance: r } = E(e.axiosRequestConfig), { i18n: { t: n } } = R(), { debounce: a } = de(), c = a(async (d) => {
336
+ r || (r = "1000");
337
+ const { axiosInstance: o } = E(e.axiosRequestConfig), { i18n: { t: n } } = R(), { debounce: a } = de(), c = a(async (d) => {
338
338
  await K(d);
339
339
  }, 200), l = h(!1), i = h(""), f = h(""), u = h([]), k = h([]), w = h(void 0), p = _(() => {
340
340
  let d = `${e.apiBaseUrl}${W(s)}`;
@@ -342,7 +342,7 @@ function De(e, s, o, t = {
342
342
  }), { isValidUuid: C } = Q(), y = async () => {
343
343
  try {
344
344
  l.value = !0;
345
- const { data: d } = await r.get(`${p.value}?size=${o}`);
345
+ const { data: d } = await o.get(`${p.value}?size=${r}`);
346
346
  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;
347
347
  } catch {
348
348
  u.value = [], i.value = n("debouncedFilter.errors.fetch");
@@ -359,16 +359,16 @@ function De(e, s, o, t = {
359
359
  if (w.value === void 0)
360
360
  try {
361
361
  if (l.value = !0, i.value = "", f.value = "", e.app === "konnect") {
362
- const b = `${p.value}/${d}`, { data: v } = await r.get(`${b}?size=${o}`);
362
+ const b = `${p.value}/${d}`, { data: v } = await o.get(`${b}?size=${r}`);
363
363
  t.fetchedItemsKey in v ? u.value = v[t.fetchedItemsKey] : v != null && v[t.exactMatchKey ?? "id"] ? u.value = [v] : u.value = [];
364
364
  } else {
365
365
  const b = [];
366
366
  C(d) && t.searchKeys.includes("id") ? b.push((async () => {
367
- const { data: g } = await r.get(`${p.value}/${d}`);
367
+ const { data: g } = await o.get(`${p.value}/${d}`);
368
368
  return [g[t.fetchedItemsKey] ?? g];
369
369
  })()) : b.push(
370
370
  ...t.searchKeys.filter((g) => g !== "id").map(async (g) => {
371
- const { data: A } = await r.get(`${p.value}?${g}=${d}`);
371
+ const { data: A } = await o.get(`${p.value}?${g}=${d}`);
372
372
  return A[t.fetchedItemsKey];
373
373
  })
374
374
  );
@@ -409,12 +409,12 @@ function De(e, s, o, t = {
409
409
  }
410
410
  const at = 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).";
411
411
  function Re(e, s) {
412
- const o = D(q, null), t = _(() => {
412
+ const r = D(q, null), t = _(() => {
413
413
  const a = m(e);
414
414
  return (a.app === "kongManager" || !!(a.app === "konnect" && a.enableDeckConfig)) && H(m(s));
415
- }), r = _(() => {
415
+ }), o = _(() => {
416
416
  const a = m(e), c = a.app === "konnect" && a.enableDeckConfig && typeof a.enableDeckConfig != "boolean" ? a.enableDeckConfig.customization : void 0;
417
- if (c && !o) {
417
+ if (c && !r) {
418
418
  console.warn(Z);
419
419
  return;
420
420
  }
@@ -425,17 +425,17 @@ function Re(e, s) {
425
425
  });
426
426
  return {
427
427
  isDeckEnabled: t,
428
- deckCustomizationOptions: r,
428
+ deckCustomizationOptions: o,
429
429
  deckCalloutPreferenceKey: n
430
430
  };
431
431
  }
432
432
  function Oe(e, s) {
433
- const o = D(q, null), t = _(() => {
433
+ const r = D(q, null), t = _(() => {
434
434
  const a = m(e);
435
435
  return (a.app === "kongManager" || !!(a.app === "konnect" && a.enableDeckTab)) && H(m(s));
436
- }), r = _(() => {
436
+ }), o = _(() => {
437
437
  const a = m(e), c = a.app === "konnect" && a.enableDeckTab && typeof a.enableDeckTab != "boolean" ? a.enableDeckTab.customization : void 0;
438
- if (c && !o) {
438
+ if (c && !r) {
439
439
  console.warn(Z);
440
440
  return;
441
441
  }
@@ -446,15 +446,15 @@ function Oe(e, s) {
446
446
  });
447
447
  return {
448
448
  isDeckEnabled: t,
449
- deckCustomizationOptions: r,
449
+ deckCustomizationOptions: o,
450
450
  deckCalloutPreferenceKey: n
451
451
  };
452
452
  }
453
453
  function Le(e, s) {
454
- const o = W(s), t = _(
455
- () => e.apiBaseUrl.startsWith("/") ? new URL(`${window.location.origin}${o}`) : new URL(o)
454
+ const r = W(s), t = _(
455
+ () => e.apiBaseUrl.startsWith("/") ? new URL(`${window.location.origin}${r}`) : new URL(r)
456
456
  );
457
- return t.value.search = "", (r) => `${t.value.href}/${r}`;
457
+ return t.value.search = "", (o) => `${t.value.href}/${o}`;
458
458
  }
459
459
  function $e() {
460
460
  const { i18n: { t: e } } = R();
@@ -471,30 +471,30 @@ function $e() {
471
471
  messages: [],
472
472
  fields: []
473
473
  };
474
- let r = [e("errors.unexpected")];
474
+ let o = [e("errors.unexpected")];
475
475
  const n = [];
476
476
  if ((c = t == null ? void 0 : t.response) != null && c.data) {
477
477
  if ((l = t.response.data.details) != null && l.length)
478
- return r = [], t.response.data.details.forEach((i) => {
478
+ return o = [], t.response.data.details.forEach((i) => {
479
479
  let f = e("errors.unexpected");
480
- i.messages && Array.isArray(i.messages) && i.messages.length && (f = i.messages.join(", ")), i.field && n.push({ field: i.field, message: f }), r.push(`${i.field ?? ""} ${f}`);
481
- }), { messages: r, fields: n };
480
+ i.messages && Array.isArray(i.messages) && i.messages.length && (f = i.messages.join(", ")), i.field && n.push({ field: i.field, message: f }), o.push(`${i.field ?? ""} ${f}`);
481
+ }), { messages: o, fields: n };
482
482
  if (t.response.data.message && Array.isArray(t.response.data.message))
483
- return r = [], t.response.data.message.forEach((i) => {
483
+ return o = [], t.response.data.message.forEach((i) => {
484
484
  if (i != null && i.constraints) {
485
485
  const f = Object.values(i.constraints).join(", ");
486
- r.push(f), i.property && n.push({ field: i.property, message: f });
487
- } else i != null && i.property && (i != null && i.message) ? (n.push({ field: i.property, message: i.message }), r.push(i.message)) : r.push(i);
488
- }), { messages: r, fields: n };
486
+ o.push(f), i.property && n.push({ field: i.property, message: f });
487
+ } else i != null && i.property && (i != null && i.message) ? (n.push({ field: i.property, message: i.message }), o.push(i.message)) : o.push(i);
488
+ }), { messages: o, fields: n };
489
489
  if (typeof t.response.data.message == "string" || typeof t.response.data == "string")
490
490
  return {
491
491
  messages: [t.response.data.message],
492
492
  fields: []
493
493
  };
494
494
  if (typeof t.response.data == "object")
495
- return r = [], Object.keys(t.response.data).forEach((i) => {
496
- n.push({ field: i, message: t.response.data[i] }), r.push(t.response.data[i]);
497
- }), { messages: r, fields: n };
495
+ return o = [], Object.keys(t.response.data).forEach((i) => {
496
+ n.push({ field: i, message: t.response.data[i] }), o.push(t.response.data[i]);
497
+ }), { messages: o, fields: n };
498
498
  }
499
499
  return {
500
500
  messages: [t.message || e("errors.unexpected")],
@@ -502,10 +502,10 @@ function $e() {
502
502
  };
503
503
  },
504
504
  getMessageFromError: (t) => {
505
- var r, n, a, c;
505
+ var o, n, a, c;
506
506
  if (!t)
507
507
  return e("errors.unexpected");
508
- if (((r = t == null ? void 0 : t.response) == null ? void 0 : r.status) === 401)
508
+ if (((o = t == null ? void 0 : t.response) == null ? void 0 : o.status) === 401)
509
509
  return console.warn("getMessageFromError: User auth token is expired or missing, returning empty message."), "";
510
510
  if ((n = t == null ? void 0 : t.response) != null && n.data) {
511
511
  if (t.response.data.detail)
@@ -529,33 +529,33 @@ function $e() {
529
529
  };
530
530
  }
531
531
  function Ee(e) {
532
- const s = window.location.origin, o = s.endsWith("/") ? s : `${s}/`;
532
+ const s = window.location.origin, r = s.endsWith("/") ? s : `${s}/`;
533
533
  try {
534
- const t = e.join("/"), r = `${o}${t}`, n = e.some((c) => c.trim() === "");
535
- 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))
536
- return `${o}${t}`;
534
+ const t = e.join("/"), o = `${r}${t}`, n = e.some((c) => c.trim() === "");
535
+ 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))
536
+ return `${r}${t}`;
537
537
  throw new Error("Invalid url");
538
538
  } catch (t) {
539
539
  return console.warn("Failed to build valid URL:", t), "";
540
540
  }
541
541
  }
542
542
  function X(e, s) {
543
- const o = _(() => {
544
- const r = m(e);
545
- return r.app === "konnect" || !!r.isExactMatch;
543
+ const r = _(() => {
544
+ const o = m(e);
545
+ return typeof o.isExactMatch == "boolean" ? o.isExactMatch : o.app === "konnect";
546
546
  }), t = _(() => {
547
- const r = m(s);
548
- return r.startsWith("/") ? new URL(`${window.location.origin}${r}`) : new URL(r);
547
+ const o = m(s);
548
+ return o.startsWith("/") ? new URL(`${window.location.origin}${o}`) : new URL(o);
549
549
  });
550
- return (r) => {
551
- const { page: n, pageSize: a, offset: c, sortColumnKey: l, sortColumnOrder: i, query: f } = r;
550
+ return (o) => {
551
+ const { page: n, pageSize: a, offset: c, sortColumnKey: l, sortColumnOrder: i, query: f } = o;
552
552
  try {
553
553
  let u = new URL(t.value.href);
554
- if (o.value && f) {
554
+ if (r.value && f) {
555
555
  const k = new URLSearchParams(t.value.search);
556
556
  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));
557
557
  } else
558
- o.value || new URLSearchParams(f).forEach((k, w) => {
558
+ r.value || new URLSearchParams(f).forEach((k, w) => {
559
559
  u.searchParams.append(w, k);
560
560
  }), l && u.searchParams.append("sort_by", l), i === "desc" && u.searchParams.append("sort_desc", "1"), u.searchParams.append("size", String(a));
561
561
  return c && n !== 1 && u.searchParams.append("offset", String(c)), u.href;
@@ -565,12 +565,12 @@ function X(e, s) {
565
565
  };
566
566
  }
567
567
  const j = /* @__PURE__ */ new Map();
568
- function Me(e, s, o) {
569
- const t = h(!0), r = m(e), { axiosInstance: n } = E(r.axiosRequestConfig), a = X(e, s), c = h({
568
+ function Me(e, s, r) {
569
+ const t = h(!0), o = m(e), { axiosInstance: n } = E(o.axiosRequestConfig), a = X(e, s), c = h({
570
570
  status: x.Idle
571
571
  }), l = async (u) => {
572
572
  var w;
573
- const k = m(o) || "data";
573
+ const k = m(r) || "data";
574
574
  try {
575
575
  c.value = t.value ? { status: x.InitialLoad } : { status: x.Loading }, t.value = !1;
576
576
  let p = a(u);
@@ -612,7 +612,7 @@ function Me(e, s, o) {
612
612
  error: p.response ? p : { response: p }
613
613
  }, C);
614
614
  }
615
- }, i = r.cacheIdentifier, f = ee(i);
615
+ }, i = o.cacheIdentifier, f = ee(i);
616
616
  return { fetcher: l, fetcherState: c, fetcherCacheKey: f };
617
617
  }
618
618
  function ee(e) {
@@ -623,9 +623,9 @@ function ee(e) {
623
623
  return h(1);
624
624
  }
625
625
  function Te() {
626
- 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;
626
+ 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;
627
627
  return {
628
- capitalize: (t) => t ? t.replace(s, (r) => r.toUpperCase()) : "",
628
+ capitalize: (t) => t ? t.replace(s, (o) => o.toUpperCase()) : "",
629
629
  convertKeyToTitle: e
630
630
  };
631
631
  }
@@ -642,22 +642,22 @@ const te = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-(
642
642
  }, Ue = (e, s) => typeof e != typeof s ? [String(e), String(s)] : [e, s], Ne = (e, s) => {
643
643
  if (B(e) || B(s))
644
644
  return 0;
645
- const [o, t] = Ue(z(e), z(s));
646
- return o > t ? 1 : o < t ? -1 : 0;
645
+ const [r, t] = Ue(z(e), z(s));
646
+ return r > t ? 1 : r < t ? -1 : 0;
647
647
  }, G = (e, s) => {
648
- for (let o = 0; o < Math.max(e.length, s.length); o++) {
649
- const t = Ne(e[o] || "0", s[o] || "0");
648
+ for (let r = 0; r < Math.max(e.length, s.length); r++) {
649
+ const t = Ne(e[r] || "0", s[r] || "0");
650
650
  if (t !== 0)
651
651
  return t;
652
652
  }
653
653
  return 0;
654
654
  }, je = (e, s) => {
655
- const o = F(e), t = F(s), r = o.pop(), n = t.pop(), a = G(o, t);
656
- return a !== 0 ? a : r && n ? G(r.split("."), n.split(".")) : r || n ? r ? -1 : 1 : 0;
657
- }, V = (e, s, o) => {
658
- Fe(o);
655
+ const r = F(e), t = F(s), o = r.pop(), n = t.pop(), a = G(r, t);
656
+ return a !== 0 ? a : o && n ? G(o.split("."), n.split(".")) : o || n ? o ? -1 : 1 : 0;
657
+ }, V = (e, s, r) => {
658
+ Fe(r);
659
659
  const t = je(e, s);
660
- return ae[o].includes(t);
660
+ return ae[r].includes(t);
661
661
  }, ae = {
662
662
  ">": [1],
663
663
  ">=": [0, 1],
@@ -672,51 +672,51 @@ const te = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-(
672
672
  throw new Error(`Invalid operator, expected one of ${S.join("|")}`);
673
673
  }, Be = (e) => typeof e == "string" && /^[v\d]/.test(e) && te.test(e);
674
674
  function ze(e) {
675
- const { gatewayInfo: s, supportedRange: o } = e;
675
+ const { gatewayInfo: s, supportedRange: r } = e;
676
676
  if (!s)
677
677
  return !0;
678
- const { edition: t, version: r } = s;
679
- if (!Be(r))
678
+ const { edition: t, version: o } = s;
679
+ if (!Be(o))
680
680
  return console.error("Invalid version"), !1;
681
- const n = o[t];
681
+ const n = r[t];
682
682
  if (!n)
683
683
  return !1;
684
684
  const [a, c] = n;
685
- return !(a && V(r, a, "<") || c && V(r, c, ">"));
685
+ return !(a && V(o, a, "<") || c && V(o, c, ">"));
686
686
  }
687
687
  function Ge(e) {
688
- const s = h(0), o = h(0), t = h(!1);
688
+ const s = h(0), r = h(0), t = h(!1);
689
689
  return se(e, (n) => {
690
- n && !t.value && (s.value = n.offsetWidth, o.value = n.scrollWidth, t.value = !0);
690
+ n && !t.value && (s.value = n.offsetWidth, r.value = n.scrollWidth, t.value = !0);
691
691
  }), {
692
- isTruncated: _(() => s.value < o.value)
692
+ isTruncated: _(() => s.value < r.value)
693
693
  };
694
694
  }
695
695
  function Ve() {
696
696
  const { i18n: { t: e } } = R();
697
697
  return {
698
- utf8Name: (o) => /^[\p{N}\p{L}.\-_~]*$/u.test(o) ? "" : e("validationErrors.utf8Name")
698
+ utf8Name: (r) => /^[\p{N}\p{L}.\-_~]*$/u.test(r) ? "" : e("validationErrors.utf8Name")
699
699
  };
700
700
  }
701
701
  const $ = Symbol("schema"), Se = (e) => {
702
702
  J($, e);
703
703
  }, We = (e) => {
704
- var r, n;
705
- const s = D($, 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 = ne(o == null ? void 0 : o[e]);
704
+ var o, n;
705
+ const s = D($, 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]);
706
706
  return J($, t), t;
707
707
  };
708
708
  function Je(e) {
709
709
  let s = "";
710
- const o = h(!1), t = h(null), r = _(() => {
710
+ const r = h(!1), t = h(null), o = _(() => {
711
711
  let a;
712
- return o.value ? a = !0 : t.value ? a = t.value.hasData || e && m(e) : a = !1, !a;
712
+ return r.value ? a = !0 : t.value ? a = t.value.hasData || e && m(e) : a = !1, !a;
713
713
  });
714
714
  return {
715
715
  tableState: t,
716
- hasRecords: o,
717
- hideTableToolbar: r,
716
+ hasRecords: r,
717
+ hideTableToolbar: o,
718
718
  handleStateChange: (a) => {
719
- a.hasData ? o.value = !0 : a.state === "success" && !a.hasData && (!e || !s) && (o.value = !1), e && (s = m(e)), t.value = { ...a };
719
+ a.hasData ? r.value = !0 : a.state === "success" && !a.hasData && (!e || !s) && (r.value = !1), e && (s = m(e)), t.value = { ...a };
720
720
  }
721
721
  };
722
722
  }
@@ -741,10 +741,10 @@ const st = {
741
741
  useSubSchema: We,
742
742
  useTableState: Je
743
743
  }, nt = (e, s) => {
744
- const o = e.__vccOpts || e;
745
- for (const [t, r] of s)
746
- o[t] = r;
747
- return o;
744
+ const r = e.__vccOpts || e;
745
+ for (const [t, o] of s)
746
+ r[t] = o;
747
+ return r;
748
748
  };
749
749
  export {
750
750
  le as C,
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),a=require("./_plugin-vue_export-helper-CPHEKtsJ.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-55ffc70c"]]),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-C9ohhutQ.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-55ffc70c"]]),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 _, 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-CxCTU6Pp.js";
2
+ import { c as D, _ as u, D as w } from "./_plugin-vue_export-helper-DBlL8ycw.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";