@bigbinary/neeto-editor 1.38.9 → 1.38.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/dist/Attachments.js +3 -3
  2. package/dist/Editor.js +4 -4
  3. package/dist/EditorContent.js +1 -1
  4. package/dist/FormikEditor.js +3 -3
  5. package/dist/Menu.js +2 -2
  6. package/dist/{chunk-5c874a66.js → chunk-17c1b4e1.js} +23 -13
  7. package/dist/chunk-17c1b4e1.js.map +1 -0
  8. package/dist/{chunk-8199190a.js → chunk-32e353fe.js} +859 -15
  9. package/dist/chunk-32e353fe.js.map +1 -0
  10. package/dist/{chunk-e9803348.js → chunk-8b1f773d.js} +4 -4
  11. package/dist/{chunk-e9803348.js.map → chunk-8b1f773d.js.map} +1 -1
  12. package/dist/chunk-b66ef3a3.js +513 -0
  13. package/dist/chunk-b66ef3a3.js.map +1 -0
  14. package/dist/cjs/Attachments.cjs.js +3 -3
  15. package/dist/cjs/Editor.cjs.js +6 -6
  16. package/dist/cjs/Editor.cjs.js.map +1 -1
  17. package/dist/cjs/EditorContent.cjs.js +1 -1
  18. package/dist/cjs/FormikEditor.cjs.js +3 -3
  19. package/dist/cjs/Menu.cjs.js +2 -2
  20. package/dist/cjs/{chunk-7d9a9ed1.cjs.js → chunk-938306ec.cjs.js} +852 -4
  21. package/dist/cjs/chunk-938306ec.cjs.js.map +1 -0
  22. package/dist/cjs/chunk-b5a7673a.cjs.js +529 -0
  23. package/dist/cjs/chunk-b5a7673a.cjs.js.map +1 -0
  24. package/dist/cjs/{chunk-635042c3.cjs.js → chunk-eb6c9e4e.cjs.js} +101 -101
  25. package/dist/cjs/{chunk-635042c3.cjs.js.map → chunk-eb6c9e4e.cjs.js.map} +1 -1
  26. package/dist/cjs/{chunk-534531c3.cjs.js → chunk-fd7976a0.cjs.js} +28 -18
  27. package/dist/cjs/chunk-fd7976a0.cjs.js.map +1 -0
  28. package/dist/cjs/index.cjs.js +5 -5
  29. package/dist/editor-content.min.css +1 -1
  30. package/dist/editor-output-pdf-email.css +1 -1
  31. package/dist/editor-output.js +1 -1
  32. package/dist/editor-stats.html +1 -1
  33. package/dist/index.js +5 -5
  34. package/package.json +1 -1
  35. package/dist/chunk-5c874a66.js.map +0 -1
  36. package/dist/chunk-8199190a.js.map +0 -1
  37. package/dist/chunk-f8510c23.js +0 -1356
  38. package/dist/chunk-f8510c23.js.map +0 -1
  39. package/dist/cjs/chunk-0dfcae31.cjs.js +0 -1373
  40. package/dist/cjs/chunk-0dfcae31.cjs.js.map +0 -1
  41. package/dist/cjs/chunk-534531c3.cjs.js.map +0 -1
  42. package/dist/cjs/chunk-7d9a9ed1.cjs.js.map +0 -1
