1var U=Object.defineProperty;var H=(a,s,t)=>s in a?U(a,s,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[s]=t;var o=(a,s,t)=>H(a,typeof s!="symbol"?s+"":s,t);import{m as j,b9 as $,a6 as B,i as b,ay as C,o as u,f as k,k as _,u as z,D as W,R as M,bf as F,j as e,am as J,F as R,s as Q,ae as q,af as G,b$ as K,d as V,a as m,aC as X,E,ao as D,C as x}from"./index-Cn21bPyG.js";import{B as I,L as Y}from"./Layout-DvTAbHXk.js";import{T as Z}from"./TagAutoComplete-C-IfrgqS.js";import{T as ee}from"./TagCategoryAutoComplete-mr_Bv3b5.js";import{N as te,a as se}from"./NamesEditStore-D__yz-qW.js";import{E as ae,a as ie,b as re}from"./EnglishTranslatedStringEditStore-C0cv8qyE.js";import{u as oe,C as ne,S as P,E as le}from"./useConflictingEditor-t_VW6njH.js";import{E as de}from"./EntryTrashPopup-CggYnk7d.js";import{L as ce,E as me}from"./DropdownList-DWKjVagm.js";import{T as he}from"./TagLockingAutoComplete-CfmZ-VDl.js";import{W as ge,a as pe}from"./WebLinksEditStore-CdFD0I88.js";import{H as L}from"./HelpLabel-72J_C3Mb.js";import{I as ue}from"./ImageUploadMessage-CgrxDcCK.js";import{M as ye}from"./MarkdownNotice-BHZJbtiM.js";import{R as fe}from"./RequiredField-9e2ZgCNo.js";import{V as Te}from"./ValidationSummaryPanel-BgZ0MJ9f.js";import{a as be}from"./ui-hm8_IjVA.js";import{U as ve}from"./UrlHelper-BdHTSy3n.js";import{J as S}from"./JQueryUIButton-CyYxSV28.js";import{T as v}from"./TagTargetTypes-CFQeYiLM.js";import{D as O}from"./DeleteEntryStore-DDVVyLm7.js";import{i as we}from"./isEmpty-C6ehNmyJ.js";import{g as Ne}from"./utils-functions-B5N3535E.js";import"./EntryAutoComplete-DzEsTBOD.js";import"./ContentLanguageSelection-CSQPLgcA.js";import"./Markdown-ByjXmBQH.js";import"./NotificationIcon-BuGIRHq_.js";import"./useRegionNames-R7sAHXgR.js";import"./UserKnownLanguageContract-B0fKxiDO.js";import"./EventCategory-a0YFCPS7.js";import"./SongListFeaturedCategory-DcGPdg7B.js";import"./LockingAutoComplete-Bz1qKvZM.js";import"./WebLinkEditStore-Bd7GDkQ2.js";import"./WebLinkCategory-CBYuWJV0.js";import"./QTipToolTip-C3qDte4a.js";import"./useWillUnmount-B3ZkyqO6.js";import"./useEventCallback-B1t7SEpY.js";import"./ImageHelper-t7bJhcfL.js";import"./JQueryUIDialog-B2zDv801.js";(function(){try{var a=typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};a.__faroBundleId_vocadb_frontend="1779057177036d7b93c7ca4"}catch{}})();var Ee=Object.defineProperty,Re=Object.getOwnPropertyDescriptor,c=(a,s,t,r)=>{for(var n=r>1?void 0:r?Re(s,t):s,h=a.length-1,g;h>=0;h--)(g=a[h])&&(n=(r?g(s,t,n):g(n))||n);return r&&n&&Ee(s,t,n),n},N;const l=(N=class{constructor(s,t,r){o(this,"categoryName");o(this,"defaultNameLanguage");o(this,"deleteStore");o(this,"description");o(this,"errors");o(this,"hideFromSuggestions");o(this,"names");o(this,"parent");o(this,"relatedTags");o(this,"status");o(this,"submitting",!1);o(this,"targets");o(this,"newTargets");o(this,"trashStore");o(this,"updateNotes","");o(this,"webLinks");o(this,"addRelatedTag",s=>this.relatedTags.push(s));o(this,"removeRelatedTag",s=>{B(this.relatedTags,s)});o(this,"denySelf",s=>s&&s.id!==this.contract.id);o(this,"allowRelatedTag",s=>this.denySelf(s)&&this.relatedTags.every(t=>t.id!==s.id));o(this,"submit",async s=>{this.submitting=!0;try{return await this.tagRepo.edit({canDelete:!1,categoryName:this.categoryName,defaultNameLanguage:this.defaultNameLanguage,deleted:!1,description:this.description.toContract(),hideFromSuggestions:this.hideFromSuggestions,id:this.contract.id,name:"",names:this.names.toContracts(),parent:this.parent.entry,relatedTags:this.relatedTags,status:this.status,targets:this.targets,updateNotes:this.updateNotes,webLinks:this.webLinks.items,newTargets:this.newTargets},s)}catch(t){throw t.response&&b(()=>{this.errors=void 0,t.response.status===400&&(this.errors=t.response.data.errors)}),t}finally{b(()=>{this.submitting=!1})}});o(this,"hasFlag",s=>(this.targets&s)===s);o(this,"hasTargetType",s=>this.hasFlag(s));o(this,"hasTagTarget",s=>this.newTargets.includes("all")||this.newTargets.includes(s)||this.newTargets.includes(s.split(":")[0]));o(this,"toggleTarget",s=>{const t={song:this.values.songTypes,artist:this.values.artistTypes.filter(d=>!C.isVoiceSynthesizerType(d)),album:this.values.albumTypes,releaseevent:this.values.eventTypes,voicesynthesizer:this.values.artistTypes.filter(C.isVoiceSynthesizerType)};Object.keys(t).forEach(d=>{t[d]=t[d].map(y=>y.toLowerCase())});const[r,n]=s.split(":"),h=this.newTargets.indexOf("all");let g=this.newTargets.indexOf(r),p=this.newTargets.indexOf(s);p===-1&&g===-1&&h===-1?this.newTargets.push(s):(h!==-1&&(this.newTargets=Object.keys(t),g=this.newTargets.indexOf(r),p=this.newTargets.indexOf(s)),p!==-1&&(this.newTargets.splice(p,1),g=this.newTargets.indexOf(r)),g!==-1&&(this.newTargets.splice(g,1),this.newTargets.push(...t[r].map(d=>[r,d].join(":")).filter(d=>d!==s)))),Object.entries(t).forEach(([d,y])=>{y.filter(i=>this.newTargets.includes(`${d}:${i}`)).length===y.length&&(this.newTargets=this.newTargets.filter(i=>!i.startsWith(d+":")),this.newTargets.push(d))}),Object.keys(t).every(d=>this.newTargets.includes(d))&&(this.newTargets=["all"])});o(this,"setTargetType",(s,t)=>{const r=p=>(this.targets&p)===p,n=()=>{const p=[v.Album,v.Artist,v.Event,v.Song];this.targets===p.sum()?this.targets=N.allEntryTypes:this.targets=p.filter(d=>r(d)).sum()};return t?(()=>{this.targets=this.targets|s,n()})():(()=>{r(s)&&(this.targets=this.targets-s,n())})()});var n;this.tagRepo=s,this.contract=t,this.values=r,j(this),this.deleteStore=new O(h=>s.delete({id:t.id,notes:h,hardDelete:!1})),this.trashStore=new O(h=>s.delete({id:t.id,notes:h,hardDelete:!0})),this.parent=new $(h=>s.getById({id:h})),this.categoryName=t.categoryName,this.defaultNameLanguage=t.defaultNameLanguage,this.description=new ae(t.description),this.hideFromSuggestions=t.hideFromSuggestions,this.names=te.fromContracts(t.names),this.parent.id=(n=t.parent)==null?void 0:n.id,this.relatedTags=t.relatedTags,this.status=t.status,this.targets=t.targets,this.newTargets=t.newTargets,this.webLinks=new ge(t.webLinks)}get parentName(){var s;return((s=this.parent)==null?void 0:s.name)??void 0}get validationError_needDescription(){return!this.description.original&&we(this.webLinks.items)}get validationError_needCategory(){return!this.categoryName||this.categoryName.trim()===""}get hasValidationErrors(){return this.validationError_needDescription||this.validationError_needCategory}},o(N,"allEntryTypes",1073741823),N);c([u],l.prototype,"categoryName",2);c([u],l.prototype,"defaultNameLanguage",2);c([u],l.prototype,"errors",2);c([u],l.prototype,"hideFromSuggestions",2);c([u],l.prototype,"parent",2);c([u],l.prototype,"relatedTags",2);c([u],l.prototype,"status",2);c([u],l.prototype,"submitting",2);c([u],l.prototype,"targets",2);c([u],l.prototype,"newTargets",2);c([u],l.prototype,"updateNotes",2);c([k],l.prototype,"parentName",1);c([k],l.prototype,"validationError_needDescription",1);c([k],l.prototype,"validationError_needCategory",1);c([k],l.prototype,"hasValidationErrors",1);c([_],l.prototype,"addRelatedTag",2);c([_],l.prototype,"removeRelatedTag",2);c([_],l.prototype,"submit",2);c([_],l.prototype,"toggleTarget",2);let Ve=l;v.Album,v.Artist,v.Song,v.Event;const Le=J(({tagEditStore:a})=>{const s=Q(),{t}=q(["Resources","ViewRes","VocaDb.Web.Resources.Views.Tag","VocaDb.Model.Resources.Songs","VocaDb.Model.Resources.Albums","VocaDb.Model.Resources","VocaDb.Web.Resources.Domain.ReleaseEvents"]),r=a.contract,n=`Edit tag - ${r.name}`,h=ve.imageThumb(r.mainPicture,G.SmallThumb),g=K(),p=oe(V.Tag),d=M.useRef(void 0),y=W(),A=[[V.Song,y.values.songTypes,"VocaDb.Model.Resources.Songs:SongTypeNames."],[V.Album,y.values.albumTypes,"VocaDb.Model.Resources.Albums:DiscTypeNames."],[V.Artist,y.values.artistTypes.filter(i=>!C.isVoiceSynthesizerType(i)),"VocaDb.Model.Resources:ArtistTypeNames."],["VoiceSynthesizer",y.values.artistTypes.filter(C.isVoiceSynthesizerType),"VocaDb.Model.Resources:ArtistTypeNames."],[V.ReleaseEvent,y.values.eventTypes,"VocaDb.Web.Resources.Domain.ReleaseEvents:EventCategoryNames."]];
1return m(Y,{pageTitle:n,ready:!0,title:n,parents:m(R,{children:[e(I.Item,{linkAs:D,linkProps:{to:"/Tag"},divider:!0,children:"Tags"}),e(I.Item,{linkAs:D,linkProps:{to:E.details_tag(r.id)},children:r.name})]}),toolbar:r.canDelete&&m(R,{children:[r.deleted?e(S,{as:"a",href:`/Tag/Restore/${r.id}`,icons:{primary:"ui-icon-trash"},children:t("ViewRes:EntryEdit.Restore")}):e(S,{as:x,href:"#",onClick:a.deleteStore.show,icons:{primary:"ui-icon-trash"},children:t("ViewRes:Shared.Delete")}),s.canMoveToTrash&&m(R,{children:[" ",e(S,{as:x,href:"#",onClick:a.trashStore.show,icons:{primary:"ui-icon-trash"},children:t("ViewRes:EntryEdit.MoveToTrash")})]}),s.canMergeEntries&&m(R,{children:[" ",e(S,{as:D,to:`/Tag/Merge/${r.id}`,children:t("ViewRes:EntryEdit.Merge")})]})]}),children:[p&&p.userId!==0&&e(ne,{conflictingEditor:p}),a.errors&&e(Te,{message:"Unable to save properties.",errors:a.errors}),e(ie,{draft:r.status===X.Draft,validationMessages:[].concat(a.validationError_needDescription?t("VocaDb.Web.Resources.Views.Tag:Edit.ValidationNeedDescription"):[],a.validationError_needCategory?t("VocaDb.Web.Resources.Views.Tag:Edit.ValidationNeedCategory"):[])}),e("br",{}),m("form",{onSubmit:async i=>{var T;i.preventDefault();try{const f=s.canViewCoverArtImages?((T=d.current.files)==null?void 0:T.item(0))??void 0:void 0,w=await a.submit(f);g(E.details_tag(w))}catch(f){throw be(f.response&&f.response.status?Ne(f.response.status):"Unable to save properties."),f}},children:[e(P,{backAction:E.details_tag(r.id),submitting:a.submitting}),e("div",{className:"editor-label",children:e(L,{label:"Default language",dangerouslySetInnerHTML:{__html:""}})}),e("div",{className:"editor-field",children:e(ce,{value:a.defaultNameLanguage,onChange:i=>b(()=>{a.defaultNameLanguage=i.target.value})})}),m("div",{className:"editor-label",children:[e(L,{label:"Names",dangerouslySetInnerHTML:{__html:""}})," ",e(fe,{})]}),e("div",{className:"editor-field",children:e(se,{namesEditStore:a.names})}),e("div",{className:"editor-label",children:e("label",{children:"Category"})}),e("div",{className:"editor-field",children:e(ee,{type:"text",maxLength:30,onAcceptSelection:i=>b(()=>{a.categoryName=i}),clearValue:!1,value:a.categoryName,onChange:i=>b(()=>{a.categoryName=i.target.value})})}),e("div",{className:"editor-label",children:e(L,{label:"Parent",dangerouslySetInnerHTML:{__html:"Parent tag groups related tags under one parent. Child tags are still considered separate."}})}),e("div",{className:"editor-field",children:e(he,{basicEntryLinkStore:a.parent,tagFilter:a.denySelf,clearValue:!0,allowAliases:!1})}),m("div",{className:"editor-label",children:[e("label",{children:"Description"}),e(ye,{})]}),e("div",{className:"editor-field entry-edit-description",children:e(re,{englishTranslatedStringEditStore:a.description})}),s.canViewCoverArtImages&&m(R,{children:[e("div",{className:"editor-label",children:"Thumbnail"}),e("div",{className:"editor-field",children:m("div",{className:"media",children:[h&&e("img",{className:"pull-left media-object",src:h,alt:"Thumb"}),m("div",{className:"media-body",children:[e(ue,{}),e("input",{type:"file",id:"thumbPicUpload",name:"thumbPicUpload",ref:d})]})]})})]}),m("div",{className:"editor-field withMargin",title:"Hides this tag from suggested tags for albums and artists",children:[e("input",{type:"checkbox",id:"hideFromSuggestions",checked:a.hideFromSuggestions,onChange:i=>b(()=>{a.hideFromSuggestions=i.target.checked})})," ","Hide from suggestions"]}),e("div",{className:"editor-label withMargin",children:t("VocaDb.Web.Resources.Views.Tag:Edit.RelatedTags")}),m("div",{className:"editor-field",children:[e("table",{children:e("tbody",{children:a.relatedTags.map((i,T)=>m("tr",{children:[e("td",{children:e(D,{to:E.details_tag(i.id),children:i.name})}),e("td",{children:e(x,{onClick:()=>a.removeRelatedTag(i),href:"#",className:"textLink removeLink",children:t("ViewRes:Shared.Remove")})})]},T))})}),e(Z,{type:"text",onAcceptSelection:i=>{a.addRelatedTag(i)},tagFilter:a.allowRelatedTag,maxLength:128,placeholder:t("ViewRes:Shared.Search"),className:"input-xlarge"})]}),e("div",{className:"editor-label",children:"Valid for"}),e("div",{className:"editor-field",children:e("div",{style:{display:"flex",flexDirection:"row",flexWrap:"wrap",width:"100%",rowGap:15},children:A.filter(([i,T,f])=>T.length>0).map(([i,T,f])=>m("div",{children:[m("div",{style:{marginBottom:5},children:[e("input",{type:"checkbox",checked:a.hasTagTarget(i.toLowerCase()),onChange:w=>{a.toggleTarget(i.toLowerCase())},style:{marginRight:5}}),e("b",{children:t(`VocaDb.Web.Resources.Domain:EntryTypeNames.${i}`)})]}),e("div",{style:{display:"grid",gridAutoFlow:"column",gridTemplateRows:"repeat(10, auto)"},children:T.map(w=>m("div",{style:{marginRight:5},children:[e("input",{type:"checkbox",checked:a.hasTagTarget(`${i}:${w}`.toLowerCase()),onChange:De=>{a.toggleTarget(`${i}:${w}`.toLowerCase())},style:{marginRight:5}}),t(f.concat(w))]},w))})]},i))})}),e("div",{className:"editor-label",children:e(L,{label:t("ViewRes:EntryEdit.WebLinks"),dangerouslySetInnerHTML:{__html:t("ViewRes:EntryEdit.ExternalLinksQuickHelp")}})}),e("div",{className:"editor-field",children:e(pe,{webLinksEditStore:a.webLinks})}),e("div",{className:"editor-label",children:e(L,{label:t("ViewRes:EntryEdit.Status"),dangerouslySetInnerHTML:{__html:t("Resources:CommonMessages.EntryStatusExplanation")}})}),e("div",{className:"editor-field",children:e(me,{allowedEntryStatuses:s.allowedEntryStatuses(),value:a.status,onChange:i=>b(()=>{a.status=i.target.value})})}),e("br",{}),e("p",{children:t("ViewRes:EntryEdit.UpdateNotes")}),e("textarea",{name:"updateNotes",id:"updateNotes",className:"input-xxlarge",rows:4,maxLength:200,value:a.updateNotes,onChange:i=>b(()=>{a.updateNotes=i.target.value})}),e("br",{}),e(P,{backAction:E.details_tag(r.id),submitting:a.submitting})]}),e(le,{confirmText:t("ViewRes:EntryEdit.ConfirmDelete"),deleteEntryStore:a.deleteStore,onDelete:()=>g(E.details_tag(r.id))}),e(de,{confirmText:t("ViewRes:EntryEdit.ConfirmMoveToTrash"),deleteEntryStore:a.trashStore,onDelete:()=>g("/Tag")})]})}),pt=()=>{const{id:a}
1=z(),s=W(),[t,r]=M.useState();return M.useEffect(()=>{F.getForEdit({id:Number(a)}).then(n=>r({tagEditStore:new Ve(F,n,s.values)})).catch(n=>{throw n.response&&n.response.status===404&&(window.location.href="/Error/NotFound"),n})},[a]),t?e(Le,{tagEditStore:t.tagEditStore}):e(R,{})};export{pt 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.