1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[941],{1128:function(a,b,c){(window.__NEXT_P=window.__NEXT_P||[]).push(["/commands",function(){return c(7408)}])},1206:function(a,b,c){"use strict";c.d(b,{b:function(){return h}});var d=c(5893),e=c(7294),f=c(4184),g=c.n(f),h=function(a){var b=a.type,c=a.children,f=a.action,h=g()("alert",{"alert-info":"info"===b,"alert-success":"success"===b,"alert-warning":"warning"===b,"alert-error":"error"===b}),i=(0,e.useMemo)(function(){switch(b){case"info":return(0,d.jsx)("svg",{className:"w-6 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})});case"success":return(0,d.jsx)("svg",{className:"w-6 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})});case"warning":return(0,d.jsx)("svg",{className:"w-6 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"})});case"error":return(0,d.jsx)("svg",{className:"w-6 mr-2",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:(0,d.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z"})})}},[b]);return(0,d.jsxs)("div",{className:h,children:[(0,d.jsxs)("div",{children:[i," ",(0,d.jsx)("span",{children:c})]}),f&&(0,d.jsx)("div",{className:"flex-none",children:f})]})}},8445:function(a,b,c){"use strict";c.d(b,{g:function(){return i}});var d=c(5893),e=c(7294),f=c(1145),g=c(1163),h=c(1634),i=function(a){var b=a.isOpen,c=a.onOpenChange,i=a.commands,j=void 0===i?[]:i,k=(0,g.useRouter)();(0,e.useEffect)(function(){document.body.classList.add("cmdk-linear")},[]),(0,e.useEffect)(function(){var a=function(a){"k"===a.key&&a.metaKey&&c(!b)};return document.addEventListener("keydown",a),function(){document.removeEventListener("keydown",a)}},[b]);var l=(0,e.useCallback)(function(a,b){var c=RegExp(b,"gi");try{var d=JSON.parse(a);return d.name.match(c)||d.description.match(c)?1:0}catch(e){return 0}},[]),m=(0,e.useCallback)(function(){c(!1),k.push("/commands/add")},[k]),n=(0,e.useCallback)(function(){c(!1),k.push("/commands")},[k]),o=(0,e.useCallback)(function(a){try{var b=JSON.parse(a);c(!1),k.push("/commands/".concat(b._id))}catch(d){}},[k]);return(0,d.jsxs)(f.m.Dialog,{filter:l,open:b,onOpenChange:c,children:[(0,d.jsx)(f.m.Input,{}),(0,d.jsxs)(f.m.List,{children:[(0,d.jsx)(f.m.Empty,{children:"You donât have any commands called that."}),(0,d.jsxs)(f.m.Group,{heading:"Actions",children:[(0,d.jsx)(f.m.Item,{onSelect:m,value:JSON.stringify({name:"add"}),children:(0,d.jsx)("div",{className:"py-4",children:"Add a command"})}),(0,d.jsx)(f.m.Item,{onSelect:n,value:JSON.stringify({name:"go to commands list"}),children:(0,d.jsx)("div",{className:"py-4",children:"Go to Commands list"})})]}),j.length?(0,d.jsx)(f.m.Group,{heading:"Edit a Command",children:j.map(function(a){return(0,d.jsxs)(e.Fragment,{children:[(0,d.jsx)(f.m.Item,{onSelect:o,value:JSON.stringify(a),children:(0,d.jsxs)("div",{className:"py-4",children:[(0,d.jsxs)("span",{className:"mb-2 text-lg font-bold block",children:["!",a.name]}),(0,d.jsx)("span",{className:"text-sm block",dangerouslySetInnerHTML:{__html:(0,h.f)(a.description)}})]})}),(0,d.jsx)(f.m.Separator,{})]},a._id)})}):null]})]})}},7018:function(a,b,c){"use strict";c.d(b,{OK:function(){return d}}),c(2042);var d=function(a,b){return"number"!=typeof a.weight?1:"number"!=typeof b.weight?-1:a.weight===b.weight?0:a.weight<b.weight?-1:1}},5638:function(a,b,c){"use strict";c.d(b,{T:function(){return e}});var d=c(5893),e=function(){return(0,d.jsx)("div",{className:"flex justify-center",children:(0,d.jsxs)("div",{className:"lds-ripple",children:[(0,d.jsx)("div",{className:"border-fuchsia-500"}),(0,d.jsx)("div",{className:"border-fuchsia-500"})]})})}},198:function(a,b,c){"use strict";c.d(b,{Q:function(){return e}});var d=c(7294),e=function(){var a=(0,d.useState)(!1),b=a[0],c=a[1];return{isOpen:b,setIsOpen:c}}},7408:function(a,b,c){"use strict";c.r(b),c.d(b,{default:function(){return M}});var d,e=c(5893),f=c(1799),g=c(9396),h=c(797),i=c(7294),j=c(1206),k=c(5638),l=c(1664),m=c.n(l),n=function(){return(0,e.jsx)("div",{className:"my-5 flex justify-center w-full",children:(0,e.jsx)("div",{className:"card w-96 bg-neutral text-neutral-content",children:(0,e.jsxs)("div",{className:"card-body items-center text-center",children:[(0,e.jsx)("h2",{className:"card-title",children:"No commands!"}),(0,e.jsx)("p",{className:"mb-3",children:"When you add commands, they will show up here!"}),(0,e.jsx)("div",{className:"card-actions justify-center",children:(0,e.jsx)(m(),{href:"/commands/add",children:(0,e.jsx)("a",{className:"btn btn-primary",children:"Add a Command"})})})]})})})},o=c(7018),p=c(887),q=c(5587),r=c(4285),s=c(4184),t=c.n(s),u=c(7568),v=c(4051),w=c.n(v),x=c(2260),y=c(3454);(0,u.Z)(w().mark(function a(b){var c,d,e;return w().wrap(function(a){for(;;)switch(a.prev=a.next){case 0:return a.next=2,(0,x.getToken)({req:b,secret:y.env.JWT_SECRET});case 2:return d=(c=a.sent).name,e=c.picture,a.abrupt("return",{username:d,picture:e});case 5:case"end":return a.stop()}},a)}));var z=c(4719),A=c(1634),B=function(a){var b=a.command,c=a.onDelete,d=(0,q.nB)({id:b._id}),h=d.attributes,j=d.listeners,k=d.setNodeRef,l=d.transform,n=d.transition,o=d.setActivatorNodeRef,p={transform:r.ux.Transform.toString(l),transition:n},s=(0,i.useCallback)(function(a){var d={id:b._id,name:b.name};console.log("SortableCommandListItem handleDelete",d),c(d)},[c]),u=(0,i.useMemo)(function(){var a=new Date;return a.getMonth(),a.getDate(),(0,z.cm)()},[]);return(0,e.jsx)("div",{ref:k,style:p,children:(0,e.jsx)("div",{"data-id":b._id,className:"select-none p-4 mb-6 card bg-base-200 h-[160px] md:text-base text-xs",children:(0,e.jsxs)("div",{className:"md:flex items-center justify-center h-full",children:[(0,e.jsxs)("div",{className:"flex flex-grow md:items-center",children:[(0,e.jsxs)("button",(0,g.Z)((0,f.Z)({className:"btn-dragon btn btn-ghost cursor-grab active:cursor-grabbing mr-3",ref:o},h,j),{children:[(0,e.jsx)("span",{className:"btn-dragon__icon btn-dragon__icon--dragon",children:u}),(0,e.jsx)("span",{className:"btn-dragon__icon btn-dragon__icon--reorder",children:(0,e.jsx)(z.qn,{})})]})),(0,e.jsxs)("div",{children:[(0,e.jsxs)("strong",{className:"font-bold text-lg",children:["!",b.name," ",b.enabled?null:(0,e.jsx)("span",{className:"ml-3 bg-primary rounded-full py-1 px-3 inline-block text-xs text-white",children:"Not visible"})]}),b.roles.length>0&&(0,e.jsx)("ul",{className:"my-2",children:b.roles.map(function(a){var b;return(0,e.jsx)("li",{className:t()("role-badge","role-badge--".concat(a)),children:"mod"===(b=a)?"Moderator":"vip"===b?"VIP":"broadcaster"===b?"Broadcaster":"sub"===b?"Subscriber":null},a)})}),(0,e.jsx)("div",{className:"my-2 ellipsize-2",dangerouslySetInnerHTML:{__html:(0,A.f)(b.description)}})]})]}),(0,e.jsxs)("div",{className:"flex md:flex-col items-center space-x-2 md:space-x-0 md:ml-2 my-2 md:my-0",children:[(0,e.jsx)(m(),{href:"/commands/".concat(b._id),children:(0,e.jsx)("a",{className:"md:w-full w-1/2 btn btn-xs md:btn-sm btn-primary border-0 text-white md:mb-3",children:"Edit"})}),(0,e.jsx)("a",{href:"#delete-command",onClick:s,className:"md:w-full w-1/2 btn btn-xs md:btn-sm bg-red-700 hover:bg-red-600 border-0 text-white",children:"Delete"})]})]})})})},C=function(a){var b=a.commands,c=a.onDelete,d=a.onOrderUpdate,j=(0,p.Dy)((0,p.VT)(p.we),
1(0,p.VT)(p.Lg,{coordinateGetter:q.is})),k=(0,i.useMemo)(function(){return b.map(function(a){return(0,g.Z)((0,f.Z)({},a),{id:a._id})})},[b]),l=(0,i.useCallback)(function(a){var c=a.active,e=a.over;if(c.id!==(null==e?void 0:e.id)){var i=b.findIndex(function(a){return a._id===c.id}),j=b.findIndex(function(a){return a._id===(null==e?void 0:e.id)});if(-1!==j){var k=(0,h.Z)(b.map(function(a){return(0,f.Z)({},a)})),l=(0,q.Rp)(k,i,j).map(function(a,b){return(0,g.Z)((0,f.Z)({},a),{weight:b})});d(l)}}},[b]),m=(0,i.useCallback)(function(a){console.log("SortableList handleDelete",a),c(a)},[c]);return(0,e.jsx)(p.LB,{sensors:j,collisionDetection:p.pE,onDragEnd:l,children:(0,e.jsx)(q.Fo,{items:k,strategy:q.qw,children:b.map(function(a){return(0,e.jsx)(B,{command:a,onDelete:m},a._id)})})})},D=(0,i.memo)(C),E=c(8445),F=c(3850),G=c(198),H=function(){var a=(0,i.useState)("idle"),b=a[0],c=a[1],d=(0,i.useState)(""),l=d[0],m=d[1],p=(0,F.m)(),q=p.commands,r=p.isFetchingCommands,s=p.refreshCommands,t=p.updateCommandOrder,u=p.deleteCommand,v=(0,i.useState)(q),w=v[0],x=v[1];(0,i.useEffect)(function(){x(q)},[q]),(0,i.useEffect)(function(){r?c("loading"):"loading"===b&&c("idle")},[r,b]);var y=(0,i.useState)(null),z=y[0],A=y[1],B=(0,i.useState)(null),C=B[0],H=B[1],I=(0,i.useCallback)(function(a){var b=a.name,c=a.id;A(b),H(c)},[]),J=(0,i.useCallback)(function(){C&&u(C).then(function(){s().then(function(){c("success"),m("Successfully deleted the command")})}).catch(function(a){console.error("error",a),c("failure"),m("Failed to delete the command")})},[C,u,s]),K=(0,i.useCallback)(function(){c("idle"),m("")},[]),L=(0,i.useCallback)(function(a){var b=(0,h.Z)(w.map(function(a){return(0,f.Z)({},a)}));x(a),t(a).then(function(a){}).catch(function(a){console.error(a),x(b),c("failure"),m("Failed to reorder list")})},[w]),M=(0,i.useMemo)(function(){return w.sort(o.OK).map(function(a,b){return(0,g.Z)((0,f.Z)({},a),{weight:a.weight||b})})},[w]),N=(0,G.Q)(),O=N.isOpen,P=N.setIsOpen;return(0,e.jsxs)("div",{className:"container",children:[(0,e.jsx)(E.g,{commands:M,isOpen:O,onOpenChange:P}),(0,e.jsx)("div",{className:"flex justify-center",children:("failure"===b||"success"===b)&&(0,e.jsxs)("div",{className:"my-4 w-full max-w-lg",children:["failure"===b&&(0,e.jsx)(j.b,{type:"error",children:l}),"success"===b&&(0,e.jsx)(j.b,{type:"success",action:(0,e.jsx)("button",{onClick:K,className:"btn btn-sm btn-ghost",children:"Close"}),children:l})]})}),(0,e.jsx)("div",{className:"flex justify-center",children:(0,e.jsxs)("div",{className:"w-full max-w-lg",children:["loading"===b?(0,e.jsx)("div",{className:"my-4",children:(0,e.jsx)(k.T,{})}):(0,e.jsxs)(e.Fragment,{children:[w.length>0&&(0,e.jsx)("h1",{className:"mb-2 text-xl font-bold",children:"Commands"}),w.length?(0,e.jsx)(D,{onDelete:I,onOrderUpdate:L,commands:M}):null]}),(0,e.jsx)("div",{className:"modal",id:"delete-command",children:(0,e.jsxs)("div",{className:"modal-box",children:[(0,e.jsx)("h3",{className:"font-bold text-lg",children:"Delete Command"}),(0,e.jsxs)("p",{className:"py-4",children:["Are you sure you want to delete the command ",(0,e.jsxs)("strong",{children:["!",z]}),"?"]}),(0,e.jsxs)("div",{className:"modal-action",children:[(0,e.jsx)("a",{href:"#",className:"btn bg-red-700 hover:bg-red-600 border-0 text-white",onClick:function(){return J()},children:"Yes, Delete"}),(0,e.jsx)("a",{href:"#",className:"btn",onClick:function(){H(null),A(null)},children:"No, Cancel"})]})]})}),0===w.length&&"idle"===b&&(0,e.jsx)(n,{})]})})]})},I=c(565),J=c(2320),K=c(2501),L=c(1163),M=function(){var a=(0,L.useRouter)(),b=(0,K.a)(),c=b.isLoading,d=b.isSignedIn;return(0,i.useEffect)(function(){c||d||a.push("/")},[d,c,a]),(0,e.jsxs)("div",{children:[(0,e.jsx)(I.H,{}),(0,e.jsx)(H,{}),(0,e.jsx)(J.n,{})]})}},1634:function(a,b,c){"use strict";c.d(b,{f:function(){return g}});var d=c(9980),e=c.n(d),f=e()({html:!1,xhtmlOut:!1,breaks:!0,linkify:!1,highlight:function(){return""}}),g=function(a){return f.render(a)}}},function(a){a.O(0,[799,411,827,875,774,888,179],function(){var b;return a(a.s=1128)}),_N_E=a.O()}])
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.