@@ -1,1356 +0,0 @@
1
- import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
- import _toConsumableArray from '@babel/runtime/helpers/toConsumableArray';
3
- import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
4
- import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
5
- import _regeneratorRuntime from '@babel/runtime/regenerator';
6
- import React__default, { useState, useRef, useMemo, useImperativeHandle, Suspense, lazy } from 'react';
7
- import classnames from 'classnames';
8
- import { removeBy, isPresent, noop, isNotEmpty } from '@bigbinary/neeto-cist';
9
- import { Toastr, Dropdown, Tooltip, Input, Button, Typography, Spinner, Alert } from '@bigbinary/neetoui';
10
- import { mergeRight, isEmpty, assoc } from 'ramda';
11
- import { useTranslation, Trans } from 'react-i18next';
12
- import { P as PropTypes, d as directUploadsApi, u as useFileUploader, a as useDropFiles } from './chunk-8199190a.js';
13
- import { n as n$1 } from './chunk-15c449f1.js';
14
- import { withEventTargetValue } from '@bigbinary/neeto-commons-frontend/utils';
15
- import { Close, MenuVertical } from '@bigbinary/neeto-icons';
16
- import { globalProps } from '@bigbinary/neeto-commons-frontend/initializers';
17
- import { D as DIRECT_UPLOAD_ENDPOINT } from './chunk-edd8b9fe.js';
18
- import _extends from '@babel/runtime/helpers/extends';
19
- import { c as commonjsGlobal, g as getDefaultExportFromCjs } from './chunk-65f73e5a.js';
20
- import axios from 'axios';
21
-
22
- var css = ".ne-attachments{display:flex;flex-direction:column;gap:8px}.ne-attachments__items{display:flex;flex-wrap:wrap;gap:8px}.ne-attachments__preview{align-items:center;background-color:rgb(var(--neeto-ui-white));border:1px solid rgb(var(--neeto-ui-gray-200));border-radius:var(--neeto-ui-rounded-sm);display:flex;justify-content:space-between;padding:4px 2px 4px 8px;width:256px}.ne-attachments__preview-wrapper{display:flex;gap:8px;width:88%}.ne-attachments__preview-wrapper__icon{height:auto;width:15px}.ne-attachments__preview-wrapper p{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:92%}.ne-attachments__preview-wrapper:hover{cursor:pointer}.ne-attachments__preview__progress{display:flex;gap:4px;justify-content:space-between;opacity:.5;width:76%}.ne-attachments__preview__progress p{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;width:85%}.ne-attachments__preview__progress p:nth-child(2){flex-shrink:0;width:-moz-fit-content;width:fit-content}.ne-attachments__preview__progress-icon{height:auto;width:15px}.ne-attachments__preview:hover{box-shadow:0 0 0 1px rgb(var(--neeto-ui-gray-400))}.ne-attachments input[type=file]{display:none}.ne-attachments-preview{display:flex;flex-direction:column;gap:8px}.ne-attachments-preview__header{border-bottom:1px solid rgb(var(--neeto-ui-gray-200));display:flex;flex-direction:row;gap:8px;margin-bottom:8px}.ne-attachments-preview__header__fileinfo{align-items:flex-end;border-right:1px solid rgb(var(--neeto-ui-gray-200));display:flex;gap:4px;padding-right:6px}.ne-attachments-preview__header__fileinfo h3{font-weight:500}.ne-attachments-preview__body{align-items:center;display:flex;flex-grow:1;justify-content:center;min-height:10px;padding-bottom:8px!important;position:relative;width:100vw}.ne-attachments-preview__body-download{color:rgb(var(--neeto-ui-primary-800));cursor:pointer}.ne-attachments-preview__body-docviewer{height:100%;width:100%}.ne-attachments-preview__body img{max-height:100%;max-width:100%}.ne-attachments-preview__body video{height:100%;width:100%}.ne-attachments-preview__body iframe{height:100%;padding:0 8px;width:100%}.ne-attachments-preview__body-left,.ne-attachments-preview__body-right{position:absolute!important;top:50%;transform:translateY(-50%);z-index:1}.ne-attachments-preview__body-left:hover,.ne-attachments-preview__body-right:hover{background-color:rgba(var(--neeto-ui-gray-100),.4)!important;cursor:pointer}.ne-attachments-preview__body-left{left:24px}.ne-attachments-preview__body-right{right:24px}.ne-attachments .attachment-button-loader{scale:.5;width:26px!important}.ne-attachments--integrated{background-color:rgb(var(--neeto-ui-white));border:1px solid rgb(var(--neeto-ui-gray-300));border-radius:0 0 var(--neeto-ui-rounded) var(--neeto-ui-rounded);border-top:none;padding:0 6px}.ne-attachments__wrapper{position:relative}.ne-attachments__wrapper.is-dragging-over-files:after{align-items:center;background-color:rgba(var(--neeto-ui-gray-300),.5);border:3px dashed rgb(var(--neeto-ui-gray-500));border-radius:5px;color:rgb(var(--neeto-ui-gray-600));content:\"Drop the file here\";display:flex;font-size:1.2rem;font-weight:700;inset:7px;justify-content:center;position:absolute}";
23
- n$1(css,{});
24
-
25
- var DEFAULT_FILE_UPLOAD_CONFIG = {
26
- directUploadEndpoint: DIRECT_UPLOAD_ENDPOINT,
27
- restrictions: {
28
- maxFileSize: globalProps.endUserUploadedFileSizeLimitInMb * 1024 * 1024
29
- }
30
- };
31
- var ATTACHMENT_OPTIONS = {
32
- DOWNLOAD: "Download",
33
- RENAME: "Rename",
34
- DELETE: "Delete"
35
- };
36
- var ATTACHMENTS_PREVIEW_DATA_CY = "ne-attachments-preview-content";
37
-
38
- var r={grad:.9,turn:360,rad:360/(2*Math.PI)},t=function(r){return "string"==typeof r?r.length>0:"number"==typeof r},n=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=Math.pow(10,t)),Math.round(n*r)/n+0},e=function(r,t,n){return void 0===t&&(t=0),void 0===n&&(n=1),r>n?n:r>t?r:t},u=function(r){return (r=isFinite(r)?r%360:0)>0?r:r+360},a=function(r){return {r:e(r.r,0,255),g:e(r.g,0,255),b:e(r.b,0,255),a:e(r.a)}},o=function(r){return {r:n(r.r),g:n(r.g),b:n(r.b),a:n(r.a,3)}},i=/^#([0-9a-f]{3,8})$/i,s=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},h=function(r){var t=r.r,n=r.g,e=r.b,u=r.a,a=Math.max(t,n,e),o=a-Math.min(t,n,e),i=o?a===t?(n-e)/o:a===n?2+(e-t)/o:4+(t-n)/o:0;return {h:60*(i<0?i+6:i),s:a?o/a*100:0,v:a/255*100,a:u}},b=function(r){var t=r.h,n=r.s,e=r.v,u=r.a;t=t/360*6,n/=100,e/=100;var a=Math.floor(t),o=e*(1-n),i=e*(1-(t-a)*n),s=e*(1-(1-t+a)*n),h=a%6;return {r:255*[e,i,o,o,s,e][h],g:255*[s,e,e,i,o,o][h],b:255*[o,o,s,e,e,i][h],a:u}},g=function(r){return {h:u(r.h),s:e(r.s,0,100),l:e(r.l,0,100),a:e(r.a)}},d=function(r){return {h:n(r.h),s:n(r.s),l:n(r.l),a:n(r.a,3)}},f=function(r){return b((n=(t=r).s,{h:t.h,s:(n*=((e=t.l)<50?e:100-e)/100)>0?2*n/(e+n)*100:0,v:e+n,a:t.a}));var t,n,e;},c=function(r){return {h:(t=h(r)).h,s:(u=(200-(n=t.s))*(e=t.v)/100)>0&&u<200?n*e/100/(u<=100?u:200-u)*100:0,l:u/2,a:t.a};var t,n,e,u;},l=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,p=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,v=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,m=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,y={string:[[function(r){var t=i.exec(r);return t?(r=t[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:4===r.length?n(parseInt(r[3]+r[3],16)/255,2):1}:6===r.length||8===r.length?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:8===r.length?n(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=v.exec(r)||m.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:a({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:void 0===t[7]?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(t){var n=l.exec(t)||p.exec(t);if(!n)return null;var e,u,a=g({h:(e=n[1],u=n[2],void 0===u&&(u="deg"),Number(e)*(r[u]||1)),s:Number(n[3]),l:Number(n[4]),a:void 0===n[5]?1:Number(n[5])/(n[6]?100:1)});return f(a)},"hsl"]],object:[[function(r){var n=r.r,e=r.g,u=r.b,o=r.a,i=void 0===o?1:o;return t(n)&&t(e)&&t(u)?a({r:Number(n),g:Number(e),b:Number(u),a:Number(i)}):null},"rgb"],[function(r){var n=r.h,e=r.s,u=r.l,a=r.a,o=void 0===a?1:a;if(!t(n)||!t(e)||!t(u))return null;var i=g({h:Number(n),s:Number(e),l:Number(u),a:Number(o)});return f(i)},"hsl"],[function(r){var n=r.h,a=r.s,o=r.v,i=r.a,s=void 0===i?1:i;if(!t(n)||!t(a)||!t(o))return null;var h=function(r){return {h:u(r.h),s:e(r.s,0,100),v:e(r.v,0,100),a:e(r.a)}}({h:Number(n),s:Number(a),v:Number(o),a:Number(s)});return b(h)},"hsv"]]},N=function(r,t){for(var n=0;n<t.length;n++){var e=t[n][0](r);if(e)return [e,t[n][1]]}return [null,void 0]},x=function(r){return "string"==typeof r?N(r.trim(),y.string):"object"==typeof r&&null!==r?N(r,y.object):[null,void 0]},M=function(r,t){var n=c(r);return {h:n.h,s:e(n.s+100*t,0,100),l:n.l,a:n.a}},H=function(r){return (299*r.r+587*r.g+114*r.b)/1e3/255},$=function(r,t){var n=c(r);return {h:n.h,s:n.s,l:e(n.l+100*t,0,100),a:n.a}},j=function(){function r(r){this.parsed=x(r)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1};}return r.prototype.isValid=function(){return null!==this.parsed},r.prototype.brightness=function(){return n(H(this.rgba),2)},r.prototype.isDark=function(){return H(this.rgba)<.5},r.prototype.isLight=function(){return H(this.rgba)>=.5},r.prototype.toHex=function(){return r=o(this.rgba),t=r.r,e=r.g,u=r.b,i=(a=r.a)<1?s(n(255*a)):"","#"+s(t)+s(e)+s(u)+i;var r,t,e,u,a,i;},r.prototype.toRgb=function(){return o(this.rgba)},r.prototype.toRgbString=function(){return r=o(this.rgba),t=r.r,n=r.g,e=r.b,(u=r.a)<1?"rgba("+t+", "+n+", "+e+", "+u+")":"rgb("+t+", "+n+", "+e+")";var r,t,n,e,u;},r.prototype.toHsl=function(){return d(c(this.rgba))},r.prototype.toHslString=function(){return r=d(c(this.rgba)),t=r.h,n=r.s,e=r.l,(u=r.a)<1?"hsla("+t+", "+n+"%, "+e+"%, "+u+")":"hsl("+t+", "+n+"%, "+e+"%)";var r,t,n,e,u;},r.prototype.toHsv=function(){return r=h(this.rgba),{h:n(r.h),s:n(r.s),v:n(r.v),a:n(r.a,3)};var r;},r.prototype.invert=function(){return w({r:255-(r=this.rgba).r,g:255-r.g,b:255-r.b,a:r.a});var r;},r.prototype.saturate=function(r){return void 0===r&&(r=.1),w(M(this.rgba,r))},r.prototype.desaturate=function(r){return void 0===r&&(r=.1),w(M(this.rgba,-r))},r.prototype.grayscale=function(){return w(M(this.rgba,-1))},r.prototype.lighten=function(r){return void 0===r&&(r=.1),w($(this.rgba,r))},r.prototype.darken=function(r){return void 0===r&&(r=.1),w($(this.rgba,-r))},r.prototype.rotate=function(r){return void 0===r&&(r=15),this.hue(this.hue()+r)},r.prototype.alpha=function(r){return "number"==typeof r?w({r:(t=this.rgba).r,g:t.g,b:t.b,a:r}):n(this.rgba.a,3);var t;},r.prototype.hue=function(r){var t=c(this.rgba);return "number"==typeof r?w({h:r,s:t.s,l:t.l,a:t.a}):n(t.h)},r.prototype.isEqual=function(r){return this.toHex()===w(r).toHex()},r}(),w=function(r){return r instanceof j?r:new j(r)},S=[],k=function(r){r.forEach(function(r){S.indexOf(r)<0&&(r(j,y),S.push(r));});};
39
-
40
- function namesPlugin(e,f){var a={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},r={};for(var d in a)r[a[d]]=d;var l={};e.prototype.toName=function(f){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return "transparent";var d,i,n=r[this.toHex()];if(n)return n;if(null==f?void 0:f.closest){var o=this.toRgb(),t=1/0,b="black";if(!l.length)for(var c in a)l[c]=new e(a[c]).toRgb();for(var g in a){var u=(d=o,i=l[g],Math.pow(d.r-i.r,2)+Math.pow(d.g-i.g,2)+Math.pow(d.b-i.b,2));u<t&&(t=u,b=g);}return b}};f.string.push([function(f){var r=f.toLowerCase(),d="transparent"===r?"#0000":a[r];return d?new e(d).toRgb():null},"name"]);}
41
-
42
- /**
43
- * lodash (Custom Build) <https://lodash.com/>
44
- * Build: `lodash modularize exports="npm" -o ./`
45
- * Copyright jQuery Foundation and other contributors <https://jquery.org/>
46
- * Released under MIT license <https://lodash.com/license>
47
- * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
48
- * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
49
- */
50
-
51
- /** Used as references for various `Number` constants. */
52
- var INFINITY = 1 / 0;
53
-
54
- /** `Object#toString` result references. */
55
- var symbolTag = '[object Symbol]';
56
-
57
- /** Detect free variable `global` from Node.js. */
58
- var freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;
59
-
60
- /** Detect free variable `self`. */
61
- var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
62
-
63
- /** Used as a reference to the global object. */
64
- var root = freeGlobal || freeSelf || Function('return this')();
65
-
66
- /** Used for built-in method references. */
67
- var objectProto = Object.prototype;
68
-
69
- /** Used to generate unique IDs. */
70
- var idCounter = 0;
71
-
72
- /**
73
- * Used to resolve the
74
- * [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
75
- * of values.
76
- */
77
- var objectToString = objectProto.toString;
78
-
79
- /** Built-in value references. */
80
- var Symbol = root.Symbol;
81
-
82
- /** Used to convert symbols to primitives and strings. */
83
- var symbolProto = Symbol ? Symbol.prototype : undefined,
84
- symbolToString = symbolProto ? symbolProto.toString : undefined;
85
-
86
- /**
87
- * The base implementation of `_.toString` which doesn't convert nullish
88
- * values to empty strings.
89
- *
90
- * @private
91
- * @param {*} value The value to process.
92
- * @returns {string} Returns the string.
93
- */
94
- function baseToString(value) {
95
- // Exit early for strings to avoid a performance hit in some environments.
96
- if (typeof value == 'string') {
97
- return value;
98
- }
99
- if (isSymbol(value)) {
100
- return symbolToString ? symbolToString.call(value) : '';
101
- }
102
- var result = (value + '');
103
- return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result;
104
- }
105
-
106
- /**
107
- * Checks if `value` is object-like. A value is object-like if it's not `null`
108
- * and has a `typeof` result of "object".
109
- *
110
- * @static
111
- * @memberOf _
112
- * @since 4.0.0
113
- * @category Lang
114
- * @param {*} value The value to check.
115
- * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
116
- * @example
117
- *
118
- * _.isObjectLike({});
119
- * // => true
120
- *
121
- * _.isObjectLike([1, 2, 3]);
122
- * // => true
123
- *
124
- * _.isObjectLike(_.noop);
125
- * // => false
126
- *
127
- * _.isObjectLike(null);
128
- * // => false
129
- */
130
- function isObjectLike(value) {
131
- return !!value && typeof value == 'object';
132
- }
133
-
134
- /**
135
- * Checks if `value` is classified as a `Symbol` primitive or object.
136
- *
137
- * @static
138
- * @memberOf _
139
- * @since 4.0.0
140
- * @category Lang
141
- * @param {*} value The value to check.
142
- * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
143
- * @example
144
- *
145
- * _.isSymbol(Symbol.iterator);
146
- * // => true
147
- *
148
- * _.isSymbol('abc');
149
- * // => false
150
- */
151
- function isSymbol(value) {
152
- return typeof value == 'symbol' ||
153
- (isObjectLike(value) && objectToString.call(value) == symbolTag);
154
- }
155
-
156
- /**
157
- * Converts `value` to a string. An empty string is returned for `null`
158
- * and `undefined` values. The sign of `-0` is preserved.
159
- *
160
- * @static
161
- * @memberOf _
162
- * @since 4.0.0
163
- * @category Lang
164
- * @param {*} value The value to process.
165
- * @returns {string} Returns the string.
166
- * @example
167
- *
168
- * _.toString(null);
169
- * // => ''
170
- *
171
- * _.toString(-0);
172
- * // => '-0'
173
- *
174
- * _.toString([1, 2, 3]);
175
- * // => '1,2,3'
176
- */
177
- function toString(value) {
178
- return value == null ? '' : baseToString(value);
179
- }
180
-
181
- /**
182
- * Generates a unique ID. If `prefix` is given, the ID is appended to it.
183
- *
184
- * @static
185
- * @since 0.1.0
186
- * @memberOf _
187
- * @category Util
188
- * @param {string} [prefix=''] The value to prefix the ID with.
189
- * @returns {string} Returns the unique ID.
190
- * @example
191
- *
192
- * _.uniqueId('contact_');
193
- * // => 'contact_104'
194
- *
195
- * _.uniqueId();
196
- * // => '105'
197
- */
198
- function uniqueId(prefix) {
199
- var id = ++idCounter;
200
- return toString(prefix) + id;
201
- }
202
-
203
- var lodash_uniqueid = uniqueId;
204
-
205
- var uniqueId$1 = /*@__PURE__*/getDefaultExportFromCjs(lodash_uniqueid);
206
-
207
- var glyphs = {
208
- '3d': /*#__PURE__*/React__default.createElement("path", {
209
- d: "M18 14.625V3.375L9 0 0 3.375v11.25L9 18l9-3.375zM9 2.136l5.918 2.22-5.98 2.242-5.919-2.22L9 2.137zM2 13.239V5.065l6.438 2.414v8.174L2 13.24zM9.438 15.7L16 13.239V5.018l-6.563 2.46V15.7z",
210
- transform: "translate(15 10)",
211
- fillRule: "evenodd"
212
- }),
213
- acrobat: /*#__PURE__*/React__default.createElement("path", {
214
- d: "M10.15 1.095C9.938.33 9.42-.051 8.984.005c-.528.068-1.09.382-1.314.876-.63 1.416.685 5.582.887 6.279-1.28 3.863-5.66 11.5-7.806 12.017-.045-.505.225-1.965 3.055-3.785.146-.157.315-.348.393-.472-2.392 1.168-5.492 3.044-3.628 4.448.102.079.259.146.439.213 1.426.528 3.425-1.201 5.435-5.121 2.213-.73 3.999-1.28 6.526-1.662 2.762 1.875 4.616 2.257 5.874 1.774.348-.135.898-.573 1.055-1.145-1.022 1.258-3.414.382-5.323-.82 1.763-.191 3.582-.303 4.369-.056 1 .314.965.808.954.876.079-.27.191-.708-.022-1.056-.842-1.37-4.706-.573-6.11-.427-2.212-1.336-3.74-3.717-4.358-5.436.573-2.212 1.19-3.818.742-5.413zm-.954 4.638C8.826 4.42 8.309 1.5 9.14.556c1.628.932.618 3.144.056 5.177zm3.044 6.514c-2.134.393-3.583.944-5.66 1.764.617-1.202 1.785-4.268 2.346-6.29.787 1.573 1.741 3.111 3.314 4.526z",
215
- transform: "translate(14 9)",
216
- fillRule: "evenodd"
217
- }),
218
- android: /*#__PURE__*/React__default.createElement("path", {
219
- d: "M17.6,9.48l1.84-3.18c0.16-0.31,0.04-0.69-0.26-0.85c-0.29-0.15-0.65-0.06-0.83,0.22l-1.88,3.24 c-2.86-1.21-6.08-1.21-8.94,0L5.65,5.67c-0.19-0.29-0.58-0.38-0.87-0.2C4.5,5.65,4.41,6.01,4.56,6.3L6.4,9.48 C3.3,11.25,1.28,14.44,1,18h22C22.72,14.44,20.7,11.25,17.6,9.48z M7,15.25c-0.69,0-1.25-0.56-1.25-1.25 c0-0.69,0.56-1.25,1.25-1.25S8.25,13.31,8.25,14C8.25,14.69,7.69,15.25,7,15.25z M17,15.25c-0.69,0-1.25-0.56-1.25-1.25 c0-0.69,0.56-1.25,1.25-1.25s1.25,0.56,1.25,1.25C18.25,14.69,17.69,15.25,17,15.25z",
220
- transform: "translate(12 8)"
221
- }),
222
- audio: /*#__PURE__*/React__default.createElement("path", {
223
- d: "M.25 4.75v4.5h3L7 13V1L3.25 4.75h-3zM10.375 7A3.375 3.375 0 0 0 8.5 3.977v6.037A3.355 3.355 0 0 0 10.375 7zM8.5.421v1.545A5.254 5.254 0 0 1 12.25 7a5.254 5.254 0 0 1-3.75 5.032v1.545A6.747 6.747 0 0 0 13.75 7 6.747 6.747 0 0 0 8.5.421z",
224
- transform: "translate(17 12)",
225
- fillRule: "evenodd"
226
- }),
227
- binary: /*#__PURE__*/React__default.createElement("path", {
228
- d: "M2.338 6.112c1.192 0 1.928-1.072 1.928-2.68 0-1.56-.576-2.504-1.8-2.504C1.274.928.538 2 .538 3.608c0 1.56.576 2.504 1.8 2.504zM1.61 3.408c0-1.008.24-1.568.776-1.568.376 0 .616.336.728.888l-1.504.776v-.096zM2.418 5.2c-.368 0-.608-.32-.72-.856l1.496-.768v.056c0 1.008-.24 1.568-.776 1.568zm7.03.8l.088-.944H8.36V.896L7.272.984v.592l-1.184.112.024.824h1.16v2.544h-1.32V6zm5.199 0l.088-.944h-1.176V.896L12.47.984v.592l-1.184.112.024.824h1.16v2.544h-1.32V6zM4.25 14l.088-.944H3.162v-4.16l-1.088.088v.592L.89 9.688l.024.824h1.16v2.544H.754V14zm5.198 0l.088-.944H8.36v-4.16l-1.088.088v.592l-1.184.112.024.824h1.16v2.544h-1.32V14zm3.287.112c1.192 0 1.928-1.072 1.928-2.68 0-1.56-.576-2.504-1.8-2.504-1.192 0-1.928 1.072-1.928 2.68 0 1.56.576 2.504 1.8 2.504zm-.728-2.704c0-1.008.24-1.568.776-1.568.376 0 .616.336.728.888l-1.504.776v-.096zm.808 1.792c-.368 0-.608-.32-.72-.856l1.496-.768v.056c0 1.008-.24 1.568-.776 1.568z",
229
- transform: "translate(16 11)",
230
- fillRule: "evenodd"
231
- }),
232
- code: /*#__PURE__*/React__default.createElement("path", {
233
- d: "M4.078 13.67c-1.875-.527-2.812-1.738-2.812-3.634V9.49C1.266 8.437.844 7.911 0 7.911V6.138c.844 0 1.266-.529 1.266-1.586v-.64c.015-.938.257-1.696.726-2.274C2.466 1.06 3.162.64 4.078.38l.492 1.375c-.656.25-.997.95-1.023 2.102v.695c0 1.167-.482 1.99-1.445 2.469.963.479 1.445 1.304 1.445 2.476v.688c.026 1.15.367 1.851 1.023 2.101l-.492 1.383zm7.844 0c1.875-.527 2.812-1.738 2.812-3.634V9.49c0-1.052.422-1.578 1.266-1.578V6.138c-.844 0-1.266-.529-1.266-1.586v-.64c-.015-.938-.257-1.696-.726-2.274-.474-.578-1.17-.998-2.086-1.258l-.492 1.375c.656.25.997.95 1.023 2.102v.695c0 1.167.482 1.99 1.445 2.469-.963.479-1.445 1.304-1.445 2.476v.688c-.026 1.15-.367 1.851-1.023 2.101l.492 1.383z",
234
- transform: "translate(16 13)",
235
- fillRule: "evenodd"
236
- }),
237
- code2: /*#__PURE__*/React__default.createElement("path", {
238
- d: "M7.4 10.6L2.8 6l4.6-4.6L6 0 0 6l6 6 1.4-1.4zm5.2 0L17.2 6l-4.6-4.6L14 0l6 6-6 6-1.4-1.4z",
239
- transform: "translate(14 14)",
240
- fillRule: "evenodd"
241
- }),
242
- compressed: /*#__PURE__*/React__default.createElement("path", {
243
- d: "M.25 0A.25.25 0 0 0 0 .25v1.5c0 .138.112.25.25.25h1.5A.25.25 0 0 0 2 1.75V.25A.25.25 0 0 0 1.75 0H.25zM1 17a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2a1 1 0 0 0 1-1v-6a1 1 0 0 0-1-1H1zm0 4v3h2v-3H1zM2 2.25A.25.25 0 0 1 2.25 2h1.5a.25.25 0 0 1 .25.25v1.5a.25.25 0 0 1-.25.25h-1.5A.25.25 0 0 1 2 3.75v-1.5zM.25 4a.25.25 0 0 0-.25.25v1.5c0 .138.112.25.25.25h1.5A.25.25 0 0 0 2 5.75v-1.5A.25.25 0 0 0 1.75 4H.25zM2 6.25A.25.25 0 0 1 2.25 6h1.5a.25.25 0 0 1 .25.25v1.5a.25.25 0 0 1-.25.25h-1.5A.25.25 0 0 1 2 7.75v-1.5zM.25 8a.25.25 0 0 0-.25.25v1.5c0 .138.112.25.25.25h1.5A.25.25 0 0 0 2 9.75v-1.5A.25.25 0 0 0 1.75 8H.25zM2 10.25a.25.25 0 0 1 .25-.25h1.5a.25.25 0 0 1 .25.25v1.5a.25.25 0 0 1-.25.25h-1.5a.25.25 0 0 1-.25-.25v-1.5zM.25 12a.25.25 0 0 0-.25.25v1.5c0 .138.112.25.25.25h1.5a.25.25 0 0 0 .25-.25v-1.5a.25.25 0 0 0-.25-.25H.25zM2 14.25a.25.25 0 0 1 .25-.25h1.5a.25.25 0 0 1 .25.25v1.5a.25.25 0 0 1-.25.25h-1.5a.25.25 0 0 1-.25-.25v-1.5z",
244
- transform: "translate(15 1)",
245
- fillRule: "evenodd"
246
- }),
247
- document: /*#__PURE__*/React__default.createElement("path", {
248
- d: "M12 4H0v2h12V4zM0 10h18V8H0v2zM0 0v2h18V0H0z",
249
- transform: "translate(15 15)",
250
- fillRule: "evenodd"
251
- }),
252
- drive: /*#__PURE__*/React__default.createElement("path", {
253
- d: "M2.199.289A.5.5 0 0 1 2.652 0h8.696a.5.5 0 0 1 .453.289l1.867 4a.5.5 0 0 1-.453.711H.785a.5.5 0 0 1-.453-.711l1.867-4zM13 6H1a.752.752 0 0 0-.75.75v4.5c0 .412.338.75.75.75h12c.412 0 .75-.338.75-.75v-4.5A.752.752 0 0 0 13 6zm-9.75 4.5c-.825 0-1.5-.675-1.5-1.5s.675-1.5 1.5-1.5 1.5.675 1.5 1.5-.675 1.5-1.5 1.5z",
254
- transform: "translate(17 13)",
255
- fillRule: "evenodd"
256
- }),
257
- font: /*#__PURE__*/React__default.createElement("path", {
258
- d: "M3.722 8.702l-.686 1.89c-.053.14-.094.28-.123.421-.03.135-.044.252-.044.352 0 .304.097.527.29.668.2.14.501.21.905.21h.414V13H.083v-.756h.343c.176 0 .325-.018.448-.053a.81.81 0 0 0 .334-.22c.1-.105.193-.249.281-.43.094-.182.197-.416.308-.704L5.787.15h1.406l4.07 11.136c.07.187.14.343.21.466.077.123.165.222.264.298.1.07.214.12.343.15.129.03.281.044.457.044h.237V13H7.826v-.756h.413c.72 0 1.081-.287 1.081-.862 0-.1-.014-.202-.044-.307a3.274 3.274 0 0 0-.105-.36l-.72-2.013H3.72zM7.009 4.65c-.188-.533-.36-1.031-.519-1.494a15.92 15.92 0 0 1-.378-1.354 7.12 7.12 0 0 1-.15.633 16.95 16.95 0 0 1-.395 1.283c-.082.229-.175.484-.28.765L4.063 7.796h4.061L7.009 4.65zm8.411 5.74c0 .562.117.984.351 1.265.24.275.61.413 1.108.413.363 0 .691-.059.984-.176.3-.117.551-.284.756-.5.211-.218.372-.481.483-.792.112-.31.168-.656.168-1.037V8.104l-1.152.053c-.51.023-.937.088-1.283.193-.34.1-.615.243-.826.43a1.546 1.546 0 0 0-.457.678c-.088.27-.132.58-.132.931zm2.18-6.32c-.346 0-.627.05-.844.15a1.182 1.182 0 0 0-.501.404 1.594 1.594 0 0 0-.237.624c-.041.24-.062.5-.062.782-.498 0-.879-.085-1.143-.255-.257-.17-.386-.463-.386-.879 0-.31.085-.574.255-.79.17-.218.401-.393.694-.528.299-.14.644-.243 1.037-.308a7.76 7.76 0 0 1 1.257-.097c.55 0 1.031.056 1.441.167.41.106.753.282 1.029.528.275.246.48.568.615.967.14.392.21.876.21 1.45v4.667c0 .252.021.46.062.624a.928.928 0 0 0 .194.395c.088.1.202.17.343.211.146.041.319.062.518.062h.053V13H19.7l-.281-1.547h-.15c-.187.252-.369.483-.544.694-.176.211-.37.393-.58.545-.211.152-.452.27-.721.352a3.053 3.053 0 0 1-.958.131c-.399 0-.77-.058-1.116-.175a2.369 2.369 0 0 1-.888-.519 2.516 2.516 0 0 1-.58-.896c-.14-.364-.211-.791-.211-1.284 0-.955.34-1.664 1.02-2.127.68-.462 1.707-.714 3.084-.755l1.495-.053V6.285a6.93 6.93 0 0 0-.053-.888 1.778 1.778 0 0 0-.229-.703 1.14 1.14 0 0 0-.51-.457c-.216-.111-.51-.167-.878-.167z",
259
- transform: "translate(13 12)",
260
- fillRule: "evenodd"
261
- }),
262
- image: /*#__PURE__*/React__default.createElement("path", {
263
- d: "M13 0L9.25 5l2.85 3.8-1.6 1.2C8.81 7.75 6 4 6 4l-6 8h22L13 0z",
264
- transform: "translate(13 14)",
265
- fillRule: "evenodd"
266
- }),
267
- presentation: /*#__PURE__*/React__default.createElement("path", {
268
- d: "M2 4H0v10c0 1.1.9 2 2 2h14v-2H2V4zm16-4H6C4.9 0 4 .9 4 2v8c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V2c0-1.1-.9-2-2-2zm0 10H6V2h12v8z",
269
- transform: "matrix(-1 0 0 1 34 12)",
270
- fillRule: "evenodd"
271
- }),
272
- settings: /*#__PURE__*/React__default.createElement("path", {
273
- d: "M13.572 8.735c.03-.24.053-.48.053-.735s-.023-.495-.053-.735l1.583-1.237a.378.378 0 0 0 .09-.48l-1.5-2.595a.377.377 0 0 0-.457-.165l-1.868.75a5.48 5.48 0 0 0-1.268-.735L9.868.815A.366.366 0 0 0 9.5.5h-3a.366.366 0 0 0-.367.315l-.285 1.988a5.762 5.762 0 0 0-1.268.735l-1.868-.75a.366.366 0 0 0-.457.165l-1.5 2.595a.37.37 0 0 0 .09.48l1.583 1.237c-.03.24-.053.488-.053.735 0 .248.022.495.053.735L.845 9.973a.378.378 0 0 0-.09.48l1.5 2.595c.09.165.292.225.458.165l1.867-.75c.39.3.81.547 1.268.735l.285 1.987c.022.18.18.315.367.315h3a.366.366 0 0 0 .367-.315l.285-1.988a5.762 5.762 0 0 0 1.268-.734l1.867.75c.173.067.368 0 .458-.165l1.5-2.595a.378.378 0 0 0-.09-.48l-1.582-1.238zM8 10.625A2.628 2.628 0 0 1 5.375 8 2.628 2.628 0 0 1 8 5.375 2.628 2.628 0 0 1 10.625 8 2.628 2.628 0 0 1 8 10.625z",
274
- transform: "translate(16 11)",
275
- fillRule: "evenodd"
276
- }),
277
- spreadsheet: /*#__PURE__*/React__default.createElement("path", {
278
- d: "M0 8h6V5H0v3zm0 5h6v-3H0v3zM0 3h6V0H0v3zm8 5h12V5H8v3zm0 5h12v-3H8v3zM8 0v3h12V0H8z",
279
- transform: "translate(14 14)",
280
- fillRule: "evenodd"
281
- }),
282
- vector: /*#__PURE__*/React__default.createElement("path", {
283
- d: "M14.5 2V1a1 1 0 0 0-1-1h-3a1 1 0 0 0-1 1v1H3.937a2 2 0 1 0 0 1h3.936A9 9 0 0 0 3 11v1h2v-1a7.003 7.003 0 0 1 4.594-6.576A1 1 0 0 0 10.5 5h3a1 1 0 0 0 .906-.576A7.003 7.003 0 0 1 19 11v1h2v-1a9 9 0 0 0-4.873-8h3.936a2 2 0 1 0 0-1H14.5zm-1-1h-3v3h3V1zM2 1.5a1 1 0 1 0 0 2 1 1 0 0 0 0-2zm19 1a1 1 0 1 0 2 0 1 1 0 0 0-2 0z",
284
- transform: "translate(12 14)",
285
- fillRule: "evenodd"
286
- }),
287
- video: /*#__PURE__*/React__default.createElement("path", {
288
- d: "M10.75 3.875V1.25A.752.752 0 0 0 10 .5H1a.752.752 0 0 0-.75.75v7.5c0 .412.338.75.75.75h9c.412 0 .75-.338.75-.75V6.125l3 3V.875l-3 3z",
289
- transform: "translate(17 14)"
290
- })
291
- };
292
-
293
- k([namesPlugin]);
294
- var propTypes = {
295
- /** Color of icon background */
296
- color: PropTypes.string,
297
-
298
- /** Text to display in label */
299
- extension: PropTypes.string,
300
-
301
- /** Displays the corner fold */
302
- fold: PropTypes.bool,
303
-
304
- /** Color of the corner fold */
305
- foldColor: PropTypes.string,
306
-
307
- /** Color of file type icon */
308
- glyphColor: PropTypes.string,
309
-
310
- /** Color of page gradient */
311
- gradientColor: PropTypes.string,
312
-
313
- /** Opacity of page gradient */
314
- gradientOpacity: PropTypes.number,
315
-
316
- /** Color of label */
317
- labelColor: PropTypes.string,
318
-
319
- /** Color of label text */
320
- labelTextColor: PropTypes.string,
321
-
322
- /** Displays the label in all caps */
323
- labelUppercase: PropTypes.bool,
324
-
325
- /** Corner radius of the file icon */
326
- radius: PropTypes.number,
327
-
328
- /** Type of glyph icon to display */
329
- type: PropTypes.oneOf(['3d', 'acrobat', 'android', 'audio', 'binary', 'code', 'code2', 'compressed', 'document', 'drive', 'font', 'image', 'presentation', 'settings', 'spreadsheet', 'vector', 'video'])
330
- };
331
- var VIEWBOX = {
332
- WIDTH: 40,
333
- HEIGHT: 48
334
- };
335
- var ICON = {
336
- WIDTH: VIEWBOX.WIDTH,
337
- HEIGHT: VIEWBOX.HEIGHT,
338
- X_OFFSET: 0
339
- };
340
- var FOLD = {
341
- HEIGHT: 12
342
- };
343
- var LABEL_HEIGHT = 14;
344
- var FileIcon = function FileIcon(_ref) {
345
- var _ref$color = _ref.color,
346
- color = _ref$color === void 0 ? 'whitesmoke' : _ref$color,
347
- extension = _ref.extension,
348
- _ref$fold = _ref.fold,
349
- fold = _ref$fold === void 0 ? true : _ref$fold,
350
- foldColor = _ref.foldColor,
351
- glyphColor = _ref.glyphColor,
352
- _ref$gradientColor = _ref.gradientColor,
353
- gradientColor = _ref$gradientColor === void 0 ? 'white' : _ref$gradientColor,
354
- _ref$gradientOpacity = _ref.gradientOpacity,
355
- gradientOpacity = _ref$gradientOpacity === void 0 ? 0.25 : _ref$gradientOpacity,
356
- labelColor = _ref.labelColor,
357
- _ref$labelTextColor = _ref.labelTextColor,
358
- labelTextColor = _ref$labelTextColor === void 0 ? 'white' : _ref$labelTextColor,
359
- _ref$labelUppercase = _ref.labelUppercase,
360
- labelUppercase = _ref$labelUppercase === void 0 ? false : _ref$labelUppercase,
361
- _ref$radius = _ref.radius,
362
- radius = _ref$radius === void 0 ? 4 : _ref$radius,
363
- type = _ref.type;
364
- var UNIQUE_ID = uniqueId$1();
365
- return /*#__PURE__*/React__default.createElement("svg", {
366
- xmlns: "http://www.w3.org/2000/svg",
367
- viewBox: "0 0 " + VIEWBOX.WIDTH + " " + VIEWBOX.HEIGHT,
368
- width: "100%",
369
- style: {
370
- maxWidth: '100%'
371
- }
372
- }, /*#__PURE__*/React__default.createElement("defs", null, /*#__PURE__*/React__default.createElement("clipPath", {
373
- id: "pageRadius" + UNIQUE_ID
374
- }, /*#__PURE__*/React__default.createElement("rect", {
375
- x: ICON.X_OFFSET,
376
- y: "0",
377
- rx: radius,
378
- ry: radius,
379
- width: ICON.WIDTH,
380
- height: ICON.HEIGHT
381
- })), /*#__PURE__*/React__default.createElement("clipPath", {
382
- id: "foldCrop" + UNIQUE_ID
383
- }, /*#__PURE__*/React__default.createElement("rect", {
384
- width: ICON.WIDTH,
385
- height: FOLD.HEIGHT,
386
- transform: "rotate(-45 0 " + FOLD.HEIGHT + ")"
387
- })), /*#__PURE__*/React__default.createElement("linearGradient", {
388
- x1: "100%",
389
- y1: "0%",
390
- y2: "100%",
391
- id: "pageGradient" + UNIQUE_ID
392
- }, /*#__PURE__*/React__default.createElement("stop", {
393
- stopColor: gradientColor,
394
- stopOpacity: gradientOpacity,
395
- offset: "0%"
396
- }), /*#__PURE__*/React__default.createElement("stop", {
397
- stopColor: gradientColor,
398
- stopOpacity: "0",
399
- offset: "66.67%"
400
- }))), /*#__PURE__*/React__default.createElement("g", {
401
- id: "file",
402
- clipPath: "url(#pageRadius" + UNIQUE_ID + ")"
403
- }, fold ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("path", {
404
- d: "M" + ICON.X_OFFSET + " 0 h " + (ICON.WIDTH - FOLD.HEIGHT) + " L " + (ICON.WIDTH + ICON.X_OFFSET) + " " + FOLD.HEIGHT + " v " + (ICON.HEIGHT - FOLD.HEIGHT) + " H " + ICON.X_OFFSET + " Z",
405
- fill: color
406
- }), /*#__PURE__*/React__default.createElement("path", {
407
- d: "M" + ICON.X_OFFSET + " 0 h " + (ICON.WIDTH - FOLD.HEIGHT) + " L " + (ICON.WIDTH + ICON.X_OFFSET) + " " + FOLD.HEIGHT + " v " + (ICON.HEIGHT - FOLD.HEIGHT) + " H " + ICON.X_OFFSET + " Z",
408
- fill: "url(#pageGradient" + UNIQUE_ID + ")"
409
- })) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("rect", {
410
- x: ICON.X_OFFSET,
411
- y: "0",
412
- width: ICON.WIDTH,
413
- height: ICON.HEIGHT,
414
- fill: color
415
- }), /*#__PURE__*/React__default.createElement("rect", {
416
- x: ICON.X_OFFSET,
417
- y: "0",
418
- width: ICON.WIDTH,
419
- height: ICON.HEIGHT,
420
- fill: "url(#pageGradient" + UNIQUE_ID + ")"
421
- }))), fold && /*#__PURE__*/React__default.createElement("g", {
422
- transform: "translate(28 " + FOLD.HEIGHT + ") rotate(-90)"
423
- }, /*#__PURE__*/React__default.createElement("rect", {
424
- width: ICON.WIDTH,
425
- height: ICON.HEIGHT,
426
- fill: foldColor || w(color).darken(0.1).toHex(),
427
- rx: radius,
428
- ry: radius,
429
- clipPath: "url(#foldCrop" + UNIQUE_ID + ")"
430
- })), extension && /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("g", {
431
- id: "label" + UNIQUE_ID
432
- }, /*#__PURE__*/React__default.createElement("rect", {
433
- fill: labelColor || w(color).darken(0.3).toHex(),
434
- x: ICON.X_OFFSET,
435
- y: ICON.HEIGHT - LABEL_HEIGHT,
436
- width: ICON.WIDTH,
437
- height: LABEL_HEIGHT,
438
- clipPath: "url(#pageRadius" + UNIQUE_ID + ")"
439
- })), /*#__PURE__*/React__default.createElement("g", {
440
- id: "labelText" + UNIQUE_ID,
441
- transform: "translate(" + ICON.X_OFFSET + " 34)"
442
- }, /*#__PURE__*/React__default.createElement("text", {
443
- x: ICON.WIDTH / 2,
444
- y: "10",
445
- fontFamily: "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif",
446
- fontSize: "9",
447
- fill: labelTextColor,
448
- textAnchor: "middle",
449
- style: {
450
- fontWeight: 'bold',
451
- textAlign: 'center',
452
- pointerEvents: 'none',
453
- textTransform: labelUppercase ? 'uppercase' : 'none',
454
- userSelect: 'none'
455
- }
456
- }, extension))), type && /*#__PURE__*/React__default.createElement("g", {
457
- transform: "translate(-4 " + (!extension ? 6 : 0) + ")",
458
- fill: glyphColor || w(color).darken(0.15).toHex()
459
- }, glyphs[type]));
460
- };
461
- FileIcon.propTypes = propTypes;
462
-
463
- var defaultStyles = {
464
- '3dm': {
465
- labelColor: '#8D1A11',
466
- type: '3d'
467
- },
468
- '3ds': {
469
- labelColor: '#5FB9AD',
470
- type: '3d'
471
- },
472
- '3g2': {
473
- type: 'video'
474
- },
475
- '3gp': {
476
- type: 'video'
477
- },
478
- '7zip': {
479
- type: 'compressed'
480
- },
481
- aab: {
482
- type: 'android',
483
- labelColor: '#3DDC84'
484
- },
485
- aac: {
486
- type: 'audio'
487
- },
488
- aep: {
489
- type: 'video'
490
- },
491
- ai: {
492
- color: '#423325',
493
- gradientOpacity: 0,
494
- labelColor: '#423325',
495
- labelTextColor: '#FF7F18',
496
- labelUppercase: true,
497
- foldColor: '#FF7F18',
498
- radius: 2
499
- },
500
- aif: {
501
- type: 'audio'
502
- },
503
- aiff: {
504
- type: 'audio'
505
- },
506
- apk: {
507
- type: 'android',
508
- labelColor: '#3DDC84'
509
- },
510
- apkm: {
511
- type: 'android',
512
- labelColor: '#3DDC84'
513
- },
514
- apks: {
515
- type: 'android',
516
- labelColor: '#3DDC84'
517
- },
518
- asf: {
519
- type: 'video'
520
- },
521
- asp: {
522
- type: 'code'
523
- },
524
- aspx: {
525
- type: 'code'
526
- },
527
- avi: {
528
- type: 'video'
529
- },
530
- bin: {
531
- type: 'binary'
532
- },
533
- bmp: {
534
- type: 'image'
535
- },
536
- c: {
537
- type: 'code'
538
- },
539
- cpp: {
540
- type: 'code'
541
- },
542
- cs: {
543
- type: 'code'
544
- },
545
- css: {
546
- type: 'code'
547
- },
548
- csv: {
549
- type: 'spreadsheet'
550
- },
551
- cue: {
552
- type: 'document'
553
- },
554
- dll: {
555
- type: 'settings'
556
- },
557
- dmg: {
558
- type: 'drive'
559
- },
560
- doc: {
561
- color: '#2C5898',
562
- foldColor: '#254A80',
563
- glyphColor: 'rgba(255,255,255,0.4)',
564
- labelColor: '#2C5898',
565
- labelUppercase: true,
566
- type: 'document'
567
- },
568
- docx: {
569
- color: '#2C5898',
570
- foldColor: '#254A80',
571
- glyphColor: 'rgba(255,255,255,0.4)',
572
- labelColor: '#2C5898',
573
- labelUppercase: true,
574
- type: 'document'
575
- },
576
- dwg: {
577
- type: 'vector'
578
- },
579
- dxf: {
580
- type: 'vector'
581
- },
582
- eot: {
583
- type: 'font'
584
- },
585
- eps: {
586
- type: 'vector'
587
- },
588
- exe: {
589
- type: 'settings'
590
- },
591
- flac: {
592
- type: 'audio'
593
- },
594
- flv: {
595
- type: 'video'
596
- },
597
- fnt: {
598
- type: 'font'
599
- },
600
- fodp: {
601
- type: 'presentation'
602
- },
603
- fods: {
604
- type: 'spreadsheet'
605
- },
606
- fodt: {
607
- type: 'document'
608
- },
609
- fon: {
610
- type: 'font'
611
- },
612
- gif: {
613
- type: 'image'
614
- },
615
- gz: {
616
- type: 'compressed'
617
- },
618
- htm: {
619
- type: 'code'
620
- },
621
- html: {
622
- type: 'code'
623
- },
624
- indd: {
625
- color: '#4B2B36',
626
- gradientOpacity: 0,
627
- labelColor: '#4B2B36',
628
- labelTextColor: '#FF408C',
629
- labelUppercase: true,
630
- foldColor: '#FF408C',
631
- radius: 2
632
- },
633
- ini: {
634
- type: 'settings'
635
- },
636
- java: {
637
- type: 'code'
638
- },
639
- jpeg: {
640
- type: 'image'
641
- },
642
- jpg: {
643
- type: 'image'
644
- },
645
- js: {
646
- labelColor: '#F7DF1E',
647
- type: 'code'
648
- },
649
- json: {
650
- type: 'code'
651
- },
652
- jsx: {
653
- labelColor: '#00D8FF',
654
- type: 'code'
655
- },
656
- m4a: {
657
- type: 'audio'
658
- },
659
- m4v: {
660
- type: 'video'
661
- },
662
- max: {
663
- labelColor: '#5FB9AD',
664
- type: '3d'
665
- },
666
- md: {
667
- type: 'document'
668
- },
669
- mid: {
670
- type: 'audio'
671
- },
672
- mkv: {
673
- type: 'video'
674
- },
675
- mov: {
676
- type: 'video'
677
- },
678
- mp3: {
679
- type: 'audio'
680
- },
681
- mp4: {
682
- type: 'video'
683
- },
684
- mpeg: {
685
- type: 'video'
686
- },
687
- mpg: {
688
- type: 'video'
689
- },
690
- obj: {
691
- type: '3d'
692
- },
693
- odp: {
694
- type: 'presentation'
695
- },
696
- ods: {
697
- type: 'spreadsheet'
698
- },
699
- odt: {
700
- type: 'document'
701
- },
702
- ogg: {
703
- type: 'audio'
704
- },
705
- ogv: {
706
- type: 'video'
707
- },
708
- otf: {
709
- type: 'font'
710
- },
711
- pdf: {
712
- labelColor: '#D93831',
713
- type: 'acrobat'
714
- },
715
- php: {
716
- labelColor: '#8892BE',
717
- type: 'code'
718
- },
719
- pkg: {
720
- type: '3d'
721
- },
722
- plist: {
723
- type: 'settings'
724
- },
725
- png: {
726
- type: 'image'
727
- },
728
- ppt: {
729
- color: '#D14423',
730
- foldColor: '#AB381D',
731
- glyphColor: 'rgba(255,255,255,0.4)',
732
- labelColor: '#D14423',
733
- labelUppercase: true,
734
- type: 'presentation'
735
- },
736
- pptx: {
737
- color: '#D14423',
738
- foldColor: '#AB381D',
739
- glyphColor: 'rgba(255,255,255,0.4)',
740
- labelColor: '#D14423',
741
- labelUppercase: true,
742
- type: 'presentation'
743
- },
744
- pr: {
745
- type: 'video'
746
- },
747
- ps: {
748
- type: 'vector'
749
- },
750
- psd: {
751
- color: '#34364E',
752
- gradientOpacity: 0,
753
- labelColor: '#34364E',
754
- labelTextColor: '#31C5F0',
755
- labelUppercase: true,
756
- foldColor: '#31C5F0',
757
- radius: 2
758
- },
759
- py: {
760
- labelColor: '#FFDE57',
761
- type: 'code'
762
- },
763
- rar: {
764
- type: 'compressed'
765
- },
766
- rb: {
767
- labelColor: '#BB271A',
768
- type: 'code'
769
- },
770
- rm: {
771
- type: 'video'
772
- },
773
- rtf: {
774
- type: 'document'
775
- },
776
- scss: {
777
- labelColor: '#C16A98',
778
- type: 'code'
779
- },
780
- sitx: {
781
- type: 'compressed'
782
- },
783
- skp: {
784
- type: '3d'
785
- },
786
- svg: {
787
- type: 'vector'
788
- },
789
- swf: {
790
- type: 'video'
791
- },
792
- sys: {
793
- type: 'settings'
794
- },
795
- tar: {
796
- type: 'compressed'
797
- },
798
- tex: {
799
- type: 'document'
800
- },
801
- tif: {
802
- type: 'image'
803
- },
804
- tiff: {
805
- type: 'image'
806
- },
807
- ts: {
808
- labelColor: '#3478C7',
809
- type: 'code'
810
- },
811
- ttf: {
812
- type: 'font'
813
- },
814
- txt: {
815
- type: 'document'
816
- },
817
- wav: {
818
- type: 'audio'
819
- },
820
- webm: {
821
- type: 'video'
822
- },
823
- wmv: {
824
- type: 'video'
825
- },
826
- woff: {
827
- type: 'font'
828
- },
829
- wpd: {
830
- type: 'document'
831
- },
832
- wps: {
833
- type: 'document'
834
- },
835
- xapk: {
836
- type: 'android',
837
- labelColor: '#3DDC84'
838
- },
839
- xlr: {
840
- type: 'spreadsheet'
841
- },
842
- xls: {
843
- color: '#1A754C',
844
- foldColor: '#16613F',
845
- glyphColor: 'rgba(255,255,255,0.4)',
846
- labelColor: '#1A754C',
847
- labelUppercase: true,
848
- type: 'spreadsheet'
849
- },
850
- xlsx: {
851
- color: '#1A754C',
852
- foldColor: '#16613F',
853
- glyphColor: 'rgba(255,255,255,0.4)',
854
- labelColor: '#1A754C',
855
- labelUppercase: true,
856
- type: 'spreadsheet'
857
- },
858
- yml: {
859
- type: 'code'
860
- },
861
- zip: {
862
- type: 'compressed'
863
- },
864
- zipx: {
865
- type: 'compressed'
866
- }
867
- };
868
-
869
- var File = function File(_ref) {
870
- var fileName = _ref.fileName;
871
- var extension = fileName.match(/([^.]+)$/)[1];
872
- return /*#__PURE__*/React__default.createElement("div", {
873
- className: "ne-attachments__preview-wrapper__icon"
874
- }, /*#__PURE__*/React__default.createElement(FileIcon, _extends({
875
- extension: extension,
876
- labelColor: "#4558f9"
877
- }, defaultStyles[extension])));
878
- };
879
-
880
- var newAxiosInstance = axios.create();
881
- var getFile = function getFile(url) {
882
- return newAxiosInstance.get(url, {
883
- responseType: "blob"
884
- });
885
- };
886
- var fileDownloadApi = {
887
- getFile: getFile
888
- };
889
-
890
- var buildFileUploadConfig = function buildFileUploadConfig(config) {
891
- return mergeRight(DEFAULT_FILE_UPLOAD_CONFIG, config);
892
- };
893
- var downloadFile = /*#__PURE__*/function () {
894
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(fileUrl, filename) {
895
- var response, blob, url, a;
896
- return _regeneratorRuntime.wrap(function _callee$(_context) {
897
- while (1) switch (_context.prev = _context.next) {
898
- case 0:
899
- _context.prev = 0;
900
- _context.next = 3;
901
- return fileDownloadApi.getFile(fileUrl);
902
- case 3:
903
- response = _context.sent;
904
- blob = new Blob([response.data]);
905
- url = URL.createObjectURL(blob);
906
- a = document.createElement("a");
907
- a.href = url;
908
- a.setAttribute("download", filename);
909
- a.style.display = "none";
910
- document.body.appendChild(a);
911
- a.click();
912
- URL.revokeObjectURL(url);
913
- document.body.removeChild(a);
914
- _context.next = 19;
915
- break;
916
- case 16:
917
- _context.prev = 16;
918
- _context.t0 = _context["catch"](0);
919
- Toastr.error(_context.t0);
920
- case 19:
921
- case "end":
922
- return _context.stop();
923
- }
924
- }, _callee, null, [[0, 16]]);
925
- }));
926
- return function downloadFile(_x, _x2) {
927
- return _ref.apply(this, arguments);
928
- };
929
- }();
930
- var checkPreviewAvailability = function checkPreviewAvailability(contentType) {
931
- return contentType && (contentType.startsWith("video/") || contentType === "application/pdf" || contentType === "image/jpeg" || contentType === "image/gif" || contentType === "image/png" || contentType === "image/webp" || contentType === "text/plain" || contentType === "image/bmp" || contentType === "application/msword" || contentType === "application/vnd.openxmlformats-officedocument.wordprocessingml.document" || contentType === "text/htm" || contentType === "text/html" || contentType === "image/jpg" || contentType === "application/vnd.ms-powerpoint" || contentType === "application/vnd.openxmlformats-officedocument.presentationml.presentation" || contentType === "image/tiff" || contentType === "application/vnd.ms-excel" || contentType === "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
932
- };
933
-
934
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
935
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
936
- var Menu = Dropdown.Menu,
937
- MenuItem = Dropdown.MenuItem;
938
- var Attachment = function Attachment(_ref) {
939
- var attachment = _ref.attachment,
940
- attachments = _ref.attachments,
941
- disabled = _ref.disabled,
942
- onChange = _ref.onChange,
943
- setSelectedAttachment = _ref.setSelectedAttachment,
944
- isLoading = _ref.isLoading,
945
- allowDelete = _ref.allowDelete;
946
- var _useTranslation = useTranslation(),
947
- t = _useTranslation.t;
948
- var _useState = useState(false),
949
- _useState2 = _slicedToArray(_useState, 2),
950
- isRenaming = _useState2[0],
951
- setIsRenaming = _useState2[1];
952
- var _useState3 = useState(false),
953
- _useState4 = _slicedToArray(_useState3, 2),
954
- isUpdating = _useState4[0],
955
- setIsUpdating = _useState4[1];
956
- var _useState5 = useState(false),
957
- _useState6 = _slicedToArray(_useState5, 2),
958
- isDeleteAlertOpen = _useState6[0],
959
- setIsDeleteAlertOpen = _useState6[1];
960
- var _useState7 = useState(false),
961
- _useState8 = _slicedToArray(_useState7, 2),
962
- isDeleting = _useState8[0],
963
- setIsDeleting = _useState8[1];
964
- var _useState9 = useState(""),
965
- _useState10 = _slicedToArray(_useState9, 2),
966
- newFilename = _useState10[0],
967
- setNewFilename = _useState10[1];
968
- var handleDownload = function handleDownload() {
969
- return downloadFile(attachment.url, attachment.filename);
970
- };
971
- var handleRename = /*#__PURE__*/function () {
972
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
973
- var _response$data, signedId, payload, response, filename;
974
- return _regeneratorRuntime.wrap(function _callee$(_context) {
975
- while (1) switch (_context.prev = _context.next) {
976
- case 0:
977
- _context.prev = 0;
978
- setIsUpdating(true);
979
- signedId = attachment.signedId;
980
- payload = {
981
- blob: {
982
- filename: newFilename
983
- }
984
- };
985
- _context.next = 6;
986
- return directUploadsApi.update({
987
- signedId: signedId,
988
- payload: payload
989
- });
990
- case 6:
991
- response = _context.sent;
992
- filename = ((_response$data = response.data) === null || _response$data === void 0 || (_response$data = _response$data.blob) === null || _response$data === void 0 ? void 0 : _response$data.filename) || response.blob.filename;
993
- onChange(attachments.map(function (attachment) {
994
- return attachment.signedId === signedId ? assoc("filename", filename, attachment) : attachment;
995
- }));
996
- _context.next = 14;
997
- break;
998
- case 11:
999
- _context.prev = 11;
1000
- _context.t0 = _context["catch"](0);
1001
- Toastr.error(_context.t0);
1002
- case 14:
1003
- _context.prev = 14;
1004
- setIsRenaming(false);
1005
- setIsUpdating(false);
1006
- setNewFilename("");
1007
- return _context.finish(14);
1008
- case 19:
1009
- case "end":
1010
- return _context.stop();
1011
- }
1012
- }, _callee, null, [[0, 11, 14, 19]]);
1013
- }));
1014
- return function handleRename() {
1015
- return _ref2.apply(this, arguments);
1016
- };
1017
- }();
1018
- var handleDelete = /*#__PURE__*/function () {
1019
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
1020
- var signedId;
1021
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
1022
- while (1) switch (_context2.prev = _context2.next) {
1023
- case 0:
1024
- if (allowDelete) {
1025
- _context2.next = 2;
1026
- break;
1027
- }
1028
- return _context2.abrupt("return");
1029
- case 2:
1030
- setIsDeleting(true);
1031
- _context2.prev = 3;
1032
- signedId = attachment.signedId;
1033
- _context2.next = 7;
1034
- return directUploadsApi.destroy(signedId);
1035
- case 7:
1036
- onChange(removeBy({
1037
- signedId: signedId
1038
- }, attachments));
1039
- _context2.next = 13;
1040
- break;
1041
- case 10:
1042
- _context2.prev = 10;
1043
- _context2.t0 = _context2["catch"](3);
1044
- Toastr.error(_context2.t0);
1045
- case 13:
1046
- case "end":
1047
- return _context2.stop();
1048
- }
1049
- }, _callee2, null, [[3, 10]]);
1050
- }));
1051
- return function handleDelete() {
1052
- return _ref3.apply(this, arguments);
1053
- };
1054
- }();
1055
- var handlers = _objectSpread(_defineProperty(_defineProperty({}, ATTACHMENT_OPTIONS.DOWNLOAD, handleDownload), ATTACHMENT_OPTIONS.RENAME, handleRename), allowDelete && _defineProperty({}, ATTACHMENT_OPTIONS.DELETE, handleDelete));
1056
- var onMenuItemClick = function onMenuItemClick(_ref5) {
1057
- var key = _ref5.key,
1058
- handler = _ref5.handler;
1059
- if (key === ATTACHMENT_OPTIONS.RENAME) {
1060
- setIsRenaming(true);
1061
- setNewFilename(attachment.filename);
1062
- } else if (key === ATTACHMENT_OPTIONS.DELETE) {
1063
- setNewFilename(attachment.filename);
1064
- setIsDeleteAlertOpen(true);
1065
- } else {
1066
- handler();
1067
- }
1068
- };
1069
- var handleKeyDown = function handleKeyDown(_ref6) {
1070
- var event = _ref6.event,
1071
- key = _ref6.key;
1072
- var handler = handlers[key];
1073
- if (event.key === "Enter" && handler && !isEmpty(newFilename)) {
1074
- event.stopPropagation();
1075
- event.preventDefault();
1076
- handler();
1077
- }
1078
- if (event.key === "Escape") {
1079
- setIsRenaming(false);
1080
- setNewFilename("");
1081
- }
1082
- };
1083
- return /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
1084
- className: "ne-attachments__preview",
1085
- "data-cy": "ne-attachments-wrapper"
1086
- }, isRenaming ? /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(Tooltip, {
1087
- content: newFilename,
1088
- position: "top"
1089
- }, /*#__PURE__*/React__default.createElement(Input, {
1090
- autoFocus: true,
1091
- "data-cy": "neeto-editor-preview-rename-input",
1092
- size: "small",
1093
- value: newFilename,
1094
- error: isEmpty(newFilename) ? t("neetoEditor.attachments.nameEmpty") : "",
1095
- onChange: withEventTargetValue(setNewFilename),
1096
- onKeyDown: function onKeyDown(event) {
1097
- return handleKeyDown({
1098
- event: event,
1099
- key: ATTACHMENT_OPTIONS.RENAME
1100
- });
1101
- }
1102
- })), /*#__PURE__*/React__default.createElement(Button, {
1103
- "data-cy": "neeto-editor-preview-rename-cancel-button",
1104
- icon: Close,
1105
- loading: isUpdating,
1106
- size: "small",
1107
- style: "text",
1108
- onClick: function onClick() {
1109
- return setIsRenaming(false);
1110
- }
1111
- })) : /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
1112
- className: "ne-attachments__preview-wrapper",
1113
- onClick: function onClick() {
1114
- return setSelectedAttachment(attachment);
1115
- }
1116
- }, /*#__PURE__*/React__default.createElement(File, {
1117
- fileName: attachment.filename
1118
- }), /*#__PURE__*/React__default.createElement(Tooltip, {
1119
- content: attachment.filename,
1120
- position: "top"
1121
- }, /*#__PURE__*/React__default.createElement(Typography, {
1122
- style: "body2"
1123
- }, attachment.filename)), isLoading && /*#__PURE__*/React__default.createElement(Spinner, {
1124
- className: "attachment-button-loader"
1125
- })), /*#__PURE__*/React__default.createElement(Tooltip, {
1126
- content: t("neetoEditor.attachments.actionsBlocked"),
1127
- disabled: !disabled,
1128
- position: "top"
1129
- }, /*#__PURE__*/React__default.createElement(Dropdown, {
1130
- disabled: disabled,
1131
- buttonSize: "small",
1132
- buttonStyle: "text",
1133
- icon: MenuVertical
1134
- }, /*#__PURE__*/React__default.createElement(Menu, null, Object.entries(handlers).map(function (_ref7) {
1135
- var _ref8 = _slicedToArray(_ref7, 2),
1136
- label = _ref8[0],
1137
- handler = _ref8[1];
1138
- return /*#__PURE__*/React__default.createElement(MenuItem.Button, {
1139
- "data-cy": "neeto-editor-preview-".concat(label.toLowerCase(), "-button"),
1140
- key: label,
1141
- onClick: function onClick() {
1142
- return onMenuItemClick({
1143
- key: label,
1144
- handler: handler
1145
- });
1146
- }
1147
- }, label);
1148
- })))))), /*#__PURE__*/React__default.createElement(Alert, {
1149
- isOpen: isDeleteAlertOpen,
1150
- isSubmitting: isDeleting,
1151
- submitButtonLabel: t("neetoEditor.menu.delete"),
1152
- title: t("neetoEditor.attachments.deleteTitle"),
1153
- message: /*#__PURE__*/React__default.createElement(Trans, {
1154
- i18nKey: "neetoEditor.attachments.deleteConfirmation",
1155
- values: {
1156
- entity: newFilename
1157
- }
1158
- }),
1159
- onClose: function onClose() {
1160
- return setIsDeleteAlertOpen(false);
1161
- },
1162
- onSubmit: handleDelete
1163
- }));
1164
- };
1165
-
1166
- var AttachmentProgress = function AttachmentProgress(_ref) {
1167
- var _attachment$progress;
1168
- var attachment = _ref.attachment,
1169
- cancelUpload = _ref.cancelUpload;
1170
- var progressPercentage = "".concat((_attachment$progress = attachment.progress) !== null && _attachment$progress !== void 0 ? _attachment$progress : 0, "%");
1171
- var handleCancel = function handleCancel() {
1172
- cancelUpload(attachment.id);
1173
- };
1174
- return /*#__PURE__*/React__default.createElement("div", {
1175
- className: "ne-attachments__preview"
1176
- }, /*#__PURE__*/React__default.createElement("div", {
1177
- className: "ne-attachments__preview__progress-icon"
1178
- }, /*#__PURE__*/React__default.createElement(FileIcon, null)), /*#__PURE__*/React__default.createElement("div", {
1179
- className: "ne-attachments__preview__progress"
1180
- }, /*#__PURE__*/React__default.createElement(Typography, {
1181
- style: "body2"
1182
- }, attachment.filename), /*#__PURE__*/React__default.createElement(Typography, {
1183
- style: "body2"
1184
- }, progressPercentage)), /*#__PURE__*/React__default.createElement(Button, {
1185
- "data-cy": "neeto-editor-preview-upload-cancel-button",
1186
- icon: Close,
1187
- size: "small",
1188
- style: "text",
1189
- onClick: handleCancel
1190
- }));
1191
- };
1192
-
1193
- var Preview = /*#__PURE__*/lazy(function () {
1194
- return import('./chunk-e9803348.js');
1195
- });
1196
- var Attachments = function Attachments(_ref, ref) {
1197
- var _fileUploadConfig$all;
1198
- var _ref$attachments = _ref.attachments,
1199
- attachments = _ref$attachments === void 0 ? [] : _ref$attachments,
1200
- _ref$className = _ref.className,
1201
- className = _ref$className === void 0 ? "" : _ref$className,
1202
- _ref$onChange = _ref.onChange,
1203
- onChange = _ref$onChange === void 0 ? noop : _ref$onChange,
1204
- _ref$isIndependent = _ref.isIndependent,
1205
- isIndependent = _ref$isIndependent === void 0 ? true : _ref$isIndependent,
1206
- _ref$disabled = _ref.disabled,
1207
- disabled = _ref$disabled === void 0 ? false : _ref$disabled,
1208
- _ref$dragDropRef = _ref.dragDropRef,
1209
- dragDropRef = _ref$dragDropRef === void 0 ? null : _ref$dragDropRef,
1210
- _ref$config = _ref.config,
1211
- config = _ref$config === void 0 ? {} : _ref$config,
1212
- _ref$setIsUploading = _ref.setIsUploading,
1213
- setIsUploading = _ref$setIsUploading === void 0 ? noop : _ref$setIsUploading,
1214
- _ref$allowDelete = _ref.allowDelete,
1215
- allowDelete = _ref$allowDelete === void 0 ? true : _ref$allowDelete;
1216
- var _useTranslation = useTranslation(),
1217
- t = _useTranslation.t;
1218
- var _useState = useState({}),
1219
- _useState2 = _slicedToArray(_useState, 2),
1220
- selectedAttachment = _useState2[0],
1221
- setSelectedAttachment = _useState2[1];
1222
- var _useState3 = useState(false),
1223
- _useState4 = _slicedToArray(_useState3, 2),
1224
- didFetchPreviewBundle = _useState4[0],
1225
- setDidFetchPreviewBundle = _useState4[1];
1226
- var attachmentInputRef = useRef(null);
1227
- var fileUploadConfig = useMemo(function () {
1228
- return buildFileUploadConfig(config);
1229
- }, [config]);
1230
- var _useFileUploader = useFileUploader({
1231
- config: fileUploadConfig,
1232
- setIsUploadingOnHost: setIsUploading,
1233
- attachments: attachments
1234
- }),
1235
- addFiles = _useFileUploader.addFiles,
1236
- uploadFiles = _useFileUploader.uploadFiles,
1237
- queuedFiles = _useFileUploader.queuedFiles,
1238
- cancelUpload = _useFileUploader.cancelUpload,
1239
- isUploading = _useFileUploader.isUploading;
1240
- var handleAddFile = /*#__PURE__*/function () {
1241
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(event) {
1242
- var uploadedFiles;
1243
- return _regeneratorRuntime.wrap(function _callee$(_context) {
1244
- while (1) switch (_context.prev = _context.next) {
1245
- case 0:
1246
- addFiles(event.target.files);
1247
- _context.next = 3;
1248
- return uploadFiles();
1249
- case 3:
1250
- uploadedFiles = _context.sent;
1251
- isNotEmpty(uploadedFiles) && onChange([].concat(_toConsumableArray(attachments), _toConsumableArray(uploadedFiles)));
1252
- attachmentInputRef.current.value = null;
1253
- case 6:
1254
- case "end":
1255
- return _context.stop();
1256
- }
1257
- }, _callee);
1258
- }));
1259
- return function handleAddFile(_x) {
1260
- return _ref2.apply(this, arguments);
1261
- };
1262
- }();
1263
- var handleUploadAttachments = function handleUploadAttachments() {
1264
- return attachmentInputRef.current.click();
1265
- };
1266
- var handleFileInputClick = function handleFileInputClick(event) {
1267
- if (!(!isEmpty(attachments) && fileUploadConfig.maxNumberOfFiles === 1)) {
1268
- return;
1269
- }
1270
- event.preventDefault();
1271
- Toastr.warning(t("neetoEditor.attachments.oneAttachmentAllowed"));
1272
- };
1273
- useImperativeHandle(ref, function () {
1274
- return {
1275
- handleUploadAttachments: handleUploadAttachments
1276
- };
1277
- }, []);
1278
- var handleFilesDrop = /*#__PURE__*/function () {
1279
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(files) {
1280
- var uploadedFiles;
1281
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
1282
- while (1) switch (_context2.prev = _context2.next) {
1283
- case 0:
1284
- addFiles(files);
1285
- _context2.next = 3;
1286
- return uploadFiles();
1287
- case 3:
1288
- uploadedFiles = _context2.sent;
1289
- isNotEmpty(uploadedFiles) && onChange([].concat(_toConsumableArray(attachments), _toConsumableArray(uploadedFiles)));
1290
- case 5:
1291
- case "end":
1292
- return _context2.stop();
1293
- }
1294
- }, _callee2);
1295
- }));
1296
- return function handleFilesDrop(_x2) {
1297
- return _ref3.apply(this, arguments);
1298
- };
1299
- }();
1300
- useDropFiles({
1301
- dropTargetRef: dragDropRef,
1302
- attachments: attachments,
1303
- onDrop: handleFilesDrop
1304
- });
1305
- return /*#__PURE__*/React__default.createElement("div", {
1306
- className: classnames("ne-attachments", _defineProperty({}, className, className))
1307
- }, /*#__PURE__*/React__default.createElement("div", {
1308
- className: "ne-attachments__items"
1309
- }, attachments.map(function (attachment) {
1310
- return /*#__PURE__*/React__default.createElement(Attachment, {
1311
- allowDelete: allowDelete,
1312
- attachment: attachment,
1313
- attachments: attachments,
1314
- disabled: disabled,
1315
- onChange: onChange,
1316
- setSelectedAttachment: setSelectedAttachment,
1317
- key: attachment.signedId,
1318
- isLoading: !didFetchPreviewBundle && selectedAttachment.url === attachment.url
1319
- });
1320
- }), queuedFiles.map(function (attachment) {
1321
- return /*#__PURE__*/React__default.createElement(AttachmentProgress, {
1322
- attachment: attachment,
1323
- cancelUpload: cancelUpload,
1324
- key: attachment.id
1325
- });
1326
- })), /*#__PURE__*/React__default.createElement("div", null, isIndependent && /*#__PURE__*/React__default.createElement(Button, {
1327
- "data-cy": "neeto-editor-attachments-upload-button",
1328
- disabled: isUploading,
1329
- label: t("neetoEditor.attachments.add"),
1330
- loading: isUploading,
1331
- size: "medium",
1332
- style: "link",
1333
- onClick: handleUploadAttachments
1334
- }), /*#__PURE__*/React__default.createElement("input", {
1335
- accept: (_fileUploadConfig$all = fileUploadConfig.allowedFileTypes) === null || _fileUploadConfig$all === void 0 ? void 0 : _fileUploadConfig$all.join(","),
1336
- multiple: fileUploadConfig.maxNumberOfFiles !== 1,
1337
- ref: attachmentInputRef,
1338
- type: "file",
1339
- onChange: handleAddFile,
1340
- onClick: handleFileInputClick
1341
- }), /*#__PURE__*/React__default.createElement(Suspense, {
1342
- fallback: /*#__PURE__*/React__default.createElement("span", null)
1343
- }, isPresent(selectedAttachment) && /*#__PURE__*/React__default.createElement(Preview, {
1344
- attachments: attachments,
1345
- selectedAttachment: selectedAttachment,
1346
- setDidFetchPreviewBundle: setDidFetchPreviewBundle,
1347
- setSelectedAttachment: setSelectedAttachment,
1348
- onClose: function onClose() {
1349
- return setSelectedAttachment({});
1350
- }
1351
- }))));
1352
- };
1353
- var Attachments$1 = /*#__PURE__*/React__default.forwardRef(Attachments);
1354
-
1355
- export { Attachments$1 as A, ATTACHMENTS_PREVIEW_DATA_CY as a, checkPreviewAvailability as c, downloadFile as d };
1356
- //# sourceMappingURL=chunk-f8510c23.js.map