(()=>{"use strict";var e,n={19904:(e,n,i)=>{var r=i(81222),o=i(85471),a=i(19051),l=i(87485),c=i(63814),s=i(74095),d=i(31133),u=i(88837),h=i(82182);const p={name:"EyeOutlineIcon",emits:["click"],props:{title:{type:String},fillColor:{type:String,default:"currentColor"},size:{type:Number,default:24}}};var A=i(14486);const m=(0,A.A)(p,function(){var t=this,e=t._self._c;return e("span",t._b({staticClass:"material-design-icon eye-outline-icon",attrs:{"aria-hidden":t.title?null:"true","aria-label":t.title,role:"img"},on:{click:function(e){return t.$emit("click",e)}}},"span",t.$attrs,!1),[e("svg",{staticClass:"material-design-icon__svg",attrs:{fill:t.fillColor,width:t.size,height:t.size,viewBox:"0 0 24 24"}},[e("path",{attrs:{d:"M12,9A3,3 0 0,1 15,12A3,3 0 0,1 12,15A3,3 0 0,1 9,12A3,3 0 0,1 12,9M12,4.5C17,4.5 21.27,7.61 23,12C21.27,16.39 17,19.5 12,19.5C7,19.5 2.73,16.39 1,12C2.73,7.61 7,4.5 12,4.5M3.18,12C4.83,15.36 8.24,17.5 12,17.5C15.76,17.5 19.17,15.36 20.82,12C19.17,8.64 15.76,6.5 12,6.5C8.24,6.5 4.83,8.64 3.18,12Z"}},[t.title?e("title",[t._v(t._s(t.title))]):t._e()])])])},[],!1,null,null,null).exports,f={name:"OAuthItem",components:{Delete:i(37793).A,NcButton:s.A,EyeOutline:m},props:{client:{type:Object,required:!0}},data(){return{id:this.client.id,name:this.client.name,redirectUri:this.client.redirectUri,clientId:this.client.clientId,clientSecret:this.client.clientSecret,renderSecret:!1}},computed:{renderedSecret(){return this.renderSecret?this.clientSecret:"****"},toggleAriaLabel(){return this.renderSecret?t("oauth2","Hide client secret"):t("oauth2","Show client secret")}},methods:{toggleSecret(){this.renderSecret=!this.renderSecret}}};var C=i(85072),v=i.n(C),g=i(97825),y=i.n(g),b=i(77659),x=i.n(b),S=i(55056),_=i.n(S),N=i(10540),w=i.n(N),O=i(41113),k=i.n(O),U=i(61726),B={};B.styleTagTransform=k(),B.setAttributes=_(),B.insert=x().bind(null,"head"),B.domAPI=y(),B.insertStyleElement=w(),v()(U.A,B),U.A&&U.A.locals&&U.A.locals;const I={name:"App",components:{OAuthItem:(0,A.A)(f,function(){var t=this,e=t._self._c;return e("tr",[e("td",[t._v(t._s(t.name))]),t._v(" "),e("td",[t._v(t._s(t.redirectUri))]),t._v(" "),e("td",[e("code",[t._v(t._s(t.clientId))])]),t._v(" "),e("td",[e("div",{staticClass:"action-secret"},[e("code",[t._v(t._s(t.renderedSecret))]),t._v(" "),""!==t.clientSecret?e("NcButton",{attrs:{variant:"tertiary-no-background","aria-label":t.toggleAriaLabel},on:{click:t.toggleSecret},scopedSlots:t._u([{key:"icon",fn:function(){return[e("EyeOutline",{attrs:{size:20}})]},proxy:!0}],null,!1,2687940113)}):t._e()],1)]),t._v(" "),e("td",{staticClass:"action-column"},[e("NcButton",{attrs:{variant:"tertiary-no-background","aria-label":t.t("oauth2","Delete")},on:{click:function(e){return t.$emit("delete",t.id)}},scopedSlots:t._u([{key:"icon",fn:function(){return[e("Delete",{attrs:{size:20,title:t.t("oauth2","Delete")}})]},proxy:!0}])})],1)])},[],!1,null,"2c0a7eff",null).exports,NcSettingsSection:u.A,NcButton:s.A,NcTextField:h.A,NcNoteCard:d.A},props:{clients:{type:Array,required:!0}},data:()=>({newClient:{name:"",redirectUri:"",errorMsg:"",error:!1},oauthDocLink:(0,r.C)("oauth2","oauth2-doc-link"),showSecretWarning:!1}),computed:{instanceName:()=>(0,l.F)().theming.name},methods:{deleteClient(t){a.Ay.delete((0,c.Jv)("apps/oauth2/clients/{id}",{id:t})).then(()=>{this.clients=this.clients.filter(e=>e.id!==t)})},addClient(){this.newClient.error=!1,a.Ay.post((0,c.Jv)("apps/oauth2/clients"),{name:this.newClient.name,redirectUri:this.newClient.redirectUri}).then(t=>{this.clients.push(t.data),this.showSecretWarning=!0,this.newClient.name="",this.newClient.redirectUri=""}).catch(t=>{this.newClient.error=!0,this.newClient.errorMsg=t.response.data.message})}}};var D=i(90163),T={};T.styleTagTransform=k(),T.setAttributes=_(),T.insert=x().bind(null,"head"),T.domAPI=y(),T.insertStyleElement=w(),v()(D.A,T),D.A&&D.A.locals&&D.A.locals;const E=(0,A.A)(I,function(){var t=this,e=t._self._c;return e("NcSettingsSection",{attrs:{name:t.t("oauth2","OAuth 2.0 clients"),description:t.t("oauth2","OAuth 2.0 allows external services to request access to {instanceName}.",{instanceName:t.instanceName}),"doc-url":t.oauthDocLink}},[t.clients.length>0?e("table",{staticClass:"grid"},[e("thead",[e("tr",[e("th",[t._v("\n\t\t\t\t\t"+t._s(t.t("oauth2","Name"))+"\n\t\t\t\t")]),t._v(" "),e("th",[t._v("\n\t\t\t\t\t"+t._s(t.t("oauth2","Redirection URI"))+"\n\t\t\t\t")]),t._v(" "),e("th",[t._v("\n\t\t\t\t\t"+t._s(t.t("oauth2","Client Identifier"))+"\n\t\t\t\t")]),t._v(" "),e("th",[t._v("\n\t\t\t\t\t"+t._s(t.t("oauth2","Secret key"))+"\n\t\t\t\t")]),t._v(" "),e("th",[t._v("\n\t\t\t\t\t"+t._s(t.t("oauth2","Delete client"))+"\n\t\t\t\t")])])]),t._v(" "),e("tbody",t._l(t.clients,function(n){return e("OAuthItem",{key:n.id,attrs:{client:n},on:{delete:t.deleteClient}})}),1)]):t._e(),t._v(" "),t.showSecretWarning?e("NcNoteCard",{attrs:{type:"warning"}},[t._v("\n\t\t"+t._s(t.t("oauth2","Make sure you store the secret key, it cannot be recovered."))+"\n\t")]):t._e(),t._v(" "),e("br"),t._v(" "),e("h3",[t._v(t._s(t.t("oauth2","Add client")))]),t._v(" "),t.newClient.error?e("span",{staticClass:"msg error"},[t._v(t._s(t.newClient.errorMsg))]):t._e(),t._v(" "),e("form",{staticClass:"oauth2-form",on:{submit:function(e){return e.preventDefault(),t.addClient.apply(null,arguments)}}},[e("NcTextField",{staticClass:"oauth2-form--input",attrs:{id:"name",value:t.newClient.name,type:"text",name:"name",label:t.t("oauth2","Name"),placeholder:t.t("oauth2","Name")},on:{"update:value":function(e){return t.$set(t.newClient,"name",e)}}}),t._v(" "),e("NcTextField",{staticClass:"oauth2-form--input",attrs:{id:"redirectUri",value:t.newClient.redirectUri,type:"url",name:"redirectUri",label:t.t("oauth2","Redirection URI"),placeholder:t.t("oauth2","Redirection URI")},on:{"update:value":function(e){return t.$set(t.newClient,"redirectUri",e)}}}),t._v(" "),e("NcButton",{staticClass:"inline-button",attrs:{type:"submit"}},[t._v("\n\t\t\t"+t._s(t.t("oauth2","Add"))+"\n\t\t")])],1)],1)},[],!1,null,"3e9919f9",null).exports;o.Ay.prototype.t=t,o.Ay.prototype.OC=OC;const R=(0,r.C)("oauth2","clients");new(o.Ay.extend(E))({propsData:{clients:R}}).$mount("#oauth2")},61726:(t,e,n)=>{n.d(e,{A:()=>l});var i=n(71354),r=n.n(i),o=n(76314),a=n.n(o)()(r());a.push([t.id,"\n.action-secret[data-v-2c0a7eff] {\n\tdisplay: flex;\n\talign-items: center;\n}\n.action-secret code[data-v-2c0a7eff] {\n\tpadding-top: 5px;\n}\ntd code[data-v-2c0a7eff] {\n\tdisplay: inline-block;\n\tvertical-align: middle;\n}\ntable.inline td[data-v-2c0a7eff] {\n\tborder: none;\n\tpadding: 5px;\n}\n.action-column[data-v-2c0a7eff] {\n\tdisplay: flex;\n\tjustify-content: flex-end;\n\tpadding-inline-end: 0;\n}\n","",{version:3,sources:["webpack://./apps/oauth2/src/components/OAuthItem.vue"],names:[],mappings:";AA0HA;CACA,aAAA;CACA,mBAAA;AACA;AAEA;CACA,gBAAA;AACA;AAEA;CACA,qBAAA;CACA,sBAAA;AACA;AAEA;CACA,YAAA;CACA,YAAA;AACA;AAEA;CACA,aAAA;CACA,yBAAA;CACA,qBAAA;AACA",sourcesContent:["\x3c!--\n - SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors\n - SPDX-License-Identifier: AGPL-3.0-or-later\n--\x3e\n\n\n