@kong-ui-public/entities-keys 1.2.0 → 1.2.1

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.
@@ -464,7 +464,7 @@ function Ca(e, n, t = "data") {
464
464
  }
465
465
  function wa() {
466
466
  return {
467
- getPropValue: (e, n) => (n == null ? void 0 : n[e]) || void 0
467
+ getPropValue: (e, n) => (n == null ? void 0 : n[e]) ?? void 0
468
468
  };
469
469
  }
470
470
  function _a() {
@@ -1,4 +1,4 @@
1
- (function(ne,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("vue-router"),require("@kong-ui-public/i18n"),require("axios"),require("@kong/kongponents")):typeof define=="function"&&define.amd?define(["exports","vue","vue-router","@kong-ui-public/i18n","axios","@kong/kongponents"],t):(ne=typeof globalThis<"u"?globalThis:ne||self,t(ne["kong-ui-public-entities-keys"]={},ne.Vue,ne.VueRouter,ne["kong-ui-public-i18n"],ne.axios,ne.Kongponents))})(this,function(ne,t,$e,he,bn,Cn){"use strict";const wn={keys:{title:"Keys",list:{toolbar_actions:{new_key:"New Key"},table_headers:{name:"Name",key_id:"Key ID",id:"ID",tags:"Tags"},empty_state:{title:"Configure a New Key",description:"A Key object holds a representation of asymmetric keys in various formats."}},actions:{create:"New Key",copy_id:"Copy ID",copy_json:"Copy JSON",edit:"Edit",delete:"Delete",clear:"Clear",view:"View Details",loading:"Loading..."},search:{placeholder:"Filter by exact name or ID",no_results:"No results found"},delete:{title:"Delete a Key",description:"This action cannot be reversed so make sure to check the key usage before deleting."},errors:{general:"Keys could not be retrieved",delete:"The key could not be deleted at this time.",copy:"Failed to copy to clipboard",key_sets:{fetch:"Could not fetch available key sets",invalid:"Please select a valid key set ID"}},copy:{success:"Copied {val} to clipboard",success_brief:"Successfully copied to clipboard"},form:{sections:{general:{title:"General Information",description:"General information will help identify and manage this key."},keys:{title:"Asymmetric Keys",description:"Choose the preferred format for this asymmetric key. Currently only support PEM and JWK format."}},fields:{id:{label:"Key ID",placeholder:"Enter a key ID",tooltip:"An identifier for a key",help:"If using JWK, need to match with the jwk.kid field"},name:{label:"Name",placeholder:"Enter a unique name for this key",tooltip:"The name to associate with the given key"},tags:{label:"Tags",placeholder:"Enter a list of tags separated by comma",help:"e.g. tag1, tag2, tag3",tooltip:"An optional set of strings for grouping and filtering, separated by commas."},key_set:{label:"Key Set",placeholder:"Select a key set to add into",footer:"Search by exact ID to find key sets not included in the list"},key_format:{label:"Key Format",options:{jwk:"JWK",pem:"PEM"}},jwk:{label:"JWK",placeholder:"Enter a JWK",tooltip:"A JSON Web key represented as a string"},kid:{label:"Key ID",tooltip:"A unique identifier for a key."},set:{label:"Key Set",tooltip:"The id (an UUID) of the key-set with which to associate the key."},private_key:{label:"Private Key",placeholder:"Enter a private key"},public_key:{label:"Public Key",placeholder:"Enter a public key"}}}}};function Sn(){const e=he.createI18n("en-us",wn);return{i18n:e,i18nT:he.i18nTComponent(e)}}const Ke={useI18n:Sn},pe={list:{konnect:{all:"/api/runtime_groups/{controlPlaneId}/keys",forKeySet:"/api/runtime_groups/{controlPlaneId}/key-sets/{keySetId}/keys"},kongManager:{all:"/{workspace}/keys",forKeySet:"/{workspace}/key-sets/{keySetId}/keys"}},form:{konnect:{create:"/api/runtime_groups/{controlPlaneId}/keys",edit:"/api/runtime_groups/{controlPlaneId}/keys/{id}",keySets:"/api/runtime_groups/{controlPlaneId}/key-sets",getKeySet:"/api/runtime_groups/{controlPlaneId}/key-sets/{keySetId}"},kongManager:{create:"/{workspace}/keys",edit:"/{workspace}/keys/{id}",keySets:"/{workspace}/key-sets",getKeySet:"/{workspace}/key-sets/{keySetId}"}}};var Xe=(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))(Xe||{}),ke=(e=>(e.Edit="edit",e.Create="create",e))(ke||{}),ce=(e=>(e[e.Loading=0]="Loading",e[e.Idle=1]="Idle",e[e.NoResults=2]="NoResults",e[e.Error=3]="Error",e))(ce||{}),D=(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.BadgeStatus="badge-status",e.BadgeMethod="badge-method",e.LinkInternal="link-internal",e.LinkExternal="link-external",e))(D||{}),Q=(e=>(e.Basic="basic",e.Advanced="advanced",e.Plugin="plugin",e))(Q||{});function Oe(e={}){return{axiosInstance:bn.create({withCredentials:!0,timeout:3e4,...e})}}function xn(){return{debounce:(e,o)=>{let n;return(...a)=>{clearTimeout(n),n=window==null?void 0:window.setTimeout(()=>{e(...a)},o)}}}}const Me="khcp-user-table-preferences",_n={pageSize:30,sortColumnKey:void 0,sortColumnOrder:void 0};function Bn(){const e=n=>{if(typeof n=="string")try{return JSON.parse(n)}catch(a){console.error("useTablePreferences(tryParseJson)",a);return}},o=()=>{const n=e(localStorage.getItem(Me));return!n||!Object.keys(n).length?new Map:new Map(Object.entries(n))};return{setTablePreferences:(n,a)=>{try{const r=o();r.set(n,a),localStorage.setItem(Me,JSON.stringify(Object.fromEntries(r.entries())))}catch(r){console.error("useTablePreferences(setTablePreferences)",r)}},getTablePreferences:n=>{const a=o();return(a==null?void 0:a.get(n))||void 0||_n},deleteAllTablePreferences:()=>{localStorage.removeItem(Me)}}}const In={message:"Are you sure you want to delete this {entityType}?",messageWithName:"Are you sure you want to delete this {entityType} {entityName}?"},Nn={actions:{save:"Save",cancel:"Cancel",back:"Back"},errors:{edit:"The entity could not be edited at this time."}},An={emptyState:{noSearchResultsTitle:"No results found",noSearchResultsMessage:"Please adjust the criteria and try again.",noSearchResultsCtaText:"Clear"}},En={title:"Configuration",actions:{copy:"Copy JSON"},sections:{advanced:"Advanced",plugin:"Plugin 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"},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"}},Vn={filterButtonText:"Filter",fieldLabel:"Filter by:",inputPlaceholder:"Enter a value",selectPlaceholder:"Select an item",applyButtonText:"Apply",clearButtonText:"Clear",clearAllButtonText:"Clear all filters"},Tn={errors:{fetch:"Could not fetch available items",invalid:"Please select a valid value"}},jn={unexpected:"An unexpected error has occurred",dataKeyUndefined:'The data key "{dataKey}" does not exist in the response.'},$n={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"}},Kn={deleteModal:In,baseForm:Nn,baseTable:An,baseConfigCard:En,filter:Vn,debouncedFilter:Tn,errors:jn,toggleModal:$n};function Fe(){const e=he.createI18n("en-us",Kn);return{i18n:e,i18nT:he.i18nTComponent(e)}}function On(e,o,n,a={fetchedItemsKey:"data",searchKeys:["id"]}){n||(n="100");const{axiosInstance:r}=Oe({headers:e.requestHeaders}),{i18n:{t:i}}=Fe(),{debounce:l}=xn(),c=l(async y=>{await m(y)},200),d=t.ref(!1),s=t.ref(""),u=t.ref(""),p=t.ref([]),h=t.ref(void 0),k=t.unref(o);let C=`${e.apiBaseUrl}${k}`;e.app==="konnect"?C=C.replace(/{controlPlaneId}/gi,(e==null?void 0:e.controlPlaneId)||""):e.app==="kongManager"&&(C=C.replace(/\/{workspace}/gi,e!=null&&e.workspace?`/${e.workspace}`:""));const b=async()=>{try{d.value=!0;const{data:y}=await r.get(`${C}?size=${n}`);y!=null&&y.next||(h.value=a.fetchedItemsKey in y?y[a.fetchedItemsKey]:[]),p.value=a.fetchedItemsKey in y?y[a.fetchedItemsKey]:[]}catch{p.value=[],s.value=i("debouncedFilter.errors.fetch")}finally{d.value=!1}},f=t.ref(""),m=async y=>{var S,N;if(f.value!==y)if(f.value=y||"",h.value===void 0)try{d.value=!0,s.value="",u.value="";let A=C+"";y&&(A+=`/${y}`);const{data:B}=await r.get(`${A}?size=${n}`);a.fetchedItemsKey in B?p.value=B[a.fetchedItemsKey]:B!=null&&B.id?p.value=[B]:p.value=[]}catch(A){((S=A==null?void 0:A.response)==null?void 0:S.status)===404?u.value=i("debouncedFilter.errors.invalid"):(p.value=[],s.value=i("debouncedFilter.errors.fetch"))}finally{d.value=!1}else d.value=!0,u.value="",y?(p.value=(N=h.value)==null?void 0:N.filter(A=>{var B;let F=!1;for(const _ of a.searchKeys){const V=typeof A[_]=="string"?(B=A[_])==null?void 0:B.toLowerCase():A[_];V!=null&&V.includes(y.toLowerCase())&&(F=!0)}return F}),(!p.value||!p.value.length)&&(u.value=i("debouncedFilter.errors.invalid"))):p.value=h.value,d.value=!1};return{loading:d,error:s,validationError:u,results:p,allRecords:h,loadItems:b,debouncedQueryChange:c}}function Mn(e,o){const n=t.unref(o),a=t.computed(()=>e.apiBaseUrl.startsWith("/")?new URL(`${window.location.origin}${n}`):new URL(n));return a.value.search="",r=>`${a.value.href}/${r}`}function Fn(){const{i18n:{t:e}}=Fe();return{getMessageFromError:o=>{var n,a,r;if(!o)return e("errors.unexpected");if((n=o==null?void 0:o.response)!=null&&n.data){if(o.response.data.detail)return o.response.data.detail;if((a=o.response.data.details)!=null&&a.length)return o.response.data.details.map(i=>{let l=e("errors.unexpected");return i.messages&&typeof i.messages=="object"&&i.messages.length&&(l=i.messages.join(", ")),i.field?`${i.field} - ${l}`:l}).join("; ");if(o.response.data.message){const{message:i}=o.response.data;return Array.isArray(i)?(r=i[0])!=null&&r.constraints?Object.values(i[0].constraints)[0]:i[0]:i}if(typeof o.response.data=="string")return o.response.data;if(typeof o.response.data=="object")return Object.keys(o.response.data).map(i=>`${i} ${o.response.data[i]}`).join(", ")}return o.message||e("errors.unexpected")}}}function et(e,o){const n=t.ref(t.unref(e)),a=t.ref(t.unref(o)),r=t.computed(()=>!!(n.value.app==="konnect"||n.value.isExactMatch)),i=t.computed(()=>a.value.startsWith("/")?new URL(`${window.location.origin}${a.value}`):new URL(a.value));return l=>{const{page:c,pageSize:d,offset:s,sortColumnKey:u,sortColumnOrder:p,query:h}=l;try{let k=new URL(i.value.href);return r.value&&h?(k.search="",k=new URL(`${k.href}/${h}/`)):(r.value||new URLSearchParams(h).forEach((C,b)=>{k.searchParams.append(b,C)}),u&&k.searchParams.append("sort_by",u),p==="desc"&&k.searchParams.append("sort_desc","1"),k.searchParams.append("size",String(d))),s&&c!==1&&k.searchParams.append("offset",String(s)),k.href}catch(k){return console.error("RouteList(fetcher)",k),a.value}}}function Dn(e,o,n="data"){const a=t.unref(o),{axiosInstance:r}=Oe({headers:e.requestHeaders}),i=et(e,a),l=t.ref({status:ce.Idle});return{fetcher:async c=>{try{l.value={status:ce.Loading};const d=i(c),{data:s}=await r.get(d),u=n&&n.replace(/[^\w-_]/gi,"");let p;s[u]&&Array.isArray(s[u])?p=s[u]:p=Object.keys(s).length?[s]:[];const h={data:p,total:p.length,...s.offset?{pagination:{offset:s.offset}}:null};return l.value={status:ce.Idle,response:h},h}catch(d){const s={data:[],total:0};return c.query&&d.response.status===404?(l.value={status:ce.NoResults,response:s,error:d},s):(l.value={status:ce.Error,response:s,error:d},s)}},fetcherState:l}}function Ln(){return{getPropValue:(e,o)=>(o==null?void 0:o[e])||void 0}}function qn(){return{convertKeyToTitle:(e,o="_")=>e?e.split(o).map(n=>n.toLowerCase()==="id"?n.toUpperCase():n.charAt(0).toUpperCase()+n.substring(1)).join(" "):""}}const tt=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,nt=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");const o=e.match(tt);if(!o)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return o.shift(),o},ot=e=>e==="*"||e==="x"||e==="X",at=e=>{const o=parseInt(e,10);return isNaN(o)?e:o},Pn=(e,o)=>typeof e!=typeof o?[String(e),String(o)]:[e,o],Un=(e,o)=>{if(ot(e)||ot(o))return 0;const[n,a]=Pn(at(e),at(o));return n>a?1:n<a?-1:0},rt=(e,o)=>{for(let n=0;n<Math.max(e.length,o.length);n++){const a=Un(e[n]||"0",o[n]||"0");if(a!==0)return a}return 0},Rn=(e,o)=>{const n=nt(e),a=nt(o),r=n.pop(),i=a.pop(),l=rt(n,a);return l!==0?l:r&&i?rt(r.split("."),i.split(".")):r||i?r?-1:1:0},it=(e,o,n)=>{vn(n);const a=Rn(e,o);return lt[n].includes(a)},lt={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]},st=Object.keys(lt),vn=e=>{if(typeof e!="string")throw new TypeError(`Invalid operator type, expected string but got ${typeof e}`);if(st.indexOf(e)===-1)throw new Error(`Invalid operator, expected one of ${st.join("|")}`)},zn=e=>typeof e=="string"&&/^[v\d]/.test(e)&&tt.test(e);function Jn(e){const{gatewayInfo:o,supportedRange:n}=e;if(!o)return!0;const{edition:a,version:r}=o;if(!zn(r))return console.error("Invalid version"),!1;const i=n[a];if(!i)return!1;const[l,c]=i;return!(l&&it(r,l,"<")||c&&it(r,c,">"))}const W={useAxios:Oe,useDebouncedFilter:On,useDeleteUrlBuilder:Mn,useErrors:Fn,useFetcher:Dn,useFetchUrlBuilder:et,useHelpers:Ln,useStringHelpers:qn,useI18n:Fe,useGatewayFeatureSupported:Jn},Hn={fail:"Failed to copy id to clipboard",success:{prefix:"Successfully",content:" copied to clipboard"}},Yn="Copy to clipboard",Wn={message:Hn,iconTitle:Yn},Gn="kong-ui-copy-uuid-notify",Zn={class:"kong-ui-copy-uuid"},Qn=["onClick"],ct=15,Xn=t.defineComponent({__name:"CopyUuid",props:{uuid:{type:String,required:!0},idTooltip:{type:String,default:""},truncated:{type:Boolean,default:!0},useMono:{type:Boolean,default:!0},notify:{type:Function,default:void 0},iconColor:{type:String,default:"rgba(0, 0, 0, 0.45)"},tooltip:{type:String,default:""},successTooltip:{type:String,default:""},format:{type:String,required:!1,default:"uuid",validator:e=>["uuid","hidden","redacted","deleted"].includes(e)}},emits:["success","error"],setup(e,{emit:o}){const n=e,{t:a}=he.createI18n("en-us",Wn),r=n.notify||t.inject(Gn,()=>{}),i=t.computed(()=>n.idTooltip?{label:n.idTooltip,positionFixed:!0,placement:"bottomStart"}:{title:n.uuid}),l=t.computed(()=>!!(n.tooltip&&n.successTooltip)),c=t.ref(n.tooltip),d=t.computed(()=>n.tooltip?{label:c.value,positionFixed:!0,maxWidth:"500px",placement:"bottomStart"}:{}),s=t.computed(()=>n.format==="redacted"?"*****":n.format==="deleted"?`*${n.uuid.substring(0,5)}`:n.uuid),u=h=>{c.value=h,setTimeout(()=>{c.value=n.tooltip},1800)},p=h=>{if(!h(n.uuid)){typeof r=="function"&&r({type:"error",message:a("message.fail")}),l.value?u(a("message.fail")):o("error",n.uuid);return}const k=n.uuid.length>ct,C=n.format==="hidden"||n.format==="redacted"?a("message.success.prefix"):`"${n.uuid.substring(0,ct)+(k?"...":"")}"`;typeof r=="function"&&r({type:"success",message:`${C}${a("message.success.content")}`}),l.value?u(n.successTooltip):o("success",n.uuid)};return(h,k)=>{const C=t.resolveComponent("KIcon"),b=t.resolveComponent("KClipboardProvider");return t.openBlock(),t.createElementBlock("div",Zn,[e.format!=="hidden"?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(e.idTooltip?"KTooltip":"div"),t.mergeProps({key:0},i.value,{"data-testid":"copy-id"}),{default:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass(["uuid-container",e.truncated?"truncated-uuid":null,e.useMono?"mono":null])},t.toDisplayString(s.value),3)]),_:1},16)):t.createCommentVNode("",!0),(t.openBlock(),t.createBlock(t.resolveDynamicComponent(e.tooltip?"KTooltip":"div"),t.mergeProps(d.value,{class:"uuid-icon-wrapper"}),{default:t.withCtx(()=>[t.createVNode(b,null,{default:t.withCtx(({copyToClipboard:f})=>[t.createElementVNode("span",{"data-testid":"copy-to-clipboard",role:"button",tabindex:"0",onClick:t.withModifiers(m=>p(f),["stop"])},[t.createVNode(C,{class:"uuid-icon",color:e.iconColor,"hide-title":!!e.tooltip||void 0,icon:"copy",size:"16",title:t.unref(a)("iconTitle")},null,8,["color","hide-title","title"])],8,Qn)]),_:1})]),_:1},16))])}}}),eo=(e,o)=>{const n=e.__vccOpts||e;for(const[a,r]of o)n[a]=r;return n},dt=eo(Xn,[["__scopeId","data-v-bfdaf6f7"]]),to={key:0,class:"config-card-fieldset-title"},no=t.defineComponent({__name:"JsonCardItem",props:{item:{type:Object,required:!0},index:{type:Number,default:-1},isArrayItem:{type:Boolean,default:!1}},setup(e){const o=e,{i18n:{t:n}}=W.useI18n(),{convertKeyToTitle:a}=W.useStringHelpers(),r=t.computed(()=>o.item.key??"json-array-item"),i=t.computed(()=>o.item.value??o.item),l=t.computed(()=>{const d=JSON.parse(JSON.stringify(i.value));return o.isArrayItem&&delete d.name,d}),c=t.computed(()=>{var d;return o.isArrayItem?(d=i.value)!=null&&d.name?a(i.value.name,"_"):n("baseConfigCard.general.entryTitle",{index:o.index}):""});return(d,s)=>(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",to,[t.createElementVNode("b",null,t.toDisplayString(c.value),1)])):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Object.keys(l.value),(u,p)=>(t.openBlock(),t.createBlock(be,{key:`${r.value}-property-${p}`,item:{key:u,label:t.unref(a)(u),value:l.value[u]}},null,8,["item"]))),128))]),_:1},8,["class"]))}}),oe=(e,o)=>{const n=e.__vccOpts||e;for(const[a,r]of o)n[a]=r;return n},pt=oe(no,[["__scopeId","data-v-68ca83ec"]]),ut=oe(t.defineComponent({__name:"InternalLinkItem",props:{item:{type:Object,required:!0}},emits:["navigation-click"],setup(e){const{i18n:{t:o}}=W.useI18n();return(n,a)=>{const r=t.resolveComponent("KButton");return t.openBlock(),t.createElementBlock("div",null,[t.createVNode(r,{appearance:"btn-link",class:"navigation-button",onClick:a[0]||(a[0]=i=>n.$emit("navigation-click",e.item))},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.item.value||t.unref(o)("baseConfigCard.commonFields.link")),1)]),_:1})])}}}),[["__scopeId","data-v-7410504d"]]),oo=t.defineComponent({__name:"StatusBadge",props:{status:{type:Boolean,default:!1}},setup(e){const{i18n:{t:o}}=W.useI18n();return(n,a)=>{const r=t.resolveComponent("KBadge");return t.openBlock(),t.createBlock(r,{appearance:e.status?"success":"neutral"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.status?t.unref(o)("baseConfigCard.statusBadge.enabledLabel"):t.unref(o)("baseConfigCard.statusBadge.disabledLabel")),1)]),_:1},8,["appearance"])}}}),ao="#0044f4",ro="#e0e4ea",io="#3a3f51",lo="1px",so="20px",co={class:"config-card-details-row"},po=["data-testid"],uo=["data-testid"],fo=["data-testid"],mo=["data-testid"],yo={key:1},go=["data-testid"],ho=["data-testid"],ko=["data-testid"],bo=["data-testid"],Co=["title"],wo={name:"ConfigCardItem",components:{CopyUuid:dt,JsonCardItem:pt,StatusBadge:oo,InternalLinkItem:ut}},So=t.defineComponent({...wo,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:o}){const n=e;t.useCssVars(p=>({"2c6ac268":s.value?"none":`solid ${t.unref(lo)} ${t.unref(ro)}`,c7a65802:d.value&&l.value?"block":"flex","778426fe":d.value&&l.value?"100%":n.slim?"50%":"25%","777f9b48":d.value&&l.value?"100%":n.slim?"50%":"75%"}));const a=t.useSlots(),{i18n:{t:r,formatUnixTimeStamp:i}}=W.useI18n(),l=t.computed(()=>n.item.value!==void 0&&n.item.value!==null&&n.item.value!==""),c=t.computed(()=>!!(n.item.tooltip||a["label-tooltip"])),d=t.computed(()=>n.item.type===D.Json||n.item.type===D.JsonArray),s=t.computed(()=>n.item.type===D.JsonArray),u=t.computed(()=>{switch(n.item.type){case D.ID:return{tag:"CopyUuid",attrs:{"data-testid":`${n.item.key}-copy-uuid`,"success-tooltip":r("baseConfigCard.copy.success"),tooltip:r("baseConfigCard.copy.tooltip",{label:n.item.label}),truncated:!1,uuid:n.item.value,notify:()=>{}}};case D.IdArray:return{tag:"div",additionalComponent:"CopyUuid",childAttrs:{"success-tooltip":r("baseConfigCard.copy.success"),tooltip:r("baseConfigCard.copy.tooltip",{label:n.item.label}),truncated:!1,notify:()=>{}}};case D.Redacted:return{tag:"CopyUuid",attrs:{"data-testid":`${n.item.key}-copy-uuid-redacted`,format:"redacted","success-tooltip":r("baseConfigCard.copy.success"),tooltip:r("baseConfigCard.copy.tooltip",{label:n.item.label}),truncated:!1,uuid:n.item.value,notify:()=>{}}};case D.RedactedArray:return{tag:"div",additionalComponent:"CopyUuid",childAttrs:{format:"redacted","success-tooltip":r("baseConfigCard.copy.success"),tooltip:r("baseConfigCard.copy.tooltip",{label:n.item.label}),truncated:!1,notify:()=>{}}};case D.Date:return{tag:"div",attrs:{"data-testid":`${n.item.key}-date`},text:i(n.item.value)};case D.BadgeStatus:return{tag:"StatusBadge",attrs:{"data-testid":`${n.item.key}-badge-status`,status:n.item.value}};case D.BadgeTag:return{tag:"div",additionalComponent:"KBadge"};case D.BadgeMethod:return{tag:"div",additionalComponent:"KMethodBadge"};case D.LinkInternal:return{tag:"InternalLinkItem",attrs:{"data-testid":`${n.item.key}-internal-link`,item:n.item,onNavigationClick:p=>{o("navigation-click",p)}}};case D.LinkExternal:return{tag:"KExternalLink",attrs:{"data-testid":`${n.item.key}-external-link`,href:n.item.value},text:n.item.value};case D.Json:return{tag:"JsonCardItem",attrs:{"data-testid":`${n.item.key}-json-content`,item:n.item}};case D.JsonArray:return{tag:"div",additionalComponent:"JsonCardItem",attrs:{"data-testid":`${n.item.key}-json-array-content`,item:n.item}};default:return{tag:"div",attrs:{"data-testid":`${n.item.key}-plain-text`},text:n.item.value}}});return(p,h)=>{const k=t.resolveComponent("KLabel"),C=t.resolveComponent("KBadge"),b=t.resolveComponent("KMethodBadge");return t.openBlock(),t.createElementBlock("div",co,[t.createElementVNode("div",{class:"config-card-details-label","data-testid":`${e.item.key}-label`},[t.renderSlot(p.$slots,"label",{item:e.item},()=>[t.createVNode(k,{"tooltip-attributes":{maxWidth:"500px"}},t.createSlots({default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.item.label)+" ",1)]),_:2},[c.value?{name:"tooltip",fn:t.withCtx(()=>[t.createElementVNode("div",{"data-testid":`${e.item.key}-label-tooltip`},[t.renderSlot(p.$slots,"label-tooltip",{},()=>[t.createTextVNode(t.toDisplayString(e.item.tooltip),1)],!0)],8,uo)]),key:"0"}:void 0]),1024)],!0)],8,po),t.createElementVNode("div",{class:"config-card-details-value","data-testid":`${e.item.key}-property-value`},[t.renderSlot(p.$slots,e.item.key,{rowValue:e.item.value},()=>[l.value?(t.openBlock(),t.createElementBlock("div",yo,[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(u.value.tag),t.normalizeProps(t.guardReactiveProps(u.value.attrs)),{default:t.withCtx(()=>[u.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,(f,m)=>(t.openBlock(),t.createBlock(C,{key:`${e.item.key}-badge-tag-${m}`,class:"config-badge","data-testid":`${e.item.key}-badge-tag-${m}`,"truncation-tooltip":f},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(f),1)]),_:2},1032,["data-testid","truncation-tooltip"]))),128))],8,go)):t.createCommentVNode("",!0),u.value.additionalComponent==="CopyUuid"?(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,(f,m)=>(t.openBlock(),t.createBlock(t.unref(dt),t.mergeProps(u.value.childAttrs,{key:`${e.item.key}-copy-uuid-${m}`,"data-testid":`${e.item.key}-copy-uuid-${m}`,uuid:f}),null,16,["data-testid","uuid"]))),128))],8,ho)):u.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,(f,m)=>(t.openBlock(),t.createBlock(b,{key:`${e.item.key}-badge-method-${m}`,class:"config-badge","data-testid":`${e.item.key}-badge-method-${m}`,"is-rounded":"",label:f,method:t.unref(Cn.MethodsArray).includes(f.toLowerCase())?f.toLowerCase():"custom"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(f),1)]),_:2},1032,["data-testid","label","method"]))),128))],8,ko)):t.createCommentVNode("",!0),u.value.additionalComponent==="JsonCardItem"?(t.openBlock(),t.createElementBlock("div",{key:3,"data-testid":`${n.item.key}-json-array-content`},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.item.value,(f,m)=>(t.openBlock(),t.createBlock(pt,{key:`json-array-item-${m}`,index:m,"is-array-item":"",item:f},null,8,["index","item"]))),128))],8,bo)):(t.openBlock(),t.createElementBlock("span",{key:4,class:t.normalizeClass(["attrs-data-text",{truncated:e.truncated}]),title:e.truncated?e.item.value:void 0},t.toDisplayString(u.value.text),11,Co))]),_:1},16))])):(t.openBlock(),t.createElementBlock("div",{key:0,"data-testid":`${e.item.key}-no-value`}," – ",8,mo))],!0)],8,fo)])}}}),be=oe(So,[["__scopeId","data-v-a3c5ab01"]]);/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */function ft(e){return typeof e>"u"||e===null}function xo(e){return typeof e=="object"&&e!==null}function _o(e){return Array.isArray(e)?e:ft(e)?[]:[e]}function Bo(e,o){var n,a,r,i;if(o)for(i=Object.keys(o),n=0,a=i.length;n<a;n+=1)r=i[n],e[r]=o[r];return e}function Io(e,o){var n="",a;for(a=0;a<o;a+=1)n+=e;return n}function No(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var Ao=ft,Eo=xo,Vo=_o,To=Io,jo=No,$o=Bo,J={isNothing:Ao,isObject:Eo,toArray:Vo,repeat:To,isNegativeZero:jo,extend:$o};function mt(e,o){var n="",a=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(n+='in "'+e.mark.name+'" '),n+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!o&&e.mark.snippet&&(n+=`
1
+ (function(ne,t){typeof exports=="object"&&typeof module<"u"?t(exports,require("vue"),require("vue-router"),require("@kong-ui-public/i18n"),require("axios"),require("@kong/kongponents")):typeof define=="function"&&define.amd?define(["exports","vue","vue-router","@kong-ui-public/i18n","axios","@kong/kongponents"],t):(ne=typeof globalThis<"u"?globalThis:ne||self,t(ne["kong-ui-public-entities-keys"]={},ne.Vue,ne.VueRouter,ne["kong-ui-public-i18n"],ne.axios,ne.Kongponents))})(this,function(ne,t,$e,he,bn,Cn){"use strict";const wn={keys:{title:"Keys",list:{toolbar_actions:{new_key:"New Key"},table_headers:{name:"Name",key_id:"Key ID",id:"ID",tags:"Tags"},empty_state:{title:"Configure a New Key",description:"A Key object holds a representation of asymmetric keys in various formats."}},actions:{create:"New Key",copy_id:"Copy ID",copy_json:"Copy JSON",edit:"Edit",delete:"Delete",clear:"Clear",view:"View Details",loading:"Loading..."},search:{placeholder:"Filter by exact name or ID",no_results:"No results found"},delete:{title:"Delete a Key",description:"This action cannot be reversed so make sure to check the key usage before deleting."},errors:{general:"Keys could not be retrieved",delete:"The key could not be deleted at this time.",copy:"Failed to copy to clipboard",key_sets:{fetch:"Could not fetch available key sets",invalid:"Please select a valid key set ID"}},copy:{success:"Copied {val} to clipboard",success_brief:"Successfully copied to clipboard"},form:{sections:{general:{title:"General Information",description:"General information will help identify and manage this key."},keys:{title:"Asymmetric Keys",description:"Choose the preferred format for this asymmetric key. Currently only support PEM and JWK format."}},fields:{id:{label:"Key ID",placeholder:"Enter a key ID",tooltip:"An identifier for a key",help:"If using JWK, need to match with the jwk.kid field"},name:{label:"Name",placeholder:"Enter a unique name for this key",tooltip:"The name to associate with the given key"},tags:{label:"Tags",placeholder:"Enter a list of tags separated by comma",help:"e.g. tag1, tag2, tag3",tooltip:"An optional set of strings for grouping and filtering, separated by commas."},key_set:{label:"Key Set",placeholder:"Select a key set to add into",footer:"Search by exact ID to find key sets not included in the list"},key_format:{label:"Key Format",options:{jwk:"JWK",pem:"PEM"}},jwk:{label:"JWK",placeholder:"Enter a JWK",tooltip:"A JSON Web key represented as a string"},kid:{label:"Key ID",tooltip:"A unique identifier for a key."},set:{label:"Key Set",tooltip:"The id (an UUID) of the key-set with which to associate the key."},private_key:{label:"Private Key",placeholder:"Enter a private key"},public_key:{label:"Public Key",placeholder:"Enter a public key"}}}}};function Sn(){const e=he.createI18n("en-us",wn);return{i18n:e,i18nT:he.i18nTComponent(e)}}const Ke={useI18n:Sn},pe={list:{konnect:{all:"/api/runtime_groups/{controlPlaneId}/keys",forKeySet:"/api/runtime_groups/{controlPlaneId}/key-sets/{keySetId}/keys"},kongManager:{all:"/{workspace}/keys",forKeySet:"/{workspace}/key-sets/{keySetId}/keys"}},form:{konnect:{create:"/api/runtime_groups/{controlPlaneId}/keys",edit:"/api/runtime_groups/{controlPlaneId}/keys/{id}",keySets:"/api/runtime_groups/{controlPlaneId}/key-sets",getKeySet:"/api/runtime_groups/{controlPlaneId}/key-sets/{keySetId}"},kongManager:{create:"/{workspace}/keys",edit:"/{workspace}/keys/{id}",keySets:"/{workspace}/key-sets",getKeySet:"/{workspace}/key-sets/{keySetId}"}}};var Xe=(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))(Xe||{}),ke=(e=>(e.Edit="edit",e.Create="create",e))(ke||{}),ce=(e=>(e[e.Loading=0]="Loading",e[e.Idle=1]="Idle",e[e.NoResults=2]="NoResults",e[e.Error=3]="Error",e))(ce||{}),D=(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.BadgeStatus="badge-status",e.BadgeMethod="badge-method",e.LinkInternal="link-internal",e.LinkExternal="link-external",e))(D||{}),Q=(e=>(e.Basic="basic",e.Advanced="advanced",e.Plugin="plugin",e))(Q||{});function Oe(e={}){return{axiosInstance:bn.create({withCredentials:!0,timeout:3e4,...e})}}function xn(){return{debounce:(e,o)=>{let n;return(...a)=>{clearTimeout(n),n=window==null?void 0:window.setTimeout(()=>{e(...a)},o)}}}}const Me="khcp-user-table-preferences",_n={pageSize:30,sortColumnKey:void 0,sortColumnOrder:void 0};function Bn(){const e=n=>{if(typeof n=="string")try{return JSON.parse(n)}catch(a){console.error("useTablePreferences(tryParseJson)",a);return}},o=()=>{const n=e(localStorage.getItem(Me));return!n||!Object.keys(n).length?new Map:new Map(Object.entries(n))};return{setTablePreferences:(n,a)=>{try{const r=o();r.set(n,a),localStorage.setItem(Me,JSON.stringify(Object.fromEntries(r.entries())))}catch(r){console.error("useTablePreferences(setTablePreferences)",r)}},getTablePreferences:n=>{const a=o();return(a==null?void 0:a.get(n))||void 0||_n},deleteAllTablePreferences:()=>{localStorage.removeItem(Me)}}}const In={message:"Are you sure you want to delete this {entityType}?",messageWithName:"Are you sure you want to delete this {entityType} {entityName}?"},Nn={actions:{save:"Save",cancel:"Cancel",back:"Back"},errors:{edit:"The entity could not be edited at this time."}},An={emptyState:{noSearchResultsTitle:"No results found",noSearchResultsMessage:"Please adjust the criteria and try again.",noSearchResultsCtaText:"Clear"}},En={title:"Configuration",actions:{copy:"Copy JSON"},sections:{advanced:"Advanced",plugin:"Plugin 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"},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"}},Vn={filterButtonText:"Filter",fieldLabel:"Filter by:",inputPlaceholder:"Enter a value",selectPlaceholder:"Select an item",applyButtonText:"Apply",clearButtonText:"Clear",clearAllButtonText:"Clear all filters"},Tn={errors:{fetch:"Could not fetch available items",invalid:"Please select a valid value"}},jn={unexpected:"An unexpected error has occurred",dataKeyUndefined:'The data key "{dataKey}" does not exist in the response.'},$n={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"}},Kn={deleteModal:In,baseForm:Nn,baseTable:An,baseConfigCard:En,filter:Vn,debouncedFilter:Tn,errors:jn,toggleModal:$n};function Fe(){const e=he.createI18n("en-us",Kn);return{i18n:e,i18nT:he.i18nTComponent(e)}}function On(e,o,n,a={fetchedItemsKey:"data",searchKeys:["id"]}){n||(n="100");const{axiosInstance:r}=Oe({headers:e.requestHeaders}),{i18n:{t:i}}=Fe(),{debounce:l}=xn(),c=l(async y=>{await m(y)},200),d=t.ref(!1),s=t.ref(""),u=t.ref(""),p=t.ref([]),h=t.ref(void 0),k=t.unref(o);let C=`${e.apiBaseUrl}${k}`;e.app==="konnect"?C=C.replace(/{controlPlaneId}/gi,(e==null?void 0:e.controlPlaneId)||""):e.app==="kongManager"&&(C=C.replace(/\/{workspace}/gi,e!=null&&e.workspace?`/${e.workspace}`:""));const b=async()=>{try{d.value=!0;const{data:y}=await r.get(`${C}?size=${n}`);y!=null&&y.next||(h.value=a.fetchedItemsKey in y?y[a.fetchedItemsKey]:[]),p.value=a.fetchedItemsKey in y?y[a.fetchedItemsKey]:[]}catch{p.value=[],s.value=i("debouncedFilter.errors.fetch")}finally{d.value=!1}},f=t.ref(""),m=async y=>{var S,N;if(f.value!==y)if(f.value=y||"",h.value===void 0)try{d.value=!0,s.value="",u.value="";let A=C+"";y&&(A+=`/${y}`);const{data:B}=await r.get(`${A}?size=${n}`);a.fetchedItemsKey in B?p.value=B[a.fetchedItemsKey]:B!=null&&B.id?p.value=[B]:p.value=[]}catch(A){((S=A==null?void 0:A.response)==null?void 0:S.status)===404?u.value=i("debouncedFilter.errors.invalid"):(p.value=[],s.value=i("debouncedFilter.errors.fetch"))}finally{d.value=!1}else d.value=!0,u.value="",y?(p.value=(N=h.value)==null?void 0:N.filter(A=>{var B;let F=!1;for(const _ of a.searchKeys){const V=typeof A[_]=="string"?(B=A[_])==null?void 0:B.toLowerCase():A[_];V!=null&&V.includes(y.toLowerCase())&&(F=!0)}return F}),(!p.value||!p.value.length)&&(u.value=i("debouncedFilter.errors.invalid"))):p.value=h.value,d.value=!1};return{loading:d,error:s,validationError:u,results:p,allRecords:h,loadItems:b,debouncedQueryChange:c}}function Mn(e,o){const n=t.unref(o),a=t.computed(()=>e.apiBaseUrl.startsWith("/")?new URL(`${window.location.origin}${n}`):new URL(n));return a.value.search="",r=>`${a.value.href}/${r}`}function Fn(){const{i18n:{t:e}}=Fe();return{getMessageFromError:o=>{var n,a,r;if(!o)return e("errors.unexpected");if((n=o==null?void 0:o.response)!=null&&n.data){if(o.response.data.detail)return o.response.data.detail;if((a=o.response.data.details)!=null&&a.length)return o.response.data.details.map(i=>{let l=e("errors.unexpected");return i.messages&&typeof i.messages=="object"&&i.messages.length&&(l=i.messages.join(", ")),i.field?`${i.field} - ${l}`:l}).join("; ");if(o.response.data.message){const{message:i}=o.response.data;return Array.isArray(i)?(r=i[0])!=null&&r.constraints?Object.values(i[0].constraints)[0]:i[0]:i}if(typeof o.response.data=="string")return o.response.data;if(typeof o.response.data=="object")return Object.keys(o.response.data).map(i=>`${i} ${o.response.data[i]}`).join(", ")}return o.message||e("errors.unexpected")}}}function et(e,o){const n=t.ref(t.unref(e)),a=t.ref(t.unref(o)),r=t.computed(()=>!!(n.value.app==="konnect"||n.value.isExactMatch)),i=t.computed(()=>a.value.startsWith("/")?new URL(`${window.location.origin}${a.value}`):new URL(a.value));return l=>{const{page:c,pageSize:d,offset:s,sortColumnKey:u,sortColumnOrder:p,query:h}=l;try{let k=new URL(i.value.href);return r.value&&h?(k.search="",k=new URL(`${k.href}/${h}/`)):(r.value||new URLSearchParams(h).forEach((C,b)=>{k.searchParams.append(b,C)}),u&&k.searchParams.append("sort_by",u),p==="desc"&&k.searchParams.append("sort_desc","1"),k.searchParams.append("size",String(d))),s&&c!==1&&k.searchParams.append("offset",String(s)),k.href}catch(k){return console.error("RouteList(fetcher)",k),a.value}}}function Dn(e,o,n="data"){const a=t.unref(o),{axiosInstance:r}=Oe({headers:e.requestHeaders}),i=et(e,a),l=t.ref({status:ce.Idle});return{fetcher:async c=>{try{l.value={status:ce.Loading};const d=i(c),{data:s}=await r.get(d),u=n&&n.replace(/[^\w-_]/gi,"");let p;s[u]&&Array.isArray(s[u])?p=s[u]:p=Object.keys(s).length?[s]:[];const h={data:p,total:p.length,...s.offset?{pagination:{offset:s.offset}}:null};return l.value={status:ce.Idle,response:h},h}catch(d){const s={data:[],total:0};return c.query&&d.response.status===404?(l.value={status:ce.NoResults,response:s,error:d},s):(l.value={status:ce.Error,response:s,error:d},s)}},fetcherState:l}}function Ln(){return{getPropValue:(e,o)=>(o==null?void 0:o[e])??void 0}}function qn(){return{convertKeyToTitle:(e,o="_")=>e?e.split(o).map(n=>n.toLowerCase()==="id"?n.toUpperCase():n.charAt(0).toUpperCase()+n.substring(1)).join(" "):""}}const tt=/^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i,nt=e=>{if(typeof e!="string")throw new TypeError("Invalid argument expected string");const o=e.match(tt);if(!o)throw new Error(`Invalid argument not valid semver ('${e}' received)`);return o.shift(),o},ot=e=>e==="*"||e==="x"||e==="X",at=e=>{const o=parseInt(e,10);return isNaN(o)?e:o},Pn=(e,o)=>typeof e!=typeof o?[String(e),String(o)]:[e,o],Un=(e,o)=>{if(ot(e)||ot(o))return 0;const[n,a]=Pn(at(e),at(o));return n>a?1:n<a?-1:0},rt=(e,o)=>{for(let n=0;n<Math.max(e.length,o.length);n++){const a=Un(e[n]||"0",o[n]||"0");if(a!==0)return a}return 0},Rn=(e,o)=>{const n=nt(e),a=nt(o),r=n.pop(),i=a.pop(),l=rt(n,a);return l!==0?l:r&&i?rt(r.split("."),i.split(".")):r||i?r?-1:1:0},it=(e,o,n)=>{vn(n);const a=Rn(e,o);return lt[n].includes(a)},lt={">":[1],">=":[0,1],"=":[0],"<=":[-1,0],"<":[-1],"!=":[-1,1]},st=Object.keys(lt),vn=e=>{if(typeof e!="string")throw new TypeError(`Invalid operator type, expected string but got ${typeof e}`);if(st.indexOf(e)===-1)throw new Error(`Invalid operator, expected one of ${st.join("|")}`)},zn=e=>typeof e=="string"&&/^[v\d]/.test(e)&&tt.test(e);function Jn(e){const{gatewayInfo:o,supportedRange:n}=e;if(!o)return!0;const{edition:a,version:r}=o;if(!zn(r))return console.error("Invalid version"),!1;const i=n[a];if(!i)return!1;const[l,c]=i;return!(l&&it(r,l,"<")||c&&it(r,c,">"))}const W={useAxios:Oe,useDebouncedFilter:On,useDeleteUrlBuilder:Mn,useErrors:Fn,useFetcher:Dn,useFetchUrlBuilder:et,useHelpers:Ln,useStringHelpers:qn,useI18n:Fe,useGatewayFeatureSupported:Jn},Hn={fail:"Failed to copy id to clipboard",success:{prefix:"Successfully",content:" copied to clipboard"}},Yn="Copy to clipboard",Wn={message:Hn,iconTitle:Yn},Gn="kong-ui-copy-uuid-notify",Zn={class:"kong-ui-copy-uuid"},Qn=["onClick"],ct=15,Xn=t.defineComponent({__name:"CopyUuid",props:{uuid:{type:String,required:!0},idTooltip:{type:String,default:""},truncated:{type:Boolean,default:!0},useMono:{type:Boolean,default:!0},notify:{type:Function,default:void 0},iconColor:{type:String,default:"rgba(0, 0, 0, 0.45)"},tooltip:{type:String,default:""},successTooltip:{type:String,default:""},format:{type:String,required:!1,default:"uuid",validator:e=>["uuid","hidden","redacted","deleted"].includes(e)}},emits:["success","error"],setup(e,{emit:o}){const n=e,{t:a}=he.createI18n("en-us",Wn),r=n.notify||t.inject(Gn,()=>{}),i=t.computed(()=>n.idTooltip?{label:n.idTooltip,positionFixed:!0,placement:"bottomStart"}:{title:n.uuid}),l=t.computed(()=>!!(n.tooltip&&n.successTooltip)),c=t.ref(n.tooltip),d=t.computed(()=>n.tooltip?{label:c.value,positionFixed:!0,maxWidth:"500px",placement:"bottomStart"}:{}),s=t.computed(()=>n.format==="redacted"?"*****":n.format==="deleted"?`*${n.uuid.substring(0,5)}`:n.uuid),u=h=>{c.value=h,setTimeout(()=>{c.value=n.tooltip},1800)},p=h=>{if(!h(n.uuid)){typeof r=="function"&&r({type:"error",message:a("message.fail")}),l.value?u(a("message.fail")):o("error",n.uuid);return}const k=n.uuid.length>ct,C=n.format==="hidden"||n.format==="redacted"?a("message.success.prefix"):`"${n.uuid.substring(0,ct)+(k?"...":"")}"`;typeof r=="function"&&r({type:"success",message:`${C}${a("message.success.content")}`}),l.value?u(n.successTooltip):o("success",n.uuid)};return(h,k)=>{const C=t.resolveComponent("KIcon"),b=t.resolveComponent("KClipboardProvider");return t.openBlock(),t.createElementBlock("div",Zn,[e.format!=="hidden"?(t.openBlock(),t.createBlock(t.resolveDynamicComponent(e.idTooltip?"KTooltip":"div"),t.mergeProps({key:0},i.value,{"data-testid":"copy-id"}),{default:t.withCtx(()=>[t.createElementVNode("div",{class:t.normalizeClass(["uuid-container",e.truncated?"truncated-uuid":null,e.useMono?"mono":null])},t.toDisplayString(s.value),3)]),_:1},16)):t.createCommentVNode("",!0),(t.openBlock(),t.createBlock(t.resolveDynamicComponent(e.tooltip?"KTooltip":"div"),t.mergeProps(d.value,{class:"uuid-icon-wrapper"}),{default:t.withCtx(()=>[t.createVNode(b,null,{default:t.withCtx(({copyToClipboard:f})=>[t.createElementVNode("span",{"data-testid":"copy-to-clipboard",role:"button",tabindex:"0",onClick:t.withModifiers(m=>p(f),["stop"])},[t.createVNode(C,{class:"uuid-icon",color:e.iconColor,"hide-title":!!e.tooltip||void 0,icon:"copy",size:"16",title:t.unref(a)("iconTitle")},null,8,["color","hide-title","title"])],8,Qn)]),_:1})]),_:1},16))])}}}),eo=(e,o)=>{const n=e.__vccOpts||e;for(const[a,r]of o)n[a]=r;return n},dt=eo(Xn,[["__scopeId","data-v-bfdaf6f7"]]),to={key:0,class:"config-card-fieldset-title"},no=t.defineComponent({__name:"JsonCardItem",props:{item:{type:Object,required:!0},index:{type:Number,default:-1},isArrayItem:{type:Boolean,default:!1}},setup(e){const o=e,{i18n:{t:n}}=W.useI18n(),{convertKeyToTitle:a}=W.useStringHelpers(),r=t.computed(()=>o.item.key??"json-array-item"),i=t.computed(()=>o.item.value??o.item),l=t.computed(()=>{const d=JSON.parse(JSON.stringify(i.value));return o.isArrayItem&&delete d.name,d}),c=t.computed(()=>{var d;return o.isArrayItem?(d=i.value)!=null&&d.name?a(i.value.name,"_"):n("baseConfigCard.general.entryTitle",{index:o.index}):""});return(d,s)=>(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",to,[t.createElementVNode("b",null,t.toDisplayString(c.value),1)])):t.createCommentVNode("",!0),(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(Object.keys(l.value),(u,p)=>(t.openBlock(),t.createBlock(be,{key:`${r.value}-property-${p}`,item:{key:u,label:t.unref(a)(u),value:l.value[u]}},null,8,["item"]))),128))]),_:1},8,["class"]))}}),oe=(e,o)=>{const n=e.__vccOpts||e;for(const[a,r]of o)n[a]=r;return n},pt=oe(no,[["__scopeId","data-v-68ca83ec"]]),ut=oe(t.defineComponent({__name:"InternalLinkItem",props:{item:{type:Object,required:!0}},emits:["navigation-click"],setup(e){const{i18n:{t:o}}=W.useI18n();return(n,a)=>{const r=t.resolveComponent("KButton");return t.openBlock(),t.createElementBlock("div",null,[t.createVNode(r,{appearance:"btn-link",class:"navigation-button",onClick:a[0]||(a[0]=i=>n.$emit("navigation-click",e.item))},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.item.value||t.unref(o)("baseConfigCard.commonFields.link")),1)]),_:1})])}}}),[["__scopeId","data-v-7410504d"]]),oo=t.defineComponent({__name:"StatusBadge",props:{status:{type:Boolean,default:!1}},setup(e){const{i18n:{t:o}}=W.useI18n();return(n,a)=>{const r=t.resolveComponent("KBadge");return t.openBlock(),t.createBlock(r,{appearance:e.status?"success":"neutral"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.status?t.unref(o)("baseConfigCard.statusBadge.enabledLabel"):t.unref(o)("baseConfigCard.statusBadge.disabledLabel")),1)]),_:1},8,["appearance"])}}}),ao="#0044f4",ro="#e0e4ea",io="#3a3f51",lo="1px",so="20px",co={class:"config-card-details-row"},po=["data-testid"],uo=["data-testid"],fo=["data-testid"],mo=["data-testid"],yo={key:1},go=["data-testid"],ho=["data-testid"],ko=["data-testid"],bo=["data-testid"],Co=["title"],wo={name:"ConfigCardItem",components:{CopyUuid:dt,JsonCardItem:pt,StatusBadge:oo,InternalLinkItem:ut}},So=t.defineComponent({...wo,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:o}){const n=e;t.useCssVars(p=>({"2c6ac268":s.value?"none":`solid ${t.unref(lo)} ${t.unref(ro)}`,c7a65802:d.value&&l.value?"block":"flex","778426fe":d.value&&l.value?"100%":n.slim?"50%":"25%","777f9b48":d.value&&l.value?"100%":n.slim?"50%":"75%"}));const a=t.useSlots(),{i18n:{t:r,formatUnixTimeStamp:i}}=W.useI18n(),l=t.computed(()=>n.item.value!==void 0&&n.item.value!==null&&n.item.value!==""),c=t.computed(()=>!!(n.item.tooltip||a["label-tooltip"])),d=t.computed(()=>n.item.type===D.Json||n.item.type===D.JsonArray),s=t.computed(()=>n.item.type===D.JsonArray),u=t.computed(()=>{switch(n.item.type){case D.ID:return{tag:"CopyUuid",attrs:{"data-testid":`${n.item.key}-copy-uuid`,"success-tooltip":r("baseConfigCard.copy.success"),tooltip:r("baseConfigCard.copy.tooltip",{label:n.item.label}),truncated:!1,uuid:n.item.value,notify:()=>{}}};case D.IdArray:return{tag:"div",additionalComponent:"CopyUuid",childAttrs:{"success-tooltip":r("baseConfigCard.copy.success"),tooltip:r("baseConfigCard.copy.tooltip",{label:n.item.label}),truncated:!1,notify:()=>{}}};case D.Redacted:return{tag:"CopyUuid",attrs:{"data-testid":`${n.item.key}-copy-uuid-redacted`,format:"redacted","success-tooltip":r("baseConfigCard.copy.success"),tooltip:r("baseConfigCard.copy.tooltip",{label:n.item.label}),truncated:!1,uuid:n.item.value,notify:()=>{}}};case D.RedactedArray:return{tag:"div",additionalComponent:"CopyUuid",childAttrs:{format:"redacted","success-tooltip":r("baseConfigCard.copy.success"),tooltip:r("baseConfigCard.copy.tooltip",{label:n.item.label}),truncated:!1,notify:()=>{}}};case D.Date:return{tag:"div",attrs:{"data-testid":`${n.item.key}-date`},text:i(n.item.value)};case D.BadgeStatus:return{tag:"StatusBadge",attrs:{"data-testid":`${n.item.key}-badge-status`,status:n.item.value}};case D.BadgeTag:return{tag:"div",additionalComponent:"KBadge"};case D.BadgeMethod:return{tag:"div",additionalComponent:"KMethodBadge"};case D.LinkInternal:return{tag:"InternalLinkItem",attrs:{"data-testid":`${n.item.key}-internal-link`,item:n.item,onNavigationClick:p=>{o("navigation-click",p)}}};case D.LinkExternal:return{tag:"KExternalLink",attrs:{"data-testid":`${n.item.key}-external-link`,href:n.item.value},text:n.item.value};case D.Json:return{tag:"JsonCardItem",attrs:{"data-testid":`${n.item.key}-json-content`,item:n.item}};case D.JsonArray:return{tag:"div",additionalComponent:"JsonCardItem",attrs:{"data-testid":`${n.item.key}-json-array-content`,item:n.item}};default:return{tag:"div",attrs:{"data-testid":`${n.item.key}-plain-text`},text:n.item.value}}});return(p,h)=>{const k=t.resolveComponent("KLabel"),C=t.resolveComponent("KBadge"),b=t.resolveComponent("KMethodBadge");return t.openBlock(),t.createElementBlock("div",co,[t.createElementVNode("div",{class:"config-card-details-label","data-testid":`${e.item.key}-label`},[t.renderSlot(p.$slots,"label",{item:e.item},()=>[t.createVNode(k,{"tooltip-attributes":{maxWidth:"500px"}},t.createSlots({default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(e.item.label)+" ",1)]),_:2},[c.value?{name:"tooltip",fn:t.withCtx(()=>[t.createElementVNode("div",{"data-testid":`${e.item.key}-label-tooltip`},[t.renderSlot(p.$slots,"label-tooltip",{},()=>[t.createTextVNode(t.toDisplayString(e.item.tooltip),1)],!0)],8,uo)]),key:"0"}:void 0]),1024)],!0)],8,po),t.createElementVNode("div",{class:"config-card-details-value","data-testid":`${e.item.key}-property-value`},[t.renderSlot(p.$slots,e.item.key,{rowValue:e.item.value},()=>[l.value?(t.openBlock(),t.createElementBlock("div",yo,[(t.openBlock(),t.createBlock(t.resolveDynamicComponent(u.value.tag),t.normalizeProps(t.guardReactiveProps(u.value.attrs)),{default:t.withCtx(()=>[u.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,(f,m)=>(t.openBlock(),t.createBlock(C,{key:`${e.item.key}-badge-tag-${m}`,class:"config-badge","data-testid":`${e.item.key}-badge-tag-${m}`,"truncation-tooltip":f},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(f),1)]),_:2},1032,["data-testid","truncation-tooltip"]))),128))],8,go)):t.createCommentVNode("",!0),u.value.additionalComponent==="CopyUuid"?(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,(f,m)=>(t.openBlock(),t.createBlock(t.unref(dt),t.mergeProps(u.value.childAttrs,{key:`${e.item.key}-copy-uuid-${m}`,"data-testid":`${e.item.key}-copy-uuid-${m}`,uuid:f}),null,16,["data-testid","uuid"]))),128))],8,ho)):u.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,(f,m)=>(t.openBlock(),t.createBlock(b,{key:`${e.item.key}-badge-method-${m}`,class:"config-badge","data-testid":`${e.item.key}-badge-method-${m}`,"is-rounded":"",label:f,method:t.unref(Cn.MethodsArray).includes(f.toLowerCase())?f.toLowerCase():"custom"},{default:t.withCtx(()=>[t.createTextVNode(t.toDisplayString(f),1)]),_:2},1032,["data-testid","label","method"]))),128))],8,ko)):t.createCommentVNode("",!0),u.value.additionalComponent==="JsonCardItem"?(t.openBlock(),t.createElementBlock("div",{key:3,"data-testid":`${n.item.key}-json-array-content`},[(t.openBlock(!0),t.createElementBlock(t.Fragment,null,t.renderList(e.item.value,(f,m)=>(t.openBlock(),t.createBlock(pt,{key:`json-array-item-${m}`,index:m,"is-array-item":"",item:f},null,8,["index","item"]))),128))],8,bo)):(t.openBlock(),t.createElementBlock("span",{key:4,class:t.normalizeClass(["attrs-data-text",{truncated:e.truncated}]),title:e.truncated?e.item.value:void 0},t.toDisplayString(u.value.text),11,Co))]),_:1},16))])):(t.openBlock(),t.createElementBlock("div",{key:0,"data-testid":`${e.item.key}-no-value`}," – ",8,mo))],!0)],8,fo)])}}}),be=oe(So,[["__scopeId","data-v-a3c5ab01"]]);/*! js-yaml 4.1.0 https://github.com/nodeca/js-yaml @license MIT */function ft(e){return typeof e>"u"||e===null}function xo(e){return typeof e=="object"&&e!==null}function _o(e){return Array.isArray(e)?e:ft(e)?[]:[e]}function Bo(e,o){var n,a,r,i;if(o)for(i=Object.keys(o),n=0,a=i.length;n<a;n+=1)r=i[n],e[r]=o[r];return e}function Io(e,o){var n="",a;for(a=0;a<o;a+=1)n+=e;return n}function No(e){return e===0&&Number.NEGATIVE_INFINITY===1/e}var Ao=ft,Eo=xo,Vo=_o,To=Io,jo=No,$o=Bo,J={isNothing:Ao,isObject:Eo,toArray:Vo,repeat:To,isNegativeZero:jo,extend:$o};function mt(e,o){var n="",a=e.reason||"(unknown reason)";return e.mark?(e.mark.name&&(n+='in "'+e.mark.name+'" '),n+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!o&&e.mark.snippet&&(n+=`
2
2
 
3
3
  `+e.mark.snippet),a+" "+n):a}function Ce(e,o){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=o,this.message=mt(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack||""}Ce.prototype=Object.create(Error.prototype),Ce.prototype.constructor=Ce,Ce.prototype.toString=function(e){return this.name+": "+mt(this,e)};var X=Ce;function De(e,o,n,a,r){var i="",l="",c=Math.floor(r/2)-1;return a-o>c&&(i=" ... ",o=a-c+i.length),n-a>c&&(l=" ...",n=a+c-l.length),{str:i+e.slice(o,n).replace(/\t/g,"→")+l,pos:a-o+i.length}}function Le(e,o){return J.repeat(" ",o-e.length)+e}function Ko(e,o){if(o=Object.create(o||null),!e.buffer)return null;o.maxLength||(o.maxLength=79),typeof o.indent!="number"&&(o.indent=1),typeof o.linesBefore!="number"&&(o.linesBefore=3),typeof o.linesAfter!="number"&&(o.linesAfter=2);for(var n=/\r?\n|\r|\0/g,a=[0],r=[],i,l=-1;i=n.exec(e.buffer);)r.push(i.index),a.push(i.index+i[0].length),e.position<=i.index&&l<0&&(l=a.length-2);l<0&&(l=a.length-1);var c="",d,s,u=Math.min(e.line+o.linesAfter,r.length).toString().length,p=o.maxLength-(o.indent+u+3);for(d=1;d<=o.linesBefore&&!(l-d<0);d++)s=De(e.buffer,a[l-d],r[l-d],e.position-(a[l]-a[l-d]),p),c=J.repeat(" ",o.indent)+Le((e.line-d+1).toString(),u)+" | "+s.str+`
4
4
  `+c;for(s=De(e.buffer,a[l],r[l],e.position,p),c+=J.repeat(" ",o.indent)+Le((e.line+1).toString(),u)+" | "+s.str+`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kong-ui-public/entities-keys",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "type": "module",
5
5
  "main": "./dist/entities-keys.umd.js",
6
6
  "module": "./dist/entities-keys.es.js",
@@ -33,8 +33,8 @@
33
33
  "axios": "^1.5.1",
34
34
  "vue": "^3.3.4",
35
35
  "vue-router": "^4.2.5",
36
- "@kong-ui-public/copy-uuid": "^1.3.0",
37
- "@kong-ui-public/i18n": "^0.8.4"
36
+ "@kong-ui-public/i18n": "^0.8.4",
37
+ "@kong-ui-public/copy-uuid": "^1.3.0"
38
38
  },
39
39
  "repository": {
40
40
  "type": "git",
@@ -51,7 +51,7 @@
51
51
  "errorLimit": "486KB"
52
52
  },
53
53
  "dependencies": {
54
- "@kong-ui-public/entities-shared": "^1.5.0"
54
+ "@kong-ui-public/entities-shared": "^1.5.1"
55
55
  },
56
56
  "scripts": {
57
57
  "dev": "cross-env USE_SANDBOX=true vite",