You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
30 KiB
1 lines
30 KiB
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[941],{8283:function(e,n,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/file-manager",function(){return t(7241)}])},157:function(e,n,t){"use strict";var r=t(5893),o=t(7357),i=t(8262),l=t(7294),c=t(7169),a=t(4825),u=t(4690),s=t(3679),f=t(2152),d=t(7750);function p(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function m(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function h(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){m(e,n,t[n])}))}return e}function v(e,n){if(null==e)return{};var t,r,o=function(e,n){if(null==e)return{};var t,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}function x(e){return function(e){if(Array.isArray(e))return p(e)}(e)||function(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,n){if(!e)return;if("string"===typeof e)return p(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return p(e,n)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var g={blue:c.Ej,red:c.hM},y=(0,l.forwardRef)((function(e,n){var t=e.actionCancelText,p=void 0===t?"Cancel":t,m=e.actionProceedText,y=e.contentContainerProps,b=void 0===y?{}:y,j=e.closeOnProceed,w=void 0!==j&&j,Z=e.content,O=e.dialogProps,P=void 0===O?{}:O,S=P.open,C=void 0!==S&&S,A=P.PaperProps,k=void 0===A?{}:A,I=e.disableProceed,U=e.formContent,D=e.loading,E=void 0!==D&&D,F=e.loadingAction,L=void 0!==F&&F,T=e.onActionAppend,N=e.onCancelAppend,M=e.onProceedAppend,B=e.onSubmitAppend,_=e.openInitially,R=void 0!==_&&_,W=e.preActionArea,H=e.proceedButtonProps,V=void 0===H?{}:H,z=e.proceedColour,G=void 0===z?"blue":z,$=e.scrollContent,X=void 0!==$&&$,J=e.scrollBoxProps,Y=(void 0===J?{}:J).sx,q=e.titleText,K=v(e.dialogProps,["open","PaperProps"]),Q=v(e.scrollBoxProps,["sx"]),ee=k.sx,ne=v(k,["sx"]),te=V.disabled,re=void 0===te?I:te,oe=V.sx,ie=v(V,["disabled","sx"]),le=(0,l.useState)(R),ce=le[0],ae=le[1],ue=(0,l.useMemo)((function(){return n?ce:C}),[C,ce,n]),se=(0,l.useMemo)((function(){return g[G]}),[G]),fe=(0,l.useMemo)((function(){var e,n,t,r=function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];var r,o;w&&ae(!1),null===T||void 0===T||(r=T).call.apply(r,[null].concat(x(n))),null===M||void 0===M||(o=M).call.apply(o,[null].concat(x(n)))};return U&&(e="form",n=function(e){for(var n=arguments.length,t=new Array(n>1?n-1:0),r=1;r<n;r++)t[r-1]=arguments[r];var o;e.preventDefault(),w&&ae(!1),null===B||void 0===B||(o=B).call.apply(o,[null,e].concat(x(t)))},r=void 0,t="submit"),{contentContainerComponent:e,contentContainerSubmitEventHandler:n,proceedButtonClickEventHandler:r,proceedButtonType:t}}),[w,U,T,M,B]),de=fe.contentContainerComponent,pe=fe.contentContainerSubmitEventHandler,me=fe.proceedButtonClickEventHandler,he=fe.proceedButtonType,ve=(0,l.useMemo)((function(){return(0,r.jsx)(a.Z,{onClick:function(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];var r,o;ae(!1),null===T||void 0===T||(r=T).call.apply(r,[null].concat(x(n))),null===N||void 0===N||(o=N).call.apply(o,[null].concat(x(n)))},children:p})}),[p,T,N]),xe=(0,l.useMemo)((function(){return(0,r.jsx)(a.Z,h({disabled:re,onClick:me,type:he},ie,{sx:h({backgroundColor:se,color:c.lD,"&:hover":{backgroundColor:"".concat(se,"F0")}},oe),children:m}))}),[m,me,re,oe,he,se,ie]),ge=(0,l.useMemo)((function(){return L?(0,r.jsx)(f.Z,{mt:0}):(0,r.jsxs)(u.Z,{row:!0,spacing:".5em",sx:{justifyContent:"flex-end",width:"100%"},children:[ve,xe]})}),[ve,L,xe]),ye=(0,l.useMemo)((function(){return"string"===typeof Z?(0,r.jsx)(d.Ac,{text:Z}):Z}),[Z]),be=(0,l.useMemo)((function(){return"string"===typeof q?(0,r.jsx)(d.z,{children:q}):q}),[q]),je=(0,l.useMemo)((function(){var e,n,t;X&&(U&&(n="hidden",t=".6em"),e=h({maxHeight:"60vh",overflowX:n,overflowY:"scroll",paddingRight:".4em",paddingTop:t},Y));return e}),[U,X,Y]),we=(0,l.useMemo)((function(){return E?(0,r.jsx)(f.Z,{}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(o.Z,h({},Q,{sx:je,children:ye})),W,ge]})}),[ge,je,ye,E,W,Q]);return(0,l.useImperativeHandle)(n,(function(){return{setOpen:function(e){return ae(e)}}}),[]),(0,r.jsxs)(i.Z,h({open:ue,PaperComponent:s.s_,PaperProps:h({},ne,{sx:h({overflow:"visible"},ee)})},K,{children:[(0,r.jsx)(s.V9,{children:be}),(0,r.jsx)(u.Z,h({component:de,onSubmit:pe},b,{children:we}))]}))}));y.displayName="ConfirmDialog",n.Z=y},5521:function(e,n,t){"use strict";t.d(n,{Z:function(){return R}});var r=t(5893),o=t(1113),i=t(1496),l=t(2293),c=t(7357),a=t(2992),u=t(4799),s=t(7294),f=t(7169),d=t(4433),p=t(9029),m=t(7533),h=t(8462),v=t(7212),x=t(8619),g=[{text:"Anvil",image:"/pngs/anvil_icon_on.png",uri:"/manage-element"},{text:"Files",image:"/pngs/files_on.png",uri:"/file-manager"},{text:"Configure",image:"/pngs/configure_icon_on.png",uri:"/config"},{text:"Help",image:"/pngs/help_icon_on.png",uri:"https://alteeve.com/w/Support"}],y={width:"40em",height:"40em"},b=t(4390),j=t(582),w=t(4690),Z=t(1770),O=t(7750),P=t(1081);function S(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function C(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var t=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,o,i=[],l=!0,c=!1;try{for(t=t.call(e);!(l=(r=t.next()).done)&&(i.push(r.value),!n||i.length!==n);l=!0);}catch(a){c=!0,o=a}finally{try{l||null==t.return||t.return()}finally{if(c)throw o}}return i}}(e,n)||function(e,n){if(!e)return;if("string"===typeof e)return S(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return S(e,n)}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var A=function(){var e=(0,P.Z)(),n=(0,s.useState)({}),t=n[0],r=n[1],o=(0,s.useCallback)((function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"suiapi.";return t["".concat(n).concat(e)]}),[t]),i=(0,s.useCallback)((function(){return o("user")}),[o]);return(0,s.useEffect)((function(){if(e){var n=document.cookie.split(/\s*;\s*/);r(n.reduce((function(e,n){var t,r=C(n.split("=",2),2),o=r[0],i=r[1],l=decodeURIComponent(i);if(l.startsWith("j:"))try{t=JSON.parse(l.substring(2))}catch(c){t=i}else t=i;return e[o]=t,e}),{}))}}),[e]),{cookieJar:t,getCookie:o,getSessionUser:i}};function k(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function I(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){k(e,n,t[n])}))}return e}var U="AnvilDrawer",D={actionIcon:"".concat(U,"-actionIcon"),list:"".concat(U,"-list")},E=(0,i.ZP)(m.ZP)((function(){var e;return k(e={},"& .".concat(D.list),{width:"200px"}),k(e,"& .".concat(D.actionIcon),{fontSize:"2.3em",color:f.of}),e})),F=function(e){var n=e.open,t=e.setOpen,o=(0,A().getSessionUser)();return(0,r.jsx)(E,{BackdropProps:{invisible:!0},anchor:"left",open:n,onClose:function(){return t(!n)},children:(0,r.jsx)("div",{role:"presentation",children:(0,r.jsxs)(h.Z,{className:D.list,children:[(0,r.jsx)(v.ZP,{children:(0,r.jsx)(O.Ac,{children:o?(0,r.jsxs)(r.Fragment,{children:["Welcome, ",o.name]}):"Unregistered"})}),(0,r.jsx)(j.Z,{}),(0,r.jsx)(x.Z,{component:"a",href:"/index.html",children:(0,r.jsxs)(w.Z,{fullWidth:!0,row:!0,spacing:"2em",children:[(0,r.jsx)(d.Z,{className:D.actionIcon}),(0,r.jsx)(O.Ac,{children:"Dashboard"})]})}),g.map((function(e){return(0,r.jsx)(x.Z,{component:"a",href:e.uri,children:(0,r.jsxs)(w.Z,{fullWidth:!0,row:!0,spacing:"2em",children:[(0,r.jsx)("img",I({alt:e.text,src:e.image},y)),(0,r.jsx)(O.Ac,{children:e.text})]})},"anvil-drawer-".concat(e.image))})),(0,r.jsx)(x.Z,{onClick:function(){b.Z.put("/auth/logout").then((function(){window.location.replace("/login")})).catch((function(e){(0,Z.Z)(e)}))},children:(0,r.jsxs)(w.Z,{fullWidth:!0,row:!0,spacing:"2em",children:[(0,r.jsx)(p.Z,{className:D.actionIcon}),(0,r.jsx)(O.Ac,{children:"Logout"})]})})]})})})},L=t(3377),T=t(2444);function N(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}var M="Header",B={input:"".concat(M,"-input"),barElement:"".concat(M,"-barElement"),iconBox:"".concat(M,"-iconBox"),searchBar:"".concat(M,"-searchBar"),icons:"".concat(M,"-icons")},_=(0,i.ZP)(l.Z)((function(e){var n,t=e.theme;return N(n={paddingTop:t.spacing(.5),paddingBottom:t.spacing(.5),paddingLeft:t.spacing(3),paddingRight:t.spacing(3),borderBottom:"solid 1px",borderBottomColor:f.hM,position:"static"},"& .".concat(B.input),{height:"2.8em",width:"30vw",backgroundColor:t.palette.secondary.main,borderRadius:f.n_}),N(n,"& .".concat(B.barElement),{padding:0}),N(n,"& .".concat(B.iconBox),N({},t.breakpoints.down("sm"),{display:"none"})),N(n,"& .".concat(B.searchBar),N({},t.breakpoints.down("sm"),{flexGrow:1,paddingLeft:"15vw"})),N(n,"& .".concat(B.icons),{paddingLeft:".1em",paddingRight:".1em"}),n})),R=function(){var e=(0,s.useRef)({}),n=(0,s.useRef)({}),t=(0,s.useState)(!1),i=t[0],l=t[1];return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(_,{children:(0,r.jsxs)(c.Z,{display:"flex",justifyContent:"space-between",flexDirection:"row",children:[(0,r.jsx)(w.Z,{row:!0,children:(0,r.jsx)(a.Z,{onClick:function(){return l(!i)},children:(0,r.jsx)("img",{alt:"",src:"/pngs/logo.png",width:"160",height:"40"})})}),(0,r.jsx)(w.Z,{className:B.iconBox,row:!0,spacing:0,children:(0,r.jsx)(c.Z,{children:(0,r.jsx)(u.Z,{onClick:function(e){var t,r,o=e.currentTarget;null===(t=n.current.setAnchor)||void 0===t||t.call(null,o),null===(r=n.current.setOpen)||void 0===r||r.call(null,!0)},sx:{color:f.of,padding:"0 .1rem"},children:(0,r.jsx)(L.Z,{icon:o.Z,ref:e})})})})]})}),(0,r.jsx)(F,{open:i,setOpen:l}),(0,r.jsx)(T.Z,{onFetchSuccessAppend:function(n){var t;null===(t=e.current.indicate)||void 0===t||t.call(null,Object.keys(n).length>0)},ref:n})]})}},4427:function(e,n,t){"use strict";var r=t(5893),o=t(2429),i=t(9309),l=t(7169);function c(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function a(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){c(e,n,t[n])}))}return e}n.Z=function(e){var n,t,u=e.children,s=e.sx,f=a((c(t={backgroundColor:l.lD,paddingRight:"3em"},"&.".concat(o.Z.selected),(c(n={backgroundColor:l.s7,fontWeight:400},"&.".concat(o.Z.focusVisible),{backgroundColor:l.s7}),c(n,"&:hover",{backgroundColor:l.s7}),n)),c(t,"&.".concat(o.Z.focusVisible),{backgroundColor:l.s7}),c(t,"&:hover",{backgroundColor:l.s7}),t),s);return(0,r.jsx)(i.Z,a({},e,{sx:f,children:u}))}},2879:function(e,n,t){"use strict";var r=t(5893),o=t(5537),i=t(5603),l=t(9558),c=t(6239),a=t(7021),u=t(1057),s=t(4799),f=t(3213),d=t(7294),p=t(7169);function m(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function h(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){m(e,n,t[n])}))}return e}function v(e,n){if(null==e)return{};var t,r,o=function(e,n){if(null==e)return{};var t,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||(o[t]=e[t]);return o}(e,n);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)t=i[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(o[t]=e[t])}return o}n.Z=function(e){var n=e.onClearIndicatorClick,t=v(e,["onClearIndicatorClick"]),x=t.sx,g=t.value,y=v(t,["sx","value"]),b=(0,d.useMemo)((function(){var e;return h((m(e={},"& .".concat(i.Z.icon),{color:p.s7}),m(e,"& .".concat(l.Z.root),{marginRight:".8em"}),m(e,"& .".concat(c.Z.root),{color:p.s7,visibility:"hidden"}),m(e,"&:hover .".concat(l.Z.root," .").concat(c.Z.root,",\n &.").concat(a.Z.focused," .").concat(l.Z.root," .").concat(c.Z.root),{visibility:"visible"}),e),x)}),[x]),j=(0,d.useMemo)((function(){return String(g).length>0&&n&&(0,r.jsx)(u.Z,{position:"end",children:(0,r.jsx)(s.Z,{onClick:n,children:(0,r.jsx)(o.Z,{fontSize:"small"})})})}),[n,g]);return(0,r.jsx)(f.Z,h({endAdornment:j,value:g},y,{sx:b}))}},1081:function(e,n,t){"use strict";var r=t(7294);n.Z=function(){var e=(0,r.useRef)(!0);return e.current?(e.current=!1,!0):e.current}},7241:function(e,n,t){"use strict";t.r(n),t.d(n,{default:function(){return Ie}});var r=t(5893),o=t(9008),i=t(4051),l=t.n(i),c=t(7294),a=t(7357),u=t(2428),s=t(2026),f=t(1797),d=t(5293),p=t.n(d),m=t(2029),h=t(7169),v=t(8128),x=t(3631),g=t(4390),y=t(157),b=t(4825),j=t(1496),w=t(3457),Z=t(3640),O=t(6886),P=t(480),S=t(267),C=t(1925),A=t(5934),k=[["iso",["application/x-cd-image","ISO (optical disc)"]],["other",["text/plain","Other file type"]],["script",["text/plain","Script (program)"]]],I=new Map(k),U=t(6125),D=t(4427),E=t(9),F=t(192),L=t(3679),T=t(2879);function N(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function M(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var t=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,o,i=[],l=!0,c=!1;try{for(t=t.call(e);!(l=(r=t.next()).done)&&(i.push(r.value),!n||i.length!==n);l=!0);}catch(a){c=!0,o=a}finally{try{l||null==t.return||t.return()}finally{if(c)throw o}}return i}}(e,n)||function(e,n){if(!e)return;if("string"===typeof e)return N(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return N(e,n)}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var B,_,R,W={isReadonly:void 0,onChange:void 0},H=(0,j.ZP)(v.Z)((B={color:h.hM},_="&.".concat(x.Z.checked),R={color:h.Ej},_ in B?Object.defineProperty(B,_,{value:R,enumerable:!0,configurable:!0,writable:!0}):B[_]=R,B)),V=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:W,n=e.fileName,t=e.fileType,o=e.fileLocations,i=e.isReadonly,l=e.onChange,a=(0,A.Z)(),u="file-name-".concat(a),s="File name",f="file-type-".concat(a),d="File type",p=(0,c.useMemo)((function(){return o.reduce((function(e,n){var t=n.anvilDescription,r=n.anvilName,o=n.anvilUUID;return e[o]||(e[o]={anvilDescription:t,anvilName:r,anvilUUID:o,flocs:[]}),e[o].flocs.push(n),e}),{})}),[o]);return(0,r.jsxs)(w.Z,{sx:{"> :not(:first-child)":{marginTop:"1em"}},children:[(0,r.jsxs)(Z.Z,{children:[(0,r.jsx)(F.Z,{htmlFor:u,children:s}),(0,r.jsx)(E.Z,{defaultValue:n,disabled:i,id:u,label:s,onChange:function(e){var t=e.target.value;null===l||void 0===l||l.call(null,{fileName:t===n?void 0:t})}})]}),t&&(0,r.jsxs)(Z.Z,{children:[(0,r.jsx)(F.Z,{htmlFor:f,children:d}),(0,r.jsx)(T.Z,{defaultValue:t,disabled:i,id:f,input:(0,r.jsx)(E.Z,{label:d}),onChange:function(e){var n=e.target.value;null===l||void 0===l||l.call(null,{fileType:n===t?void 0:n})},children:k.map((function(e){var n=M(e,2),t=n[0],o=M(n[1],2)[1];return(0,r.jsx)(D.Z,{value:t,children:o},t)}))})]}),(0,r.jsx)(U.Z,{listItems:p,listProps:{dense:!0,disablePadding:!0},renderListItem:function(e,n){var t=n.anvilDescription,c=n.anvilName,a=n.flocs;return(0,r.jsx)(L.TZ,{header:"".concat(c,": ").concat(t),panelProps:{padding:0,width:"100%"},children:(0,r.jsx)(L.bc,{children:(0,r.jsx)(O.ZP,{columns:{xs:1,sm:2,md:3,lg:4,xl:5},columnSpacing:"1em",container:!0,direction:"row",children:a.map((function(n){var t=n.fileLocationUUID,c=n.hostName,a=n.hostUUID,u=n.isFileLocationActive;return(0,r.jsx)(O.ZP,{item:!0,xs:1,children:(0,r.jsx)(P.Z,{control:(0,r.jsx)(H,{checkedIcon:(0,r.jsx)(S.Z,{}),defaultChecked:u,disabled:i,edge:"start",icon:(0,r.jsx)(C.Z,{}),onChange:function(e){var n=e.target.checked;null===l||void 0===l||l.call(null,{isFileLocationActive:n===u?void 0:n},{fileLocationIndex:o.findIndex((function(e){var n=e.fileLocationUUID;return t===n}))})}}),label:c,sx:{color:h.lD},value:"".concat(a,"-sync")})},"floc-".concat(e,"-").concat(a))}))})})})}})]})};V.defaultProps=W;var z=V,G=t(2152),$=t(1200);function X(e,n,t,r,o,i,l){try{var c=e[i](l),a=c.value}catch(u){return void t(u)}c.done?n(a):Promise.resolve(a).then(r,o)}function J(e){return function(){var n=this,t=arguments;return new Promise((function(r,o){var i=e.apply(n,t);function l(e){X(i,r,o,l,c,"next",e)}function c(e){X(i,r,o,l,c,"throw",e)}l(void 0)}))}}function Y(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function q(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){Y(e,n,t[n])}))}return e}var K={onEditFilesComplete:void 0,onPurgeFilesComplete:void 0},Q=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:K,n=e.filesOverview,t=e.onEditFilesComplete,o=e.onPurgeFilesComplete,i=(0,c.useState)([]),u=i[0],s=i[1],f=(0,c.useState)([]),d=f[0],p=f[1],j=(0,c.useState)(!1),w=j[0],Z=j[1],O=(0,c.useState)(!1),P=O[0],S=O[1],C=(0,c.useState)(0),A=C[0],k=C[1],I={backgroundColor:h.hM,color:h.lD,"&:hover":{backgroundColor:h.hM}},U=function(e){return function(n){var t=(arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}).fileLocationIndex;void 0!==t?u[e].fileLocations[t]=q({},u[e].fileLocations[t],n):u[e]=q({},u[e],n)}},D=function(e){e.preventDefault(),Z(!0);var n=u.reduce((function(e,n){var t=n.fileLocations,r=n.fileName,o=n.fileType,i=n.fileUUID,l={};void 0!==r&&(l.fileName=r),void 0!==o&&(l.fileType=o);var c=t.reduce((function(e,n){var t=n.fileLocationUUID,r=n.isFileLocationActive;return void 0!==r&&e.push({fileLocationUUID:t,isFileLocationActive:r}),e}),[]);return c.length>0&&(l.fileLocations=c),Object.keys(l).length>0&&e.push(g.Z.put("/file/".concat(i),l)),e}),[]);Promise.all(n).then((function(){Z(!1)})).then(t)},E=function(){S(!1),Z(!0);var e=d.filter((function(e){return e.isSelected})).map((function(e){var n=e.fileUUID;return g.Z.delete("/file/".concat(n))}));Promise.all(e).then((function(){Z(!1)})).then(o)},F=function(){S(!1)},L=function(){var e=d.filter((function(e){return e.isSelected})).length;k(e),e>0&&S(!0)};return(0,c.useEffect)((function(){Z(!0),Promise.all(n.map(function(){var e=J(l().mark((function e(n){var t,r;return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=q({},n,{fileLocations:[]}),e.prev=1,e.next=4,(0,$.Z)("".concat(m.Z,"/file/").concat(n.fileUUID));case 4:r=e.sent,t.fileLocations=r.map((function(e){var n=e[5],t=e[6],r=e[7],o=e[8],i=e[9],l=e[10];return{anvilDescription:i,anvilName:o,anvilUUID:r,fileLocationUUID:n,hostName:e[11],hostUUID:l,isFileLocationActive:1===parseInt(t,10)}})),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),t.dataIncompleteError=e.t0;case 11:return e.abrupt("return",t);case 12:case"end":return e.stop()}}),e,null,[[1,8]])})));return function(n){return e.apply(this,arguments)}}())).then((function(e){p(e);for(var n=[],t=0;t<e.length;t+=1){var r=e[t];n.push({fileUUID:r.fileUUID,fileLocations:r.fileLocations.map((function(e){return{fileLocationUUID:e.fileLocationUUID}}))})}s(n),Z(!1)}))}),[n]),(0,r.jsx)(r.Fragment,{children:w?(0,r.jsx)(G.Z,{}):(0,r.jsxs)("form",{onSubmit:D,children:[(0,r.jsxs)(a.Z,{sx:{display:"flex",flexDirection:"column","& > :not(:first-child)":{marginTop:"1em"}},children:[d.map((function(e,n){var t=e.fileName,o=e.fileLocations,i=e.fileType,l=e.fileUUID;return(0,r.jsxs)(a.Z,{sx:{display:"flex",flexDirection:"row","& > :last-child":{flexGrow:1}},children:[(0,r.jsx)(a.Z,{sx:{marginTop:".4em"},children:(0,r.jsx)(v.Z,{onChange:function(e){var t=e.target.checked;d[n].isSelected=t},sx:Y({color:h.s7},"&.".concat(x.Z.checked),{color:h.lD})})}),(0,r.jsx)(z,{fileName:t,fileType:i,fileLocations:o,onChange:U(n)})]},"file-edit-".concat(l))})),d.length>0&&(0,r.jsxs)(a.Z,{sx:{display:"flex",flexDirection:"row",justifyContent:"flex-end","& > :not(:last-child)":{marginRight:".5em"}},children:[(0,r.jsx)(b.Z,{onClick:L,sx:I,children:"Purge"}),(0,r.jsx)(b.Z,{type:"submit",children:"Update"})]})]}),(0,r.jsx)(y.Z,{actionProceedText:"Purge",content:"".concat(A," files will be removed from the system. You cannot undo this purge."),dialogProps:{open:P},onCancelAppend:F,onProceedAppend:E,proceedButtonProps:{sx:I},titleText:"Are you sure you want to purge ".concat(A," selected files? ")})]})})};Q.defaultProps=K;var ee=Q,ne=t(8462),te=t(7212),re=t(7720),oe=t(8600),ie=t.n(oe),le=t(7750),ce=function(e){var n=e.filesOverview;return(0,r.jsx)(ne.Z,{children:n.map((function(e){var n,t,o=e.fileChecksum,i=e.fileName,l=e.fileSizeInBytes,c=e.fileType,u=e.fileUUID,s=ie()(l,{binary:!0});return(0,r.jsx)(te.ZP,{sx:{padding:".6em 0"},children:(0,r.jsxs)(a.Z,{sx:{display:"flex",flexDirection:{xs:"column",md:"row"},width:"100%"},children:[(0,r.jsxs)(a.Z,{sx:{flexGrow:1},children:[(0,r.jsxs)(a.Z,{sx:{display:"flex",flexDirection:"row"},children:[(0,r.jsx)(le.Ac,{sx:{fontFamily:"Source Code Pro",fontWeight:400},text:i}),(0,r.jsx)(re.Z,{flexItem:!0,orientation:"vertical",sx:{backgroundColor:h.d,marginLeft:".5em",marginRight:".5em"}}),(0,r.jsx)(le.Ac,{text:null!==(t=null===(n=I.get(c))||void 0===n?void 0:n[1])&&void 0!==t?t:""})]}),(0,r.jsx)(le.Ac,{text:s})]}),(0,r.jsx)(a.Z,{sx:{alignItems:"center",display:"flex",flexDirection:"row"},children:(0,r.jsx)(le.Ac,{sx:{fontFamily:"Source Code Pro",fontWeight:400},text:o})})]})},u)}))})},ae=t(76),ue=t(9332),se=t(9297),fe=t(8187);function de(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function pe(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function me(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})))),r.forEach((function(n){pe(e,n,t[n])}))}return e}function he(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var t=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,o,i=[],l=!0,c=!1;try{for(t=t.call(e);!(l=(r=t.next()).done)&&(i.push(r.value),!n||i.length!==n);l=!0);}catch(a){c=!0,o=a}finally{try{l||null==t.return||t.return()}finally{if(c)throw o}}return i}}(e,n)||xe(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function ve(e){return function(e){if(Array.isArray(e))return de(e)}(e)||function(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||xe(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function xe(e,n){if(e){if("string"===typeof e)return de(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(t):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?de(e,n):void 0}}var ge={onFileUploadComplete:void 0,eventEmitter:void 0},ye=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ge,n=e.onFileUploadComplete,t=e.eventEmitter,o=(0,c.useRef)(),i=(0,c.useState)([]),l=i[0],u=i[1],s=(0,c.useState)([]),f=s[0],d=s[1],p=function(e){var n,t=I.entries();do{var r=t.next();if(r.value){var o=he(r.value,2),i=o[0];e===he(o[1],1)[0]&&(n=i)}else n="other"}while(!n);return n},m=function(e){var n=e.target.files;n&&u(Array.from(n).map((function(e){return{file:e,fileName:e.name,fileLocations:[],fileType:p(e.type)}})))},h=function(e){return function(n){l[e]=me({},l[e],n)}},v=function(e){for(e.preventDefault();l.length>0;){var t=l.shift();if(t){var r=t.file,o=t.fileName,i=new FormData;i.append("file",new File([r],o,me({},r)));var c={fileName:o,progressValue:0};f.push(c),g.Z.post("/file",i,{headers:{"Content-Type":"multipart/form-data"},onUploadProgress:function(e){var n=e.loaded,t=e.total;c.progressValue=Math.round(n/t*100),d(ve(f))}}).then((function(){null===n||void 0===n||n.call(null),f.splice(f.indexOf(c),1),d(ve(f))}))}}u([]),d(ve(f))};return(0,c.useEffect)((function(){null===t||void 0===t||t.addListener("openFilePicker",(function(){var e;null===(e=o.current)||void 0===e||e.click()})),null===t||void 0===t||t.addListener("clearSelectedFiles",(function(){u([])}))}),[t]),(0,r.jsxs)("form",{onSubmit:v,children:[(0,r.jsx)(ae.Z,{htmlFor:"select-file",children:(0,r.jsx)(ue.Z,{id:"select-file",inputProps:{multiple:!0},onChange:m,ref:o,sx:{display:"none"},type:"file"})}),(0,r.jsx)(a.Z,{sx:{display:"flex",flexDirection:"column"},children:f.map((function(e){var n=e.fileName,t=e.progressValue;return(0,r.jsxs)(a.Z,{sx:{alignItems:{md:"center"},display:"flex",flexDirection:{xs:"column",md:"row"},"& > :first-child":{minWidth:100,overflow:"hidden",overflowWrap:"normal",textOverflow:"ellipsis",whiteSpace:"nowrap",width:{xs:"100%",md:200},wordBreak:"keep-all"},"& > :last-child":{flexGrow:1}},children:[(0,r.jsx)(le.Ac,{text:n}),(0,r.jsx)(se.k,{progressPercentage:t})]},"in-upload-".concat(n))}))}),(0,r.jsxs)(a.Z,{sx:{display:"flex",flexDirection:"column","& > :not(:first-child)":{marginTop:"1em"}},children:[l.length>0&&(0,r.jsx)(fe.Z,{text:"Uploaded files will be listed automatically, but it may take a while for larger files to appear.",type:"info"}),l.map((function(e,n){var t=e.file.name,r=e.fileName,o=e.fileLocations;return(0,c.createElement)(z,{fileName:r,fileLocations:o,key:"selected-".concat(t),onChange:h(n)})})),l.length>0&&(0,r.jsx)(a.Z,{sx:{display:"flex",flexDirection:"row",justifyContent:"flex-end"},children:(0,r.jsx)(b.Z,{type:"submit",children:"Upload"})})]})]})};ye.defaultProps=ge;var be=ye,je=t(1706),we=t(1905);function Ze(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function Oe(e,n,t,r,o,i,l){try{var c=e[i](l),a=c.value}catch(u){return void t(u)}c.done?n(a):Promise.resolve(a).then(r,o)}function Pe(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var t=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,o,i=[],l=!0,c=!1;try{for(t=t.call(e);!(l=(r=t.next()).done)&&(i.push(r.value),!n||i.length!==n);l=!0);}catch(a){c=!0,o=a}finally{try{l||null==t.return||t.return()}finally{if(c)throw o}}return i}}(e,n)||function(e,n){if(!e)return;if("string"===typeof e)return Ze(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);"Object"===t&&e.constructor&&(t=e.constructor.name);if("Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Ze(e,n)}(e,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var Se="".concat(m.Z,"/file"),Ce=function(){var e=(0,c.useState)([]),n=e[0],t=e[1],o=(0,c.useState)(),i=o[0],d=o[1],m=(0,c.useState)(!1),v=m[0],x=m[1],g=(0,c.useState)(!1),y=g[0],b=g[1],j=new(p()),w=function(){var e,n=(e=l().mark((function e(){var n;return l().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return x(!0),e.prev=1,e.next=4,(0,$.Z)(Se);case 4:n=e.sent,t(n),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),d("Failed to get files due to a network issue.");case 11:x(!1);case 12:case"end":return e.stop()}}),e,null,[[1,8]])})),function(){var n=this,t=arguments;return new Promise((function(r,o){var i=e.apply(n,t);function l(e){Oe(i,r,o,l,c,"next",e)}function c(e){Oe(i,r,o,l,c,"throw",e)}l(void 0)}))});return function(){return n.apply(this,arguments)}}();return(0,we.Z)(Se,{onSuccess:function(e){e.length!==n.length&&t(e)}}),(0,c.useEffect)((function(){y||w()}),[y]),(0,r.jsxs)(L.s_,{children:[(0,r.jsxs)(a.Z,{sx:{alignItems:"center",display:"flex",flexDirection:"row",marginBottom:"1em",width:"100%","& > :first-child":{flexGrow:1},"& > :not(:first-child, :last-child)":{marginRight:".3em"}},children:[(0,r.jsx)(le.z,{text:"Files"}),!y&&(0,r.jsx)(je.Z,{onClick:function(){j.emit("openFilePicker")},children:(0,r.jsx)(u.Z,{})}),(0,r.jsx)(je.Z,{onClick:function(){j.emit("clearSelectedFiles"),b(!y)},children:y?(0,r.jsx)(s.Z,{sx:{color:h.Ej}}):(0,r.jsx)(f.Z,{})})]}),i&&(0,r.jsx)(fe.Z,{text:i,type:"error"}),(0,r.jsx)(be,{eventEmitter:j,onFileUploadComplete:w}),function(){var e;if(v)e=(0,r.jsx)(G.Z,{});else{var t=n.map((function(e){var n=Pe(e,5),t=n[0],r=n[1],o=n[2],i=n[3];return{fileChecksum:n[4],fileName:r,fileSizeInBytes:parseInt(o,10),fileType:i,fileUUID:t}}));e=y?(0,r.jsx)(ee,{filesOverview:t,onEditFilesComplete:w,onPurgeFilesComplete:w}):(0,r.jsx)(ce,{filesOverview:t})}return e}()]})},Ae=Ce,ke=t(5521),Ie=function(){return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(o.default,{children:(0,r.jsx)("title",{children:"File Manager"})}),(0,r.jsx)(ke.Z,{}),(0,r.jsx)(Ae,{})]})}}},function(e){e.O(0,[382,483,894,182,768,746,203,774,888,179],(function(){return n=8283,e(e.s=n);var n}));var n=e.O();_N_E=n}]); |