1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8994],{95033:function(e,r,t){t.d(r,{y:function(){return C}});var o=t(67294),i=t(64761),n=t(48427),a=t(95117),s=(0,t(56817).k)((e,{color:r})=>({root:{backgroundColor:e.fn.themeColor(r,"dark"===e.colorScheme?5:2),color:"dark"===e.colorScheme?e.colors.dark[9]:"inherit"}})),l=t(64523),c=Object.defineProperty,d=Object.getOwnPropertySymbols,u=Object.prototype.hasOwnProperty,p=Object.prototype.propertyIsEnumerable,__defNormalProp=(e,r,t)=>r in e?c(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,__spreadValues=(e,r)=>{for(var t in r||(r={}))u.call(r,t)&&__defNormalProp(e,t,r[t]);if(d)for(var t of d(r))p.call(r,t)&&__defNormalProp(e,t,r[t]);return e},__objRest=(e,r)=>{var t={};for(var o in e)u.call(e,o)&&0>r.indexOf(o)&&(t[o]=e[o]);if(null!=e&&d)for(var o of d(e))0>r.indexOf(o)&&p.call(e,o)&&(t[o]=e[o]);return t};let h={color:"yellow"},y=(0,o.forwardRef)((e,r)=>{let t=(0,i.N4)("Mark",h,e),{color:n,className:a,unstyled:c,variant:d}=t,u=__objRest(t,["color","className","unstyled","variant"]),{classes:p,cx:y}=s({color:n},{unstyled:c,name:"Mark",variant:d});return o.createElement(l.x,__spreadValues({component:"mark",ref:r,className:y(p.root,a)},u))});function escapeRegex(e){return e.replace(/[-[\]{}()*+?.,\\^$|#]/g,"\\$&")}y.displayName="@mantine/core/Mark";var g=Object.defineProperty,_=Object.getOwnPropertySymbols,f=Object.prototype.hasOwnProperty,x=Object.prototype.propertyIsEnumerable,Highlight_defNormalProp=(e,r,t)=>r in e?g(e,r,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[r]=t,Highlight_spreadValues=(e,r)=>{for(var t in r||(r={}))f.call(r,t)&&Highlight_defNormalProp(e,t,r[t]);if(_)for(var t of _(r))x.call(r,t)&&Highlight_defNormalProp(e,t,r[t]);return e},Highlight_objRest=(e,r)=>{var t={};for(var o in e)f.call(e,o)&&0>r.indexOf(o)&&(t[o]=e[o]);if(null!=e&&_)for(var o of _(e))0>r.indexOf(o)&&x.call(e,o)&&(t[o]=e[o]);return t};let m={highlightColor:"yellow"},k=(0,o.forwardRef)((e,r)=>{let t=(0,i.N4)("Highlight",m,e),{children:n,highlight:s,highlightColor:l,highlightStyles:c,unstyled:d}=t,u=Highlight_objRest(t,["children","highlight","highlightColor","highlightStyles","unstyled"]),p=function(e,r){if(null==r)return[{chunk:e,highlighted:!1}];let t=Array.isArray(r)?r.map(escapeRegex):escapeRegex(r),o=Array.isArray(t)?t.filter(e=>e.trim().length>0).length>0:""!==t.trim();if(!o)return[{chunk:e,highlighted:!1}];let i="string"==typeof t?t.trim():t.filter(e=>0!==e.trim().length).map(e=>e.trim()).join("|"),n=RegExp(`(${i})`,"gi"),a=e.split(n).map(e=>({chunk:e,highlighted:n.test(e)})).filter(({chunk:e})=>e);return a}(n,s);return o.createElement(a.x,Highlight_spreadValues({unstyled:d,ref:r,__staticSelector:"Highlight"},u),p.map(({chunk:e,highlighted:r},t)=>r?o.createElement(y,{unstyled:d,key:t,color:l,sx:c,"data-highlight":e},e):o.createElement("span",{key:t},e)))});k.displayName="@mantine/core/Highlight";let C=(0,n.F)(k)},18060:function(e,r,t){t.d(r,{V:function(){return useClipboard}});var o=t(67294);function useClipboard({timeout:e=2e3}={}){let[r,t]=(0,o.useState)(null),[i,n]=(0,o.useState)(!1),[a,s]=(0,o.useState)(null),handleCopyResult=r=>{clearTimeout(a),s(setTimeout(()=>n(!1),e)),n(r)};return{copy:e=>{"clipboard"in navigator?navigator.clipboard.writeText(e).then(()=>handleCopyResult(!0)).catch(e=>t(e)):t(Error("useClipboard: navigator.clipboard is not supported"))},reset:()=>{n(!1),t(null),clearTimeout(a)},error:r,copied:i}}},39759:function(e,r,t){t.d(r,{c:function(){return useDebouncedValue}});var o=t(67294);function useDebouncedValue(e,r,t={leading:!1}){let[i,n]=(0,o.useState)(e),a=(0,o.useRef)(!1),s=(0,o.useRef)(null),l=(0,o.useRef)(!1),cancel=()=>window.clearTimeout(s.current);return(0,o.useEffect)(()=>{a.current&&(!l.current&&t.leading?(l.current=!0,n(e)):(cancel(),s.current=window.setTimeout(()=>{l.current=!1,n(e)},r)))},[e,t.leading,r]),(0,o.useEffect)(()=>(a.current=!0,cancel),[]),[i,cancel]}},93625:function(e,r,t){t.d(r,{Z:function(){return o}});var o=(0,t(30853).Z)("copy","IconCopy",[["path",{d:"M8 8m0 2a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2z",key:"svg-0"}],["path",{d:"M16 8v-2a2 2 0 0 0 -2 -2h-8a2 2 0 0 0 -2 2v8a2 2 0 0 0 2 2h2",key:"svg-1"}]])},21942:function(e,r,t){t.d(r,{Z:function(){return o}});var o=(0,t(30853).Z)("edit","IconEdit",[["path",{d:"M7 7h-1a2 2 0 0 0 -2 2v9a2 2 0 0 0 2 2h9a2 2 0 0 0 2 -2v-1",key:"svg-0"}],["path",{d:"M20.385 6.585a2.1 2.1 0 0 0 -2.97 -2.97l-8.415 8.385v3h3l8.385 -8.415z",ke
1y:"svg-1"}],["path",{d:"M16 5l3 3",key:"svg-2"}]])},79153:function(e,r,t){t.d(r,{Z:function(){return o}});var o=(0,t(30853).Z)("search","IconSearch",[["path",{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0",key:"svg-0"}],["path",{d:"M21 21l-6 -6",key:"svg-1"}]])},54775:function(e,r,t){t.d(r,{KH:function(){return i},NG:function(){return apiFetchOrgApiKeys},S8:function(){return apiPatchApiKey},ST:function(){return apiFetchPersonalApiKeys},hX:function(){return apiDeleteApiKey},tI:function(){return apiCreateApiKey}});var o,i,n=t(1448);(o=i||(i={})).CREATED_AT_ASC="CreatedAtAsc",o.CREATED_AT_DESC="CreatedAtDesc",o.EXPIRES_AT_ASC="ExpiresAtAsc",o.EXPIRES_AT_DESC="ExpiresAtDesc";let apiFetchPersonalApiKeys=async e=>{let{page_size:r,page_number:t,api_key_search:o,sort_by:i}=e,a={};t&&(a.page_number=t.toString()),r&&(a.page_size=r.toString()),o&&(a.api_key_search=o),i&&(a.sort_by=i);let s=await (0,n.A_)("/api/fe/v3/personal_api_keys",a);return s.ok?await s.json():Promise.reject("An unexpected error has occurred.")},apiFetchOrgApiKeys=async e=>{let{org_id:r,page_size:t,page_number:o,api_key_search:i,sort_by:a}=e,s={org_id:r};o&&(s.page_number=o.toString()),t&&(s.page_size=t.toString()),i&&(s.api_key_search=i),a&&(s.sort_by=a);let l=await (0,n.A_)("/api/fe/v3/org_api_keys",s);return l.ok?await l.json():Promise.reject("An unexpected error has occurred.")},apiCreateApiKey=async e=>{let{org_id:r=null,expiration_option:t,display_name:o}=e;return(0,n.j0)("/api/fe/v3/api_keys",{org_id:r,expiration_option:t,display_name:o||void 0}).then(e=>e.ok?e.json().then(e=>({success:!0,data:{api_key_token:e.api_key_token,api_key_id:e.api_key_id}})):400===e.status?e.json().then(e=>({success:!1,error_type:"invalid_request_fields",...e})):403===e.status||404===e.status?{success:!1,error_type:"forbidden",message:"Unable to create API key (forbidden)"}:401===e.status?(0,n.Yg)():(0,n.xo)())},apiPatchApiKey=async e=>{let{api_key_id:r,display_name:t}=e;return(0,n.Ll)("/api/fe/v3/api_keys/".concat(r),{display_name:t||void 0}).then(e=>e.ok?{success:!0}:400===e.status?e.json().then(e=>({success:!1,error_type:"invalid_request_fields",...e})):403===e.status||404===e.status?{success:!1,error_type:"forbidden",message:"Unable to create API key (forbidden)"}:401===e.status?(0,n.Yg)():(0,n.xo)())},apiDeleteApiKey=async e=>(0,n.Jl)("/api/fe/v1/api_keys/".concat(e),{}).then(e=>e.ok?{success:!0}:403===e.status?{success:!1,error_type:"forbidden",message:"Unable to delete API key (forbidden)"}:404===e.status?{success:!1,error_type:"key_not_found",message:"Unable to delete API key (API key not found)"}:401===e.status?(0,n.Yg)():(0,n.xo)())},28994:function(e,r,t){t.d(r,{Z:function(){return api_keys_ApiKeysTable}});var o,i,n=t(85893),a=t(64761),s=t(97564),l=t(20050),c=t(67841),d=t(80061),u=t(66137),p=t(91759),h=t(1177),y=t(79153),g=t(30853),_=(0,g.Z)("chevron-up","IconChevronUp",[["path",{d:"M6 15l6 -6l6 6",key:"svg-0"}]]),f=(0,g.Z)("selector","IconSelector",[["path",{d:"M8 9l4 -4l4 4",key:"svg-0"}],["path",{d:"M16 15l-4 4l-4 -4",key:"svg-1"}]]),x=t(67294),m=t(9673),k=t(81407),C=t(35864),v=t(10614),A=t(21942),b=t(46562),j=t(54070),S=t(5757),w=t(95117),E=t(20966),K=t(33575),P=t(11163),I=t(54775),R=t(1448),api_keys_ArchiveApiKeyModal=e=>{let{apiKey:r,...t}=e,{fns:{refreshApiKeys:o}}=(0,m.nB)(),i=(0,P.useRouter)(),[a,l]=(0,x.useState)(!1),archiveApiKey=async()=>{l(!0);let e=await (0,I.hX)(r.api_key_id);e.success?(await o(),K.N9.show({title:"Success",message:"API key revoked",color:"actionButtonColor.6"}),t.onClose()):"key_not_found"===e.error_type||"forbidden"===e.error_type?K.N9.show({title:"Failed to revoke API key",message:e.message,color:"errorButtonColor.6"}):"unauthorized"===e.error_type?(K.N9.show({title:"Error",message:"You must be logged in to perform this action. Redirecting to login...",color:"errorButtonColor.6"}),i.push("/login")):"unexpected_error"===e.error_type&&K.N9.show({title:"Error",message:R.aK,color:"errorButtonColor.6"}),l(!1)};return(0,n.jsxs)(S.u,{...t,title:"Revoke API key",children:[(0,n.jsxs)(w.x,{children:["Are you sure you want to revoke this API key?"," ",(0,n.jsx)(w.x,{span:!0,fw:600,children:"This action cannot be undone."})]}),(0,n.jsxs)(s.K,{py:"lg",spacing:0,children:[(0,n.jsx)(w.x,{children:"API Key:"}),(0,n.jsxs)(w.x,{span:!0,fw:600,children:[r.api_key_id,"..."]})]}),(0,n.jsxs)(u.Z,{grow:!0,mt:"lg",children:[(0,n.jsx)(c.z,{variant:j.Bq.SidebarOutline,onClick:t.onClose,children:"Cancel"}),(0,n.jsx)(c.z,{variant:j.Bq.SidebarDangerSolid,onClick:archiveApiKey,children:a?(0,n.jsx)(E.a,{size:"sm",color:j.xR.ErrorButtonColor}):"Revoke key"})]})]})},T=t(77248),api_keys_EditApiKeyModal=e=>{let{apiKey:r,...t}=e,{fns:{refreshApiKeys:o}}=(0,m.nB)(),i=(0,P.useRouter)(),[a,l]=(0,x.useState)(!1),p=(0,T.c)({initialValues:{display_name:r.display_name||""},validate:{display_name:e=>{let r=e.trim();return r?null:"API key name is required"}},transformValues:e=>({...e,display_name:e.display_name.trim()})}),h=p.values.display_name!==(r.display_name||"");(0,x.useEffect)(()=>{t.opened&&(p.setValues({display_name:r.display_name||""}),p.clearErrors())},[t.opened,r.display_name]);let handleSubmit=async e=>{if(a)return;l(!0);let n=await (0,I.S8)({api_key_id:r.api_key_id,display_name:e.display_name});n.success?(await o(),K.N9.show({title:"Success",message:"API key updated",color:"actionButtonColor.6"}),t.onClose()):"invalid_request_fields"===n.error_type?p.setFieldError("display_name",n.user_facing_errors.display_name):"forbidden"===n.error_type?(K.N9.show({title:"Error",message:n.message,color:"errorButtonColor.6"}),t.onClose()):"unauthorized"===n.error_type?(K.N9.show({title:"Error",message:"You must be logged in to perform this action. Redirecting to login...",color:"errorButtonColor.6"}),t.onClose(),i.push("/login")):(K.N9.show({title:"Error",message:R.aK,color:"errorButtonColor.6"}),t.onClose()),l(!1)};return(0,n.jsx)(S.u,{...t,title:"Edit API key",children:(0,n.jsx)("form",{onSubmit:p.onSubmit(handleSubmit),children:(0,n.jsxs)(s.K,{children:[(0,n.jsxs)(s.K,{spacing:0,children:[(0,n.jsx)(w.x,{children:"API Key ID:"}),(0,n.jsx)(w.x,{span:!0,fw:600,children:r.api_key_id})]}),(0,n.jsxs)(s.K,{spacing:0,children:[(0,n.jsx)(w.x,{children:"API Key Name"}),(0,n.jsx)(d.o,{variant:j.kI.Sidebar,...p.getInputProps("display_name")})]}),(0,n.jsxs)(u.Z,{grow:!0,mt:"lg",children:[(0,n.jsx)(c.z,{variant:j.Bq.SidebarOutline,onClick:t.onClose,type:"button",children:"Cancel"}),(0,n.jsx)(c.z,{type:"submit",disabled:!h||a,children:a?(0,n.jsx)(E.a,{size:"sm"}):"Save"})]})]})})})},api_keys_ApiKeyActionMenu=e=>{let{apiKey:r}=e,t=(0,a.rZ)(),[o,{open:i,close:s}]=(0,p.q)(),[l,{open:d,close:u}]=(0,p.q)();return(0,n.jsxs)(C.v,{withinPortal:!0,position:"bottom-end",children:[(0,n.jsx)(C.v.Target,{children:(0,n.jsx)(c.z,{variant:j.Bq.Subtle,p:"md",children:(0,n.jsx)(v.Z,{})})}),(0,n.jsxs)(C.v.Dropdown,{children:[(0,n.jsx)(C.v.Item,{icon:(0,n.jsx)(A.Z,{size:t.other.iconSizes.lg}),onClick:d,children:"Edit name"}),(0,n.jsx)(C.v.Item,{sx:{color:t.colors.errorButtonColor[6],"&:hover":{backgroundColor:t.fn.rgba(t.colors.errorButtonColor[6],.1)}},icon:(0,n.jsx)(b.Z,{size:t.other.iconSizes.lg}),onClick:i,children:"Revoke API key"})]}),(0,n.jsx)(api_keys_EditApiKeyModal,{apiKey:r,centered:!0,withCloseButton:!1,opened:l,onClose:u}),(0,n.jsx)(api_keys_ArchiveApiKeyModal,{apiKey:r,centered:!0,withCloseButton:!1,opened:o,onClose:s})]})},N=t(95033),api_keys_ApiKeyIdCell=e=>{let{apiKeyId:r,search:t=""}=e;return(0,n.jsx)(N.y,{fw:500,highlight:t,color:"mainTextColor.6",highlightStyles:e=>({backgroundColor:e.fn.lighten(e.colors.actionButtonColor[6],.4),borderRadius:e.radius.sm}),children:"".concat(r,"...")})},api_keys_ApiKeyNameCell=e=>{let{apiKeyName:r}=e;return(0,n.jsx)(w.x,{color:"mainTextColor.6",ml:r?0:8,children:r||"â"})},z=t(28855),B=t(40423),O=t(40102),api_keys_GenerateApiKeyModal=e=>{let{apiKeyConfig:r,orgId:t,fns:{refreshApiKeys:o}}=(0,m.nB)(),i=(0,P.useRouter)(),[a,l]=(0,x.useState)(!1),[p,h]=(0,x.useState)(!1),[y,g]=(0,x.useState)(!1),[_,f]=(0,x.useState)(""),[k,C]=(0,x.useState)(r.expiration_options.default),v=Object.keys(B.wP).filter(e=>r.expiration_options.options[e]).map(e=>({value:e,label:B.wP[e]})),[A,b]=(0,x.useState)(""),[T,N]=(0,x.useState)(null),Z=(0,x.useCallback)(()=>{b(""),f(""),g(!1),l(!1),h(!1),e.onClose()},[e]),M=(0,x.useCallback)(async()=>
1{l(!0);let e=await (0,I.tI)({org_id:t||null,expiration_option:k,display_name:A});e.success?(f(e.data.api_key_token),await o()):"invalid_request_fields"===e.error_type?N(e.user_facing_errors.display_name):"forbidden"===e.error_type?(K.N9.show({title:"Error",message:e.message,color:"errorButtonColor.6"}),Z()):"unauthorized"===e.error_type?(K.N9.show({title:"Error",message:"You must be logged in to perform this action. Redirecting to login...",color:"errorButtonColor.6"}),Z(),i.push("/login")):(K.N9.show({title:"Error",message:R.aK,color:"errorButtonColor.6"}),Z()),l(!1)},[o,k,Z,t,A]);(0,x.useEffect)(()=>{let r=e.opened&&0===_.length&&!a&&1===v.length;r&&M()},[_.length,v,Z,M,a,e.opened,t]);let F=!a&&0===_.length,D=!a&&_.length>0;return(0,n.jsxs)(S.u,{...e,title:"New ".concat(t?"Organization":"Personal"," API Key"),children:[F&&(0,n.jsxs)(s.K,{children:[(0,n.jsx)(w.x,{mt:"lg",children:"API Key Name (Optional)"}),(0,n.jsx)(d.o,{variant:j.kI.Sidebar,value:A,onChange:e=>{b(e.target.value),N(null)},error:T}),(0,n.jsx)(w.x,{mt:"lg",children:"When should this API key expire?"}),(0,n.jsx)(z.Ph,{withinPortal:!0,variant:j.kI.Sidebar,value:k,data:v,onChange:e=>{e&&Object.keys(B.wP).includes(e)&&C(e)}}),(0,n.jsxs)(u.Z,{w:"100%",grow:!0,noWrap:!0,mt:"lg",children:[(0,n.jsx)(c.z,{variant:j.Bq.SidebarOutline,onClick:Z,children:"Cancel"}),(0,n.jsx)(c.z,{onClick:M,children:a?(0,n.jsx)(E.a,{}):"Create"})]})]}),D&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)(w.x,{children:["Your API key has been successfully created."," ",(0,n.jsx)(w.x,{span:!0,fw:600,children:"Be sure to copy it now, you will not be able to view it again."})]}),(0,n.jsxs)(s.K,{my:"lg",spacing:0,children:[(0,n.jsx)(w.x,{children:"API Key:"}),y?(0,n.jsx)(u.Z,{w:"100%",children:(0,n.jsx)(w.x,{sx:{overflowWrap:"anywhere"},fw:600,children:_})}):(0,n.jsx)(O.v,{variant:j.kI.Sidebar,value:_,onCopy:()=>h(!0),children:(0,n.jsx)(w.x,{children:_})})]}),(0,n.jsxs)(s.K,{mt:"xl",children:[(0,n.jsx)(c.z,{disabled:!p&&!y,onClick:Z,children:"Done"}),!y&&(0,n.jsx)(c.z,{variant:j.Bq.SidebarSubtle,onClick:()=>{g(!0)},children:"Manually copy API key"})]})]})]})},Z=t(72908),M=t(14835);(o=i||(i={})).Created="created",o.Expires="expires";var api_keys_ApiKeysTable=()=>{let{isLoading:e,apiKeys:r,sortStatus:t,search:o,hasMoreResults:i,totalApiKeys:g,pageNumber:C,fns:{setSortStatus:v,setSearch:A,setPageNumber:b}}=(0,m.nB)(),j=(0,a.rZ)(),[S,w]=(0,x.useState)([]),[E,K]=(0,x.useState)([]),[P,{open:I,close:R}]=(0,p.q)(),toggleFull=(e,r)=>{let t="created"===r,o=t?S:E;(t?w:K)(o.includes(e)?o.filter(r=>r!==e):[...o,e])},isFull=(e,r)=>("created"===r?S:E).includes(e);return(0,n.jsxs)(s.K,{spacing:"lg",children:[(0,n.jsxs)(l.r,{children:[(0,n.jsx)(l.r.Col,{sm:4,md:2,children:(0,n.jsx)(c.z,{leftIcon:(0,n.jsx)(h.Z,{size:j.other.iconSizes.lg}),onClick:I,children:"New API key"})}),(0,n.jsx)(l.r.Col,{sm:8,offsetMd:2,children:(0,n.jsx)(d.o,{icon:(0,n.jsx)(y.Z,{size:j.other.iconSizes.lg}),placeholder:"Search by API key",value:o,onChange:e=>A(e.target.value)})})]}),(0,n.jsx)(Z.Z,{data:r,totalDataRecords:g,hasMoreResults:i,dataPage:C,setDataPage:b,isLoading:e,noRecordsText:"No API keys found",searchQuery:o,columns:[{accessor:"api_key_id",title:"API Key",render:e=>(0,n.jsx)(u.Z,{position:"left",ml:"lg",children:(0,n.jsx)(api_keys_ApiKeyIdCell,{apiKeyId:e.api_key_id,search:o})}),width:"25%"},{accessor:"display_name",title:"Name",render:e=>(0,n.jsx)(api_keys_ApiKeyNameCell,{apiKeyName:e.display_name}),width:"25%"},{accessor:k.Z.CREATED_AT,title:"Created",render:e=>(0,n.jsx)(M.Z,{isPast:!0,seconds:e.created_at,isFull:isFull(e.api_key_id,"created"),toggleFull:()=>toggleFull(e.api_key_id,"created")}),width:"20%",sortable:!0},{accessor:k.Z.EXPIRES_AT,title:"Expires",render:e=>(0,n.jsx)(M.Z,{seconds:e.expires_at_seconds,isFull:isFull(e.api_key_id,"expires"),toggleFull:()=>toggleFull(e.api_key_id,"expires")}),width:"20%",sortable:!0},{accessor:"index",title:"",width:"10%",textAlignment:"right",render:e=>(0,n.jsx)(u.Z,{position:"right",mr:"md",children:(0,n.jsx)(api_keys_ApiKeyActionMenu,{apiKey:e})})}],sortStatus:t,onSortStatusChange:v,sortIcons:{sorted:(0,n.jsx)(_,{size:j.other.iconSizes.lg}),unsorted:(0,n.jsx)(f,{size:j.other.iconSizes.lg})}}),(0,n.jsx)(api_keys_GenerateApiKeyModal,{opened:P,onClose:R,centered:!0,closeOnClickOutside:!1,closeOnEscape:!1,withCloseButton:!1})]})}},40102:function(e,r,t){t.d(r,{v:function(){return CopyTextValue}});var o=t(85893),i=t(56817),n=t(58404),a=t(71298),s=t(64761),l=t(64523),c=t(95117
1),d=t(88393),u=t(49834),p=t(18060),h=t(88198),y=t(93625),g=t(54070),_=t(95427);let f=(0,i.k)((e,r)=>{let{expand:t,canHighlight:o,copied:i,iconAlignment:s,iconPosition:l,withBackground:c,fitContent:d,fontSize:u,label:p,variant:h,onlyOneLine:y}=r,f=g.xR.MainBackgroundColor,x=g.xR.MainTextColor,m=g.xR.ActionButtonColor;switch(h){case g.kI.Login:f=g.xR.LoginForegroundColor,x=g.xR.LoginForegroundTextColor,m=g.xR.LoginSuccessButtonColor;break;case g.kI.Sidebar:f=g.xR.SidebarBackgroundColor,x=g.xR.SidebarTextColor}return{root:{display:"flex",flexDirection:"column",alignItems:"flex-start",justifyContent:"flex-start",width:d?"fit-content":"100%",maxWidth:"100%",...y&&{whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}},inner:{display:"flex",flexDirection:"row",alignItems:"top"===s?"flex-start":"center",justifyContent:"flex-start",width:"100%",cursor:o?"standard":"pointer",padding:c?e.spacing.md:0,paddingRight:c?"left"===l?e.spacing.lg:e.spacing.md:0,paddingLeft:c?"right"===l?e.spacing.lg:e.spacing.md:0,marginTop:c&&p?e.spacing.sm:0,border:c?"1px solid ".concat((0,_.tv)(e,h)):"none",borderRadius:e.radius.md,backgroundColor:c?e.colors[f][6]:"transparent","&:hover":{backgroundColor:c?o?e.colors[f][6]:e.fn.darken(e.colors[f][6],.1):"transparent"},["&:hover .".concat((0,n.A)("text"))]:{color:o||c?e.colors[x][6]:e.fn.lighten(e.colors[x][6],.4)},["&:hover .".concat((0,n.A)("icon"))]:{color:i?e.colors[m][6]:o||c?e.colors[x][6]:e.fn.lighten(e.colors[x][6],.4)}},label:{fontSize:e.fontSizes.sm,fontWeight:500,cursor:"default"},text:{ref:(0,n.A)("text"),fontSize:(0,a.px)(u),fontWeight:500,fontFamily:e.fontFamily,overflow:t?"visible":"hidden",overflowWrap:t?"anywhere":"normal",textOverflow:t?"visible":"ellipsis",width:"100%",cursor:o?"text":"pointer",color:e.colors[x][6]},icon:{ref:(0,n.A)("icon"),color:i?e.colors[m][6]:e.colors[x][6],backgroundColor:"transparent",marginRight:"left"===l&&o?e.spacing.md:e.spacing.sm,width:"fit-content","&:hover":{backgroundColor:o?c?e.fn.rgba(e.colors[f][6],.1):e.colors[f][6]:"transparent"}}}});function CopyTextValue(e){let{value:r,expand:t=!1,canHighlight:i=!1,iconAlignment:n="center",iconPosition:a="left",timeout:_=1e3,withBackground:x=!1,fitContent:m=!1,fontSize:k=16,label:C,variant:v=g.kI.Main,onlyOneLine:A=!1,...b}=e,j=(0,p.V)({timeout:_}),{classes:S}=f({expand:t,canHighlight:i,copied:j.copied,iconAlignment:n,iconPosition:a,withBackground:x,fitContent:m,fontSize:k,label:C,variant:v,onlyOneLine:A}),w=(0,s.rZ)(),copyValue=()=>{j.copy(r),b.onCopy&&b.onCopy()},E=v===g.kI.Main?g.kI.Sidebar:v;return(0,o.jsxs)(l.x,{className:S.root,...b,children:[C&&(0,o.jsx)(c.x,{className:S.label,children:C}),(0,o.jsx)(d.u.Floating,{variant:E,label:j.copied?"Copied":"Copy",disabled:i,children:(0,o.jsxs)(l.x,{className:S.inner,onClick:()=>{i||copyValue()},children:["right"===a&&(0,o.jsx)(c.x,{className:"".concat(S.text," ph-no-capture"),children:r}),(0,o.jsx)(d.u.Floating,{variant:E,label:j.copied?"Copied":"Copy",disabled:!i,children:(0,o.jsx)(u.A,{className:S.icon,onClick:()=>{i&©Value()},children:j.copied?(0,o.jsx)(h.Z,{size:w.other.iconSizes.lg}):(0,o.jsx)(y.Z,{size:w.other.iconSizes.lg})})}),"left"===a&&(0,o.jsx)(c.x,{className:"".concat(S.text," ph-no-capture"),children:r})]})})]})}},14835:function(e,r,t){var o=t(85893),i=t(67841),n=t(95117),a=t(69695),s=t.n(a),l=t(30120);r.Z=e=>{let{seconds:r,isPast:t=!1,isFull:a,toggleFull:c,fontSize:d}=e,u=l.ou.fromSeconds(r||0),p=u.diffNow().as("milliseconds"),h=u.toLocaleString({year:"numeric",month:"short",day:"numeric"}),y=s()(p,{largest:1,round:!0}),g=h.concat(" (".concat(t?"":"in ").concat(y).concat(t?" ago":"",")")),_=u.toRFC2822()||"",f=null===r;return(0,o.jsx)(i.z,{sx:e=>({padding:0,margin:0,backgroundColor:"transparent",border:"none",cursor:f?"default":"pointer",color:e.colors.mainTextColor[6],"&:hover":{color:e.fn.lighten(e.colors.mainTextColor[6],f?0:.4),backgroundColor:"transparent"}}),fw:500,onClick:c,children:(0,o.jsx)(n.x,{fw:500,size:d,suppressHydrationWarning:!0,children:f?"Never":a?_:g})})}},9673:function(e,r,t){t.d(r,{OV:function(){return ApiKeysContextProvider},_V:function(){return i},nB:function(){return useApiKeys}});var o,i,n=t(85893),a=t(39759),s=t(30202),l=t(78551),c=t(67294),d=t(54775),u=t(86093),p=t(81407);(o=i||(i={})).ORG="org",o.PERSONAL="personal";let h=(0,c.createContext)(null),useApiKeys=()=>{let e=(0,c.useContext)(h);if(!e)throw Error("apiKeysContext: No value provided");return e},ApiKeysContextProvider=e=>{var r,t,o,i;let{type:y,pageConfig:g,children:_}=e,f="org"===y?null===(r=g.selected_org)||void 0===r?void 0:r.id:void 0,x=(0,s.NL)(),[m,k]=(0,c.useState)(1),[C,v]=(0,c.useState)(""),[A]=(0,a.c)(C,250),[b,j]=(0,c.useState)({columnAccessor:p.Z.CREATED_AT,direction:"desc"}),fetchApiKeys=async()=>{let e={page_number:m-1,api_key_search:A,sort_by:(0,p.K)(b)};return f?await (0,d.NG)({org_id:f,...e}):await (0,d.ST)(e)},refreshApiKeys=async()=>{await x.refetchQueries({queryKey:[y,f]})},{data:S,isLoading:w,isError:E}=(0,l.a)({queryFn:fetchApiKeys,queryKey:[y,f,m,A,b],refetchOnWindowFocus:!1,gcTime:0}),K=w||C!==A;return((0,c.useEffect)(()=>{k(1)},[A,b]),(0,c.useEffect)(()=>{!K&&(null==S?void 0:S.api_keys.length)===0&&m>1&&k(e=>e-1)}
1,[K,null==S?void 0:S.api_keys,m]),E)?(0,n.jsx)(u.Z,{children:"Failed to load API keys. Reload the page to try again."}):(0,n.jsx)(h.Provider,{value:{isLoading:K,orgId:f,apiKeys:null!==(t=null==S?void 0:S.api_keys)&&void 0!==t?t:[],totalApiKeys:null!==(o=null==S?void 0:S.total_api_keys)&&void 0!==o?o:0,pageNumber:m,hasMoreResults:null!==(i=null==S?void 0:S.has_more_results)&&void 0!==i&&i,search:C,sortStatus:b,apiKeyConfig:g.api_key_config,fns:{setPageNumber:k,setSearch:v,setSortStatus:j,refreshApiKeys}},children:_})}},81407:function(e,r,t){t.d(r,{K:function(){return sortStatusToSortBy},Z:function(){return i}});var o,i,n=t(54775);(o=i||(i={})).CREATED_AT="created_at",o.EXPIRES_AT="expires_at_seconds";let sortStatusToSortBy=e=>{switch(e.columnAccessor){case"created_at":if("asc"===e.direction)return n.KH.CREATED_AT_ASC;return n.KH.CREATED_AT_DESC;case"expires_at_seconds":if("asc"===e.direction)return n.KH.EXPIRES_AT_ASC;return n.KH.EXPIRES_AT_DESC;default:return n.KH.CREATED_AT_DESC}}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.