1 line
8.1 KiB
JavaScript
Vendored
1 line
8.1 KiB
JavaScript
Vendored
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9266],{79266:function(e,n,t){"use strict";t.r(n),t.d(n,{UserDropdown:function(){return L}});var r=t(85893),o=t(66516),i=t(13013),a=t(71577),l=t(94184),s=t.n(l),c=t(4480),u=t(67294),d=t(46977),f=t(5152),p=t.n(f),h=t(4511),v=t(44974),y=t(27345),m=t.n(y),b=t(69183);let k=p()(()=>Promise.all([t.e(2074),t.e(8244)]).then(t.t.bind(t,18244,23)),{loadableGenerated:{webpack:()=>[18244]},ssr:!1}),w=p()(()=>Promise.all([t.e(2074),t.e(775)]).then(t.t.bind(t,10775,23)),{loadableGenerated:{webpack:()=>[10775]},ssr:!1}),g=p()(()=>Promise.all([t.e(2074),t.e(6275)]).then(t.t.bind(t,6275,23)),{loadableGenerated:{webpack:()=>[6275]},ssr:!1}),C=p()(()=>Promise.all([t.e(2074),t.e(5672)]).then(t.t.bind(t,65672,23)),{loadableGenerated:{webpack:()=>[65672]},ssr:!1}),j=p()(()=>Promise.all([t.e(2074),t.e(5412)]).then(t.t.bind(t,95412,23)),{loadableGenerated:{webpack:()=>[95412]},ssr:!1}),x=p()(()=>Promise.all([t.e(5874),t.e(5402),t.e(9614)]).then(t.bind(t,29614)).then(e=>e.Modal),{loadableGenerated:{webpack:()=>[29614]},ssr:!1}),E=p()(()=>Promise.all([t.e(173),t.e(5874),t.e(5257),t.e(4041),t.e(3427)]).then(t.bind(t,7783)).then(e=>e.NameChangeModal),{loadableGenerated:{webpack:()=>[7783]},ssr:!1}),A=p()(()=>Promise.all([t.e(173),t.e(5874),t.e(5348),t.e(4526),t.e(8513)]).then(t.bind(t,78513)).then(e=>e.AuthModal),{loadableGenerated:{webpack:()=>[78513]},ssr:!1}),L=e=>{let{id:n,username:t,hideTitleOnMobile:l=!1,showToggleChatOption:f=!0}=e,[p,y]=(0,u.useState)(!1),[L,_]=(0,u.useState)(!1),[O,S]=(0,c.FV)(v.ZA),P=(0,c.sJ)(v.Q),D=()=>{f&&S(!O)},K=()=>{y(!0)};(0,d.y1)("c",D,{enableOnContentEditable:!1},[O]);let N=(0,c.sJ)(v.db);if(!N)return null;let{displayName:R}=N,T=(0,r.jsxs)(o.Z,{children:[(0,r.jsx)(o.Z.Item,{icon:(0,r.jsx)(w,{}),onClick:()=>K(),children:"Change name"},"0"),(0,r.jsx)(o.Z.Item,{icon:(0,r.jsx)(g,{}),onClick:()=>_(!0),children:"Authenticate"},"1"),f&&P.chatAvailable&&(0,r.jsx)(o.Z.Item,{icon:(0,r.jsx)(C,{}),onClick:()=>D(),"aria-expanded":O,className:m().chatToggle,children:O?"Hide Chat":"Show Chat"},"3")]});return(0,r.jsx)(h.SV,{fallbackRender:e=>{let{error:n,resetErrorBoundary:t}=e;return(0,r.jsx)(b.A,{componentName:"UserDropdown",message:n.message,retryFunction:t})},children:(0,r.jsxs)("div",{className:m().root,children:[(0,r.jsx)(i.Z,{overlay:T,trigger:["click"],children:(0,r.jsxs)(a.Z,{id:n,type:"primary",icon:(0,r.jsx)(j,{className:m().userIcon}),children:[(0,r.jsx)("span",{className:s()([m().username,l&&m().hideTitleOnMobile]),children:t||R}),(0,r.jsx)(k,{})]})}),(0,r.jsx)(x,{title:"Change Chat Display Name",open:p,handleCancel:()=>y(!1),children:(0,r.jsx)(E,{})}),(0,r.jsx)(x,{title:"Authenticate",open:L,handleCancel:()=>_(!1),children:(0,r.jsx)(A,{})})]})})}},27345:function(e){e.exports={root:"UserDropdown_root__IdxfQ","ant-space":"UserDropdown_ant-space__XJTZ3","ant-space-item":"UserDropdown_ant-space-item__w4nC2",username:"UserDropdown_username__nVyPA",hideTitleOnMobile:"UserDropdown_hideTitleOnMobile__AtFIT",chatToggle:"UserDropdown_chatToggle__pZoqQ"}},46977:function(e,n,t){"use strict";t.d(n,{y1:function(){return k}});var r=t(67294);function o(){return(o=Object.assign?Object.assign.bind():function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}t(85893);var i=["shift","alt","meta","mod","ctrl"],a={esc:"escape",return:"enter",".":"period",",":"comma","-":"slash"," ":"space","`":"backquote","#":"backslash","+":"bracketright",ShiftLeft:"shift",ShiftRight:"shift",AltLeft:"alt",AltRight:"alt",MetaLeft:"meta",MetaRight:"meta",OSLeft:"meta",OSRight:"meta",ControlLeft:"ctrl",ControlRight:"ctrl"};function l(e){return(a[e]||e).trim().toLowerCase().replace(/key|digit|numpad|arrow/,"")}function s(e,n){return void 0===n&&(n=","),e.split(n)}function c(e,n,t){void 0===n&&(n="+");var r=e.toLocaleLowerCase().split(n).map(function(e){return l(e)});return o({},{alt:r.includes("alt"),ctrl:r.includes("ctrl")||r.includes("control"),shift:r.includes("shift"),meta:r.includes("meta"),mod:r.includes("mod")},{keys:r.filter(function(e){return!i.includes(e)}),description:t})}"undefined"!=typeof document&&(document.addEventListener("keydown",function(e){void 0!==e.key&&d([l(e.key),l(e.code)])}),document.addEventListener("keyup",function(e){void 0!==e.key&&f([l(e.key),l(e.code)])})),"undefined"!=typeof window&&window.addEventListener("blur",function(){u.clear()});var u=new Set;function d(e){var n=Array.isArray(e)?e:[e];u.has("meta")&&u.forEach(function(e){return!i.includes(e)&&u.delete(e.toLowerCase())}),n.forEach(function(e){return u.add(e.toLowerCase())})}function f(e){var n=Array.isArray(e)?e:[e];"meta"===e?u.clear():n.forEach(function(e){return u.delete(e.toLowerCase())})}function p(e,n){var t=e.target;void 0===n&&(n=!1);var r=t&&t.tagName;return n instanceof Array?!!(r&&n&&n.some(function(e){return e.toLowerCase()===r.toLowerCase()})):!!(r&&n&&!0===n)}var h=function(e,n,t){void 0===t&&(t=!1);var r,o=n.alt,i=n.meta,a=n.mod,s=n.shift,c=n.ctrl,d=n.keys,f=e.key,p=e.code,h=e.ctrlKey,v=e.metaKey,y=e.shiftKey,m=e.altKey,b=l(p),k=f.toLowerCase();if(!t){if(!m===o&&"alt"!==k||!y===s&&"shift"!==k)return!1;if(a){if(!v&&!h)return!1}else if(!v===i&&"meta"!==k&&"os"!==k||!h===c&&"ctrl"!==k&&"control"!==k)return!1}return!!(d&&1===d.length&&(d.includes(k)||d.includes(b)))||(d?(void 0===r&&(r=","),(Array.isArray(d)?d:d.split(r)).every(function(e){return u.has(e.trim().toLowerCase())})):!d)},v=(0,r.createContext)(void 0),y=(0,r.createContext)({hotkeys:[],enabledScopes:[],toggleScope:function(){},enableScope:function(){},disableScope:function(){}}),m=function(e){e.stopPropagation(),e.preventDefault(),e.stopImmediatePropagation()},b="undefined"!=typeof window?r.useLayoutEffect:r.useEffect;function k(e,n,t,o){var i,a=(0,r.useRef)(null),u=(0,r.useRef)(!1),k=t instanceof Array?o instanceof Array?void 0:o:t,w=e instanceof Array?e.join(null==k?void 0:k.splitKey):e,g=t instanceof Array?t:o instanceof Array?o:void 0,C=(0,r.useCallback)(n,null!=g?g:[]),j=(0,r.useRef)(C);g?j.current=C:j.current=n;var x=(!function e(n,t){return n&&t&&"object"==typeof n&&"object"==typeof t?Object.keys(n).length===Object.keys(t).length&&Object.keys(n).reduce(function(r,o){return r&&e(n[o],t[o])},!0):n===t}((i=(0,r.useRef)(void 0)).current,k)&&(i.current=k),i.current),E=(0,r.useContext)(y).enabledScopes,A=(0,r.useContext)(v);return b(function(){if((null==x?void 0:x.enabled)!==!1&&(e=null==x?void 0:x.scopes,0===E.length&&e?(console.warn('A hotkey has the "scopes" option set, however no active scopes were found. If you want to use the global scopes feature, you need to wrap your app in a <HotkeysProvider>'),!0):!!(!e||E.some(function(n){return e.includes(n)})||E.includes("*")))){var e,n=function(e,n){var t;if(void 0===n&&(n=!1),!(p(e,["input","textarea","select"])&&!p(e,null==x?void 0:x.enableOnFormTags)||null!=x&&null!=x.ignoreEventWhen&&x.ignoreEventWhen(e))){if(null!==a.current&&document.activeElement!==a.current&&!a.current.contains(document.activeElement)){m(e);return}(null==(t=e.target)||!t.isContentEditable||null!=x&&x.enableOnContentEditable)&&s(w,null==x?void 0:x.splitKey).forEach(function(t){var r,o,i,a=c(t,null==x?void 0:x.combinationKey);if(h(e,a,null==x?void 0:x.ignoreModifiers)||null!=(i=a.keys)&&i.includes("*")){if(n&&u.current)return;if(("function"==typeof(r=null==x?void 0:x.preventDefault)&&r(e,a)||!0===r)&&e.preventDefault(),"function"==typeof(o=null==x?void 0:x.enabled)?!o(e,a):!0!==o&&void 0!==o){m(e);return}j.current(e,a),n||(u.current=!0)}})}},t=function(e){void 0!==e.key&&(d(l(e.code)),((null==x?void 0:x.keydown)===void 0&&(null==x?void 0:x.keyup)!==!0||null!=x&&x.keydown)&&n(e))},r=function(e){void 0!==e.key&&(f(l(e.code)),u.current=!1,null!=x&&x.keyup&&n(e,!0))},o=a.current||(null==k?void 0:k.document)||document;return o.addEventListener("keyup",r),o.addEventListener("keydown",t),A&&s(w,null==x?void 0:x.splitKey).forEach(function(e){return A.addHotkey(c(e,null==x?void 0:x.combinationKey,null==x?void 0:x.description))}),function(){o.removeEventListener("keyup",r),o.removeEventListener("keydown",t),A&&s(w,null==x?void 0:x.splitKey).forEach(function(e){return A.removeHotkey(c(e,null==x?void 0:x.combinationKey,null==x?void 0:x.description))})}}},[w,x,E]),a}}}]); |