1import{o as e}from"../../rolldown-runtime.CMxvf4Kt.min.js";import{Aa as t,Gp as n,Ll as r,Ma as i,Qo as a,Ta as o,ka as s,mp as c,oc as l,va as u,vo as d}from"../dashboard/titlebar.DyAU_Ibz.min.js";import{M as f,O as p,dt as m,ft as h,k as g}from"../../../vendor/react-core.Bz6AEaX7.min.js"; 2/** 3* @author Mihran Abrahamian <[email protected]> 4* @copyright 2009-2025 Vanilla Forums Inc. 5* @license Proprietary 6*/ 7var _={articles:{getDescription:()=>`new articles`,getDefaultPreferences:e=>{let{newArticle:t}=e??{};return{"preferences.popup.articles":t?.popup??!1,"preferences.email.articles":t?.email??!1}}},articleUpdates:{getDescription:()=>`updated articles`,getDefaultPreferences:e=>{let{updatedArticle:t}=e??{};return{"preferences.popup.articleUpdates":t?.popup??!1,"preferences.email.articleUpdates":t?.email??!1}}}};function v(e){let t={"preferences.followed":!1};return Object.values(_).forEach(n=>{t={...t,...n.getDefaultPreferences(e)}}),t} 8/** 9* @author Mihran Abrahamian <[email protected]> 10* @copyright 2009-2025 Vanilla Forums Inc. 11* @license Proprietary 12*/ 13function y(e){let t=n(),{knowledgeBaseID:i,userID:a,locale:o=t,setServerError:s,showSuccessToast:u=!0}=e,d={knowledgeBaseID:i,userID:a,locale:o},m=f(),h=l();return p({mutationFn:async e=>{s(null);let{data:t}=await r.patch(`/knowledge-bases/${i}/preferences/${a}/${o}`,e);return t},onMutate:async function(e){s(null);let t=m.getQueryData([`knowledgeBaseNotificationPreferences`,d]);return m.setQueryData([`knowledgeBaseNotificationPreferences`,d],e),{previousPreferences:t}},onError:(e,t,n)=>{n?.previousPreferences&&(m.setQueryData([`knowledgeBaseNotificationPreferences`,d],n.previousPreferences),s(e))},onSuccess:async e=>{m.setQueryData([`knowledgeBaseNotificationPreferences`,d],e),u&&h.addToast({autoDismiss:!0,body:c(`Success! Preferences saved.`)})},mutationKey:[i,a]})}function b(e){let t=n(),{knowledgeBaseID:i,userID:a,locale:o=t,initialData:s}=e;return g({queryFn:async()=>(await r.get(`/knowledge-bases/${i}/preferences/${a}/${o}`)).data,queryKey:[`knowledgeBaseNotificationPreferences`,{knowledgeBaseID:i,userID:a,locale:o}],initialData:s,refetchOnWindowFocus:!1})} 14/** 15* @author Mihran Abrahamian <[email protected]> 16* @copyright 2009-2025 Vanilla Forums Inc. 17* @license Proprietary 18*/ 19var x=e(h()),S=m();function C(e){let{userID:n,locale:r,notificationPreferences:i,...s}=e,{recordID:l}=s,{preferences:f}=t(),p=v(f?.data),[m,h]=(0,x.useState)(null),g=d(),C=b({knowledgeBaseID:l,userID:n,locale:r,initialData:i}),{mutateAsync:w}=y({knowledgeBaseID:l,userID:n,locale:r,setServerError:h,showSuccessToast:!e.buttonOnly});return(0,S.jsxs)(a.Provider,{value:{preferences:C.data??p,setPreferences:w},children:[m&&(0,S.jsx)(u,{error:m,stringContents:m.message,className:g.error}),(0,S.jsx)(o,{...s,recordDetails:{recordKey:`knowledgeBaseID`,recordFollowedContentText:c(`View all followed Knowledge Bases`),recordUnfollowText:c(`Unfollow Knowledge Base`)},viewRecordText:c(`View Knowledge Base`),notificationTypes:_})]})}function w(e){let{api:t=i,...n}=e;return(0,S.jsx)(s,{userID:n.userID,api:i,children:(0,S.jsx)(C,{...n})})}export{w as t};
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.