PageSourceSearch

https://anythingllm-production-143e.up.railway.app/assets/index-68297a3a.js

js anythingllm-production-143e.up.railway.app collected 2026-10-03 12:11:22 UTC 19,891 bytes, 5 lines download raw bytes

1import{R as l,r as d,e as L,j as e,C as N,z as F,D as C,M as k,s as w,n as Z,E as R,m as D,G as H,o as V}from"../index.js";import{S as O}from"./index-44bf2282.js";/* empty css                 */import{A as g}from"./admin-80960fc6.js";import{t as U}from"./index-b542d8eb.js";const P=new Map([["bold",l.createElement(l.Fragment,null,l.createElement("path",{d:"M256,136a12,12,0,0,1-12,12h-8v8a12,12,0,0,1-24,0v-8h-8a12,12,0,0,1,0-24h8v-8a12,12,0,0,1,24,0v8h8A12,12,0,0,1,256,136Zm-54.81,56.28a12,12,0,1,1-18.38,15.44C169.12,191.42,145,172,108,172c-28.89,0-55.46,12.68-74.81,35.72a12,12,0,0,1-18.38-15.44A124.08,124.08,0,0,1,63.5,156.53a72,72,0,1,1,89,0A124,124,0,0,1,201.19,192.28ZM108,148a48,48,0,1,0-48-48A48.05,48.05,0,0,0,108,148Z"}))],["duotone",l.createElement(l.Fragment,null,l.createElement("path",{d:"M168,100a60,60,0,1,1-60-60A60,60,0,0,1,168,100Z",opacity:"0.2"}),l.createElement("path",{d:"M256,136a8,8,0,0,1-8,8H232v16a8,8,0,0,1-16,0V144H200a8,8,0,0,1,0-16h16V112a8,8,0,0,1,16,0v16h16A8,8,0,0,1,256,136Zm-57.87,58.85a8,8,0,0,1-12.26,10.3C165.75,181.19,138.09,168,108,168s-57.75,13.19-77.87,37.15a8,8,0,0,1-12.25-10.3c14.94-17.78,33.52-30.41,54.17-37.17a68,68,0,1,1,71.9,0C164.6,164.44,183.18,177.07,198.13,194.85ZM108,152a52,52,0,1,0-52-52A52.06,52.06,0,0,0,108,152Z"}))],["fill",l.createElement(l.Fragment,null,l.createElement("path",{d:"M256,136a8,8,0,0,1-8,8H232v16a8,8,0,0,1-16,0V144H200a8,8,0,0,1,0-16h16V112a8,8,0,0,1,16,0v16h16A8,8,0,0,1,256,136ZM144,157.68a68,68,0,1,0-71.9,0c-20.65,6.76-39.23,19.39-54.17,37.17A8,8,0,0,0,24,208H192a8,8,0,0,0,6.13-13.15C183.18,177.07,164.6,164.44,144,157.68Z"}))],["light",l.createElement(l.Fragment,null,l.createElement("path",{d:"M254,136a6,6,0,0,1-6,6H230v18a6,6,0,0,1-12,0V142H200a6,6,0,0,1,0-12h18V112a6,6,0,0,1,12,0v18h18A6,6,0,0,1,254,136Zm-57.41,60.14a6,6,0,1,1-9.18,7.72C166.9,179.45,138.69,166,108,166s-58.89,13.45-79.41,37.86a6,6,0,0,1-9.18-7.72C35.14,177.41,55,164.48,77,158.25a66,66,0,1,1,62,0C161,164.48,180.86,177.41,196.59,196.14ZM108,154a54,54,0,1,0-54-54A54.06,54.06,0,0,0,108,154Z"}))],["regular",l.createElement(l.Fragment,null,l.createElement("path",{d:"M256,136a8,8,0,0,1-8,8H232v16a8,8,0,0,1-16,0V144H200a8,8,0,0,1,0-16h16V112a8,8,0,0,1,16,0v16h16A8,8,0,0,1,256,136Zm-57.87,58.85a8,8,0,0,1-12.26,10.3C165.75,181.19,138.09,168,108,168s-57.75,13.19-77.87,37.15a8,8,0,0,1-12.25-10.3c14.94-17.78,33.52-30.41,54.17-37.17a68,68,0,1,1,71.9,0C164.6,164.44,183.18,177.07,198.13,194.85ZM108,152a52,52,0,1,0-52-52A52.06,52.06,0,0,0,108,152Z"}))],["thin",l.createElement(l.Fragment,null,l.createElement("path",{d:"M252,136a4,4,0,0,1-4,4H228v20a4,4,0,0,1-8,0V140H200a4,4,0,0,1,0-8h20V112a4,4,0,0,1,8,0v20h20A4,4,0,0,1,252,136Zm-56.94,61.43a4,4,0,0,1-6.12,5.14C168,177.7,139.3,164,108,164s-60,13.7-80.94,38.57a4,4,0,1,1-6.12-5.14c16.71-19.9,38.13-33.13,61.89-38.59a64,64,0,1,1,50.34,0C156.93,164.3,178.35,177.53,195.06,197.43ZM108,156a56,56,0,1,0-56-56A56.06,56.06,0,0,0,108,156Z"}))]]);var z=Object.defineProperty,q=Object.defineProperties,T=Object.getOwnPropertyDescriptors,y=Object.getOwnPropertySymbols,I=Object.prototype.hasOwnProperty,$=Object.prototype.propertyIsEnumerable,j=(s,t,a)=>t in s?z(s,t,{enumerable:!0,configurable:!0,writable:!0,value:a}):s[t]=a,B=(s,t)=>{for(var a in t||(t={}))I.call(t,a)&&j(s,a,t[a]);if(y)for(var a of y(t))$.call(t,a)&&j(s,a,t[a]);return s},_=(s,t)=>q(s,T(t));const M=d.forwardRef((s,t)=>l.createElement(L,_(B({ref:t},s),{weights:P})));M.displayName="UserPlus";function G({currentUser:s,user:t,closeModal:a}){const[i,r]=d.useState(t.role),[n,m]=d.useState(null),[h,x]=d.useState({enabled:t.dailyMessageLimit!==null,limit:t.dailyMessageLimit||10}),u=async c=>{m(null),c.preventDefault();const o={},p=new FormData(c.target);for(var[b,f]of p.entries())!f||f===null||(o[b]=f);h.enabled?o.dailyMessageLimit=h.limit:o.dailyMessageLimit=null;const{success:v,error:S}=await g.updateUser(t.id,o);v&&(s&&s.id===t.id&&(s.username=o.username,s.bio=o.bio,s.role=o.role,localStorage.setItem(F,JSON.stringify(s))),window.location.reload()),m(S)};return e.jsx("div",{className:"fixed inset-0 z-50 overflow-auto bg-black bg-opacity-50 flex items-center justify-center",children:e.jsxs("div",{className:"relative w-full max-w-2xl bg-theme-bg
1-secondary rounded-lg shadow border-2 border-theme-modal-border",children:[e.jsxs("div",{className:"relative p-6 border-b rounded-t border-theme-modal-border",children:[e.jsx("div",{className:"w-full flex gap-x-2 items-center",children:e.jsxs("h3",{className:"text-xl font-semibold text-white overflow-hidden overflow-ellipsis whitespace-nowrap",children:["Edit ",t.username]})}),e.jsx("button",{onClick:a,type:"button",className:"absolute top-4 right-4 transition-all duration-300 bg-transparent rounded-lg text-sm p-1 inline-flex items-center hover:bg-theme-modal-border hover:border-theme-modal-border hover:border-opacity-50 border-transparent border",children:e.jsx(N,{size:24,weight:"bold",className:"text-white"})})]}),e.jsx("div",{className:"p-6",children:e.jsxs("form",{onSubmit:u,children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"username",className:"block mb-2 text-sm font-medium text-white",children:"Username"}),e.jsx("input",{name:"username",type:"text",className:"border-none bg-theme-settings-input-bg w-full text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"User's username",defaultValue:t.username,minLength:2,required:!0,autoComplete:"off"}),e.jsx("p",{className:"mt-2 text-xs text-white/60",children:"Username must only contain lowercase letters, periods, numbers, underscores, and hyphens with no spaces"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"password",className:"block mb-2 text-sm font-medium text-white",children:"New Password"}),e.jsx("input",{name:"password",type:"text",className:"border-none bg-theme-settings-input-bg w-full text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:`${t.username}'s new password`,autoComplete:"off",minLength:8}),e.jsx("p",{className:"mt-2 text-xs text-white/60",children:"Password must be at least 8 characters long"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"bio",className:"block mb-2 text-sm font-medium text-white",children:"Bio"}),e.jsx("textarea",{name:"bio",className:"border-none bg-theme-settings-input-bg w-full text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"User's bio",defaultValue:t.bio,autoComplete:"off",rows:3})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"role",className:"block mb-2 text-sm font-medium text-white",children:"Role"}),e.jsxs("select",{name:"role",required:!0,defaultValue:t.role,onChange:c=>r(c.target.value),className:"border-none bg-theme-settings-input-bg w-full text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",children:[e.jsx("option",{value:"default",children:"Default"}),e.jsx("option",{value:"manager",children:"Manager"}),(s==null?void 0:s.role)==="admin"&&e.jsx("option",{value:"admin",children:"Administrator"})]}),e.jsx(A,{role:i})]}),e.jsx(E,{role:i,enabled:h.enabled,limit:h.limit,updateState:x}),n&&e.jsxs("p",{className:"text-red-400 text-sm",children:["Error: ",n]})]}),e.jsxs("div",{className:"flex justify-between items-center mt-6 pt-6 border-t border-theme-modal-border",children:[e.jsx("button",{onClick:a,type:"button",className:"transition-all duration-300 text-white hover:bg-zinc-700 px-4 py-2 rounded-lg text-sm",children:"Cancel"}),e.jsx("button",{type:"submit",className:"transition-all duration-300 bg-white text-black hover:opacity-60 px-4 py-2 rounded-lg text-sm",children:"Update user"})]})]})})]})})}const J={admin:["admin","manager","default"],manager:["manager","default"],default:[]};function W({currUser:s,user:t}){const a=d.useRef(null),i=J[(s==null?void 0:s.role)||"default"].includes(t.role),[r,n]=d.useState(t.suspended===1),{isOpen:m,openModal:h,closeModal:x}=C(),u=async()=>
1{if(!window.confirm(`Are you sure you want to suspend ${t.username}?
2After you do this they will be logged out and unable to log back into this instance of AnythingLLM until unsuspended by an admin.`))return!1;const{success:o,error:p}=await g.updateUser(t.id,{suspended:r?0:1});o||w(p,"error",{clear:!0}),o&&(w(`User ${r?"is no longer suspended":"has been suspended"}.`,"success",{clear:!0}),n(!r))},c=async()=>{var b;if(!window.confirm(`Are you sure you want to delete ${t.username}?
3After you do this they will be logged out and unable to use this instance of AnythingLLM.
4
5This action is irreversible.`))return!1;const{success:o,error:p}=await g.deleteUser(t.id);o||w(p,"error",{clear:!0}),o&&((b=a==null?void 0:a.current)==null||b.remove(),w("User deleted from system.","success",{clear:!0}))};return e.jsxs(e.Fragment,{children:[e.jsxs("tr",{ref:a,className:"bg-transparent text-white text-opacity-80 text-xs font-medium border-b border-white/10 h-10",children:[e.jsx("th",{scope:"row",className:"px-6 whitespace-nowrap",children:t.username}),e.jsx("td",{className:"px-6",children:U(t.role)}),e.jsx("td",{className:"px-6",children:t.createdAt}),e.jsxs("td",{className:"px-6 flex items-center gap-x-6 h-full mt-2",children:[i&&e.jsx("button",{onClick:h,className:"text-xs font-medium text-white/80 light:text-black/80 rounded-lg hover:text-white hover:light:text-gray-500 px-2 py-1 hover:bg-white hover:bg-opacity-10",children:"Edit"}),(s==null?void 0:s.id)!==t.id&&i&&e.jsxs(e.Fragment,{children:[e.jsx("button",{onClick:u,className:"text-xs font-medium text-white/80 light:text-black/80 hover:light:text-orange-500 hover:text-orange-300 rounded-lg px-2 py-1 hover:bg-white hover:light:bg-orange-50 hover:bg-opacity-10",children:r?"Unsuspend":"Suspend"}),e.jsx("button",{onClick:c,className:"text-xs font-medium text-white/80 light:text-black/80 hover:light:text-red-500 hover:text-red-300 rounded-lg px-2 py-1 hover:bg-white hover:light:bg-red-50 hover:bg-opacity-10",children:"Delete"})]})]})]}),e.jsx(k,{isOpen:m,children:e.jsx(G,{currentUser:s,user:t,closeModal:x})})]})}function K({closeModal:s}){const[t,a]=d.useState(null),[i,r]=d.useState("default"),[n,m]=d.useState({enabled:!1,limit:10}),h=async u=>{a(null),u.preventDefault();const c={},o=new FormData(u.target);for(var[p,b]of o.entries())c[p]=b;c.dailyMessageLimit=n.enabled?n.limit:null;const{user:f,error:v}=await g.newUser(c);f&&window.location.reload(),a(v)},x=Z();return e.jsx("div",{className:"fixed inset-0 z-50 overflow-auto bg-black bg-opacity-50 flex items-center justify-center",children:e.jsxs("div",{className:"relative w-full max-w-2xl bg-theme-bg-secondary rounded-lg shadow border-2 border-theme-modal-border",children:[e.jsxs("div",{className:"relative p-6 border-b rounded-t border-theme-modal-border",children:[e.jsx("div",{className:"w-full flex gap-x-2 items-center",children:e.jsx("h3",{className:"text-xl font-semibold text-white overflow-hidden overflow-ellipsis whitespace-nowrap",children:"Add user to instance"})}),e.jsx("button",{onClick:s,type:"button",className:"absolute top-4 right-4 transition-all duration-300 bg-transparent rounded-lg text-sm p-1 inline-flex items-center hover:bg-theme-modal-border hover:border-theme-modal-border hover:border-opacity-50 border-transparent border",children:e.jsx(N,{size:24,weight:"bold",className:"text-white"})})]}),e.jsx("div",{className:"p-6",children:e.jsxs("form",{onSubmit:h,children:[e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx("label",{htmlFor:"username",className:"block mb-2 text-sm font-medium text-white",children:"Username"}),e.jsx("input",{name:"username",type:"text",className:"border-none bg-theme-settings-input-bg w-full text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"User's username",minLength:2,required:!0,autoComplete:"off"}),e.jsx("p",{className:"mt-2 text-xs text-white/60",children:"Username must only contain lowercase letters, periods, numbers, underscores, and hyphens with no spaces"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"password",className:"block mb-2 text-sm font-medium text-white",children:"Password"}),e.jsx("input",{name:"password",type:"text",className:"border-none bg-theme-settings-input-bg w-full text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"User's initial password",required:!0,autoComplete:"off",minLength:8}),e.jsx("p",{className:"mt-2 text-xs text-white/60",children:"Password must be at least 8 characters long"})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"bio",className:"block mb-2 text-sm font-medium text-white",children:"Bio"}),e.jsx("textarea",{name:"bio",className:"border-none bg-theme-settings-input-bg w-full text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",placeholder:"User's bio",autoComplete:"off",rows:3})]}),e.jsxs("div",{children:[e.jsx("label",{htmlFor:"role",className:"block mb-2 text-sm font-medium text-white",children:"Role"}),e.jsxs("select",{name:"role",required:!0,defaultValue:"default",onChange:u=>r(u.target.value),className:"border-none bg-theme-settings-input-bg w-full text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5",children:[e.jsx("option",{value:"default",children:"Default"}),e.jsx("option",{value:"manager",children:"Manager"}),(x==null?void 0:x.role)==="admin"&&e.jsx("option",{value:"admin",children:"Administrator"})]}),e.jsx(A,{role:i})]}),e.jsx(E,{role:i,enabled:n.enabled,limit:n.limit,updateState:m}),t&&e.jsxs("p",{className:"text-red-400 text-sm",children:["Error: ",t]}),e.jsx("p",{className:"text-white text-xs md:text-sm",children:"After creating a user they will need to login with their initial login to get access."})]}),e.jsxs("div",{className:"flex justify-between items-center mt-6 pt-6 border-t border-theme-modal-border",children:[e.jsx("button",{onClick:s,type:"button",className:"transition-all duration-300 text-white hover:bg-zinc-700 px-4 py-2 rounded-lg text-sm",children:"Cancel"}),e.jsx("button",{type:"submit",className:"transition-all duration-300 bg-white text-black hover:opacity-60 px-4 py-2 rounded-lg text-sm",children:"Add user"})]})]})})]})})}
5function le(){const{isOpen:s,openModal:t,closeModal:a}=C();return e.jsxs("div",{className:"w-screen h-screen overflow-hidden bg-theme-bg-container flex",children:[e.jsx(R,{}),e.jsxs("div",{style:{height:D?"100%":"calc(100% - 32px)"},className:"relative md:ml-[2px] md:mr-[16px] md:my-[16px] md:rounded-[16px] bg-theme-bg-secondary w-full h-full overflow-y-scroll p-4 md:p-0",children:[e.jsxs("div",{className:"flex flex-col w-full px-1 md:pl-6 md:pr-[50px] md:py-6 py-16",children:[e.jsxs("div",{className:"w-full flex flex-col gap-y-1 pb-6 border-white/10 border-b-2",children:[e.jsx("div",{className:"items-center flex gap-x-4",children:e.jsx("p",{className:"text-lg leading-6 font-bold text-theme-text-primary",children:"Users"})}),e.jsx("p",{className:"text-xs leading-[18px] font-base text-theme-text-secondary",children:"These are all the accounts which have an account on this instance. Removing an account will instantly remove their access to this instance."})]}),e.jsx("div",{className:"w-full justify-end flex",children:e.jsxs(H,{onClick:t,className:"mt-3 mr-0 mb-4 md:-mb-6 z-10",children:[e.jsx(M,{className:"h-4 w-4",weight:"bold"})," Add user"]})}),e.jsx("div",{className:"overflow-x-auto",children:e.jsx(Q,{})})]}),e.jsx(k,{isOpen:s,children:e.jsx(K,{closeModal:a})})]})]})}function Q(){const{user:s}=V(),[t,a]=d.useState(!0),[i,r]=d.useState([]);return d.useEffect(()=>{async function n(){const m=await g.users();r(m),a(!1)}n()},[]),t?e.jsx(O,{height:"80vh",width:"100%",highlightColor:"var(--theme-bg-primary)",baseColor:"var(--theme-bg-secondary)",count:1,className:"w-full p-4 rounded-b-2xl rounded-tr-2xl rounded-tl-sm mt-8",containerClassName:"flex w-full"}):e.jsxs("table",{className:"w-full text-xs text-left rounded-lg min-w-[640px] border-spacing-0",children:[e.jsx("thead",{className:"text-theme-text-secondary text-xs leading-[18px] font-bold uppercase border-white/10 border-b",children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",className:"px-6 py-3 rounded-tl-lg",children:"Username"}),e.jsx("th",{scope:"col",className:"px-6 py-3",children:"Role"}),e.jsx("th",{scope:"col",className:"px-6 py-3",children:"Date Added"}),e.jsx("th",{scope:"col",className:"px-6 py-3 rounded-tr-lg",children:" "})]})}),e.jsx("tbody",{children:i.map(n=>e.jsx(W,{currUser:s,user:n},n.id))})]})}const X={default:["Can only send chats with workspaces they are added to by admin or managers.","Cannot modify any settings at all."],manager:["Can view, create, and delete any workspaces and modify workspace-specific settings.","Can create, update and invite new users to the instance.","Cannot modify LLM, vectorDB, embedding, or other connections."],admin:["Highest user level privilege.","Can see and do everything across the system."]};function A({role:s}){return e.jsxs("div",{className:"flex flex-col gap-y-1 py-1 pb-4",children:[e.jsx("p",{className:"text-sm font-medium text-theme-text-primary",children:"Permissions"}),e.jsx("ul",{className:"flex flex-col gap-y-1 list-disc px-4",children:X[s??"default"].map((t,a)=>e.jsx("li",{className:"text-xs text-theme-text-secondary",children:t},a))})]})}function E({enabled:s,limit:t,updateState:a,role:i}){return i==="admin"?null:e.jsxs("div",{className:"mt-4 mb-8",children:[e.jsxs("div",{className:"flex flex-col gap-y-1",children:[e.jsxs("div",{className:"flex items-center gap-x-2",children:[e.jsx("h2",{className:"text-base leading-6 font-bold text-white",children:"Limit messages per day"}),e.jsxs("label",{className:"relative inline-flex cursor-pointer items-center",children:[e.jsx("input",{type:"checkbox",checked:s,onChange:r=>{a(n=>({...n,enabled:r.target.checked}))},className:"peer sr-only"}),e.jsx("div",{className:"pointer-events-none peer h-6 w-11 rounded-full bg-[#CFCFD0] after:absolute after:left-[2px] after:top-[2px] after:h-5 after:w-5 after:rounded-full after:shadow-xl after:border-none after:bg-white after:box-shadow-md after:transition-all after:content-[''] peer-checked:bg-[#32D583] peer-checked:after:translate-x-full peer-checked:after:border-white peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-transparent"})]})]}),e.jsx("p",{className:"text-xs leading-[18px] font-base text-white/60",children:"Restrict this user to a number of successful queries or chats within a 24 hour window."})]}),s&&e.jsxs("div",{className:"mt-4",children:[e.jsx("label",{className:"text-white text-sm font-semibold block mb-4",children:"Message limit per day"}),e.jsx("div",{className:"relative mt-2",children:e.jsx("input",{type:"number",onScroll:r=>r.target.blur(),onChange:r=>{var n;a({enabled:!0,limit:Number(((n=r==null?void 0:r.target)==null?void 0:n.value)||0)})},value:t,min:1,className:"border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5"})})]})]})}export{E as MessageLimitInput,A as RoleHintDisplay,le 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.