This repository was archived by the owner on Aug 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathutils-cf944c28.js.map
1 lines (1 loc) · 4.06 KB
/
utils-cf944c28.js.map
1
{"version":3,"file":"utils-cf944c28.js","sources":["../src/ui/Message/utils.js"],"sourcesContent":["import format from 'date-fns/format';\nimport MessageStatusType from '../MessageStatus/type';\n\nexport const copyToClipboard = (text) => {\n if (window.clipboardData && window.clipboardData.setData) {\n // Internet Explorer-specific code path to prevent textarea being shown while dialog is visible.\n return window.clipboardData.setData('Text', text);\n }\n if (document.queryCommandSupported && document.queryCommandSupported('copy')) {\n const textarea = document.createElement('textarea');\n textarea.textContent = text;\n textarea.style.position = 'fixed'; // Prevent scrolling to bottom of page in Microsoft Edge.\n document.body.appendChild(textarea);\n textarea.select();\n try {\n return document.execCommand('copy'); // Security exception may be thrown by some browsers.\n } catch (ex) {\n return false;\n } finally {\n document.body.removeChild(textarea);\n }\n }\n return false;\n};\n\nexport const getMessageCreatedAt = (message) => format(message.createdAt || 0, 'p');\n\nexport const getSenderName = (message) => (\n message.sender && (\n message.sender.friendName\n || message.sender.nickname\n || message.sender.userId\n )\n);\n\nexport const getSenderProfileUrl = (message) => message.sender && message.sender.profileUrl;\n\nexport const getIsSentFromStatus = (status) => (\n status === MessageStatusType.SENT\n || status === MessageStatusType.DELIVERED\n || status === MessageStatusType.READ\n);\n\nexport const getIsSentFromSendingStatus = (message = {}) => {\n if (message.sendingStatus && typeof message.sendingStatus === 'string') {\n return message.sendingStatus === 'none' || message.sendingStatus === 'succeeded';\n }\n return false;\n};\n\nexport const createUrlTester = (regexp) => (text) => regexp.test(text);\n\nexport default {\n copyToClipboard,\n getMessageCreatedAt,\n getSenderName,\n getSenderProfileUrl,\n getIsSentFromStatus,\n getIsSentFromSendingStatus,\n createUrlTester,\n};\n"],"names":["copyToClipboard","text","window","clipboardData","setData","document","queryCommandSupported","textarea","createElement","textContent","style","position","body","appendChild","select","execCommand","ex","removeChild","getMessageCreatedAt","message","format","createdAt","getSenderName","sender","friendName","nickname","userId","getSenderProfileUrl","profileUrl","getIsSentFromStatus","status","MessageStatusType","SENT","DELIVERED","READ","getIsSentFromSendingStatus","sendingStatus"],"mappings":";;;IAGaA,eAAe,GAAG,SAAlBA,eAAkB,CAACC,IAAD,EAAU;AACvC,MAAIC,MAAM,CAACC,aAAP,IAAwBD,MAAM,CAACC,aAAP,CAAqBC,OAAjD,EAA0D;AACxD;AACA,WAAOF,MAAM,CAACC,aAAP,CAAqBC,OAArB,CAA6B,MAA7B,EAAqCH,IAArC,CAAP;AACD;;AACD,MAAII,QAAQ,CAACC,qBAAT,IAAkCD,QAAQ,CAACC,qBAAT,CAA+B,MAA/B,CAAtC,EAA8E;AAC5E,QAAMC,QAAQ,GAAGF,QAAQ,CAACG,aAAT,CAAuB,UAAvB,CAAjB;AACAD,IAAAA,QAAQ,CAACE,WAAT,GAAuBR,IAAvB;AACAM,IAAAA,QAAQ,CAACG,KAAT,CAAeC,QAAf,GAA0B,OAA1B,CAH4E;;AAI5EN,IAAAA,QAAQ,CAACO,IAAT,CAAcC,WAAd,CAA0BN,QAA1B;AACAA,IAAAA,QAAQ,CAACO,MAAT;;AACA,QAAI;AACF,aAAOT,QAAQ,CAACU,WAAT,CAAqB,MAArB,CAAP,CADE;AAEH,KAFD,CAEE,OAAOC,EAAP,EAAW;AACX,aAAO,KAAP;AACD,KAJD,SAIU;AACRX,MAAAA,QAAQ,CAACO,IAAT,CAAcK,WAAd,CAA0BV,QAA1B;AACD;AACF;;AACD,SAAO,KAAP;AACD;IAEYW,mBAAmB,GAAG,SAAtBA,mBAAsB,CAACC,OAAD;AAAA,SAAaC,MAAM,CAACD,OAAO,CAACE,SAAR,IAAqB,CAAtB,EAAyB,GAAzB,CAAnB;AAAA;IAEtBC,aAAa,GAAG,SAAhBA,aAAgB,CAACH,OAAD;AAAA,SAC3BA,OAAO,CAACI,MAAR,KACEJ,OAAO,CAACI,MAAR,CAAeC,UAAf,IAC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