1import{J as V}from"./ActionMessage.d1ad8f77.js";import{J as x}from"./ActionSection.84334e87.js";import{B as L}from"./Button.17ac716b.js";import{M as N}from"./Modal.6534071c.js";import{_ as y}from"./_plugin-vue_export-helper.cdc0426e.js";import{d as A,o as l,c as E,w as o,a as s,e as f,r as a,f as m,b as i,g as p,h as r,F as g,i as h,t as c,n as _}from"./app.127da53e.js";import{J as U}from"./DangerButton.cb9cb59a.js";import{J as z}from"./DialogModal.3fa3ceb4.js";import{J as W}from"./FormSection.f862d041.js";import{J as X}from"./Input.e8795a60.js";import{C as Y}from"./Checkbox.68cfdd57.js";import{X as q}from"./InputError.1f47e52f.js";import{J as G}from"./Label.e8e69642.js";import{J as H}from"./SecondaryButton.b5524654.js";import{J as K}from"./SectionBorder.c5066e24.js";import"./SectionTitle.38b30003.js";const O=A({emits:["close"],components:{Modal:N},props:{show:{default:!1},maxWidth:{default:"2xl"},closeable:{default:!0}},methods:{close(){this.$emit("close")}}}),Q={class:"bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4"},R={class:"sm:flex sm:items-start"},Z=s("div",{class:"mx-auto shrink-0 flex items-center justify-center h-12 w-12 rounded-full bg-red-100 sm:mx-0 sm:h-10 sm:w-10"},[s("svg",{class:"h-6 w-6 text-red-600",stroke:"currentColor",fill:"none",viewBox:"0 0 24 24"},[s("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})])],-1),ee={class:"mt-3 text-center sm:mt-0 sm:ml-4 sm:text-left"},oe={class:"text-lg"},te={class:"mt-2"},se={class:"flex flex-row justify-end px-6 py-4 bg-gray-100 text-right"};function ne(e,n,$,F,j,C){const u=a("modal");return l(),E(u,{show:e.show,"max-width":e.maxWidth,closeable:e.closeable,onClose:e.close},{default:o(()=>[s("div",Q,[s("div",R,[Z,s("div",ee,[s("h3",oe,[f(e.$slots,"title")]),s("div",te,[f(e.$slots,"content")])])])]),s("div",se,[f(e.$slots,"footer")])]),_:3},8,["show","max-width","closeable","onClose"])}const ie=y(O,[["render",ne]]),re=A({components:{JetActionMessage:V,JetActionSection:x,JetButton:L,JetConfirmationModal:ie,JetDangerButton:U,JetDialogModal:z,JetFormSection:W,JetInput:X,JetCheckbox:Y,JetInputError:q,JetLabel:G,JetSecondaryButton:H,JetSectionBorder:K},props:["tokens","availablePermissions","defaultPermissions"],data(){return{createApiTokenForm:this.$inertia.form({name:"",permissions:this.defaultPermissions}),updateApiTokenForm:this.$inertia.form({permissions:[]}),deleteApiTokenForm:this.$inertia.form(),displayingToken:!1,managingPermissionsFor:null,apiTokenBeingDeleted:null}},methods:{createApiToken(){this.createApiTokenForm.post(route("api-tokens.store"),{preserveScroll:!0,onSuccess:()=>{this.displayingToken=!0,this.createApiTokenForm.reset()}})},manageApiTokenPermissions(e){this.updateApiTokenForm.permissions=e.abilities,this.managingPermissionsFor=e},updateApiToken(){this.updateApiTokenForm.put(route("api-tokens.update",this.managingPermissionsFor),{preserveScroll:!0,preserveState:!0,onSuccess:()=>this.managingPermissionsFor=null})},confirmApiTokenDeletion(e){this.apiTokenBeingDeleted=e},deleteApiToken(){this.deleteApiTokenForm.delete(route("api-tokens.destroy",this.apiTokenBeingDeleted),{preserveScroll:!0,preserveState:!0,onSuccess:()=>this.apiTokenBeingDeleted=null})}}}),ae={class:"col-span-6 sm:col-span-4"},le={key:0,class:"col-span-6"},me={class:"mt-2 grid grid-cols-1 md:grid-cols-2 gap-4"},de={class:"flex items-center"},pe={class:"ml-2 text-sm text-gray-600"},ce={key:0},ue={class:"mt-10 sm:mt-0"},ke={class:"space-y-6"},fe={class:"flex items-center"},ge={key:0,class:"text-sm text-gray-400"},he=["onClick"],_e=["onClick"],ve=s("div",null," Please copy your new API token. For your security, it won't be shown again. ",-1),Te={key:0,class:"mt-4 bg-gray-100 px-4 py-2 rounded font-mono text-sm text-gray-500"},be={class:"grid grid-cols-1 md:grid-cols-2 gap-4"},ye={class:"flex items-center"},Ae={class:"ml-2 text-sm text-gray-600"};function $e(e,n,$,F,j,C){const u=a("jet-label"),w=a("jet-input"),P=a("jet-input-error"),v=a("jet-checkbox"),J=a("jet-action-message"),T=a("jet-button"),B=a("jet-form-section"),S=a("jet-section-border"),D=a("jet-action-section"),k=a("jet-secondary-button"),b=a("jet-dialog-modal"),I=a("jet-danger-button"),M=a("jet-confirmation-modal");return l(),m("div",null,[i(B,{onSubmitted:e.createApiToken},{title:o(()=>[r(" Create API Token ")]),description:o(()=>[r(" API tokens allow third-party services to authenticate with our application on your behalf. ")]),form:o(()=>[s("div",ae,[i(u,{for:"name",value:"name_field"}),i(w,{id:"name",type:"text",class:"mt-1 block w-full",modelValue:e.createApiTokenForm.name,"onUpdate:modelValue":n[0]||(n[0]=t=>e.createApiTokenForm.name=t),autofocus:""},null,8,["modelValue"]),i(P,{message:e.createApiTokenForm.errors.name,class:"mt-2"},null,8,["message"])]),e.availablePermissions.length>0?(l(),m("div",le,[i(u,{for:"permissions",value:"Permissions"}),s("div",me,[(l(!0),m(g,null,h(e.availablePermissions,t=>(l(),m("div",{key:t},[s("label",de,[i(v,{value:t,checked:e.createApiTokenForm.permissions,"onUpdate:checked":n[1]||(n[1]=d=>e.createApiTokenForm.permissions=d)},null,8,["value","checked"]),s("span",pe,c(t),1)])]))),128))])])):p("",!0)]),actions:o(()=>[i(J,{on:e.createApiTokenForm.recentlySuccessful,class:"mr-3"},{default:o(()=>[r(" Created. ")]),_:1},8,["on"]),i(T,{class:_({"opacity-25":e.createApiTokenForm.processing}),disabled:e.createApiTokenForm.processing},{default:o(()=>[r(" Create ")]),_:1},8,["class","disabled"])]),_:1},8,["onSubmitted"]),e.tokens.length>0?(l(),m("div",ce,[i(S),s("div",ue,[i(D,null,{title:o(()=>[r(" Manage api_tokens ")]),description:o(()=>[r(" You may delete any of your existing tokens if they are no longer needed. ")]),content:o(()=>[s("div",ke,[(l(!0),m(g,null,h(e.tokens,t=>
1(l(),m("div",{class:"flex items-center justify-between",key:t.id},[s("div",null,c(t.name),1),s("div",fe,[t.last_used_ago?(l(),m("div",ge," Last used "+c(t.last_used_ago),1)):p("",!0),e.availablePermissions.length>0?(l(),m("button",{key:1,class:"cursor-pointer ml-6 text-sm text-gray-400 underline",onClick:d=>e.manageApiTokenPermissions(t)}," Permissions ",8,he)):p("",!0),s("button",{class:"cursor-pointer ml-6 text-sm text-red-500",onClick:d=>e.confirmApiTokenDeletion(t)}," Delete ",8,_e)])]))),128))])]),_:1})])])):p("",!0),i(b,{show:e.displayingToken,onClose:n[3]||(n[3]=t=>e.displayingToken=!1)},{title:o(()=>[r(" API Token ")]),content:o(()=>[ve,e.$page.props.jetstream.flash.token?(l(),m("div",Te,c(e.$page.props.jetstream.flash.token),1)):p("",!0)]),footer:o(()=>[i(k,{onClick:n[2]||(n[2]=t=>e.displayingToken=!1)},{default:o(()=>[r(" Close ")]),_:1})]),_:1},8,["show"]),i(b,{show:e.managingPermissionsFor,onClose:n[6]||(n[6]=t=>e.managingPermissionsFor=null)},{title:o(()=>[r(" API Token Permissions ")]),content:o(()=>[s("div",be,[(l(!0),m(g,null,h(e.availablePermissions,t=>(l(),m("div",{key:t},[s("label",ye,[i(v,{value:t,checked:e.updateApiTokenForm.permissions,"onUpdate:checked":n[4]||(n[4]=d=>e.updateApiTokenForm.permissions=d)},null,8,["value","checked"]),s("span",Ae,c(t),1)])]))),128))])]),footer:o(()=>[i(k,{onClick:n[5]||(n[5]=t=>e.managingPermissionsFor=null)},{default:o(()=>[r(" Cancel ")]),_:1}),i(T,{class:_(["ml-3",{"opacity-25":e.updateApiTokenForm.processing}]),onClick:e.updateApiToken,disabled:e.updateApiTokenForm.processing},{default:o(()=>[r(" Save ")]),_:1},8,["onClick","class","disabled"])]),_:1},8,["show"]),i(M,{show:e.apiTokenBeingDeleted,onClose:n[8]||(n[8]=t=>e.apiTokenBeingDeleted=null)},{title:o(()=>[r(" Delete API Token ")]),content:o(()=>[r(" Are you sure you would like to delete this API token? ")]),footer:o(()=>[i(k,{onClick:n[7]||(n[7]=t=>e.apiTokenBeingDeleted=null)},{default:o(()=>[r(" Cancel ")]),_:1}),i(I,{class:_(["ml-3",{"opacity-25":e.deleteApiTokenForm.processing}]),onClick:e.deleteApiToken,disabled:e.deleteApiTokenForm.processing},{default:o(()=>[r(" Delete ")]),_:1},8,["onClick","class","disabled"])]),_:1},8,["show"])])}const Ue=y(re,[["render",$e]]);export{Ue as default};
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.