(()=>{"use strict";vart,e,s,a={27498:(t,e,s)=>{vara=s(20144),r=s(77958),i=s(87604),n=s(90580),o=s(31352),l=s(64024),d=s(29497),c=s(77723),g=s(35380),u=s(49368),m=s(36906);constp={userVisible:!0,userAssignable:!0,canAssign:!0};s(93664);varh=s(79753),y=s(14596);constb=(0,h.generateRemoteUrl)("dav"),v=(0,y.eI)(b,{headers:{requesttoken:(0,r.IH)()??""}}),f=(0,s(17499).IY)().setApp("systemtags").detectUser().build();varA;!function(t){t.Public="Public",t.Restricted="Restricted",t.Invisible="Invisible"}(A||(A={}));const_=[{id:A.Public,label:(0,o.Iu)("systemtags","Public")},{id:A.Restricted,label:(0,o.Iu)("systemtags","Restricted")},{id:A.Invisible,label:(0,o.Iu)("systemtags","Invisible")}],C=(t,e)=>({[[!0,!0].join(",")]:A.Public,[[!0,!1].join(",")]:A.Restricted,[[!1,!1].join(",")]:A.Invisible}[[t,e].join(",")]),x=a.default.extend({name:"SystemTagForm",components:{NcButton:d.Z,NcLoadingIcon:i.Z,NcSelect:c.Z,NcSelectTags:g.Z,NcTextField:u.Z},props:{tags:{type:Array,required:!0}},data:()=>({loading:!1,tagLevelOptions:_,selectedTag:null,errorMessage:"",tagName:"",tagLevel:A.Public}),watch:{selectedTag(t){this.tagName=t?t.displayName:"",this.tagLevel=t?C(t.userVisible,t.userAssignable):A.Public}},computed:{isCreating(){returnnull===this.selectedTag},isCreateDisabled(){return""===this.tagName},isUpdateDisabled(){return""===this.tagName||this.selectedTag?.displayName===this.tagName&&C(this.selectedTag?.userVisible,this.selectedTag?.userAssignable)===this.tagLevel},isResetDisabled(){returnthis.isCreating?""===this.tagName&&this.tagLevel===A.Public:null===this.selectedTag},userVisible(){return{[A.Public]:!0,[A.Restricted]:!0,[A.Invisible]:!1}[this.tagLevel]},userAssignable(){return{[A.Public]:!0,[A.Restricted]:!1,[A.Invisible]:!1}[this.tagLevel]},tagProperties(){return{displayName:this.tagName,userVisible:this.userVisible,userAssignable:this.userAssignable}}},methods:{t:o.Iu,asynchandleSubmit(){this.isCreating?awaitthis.create():awaitthis.update()},asynccreate(){constt={...p,...this.tagProperties};this.loading=!0;try{conste=await(asynct=>{conste=(t=>{conste={...t};returne.name&&!e.displayName||(e.name=e.displayName,deletee.displayName),e})(t);try{const{headers:t}=awaitv.customRequest("/systemtags",{method:"POST",data:e}),s=t.get("content-location");if(s)return(t=>{conste=t.indexOf("?");e>0&&(t=t.substring(0,e));consts=t.split("/");leta;do{a=s[s.length-1],s.pop()}while(!a&&s.length>0);returnNumber(a)})(s);throwf.error((0,o.Iu)("systemtags",'Missing "Content-Location" header')),newError((0,o.Iu)("systemtags",'Missing "Content-Location" header'))}catch(t){throwf.error((0,o.Iu)("systemtags","Failed to create tag"),{error:t}),newError((0,o.Iu)("systemtags","Failed to create tag"))}})(t),s={...t,id:e};this.$emit("tag:created",s),(0,l.s$)((0,o.Iu)("systemtags","Created tag")),this.reset()}catch(t){this.errorMessage=(0,o.Iu)("systemtags","Failed to create tag")}this.loading=!1},asyncupdate(){if(null===this.selectedTag)return;constt={...this.selectedTag,...this.tagProperties};this.loading=!0;try{await(asynct=>{conste="/systemtags/"+t.id,s=`<?xml version="1.0"?>\n\t<d:propertyupdate xmlns:d="DAV:" xmlns:oc="http://owncloud.org/ns">\n\t\t<d:set>\n\t\t\t<d:prop>\n\t\t\t\t<oc:display-name>${t.displayName}</oc:display-name>\n\t\t\t\t<oc:user-visible>${t.userVisible}</oc:user-visible>\n\t\t\t\t<oc:user-assignable>${t.userAssignable}</oc:user-assignable>\n\t\t\t</d:prop>\n\t\t</d:set>\n\t</d:propertyupdate>`;try{awaitv.customRequest(e,{method:"PROPPATCH",data:s})}catch(t){throwf.error((0,o.Iu)("systemtags","Failed to update tag"),{error:t}),newError((0,o.Iu)("systemtags","Failed to update tag"))}})(t),this.selectedTag=t,this.$emit("tag:updated",t),(0,l.s$)((0,o.Iu)("systemtags","Updated tag")),this.$refs.tagNameInput?.focus()}catch(t){this.errorMessage=(0,o.Iu)("systemtags","Failed to update tag")}this.loading=!1},asynchandleDelete(){if(null!==this.selectedTag){this.loading=!0;try{await(asynct=>{conste="/systemtags/"+this.selectedTag.id;try{awaitv.deleteFile(e)}catch(t){throwf.error((0,o.Iu)("systemtags","Faile