@team-chatt/window-manager
Advanced tools
Comparing version 0.10.0 to 0.10.1
@@ -11,3 +11,3 @@ !function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("react"),require("prop-types"));else if("function"==typeof define&&define.amd)define(["react","prop-types"],t);else{var n="object"==typeof exports?t(require("react"),require("prop-types")):t(e.React,e.PropTypes);for(var o in n)("object"==typeof exports?exports:e)[o]=n[o]}}(window,(function(e,t){return function(e){var t={};function n(o){if(t[o])return t[o].exports;var i=t[o]={i:o,l:!1,exports:{}};return e[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(o,i,function(t){return e[t]}.bind(null,i));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=30)}([function(t,n){t.exports=e},function(e,n){e.exports=t},function(e,t,n){var o; | ||
http://jedwatson.github.io/classnames | ||
*/!function(){"use strict";var n={}.hasOwnProperty;function i(){for(var e=[],t=0;t<arguments.length;t++){var o=arguments[t];if(o){var r=typeof o;if("string"===r||"number"===r)e.push(o);else if(Array.isArray(o)&&o.length){var a=i.apply(null,o);a&&e.push(a)}else if("object"===r)for(var s in o)n.call(o,s)&&o[s]&&e.push(s)}}return e.join(" ")}e.exports?(i.default=i,e.exports=i):void 0===(o=function(){return i}.apply(t,[]))||(e.exports=o)}()},function(e,t,n){var o=n(25);"string"==typeof o&&(o=[[e.i,o,""]]);var i={insert:"head",singleton:!1};n(4)(o,i);o.locals&&(e.exports=o.locals)},function(e,t,n){var o=n(26);"string"==typeof o&&(o=[[e.i,o,""]]);var i={insert:"head",singleton:!1};n(4)(o,i);o.locals&&(e.exports=o.locals)},function(e,t){e.exports="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2ZXJzaW9uPSIxLjEiICB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCI+CiAgIDxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKC00LDEyKSI+CiAgICAgIDxwYXRoIGZpbGw9IiNmZmZmZmYiIGQ9Ik0yMCwxNEg0VjEwSDIwIiAvPgogICA8L2c+Cjwvc3ZnPg=="},function(e,t){e.exports="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2ZXJzaW9uPSIxLjEiICB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCI+CiAgIDxwYXRoIGZpbGw9IiNmZmZmZmYiIGQ9Ik0xOSw2LjQxTDE3LjU5LDVMMTIsMTAuNTlMNi40MSw1TDUsNi40MUwxMC41OSwxMkw1LDE3LjU5TDYuNDEsMTlMMTIsMTMuNDFMMTcuNTksMTlMMTksMTcuNTlMMTMuNDEsMTJMMTksNi40MVoiIC8+Cjwvc3ZnPg=="},function(e,t,n){var o=n(27);"string"==typeof o&&(o=[[e.i,o,""]]);var i={insert:"head",singleton:!1};n(4)(o,i);o.locals&&(e.exports=o.locals)},function(e,t,n){var o=n(28);"string"==typeof o&&(o=[[e.i,o,""]]);var i={insert:"head",singleton:!1};n(4)(o,i);o.locals&&(e.exports=o.locals)},function(e,t,n){var o=n(29);"string"==typeof o&&(o=[[e.i,o,""]]);var i={insert:"head",singleton:!1};n(4)(o,i);o.locals&&(e.exports=o.locals)},function(e,t,n){(t=e.exports=n(3)(!1)).push([e.i,".file-grid--1BGOO{flex:1;padding:24px 24px 24px 24px;display:grid;grid-template-rows:repeat(auto-fill, 72px);grid-template-columns:repeat(auto-fill, 72px);grid-gap:24px}.file-grid--row--Da16I{grid-auto-flow:row}.file-grid--column--2Otzt{grid-auto-flow:column}\n",""]),t.locals={"file-grid":"file-grid--1BGOO","file-grid--row":"file-grid--row--Da16I","file-grid--column":"file-grid--column--2Otzt"}},function(e,t,n){(t=e.exports=n(3)(!1)).push([e.i,".file-grid-item--_0fiq{padding:0;margin:0;border:0;background:0;-webkit-user-select:none;user-select:none}.file-grid-item--_0fiq:focus{outline:none}.file-grid-item_inner--1MCIk{display:grid;width:72px;grid-template-rows:48px auto;grid-gap:6px;justify-items:center;align-items:center;text-align:center}.file-grid-item_icon--1GOHW{width:48px;height:48px}.file-grid-item--_0fiq:focus .file-grid-item_icon--1GOHW{filter:sepia(1) saturate(2) hue-rotate(185deg) brightness(0.7)}.file-grid-item_label--3FSa2{display:block;padding:3px 3px 3px 3px;font-size:12px}.file-grid-item--_0fiq:focus .file-grid-item_label--3FSa2{background:#228be6;color:#fff;text-shadow:0 1px rgba(33,37,41,0.5),0 0 3px rgba(33,37,41,0.5)}.file-grid-item--light--e24lp .file-grid-item_label--3FSa2{color:#fff;text-shadow:0 1px rgba(33,37,41,0.5),0 0 3px rgba(33,37,41,0.5)}.file-grid-item--dark--3xDRl .file-grid-item_label--3FSa2{color:#212529}\n",""]),t.locals={"file-grid-item":"file-grid-item--_0fiq","file-grid-item_inner":"file-grid-item_inner--1MCIk","file-grid-item_icon":"file-grid-item_icon--1GOHW","file-grid-item_label":"file-grid-item_label--3FSa2","file-grid-item--light":"file-grid-item--light--e24lp","file-grid-item--dark":"file-grid-item--dark--3xDRl"}},function(e,t,n){(t=e.exports=n(3)(!1)).push([e.i,".desktop--2U5pg{display:flex;position:relative;flex:1;background:#339af0}.desktop--2U5pg>*{position:relative}.desktop_items--3tDWi{flex:1;padding:24px 24px 24px 24px;display:grid;grid-auto-flow:column;grid-template-rows:repeat(auto-fill, 72px);grid-template-columns:repeat(auto-fill, 72px);grid-gap:24px}.desktop_background--11u5_{position:absolute;top:0;bottom:0;left:0;right:0;background-position:top center;background-size:cover;transition:background 3s}\n",""]),t.locals={desktop:"desktop--2U5pg",desktop_items:"desktop_items--3tDWi",desktop_background:"desktop_background--11u5_"}},function(e,t,n){(t=e.exports=n(3)(!1)).push([e.i,".taskbar--Ap6Iu{display:grid;grid-auto-flow:column;grid-auto-columns:min-content;grid-gap:3px;position:relative;padding:3px 3px 3px 3px;height:48px;border:2px outset #339af0;background:linear-gradient(to bottom, #74c0fc 0%, #228be6 10%, #339af0 30%, #339af0 80%, #1c7ed6 100%);z-index:100}\n",""]),t.locals={taskbar:"taskbar--Ap6Iu"}},function(e,t,n){(t=e.exports=n(3)(!1)).push([e.i,".taskbar-button--MzJmj{position:relative;margin:0;padding:6px 12px;border:2px outset #4dabf7;border-radius:6px;background:linear-gradient(to bottom, #74c0fc 0%, #339af0 10%, #4dabf7 30%, #4dabf7 80%, #228be6 100%);cursor:pointer;font-family:inherit;font-size:inherit;color:#fff;text-shadow:0 1px rgba(33,37,41,0.5);white-space:nowrap}.taskbar-button--MzJmj svg{margin:-6px}.taskbar-button--borderless--f8oH7{border:2px solid transparent;background:none}.taskbar-button--MzJmj:focus{outline:0;box-shadow:0 0 0 2px #ffa94d}.taskbar-button--MzJmj:hover{filter:brightness(1.1)}.taskbar-button--active--2SrnT{border:2px outset #228be6;background:linear-gradient(to bottom, #228be6 0%, #1c7ed6 10%, #1c7ed6 30%, #1c7ed6 80%, #1971c2 100%)}.taskbar-button--MzJmj:active:not([disabled]){border:2px inset #4dabf7 !important;background:linear-gradient(to top, #74c0fc 0%, #339af0 10%, #4dabf7 30%, #4dabf7 80%, #228be6 100%) !important}.taskbar-button--MzJmj[disabled]{opacity:0.25;cursor:default}\n",""]),t.locals={"taskbar-button":"taskbar-button--MzJmj","taskbar-button--borderless":"taskbar-button--borderless--f8oH7","taskbar-button--active":"taskbar-button--active--2SrnT"}},function(e,t,n){(t=e.exports=n(3)(!1)).push([e.i,".window-manager--KrBjA{display:grid;grid-template-rows:1fr min-content;height:100vh;overflow:hidden}.window-manager_layer-group--Yt68A{position:relative}.window-manager_layer--YHnOX{display:flex;pointer-events:none;overflow:hidden;position:absolute;top:0;bottom:0;left:0;right:0}.window-manager_layer--YHnOX>*{pointer-events:initial}\n",""]),t.locals={"window-manager":"window-manager--KrBjA","window-manager_layer-group":"window-manager_layer-group--Yt68A","window-manager_layer":"window-manager_layer--YHnOX"}},function(e,t,n){(t=e.exports=n(3)(!1)).push([e.i,".bsod--1H_0P{display:flex;flex-direction:column;align-items:center;justify-content:center;font-family:monospace;text-align:center;height:100vh;padding:24px 24px 24px 24px;background-color:#1e00ff;color:#fff}.bsod--1H_0P pre{white-space:pre-wrap;text-align:left}.bsod_column--4A5cn{max-width:960px;max-height:100%;overflow:hidden}\n",""]),t.locals={bsod:"bsod--1H_0P",bsod_column:"bsod_column--4A5cn"}},function(e,t,n){(t=e.exports=n(3)(!1)).push([e.i,".window--13ujq{display:flex;flex:1;flex-direction:column;max-width:100%;-webkit-user-select:none;user-select:none;border:2px outset #74c0fc;border-top-right-radius:6px;border-top-left-radius:6px;background-color:#f5eee5}.window--focused--2-nSM{border:2px outset #339af0}.window_header--1A5sM{display:flex;background:linear-gradient(to bottom, #74c0fc 0%, #228be6 10%, #339af0 30%, #339af0 80%, #1c7ed6 100%);border-top-right-radius:4px;border-top-left-radius:4px;filter:saturate(0.65) brightness(1.25)}.window--focused--2-nSM .window_header--1A5sM{filter:none}.window_title--DWigu{flex:1;color:#fff;padding:12px 18px;text-shadow:0 1px rgba(33,37,41,0.5)}.window_buttons--2k5ol{display:grid;grid-auto-flow:column;grid-gap:3px;padding:3px 3px 3px 3px}.window_body--2TbKa{display:flex;flex:1;overflow:hidden;-webkit-user-select:none;user-select:none}.window--focused--2-nSM .window_body--2TbKa{-webkit-user-select:text;user-select:text}.window-button--2A-WI{display:flex;align-items:center;justify-content:center;width:36px;height:36px;margin:0;padding:0;border-radius:3px;border:1px solid #fff;background:linear-gradient(to bottom, rgba(255,255,255,0) 0%, rgba(255,255,255,0.4) 5%, rgba(255,255,255,0) 15%, rgba(255,255,255,0) 85%, rgba(33,37,41,0.1) 100%),#339af0;cursor:pointer}.window-button--2A-WI:focus{outline:none;box-shadow:0 0 0 2px #ffa94d}.window-button--close--X4miR{background:linear-gradient(to bottom, rgba(255,255,255,0) 0%, rgba(255,255,255,0.4) 5%, rgba(255,255,255,0) 15%, rgba(255,255,255,0) 85%, rgba(33,37,41,0.1) 100%),#ff6b6b}\n",""]),t.locals={window:"window--13ujq","window--focused":"window--focused--2-nSM",window_header:"window_header--1A5sM",window_title:"window_title--DWigu",window_buttons:"window_buttons--2k5ol",window_body:"window_body--2TbKa","window-button":"window-button--2A-WI","window-button--close":"window-button--close--X4miR"}},function(e,t,n){(t=e.exports=n(3)(!1)).push([e.i,".outline--7Bks2{opacity:0;position:absolute;border:2px solid #212529;pointer-events:none;z-index:100}.outline--animate--PlkLC{opacity:1;transition:top 250ms steps(6),left 250ms steps(6),bottom 250ms steps(6),right 250ms steps(6)}\n",""]),t.locals={outline:"outline--7Bks2","outline--animate":"outline--animate--PlkLC"}},function(e,t,n){(t=e.exports=n(3)(!1)).push([e.i,".window-frame--1e6t8{display:flex;flex:1;position:absolute;background:#339af0;outline:none}@media (min-width: 576px){.window-frame--1e6t8{background:none}}@media screen and (max-width: 575px){.window-frame--1e6t8{top:0 !important;left:0 !important;bottom:0 !important;right:0 !important;width:unset !important;height:unset !important}}.window-frame_shadow--3vWl4{position:absolute;pointer-events:none;top:0;bottom:0;left:0;right:0;box-shadow:0 8px 24px rgba(33,37,41,0.5);border-radius:6px}.appear--enter--OGbDx{opacity:0}.appear--enter-active--Z7uiF{transition:opacity;transition-delay:250ms;opacity:1}.appear--enter-done--2Vnuw{opacity:1}\n",""]),t.locals={"window-frame":"window-frame--1e6t8","window-frame_shadow":"window-frame_shadow--3vWl4","appear--enter":"appear--enter--OGbDx","appear--enter-active":"appear--enter-active--Z7uiF","appear--enter-done":"appear--enter-done--2Vnuw"}},function(e,t,n){(t=e.exports=n(3)(!1)).push([e.i,".file-grid-item--AGvUH{position:relative}.file-grid-item_origin--2YABG{position:absolute;pointer-events:none;top:50%;left:50%;bottom:50%;right:50%}\n",""]),t.locals={"file-grid-item":"file-grid-item--AGvUH","file-grid-item_origin":"file-grid-item_origin--2YABG"}},function(e,t,n){"use strict";n.r(t);var o=n(0),i=n.n(o),r=n(1),a=n.n(r),s=n(5),c=n.n(s),l=n(2),d=n.n(l);const u=d.a.bind(c.a),p=Object(o.createContext)(),f=({children:e,layout:t,color:n})=>i.a.createElement(p.Provider,{value:n},i.a.createElement("div",{className:u("file-grid",{"file-grid--row":"row"===t,"file-grid--column":"column"===t})},e));f.propTypes={children:a.a.node,layout:a.a.oneOf(["row","column"]),color:a.a.oneOf(["light","dark"])},f.defaultProps={layout:"row",color:"dark"};var m=n(6),b=n.n(m);const g=d.a.bind(b.a),w=({onDoubleClick:e,icon:t,label:n})=>{const r=(()=>Object(o.useContext)(p))();return i.a.createElement("button",{className:g("file-grid-item",{"file-grid-item--light":"light"===r,"file-grid-item--dark":"dark"===r}),onDoubleClick:e},i.a.createElement("div",{className:g("file-grid-item_inner")},i.a.createElement("img",{className:g("file-grid-item_icon"),src:t,draggable:"false"}),i.a.createElement("span",{className:g("file-grid-item_label")},n)))};w.propTypes={onDoubleClick:a.a.func,icon:a.a.string,label:a.a.node};var v=n(7),h=n.n(v);const y=d.a.bind(h.a),x=({background:e,children:t})=>i.a.createElement("div",{className:y("desktop")},i.a.createElement("div",{className:y("desktop_background"),style:{backgroundImage:"url(".concat(e,")")}}),t);var k=n(8),M=n.n(k);const E=d.a.bind(M.a),j=({children:e})=>i.a.createElement("div",{className:E("taskbar")},e);var _=n(9),O=n.n(_);const C=d.a.bind(O.a),I=({name:e,active:t,borderless:n,children:o,disabled:r,onClick:a,onMouseDown:s,onMouseUp:c,onMouseLeave:l,onKeyDown:d,onKeyUp:u,onFocus:p,onBlur:f})=>i.a.createElement("button",{name:e,className:C("taskbar-button",{"taskbar-button--active":t,"taskbar-button--borderless":n}),disabled:r,onClick:a,onMouseDown:s,onMouseUp:c,onMouseLeave:l,onKeyDown:d,onKeyUp:u,onFocus:p,onBlur:f},o);I.propTypes={name:a.a.string,active:a.a.bool,borderless:a.a.bool,children:a.a.node.isRequired,disabled:a.a.bool,onClick:a.a.func,onMouseDown:a.a.func,onMouseUp:a.a.func,onMouseLeave:a.a.func,onKeyDown:a.a.func,onKeyUp:a.a.func,onFocus:a.a.func,onBlur:a.a.func};var D=n(10),N=n.n(D);const S=d.a.bind(N.a),R=(Object(o.createContext)(),({background:e,windowItems:t,desktopItems:n,taskbarItems:o,taskbarExtras:r})=>i.a.createElement("div",{className:S("window-manager")},i.a.createElement("div",{className:S("window-manager_layer-group")},i.a.createElement("div",{className:S("window-manager_layer")},i.a.createElement(x,{background:e},i.a.createElement(f,{layout:"column",color:"light"},n))),i.a.createElement("div",{className:S("window-manager_layer")},t)),i.a.createElement(j,null,o,r)));class T{constructor(){this._promise=new Promise(e=>{this._resolve=e})}static create(){return new T}resolve(...e){this._resolve(...e)}then(...e){return this._promise.then(...e)}catch(...e){return this._promise.catch(...e)}}var L=T.create;var W=()=>new Promise(e=>window.requestAnimationFrame(e));class z{constructor(){this.map=new Map}ensureKey(e){return this.map.has(e)||this.map.set(e,L()),this.map.get(e)}async get(e){return Promise.race([this.ensureKey(e),W().then(()=>!1)])}async set(e,t){this.ensureKey(e).resolve(t),await W(),this.map.delete(e)}}class A{constructor(){this.inMap=new z,this.outMap=new z}static create(){return new A}async in(e,t){return this.inMap.set(e,t),this.outMap.get(e)}async out(e,t){return this.outMap.set(e,t),this.inMap.get(e)}}const F=A.create,B=i.a.createContext(),P=({children:e})=>{const[t]=Object(o.useState)(F);return i.a.createElement(B.Provider,{value:t},e)},H=(e,t,n,i)=>{Object(o.useLayoutEffect)(()=>t?(()=>n(e.current))():(()=>i(e.current))(),[t])};var Z=n(11),G=n.n(Z);var U=e=>(...t)=>{const n=e(...t);let o=!1;return(async()=>{for await(const e of n)if(o)break})(),()=>{o=!0}};const K=e=>{const[t,n]=Object(o.useState)([]);return[t,U((e=>(async function*(t){e.setup(),yield await W(),e.run(),yield await new Promise(e=>t.addEventListener("transitionend",e,{once:!0})),e.teardown()}))({setup:()=>n([e]),run:()=>n([e,"".concat(e,"-active")]),teardown:()=>n([e,"".concat(e,"-done")])}))]},q=(e,t,n)=>{const[o,i]=K("enter"),[r,a]=K("exit");return H(e,t,i,a),((e,t)=>G()(e.map(e=>t[e])))([...o,...r],n)};var J=n(12),V=n.n(J);const Y=d.a.bind(V.a),X=({error:e})=>i.a.createElement("div",{className:Y("bsod")},i.a.createElement("div",{className:Y("bsod_column")},i.a.createElement("h2",null,"Error"),i.a.createElement("pre",null,"An exception has occurred and the application cannot continue"),i.a.createElement("pre",null,e&&e.stack)));class Q extends o.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}render(){const{children:e}=this.props,{error:t}=this.state;return t?i.a.createElement(X,{error:t}):e}}const $={left:0,top:0},ee=()=>{};var te=n(13),ne=n.n(te),oe=n(14),ie=n.n(oe),re=n(15),ae=n.n(re);const se=d.a.bind(ne.a),ce=({title:e,children:t,className:n,isFocused:r,onMinimize:a,onClose:s,onDragStart:c,onDrag:l,onDragEnd:d})=>{const u=(({onDragStart:e=ee,onDrag:t=ee,onDragEnd:n=ee})=>{const[i,r]=Object(o.useState)($),[a,s]=Object(o.useState)(!1),c=Object(o.useCallback)(({clientX:t,clientY:n,button:o})=>{2!==o&&(s(!0),r({left:t,top:n}),e())},[]),l=Object(o.useCallback)(({clientX:e,clientY:n})=>{const o={left:e-i.left,top:n-i.top};t(o)},[i,t]),d=Object(o.useCallback)(()=>{s(!1),n()},[n]);return Object(o.useEffect)(()=>{if(a)return window.addEventListener("mousemove",l),window.addEventListener("mouseup",d),()=>{window.removeEventListener("mousemove",l),window.removeEventListener("mouseup",d)}},[a,l,d]),c})({onDragStart:c,onDrag:l,onDragEnd:d});return i.a.createElement("div",{className:se(n,"window",{"window--focused":r})},i.a.createElement("div",{className:se("window_header"),onMouseDown:u},i.a.createElement("span",{className:se("window_title")},e),i.a.createElement("div",{className:se("window_buttons")},i.a.createElement("button",{onClick:a,className:se("window-button","window-button--minimize"),name:"minimize window"},i.a.createElement("img",{src:ie.a,alt:""})),i.a.createElement("button",{onClick:s,className:se("window-button","window-button--close"),name:"close window"},i.a.createElement("img",{src:ae.a,alt:""})))),i.a.createElement("div",{className:se("window_body")},t))};var le=n(16),de=n.n(le);const ue=d.a.bind(de.a),pe=Object(o.forwardRef)(({animate:e,rect:t},n)=>{const o={top:t.top,left:t.left,bottom:t.bottom,right:t.right},r=ue("outline",{"outline--animate":e});return i.a.createElement("div",{ref:n,className:r,style:o})});pe.propTypes={animate:a.a.bool,rect:a.a.shape({top:a.a.number.isRequired,left:a.a.number.isRequired,bottom:a.a.number.isRequired,right:a.a.number.isRequired}).isRequired};const fe={left:0,top:0,right:0,bottom:0},me=(e,t)=>({top:e.top-t.top,left:e.left-t.left,bottom:-(e.bottom-t.bottom),right:-(e.right-t.right)}),be=async function*(){},ge=(e,t)=>{const[n,i]=Object(o.useState)(fe),[r,a]=Object(o.useState)(!1);return((e,t,n,i,r)=>{const a=Object(o.useContext)(B);H(t,n,U((async function*(){const n=await a.in(e,t.current);yield,n&&(yield*i(n,t.current))})),U((async function*(){const n=await a.out(e,t.current);yield,n&&(yield*r(t.current,n))}))),Object(o.useEffect)(()=>()=>{a.out(e,(e=>{const t=e.getBoundingClientRect();return{getBoundingClientRect:()=>t}})(t.current))},[])})(e,t,!0,(e=>(async function*(t,n){e.setup(t,n),await W(),yield,e.run(t,n),await new Promise(e=>n.addEventListener("transitionend",e)),yield,e.teardown(t,n)}))({setup:(e,t)=>{i(((e,t)=>{const n=e.getBoundingClientRect(),o=t.getBoundingClientRect();return me(n,o)})(e,t)),a(!1)},run:()=>{i(fe),a(!0)},teardown:()=>{a(!1)}}),be),{rect:n,isAnimating:r}},we=({id:e})=>{const t=Object(o.useRef)(),{isAnimating:n,rect:r}=ge(e,t);return i.a.createElement(pe,{ref:t,rect:r,animate:n})};var ve=n(17),he=n.n(ve);const ye=d.a.bind(he.a),xe={enter:ye("appear--enter"),"enter-active":ye("appear--enter-active"),"enter-done":ye("appear--enter-done")},ke=Object(o.createContext)(),Me=()=>Object(o.useContext)(ke),Ee=({id:e,title:t,children:n,order:r,position:a,dimensions:s,isFocused:c,onMinimize:l,onClose:d,onFocus:u,onBlur:p,onMove:f})=>{const m=Object(o.useRef)(),b=q(m,!0,xe),g=Object(o.useRef)();((e,{isFocused:t,onFocus:n,onBlur:i})=>{const r=Object(o.useRef)();r.current=t,Object(o.useEffect)(()=>{t&&!e.current.contains(document.activeElement)&&e.current.focus({preventScroll:!0})},[t]),Object(o.useEffect)(()=>{const t=()=>{window.setTimeout(()=>{const t=e.current.contains(document.activeElement)||e.current===document.activeElement,o=r.current;o&&!t&&i(),!o&&t&&n()},0)};return document.addEventListener("focusout",t),document.addEventListener("focusin",t),()=>{document.removeEventListener("focusout",t),document.removeEventListener("focusin",t)}},[])})(g,{isFocused:c,onFocus:u,onBlur:p});const{onDragStart:w,onDrag:v,onDragEnd:h}=((e,t)=>{const n=Object(o.useRef)(),i=Object(o.useRef)();n.current=e;const[r,a]=Object(o.useState)(!1);return{isDragging:r,onDragStart:Object(o.useCallback)(()=>{i.current=n.current,a(!0)},[]),onDrag:Object(o.useCallback)(e=>{const n={top:i.current.top+e.top,left:i.current.left+e.left};t(n)},[t]),onDragEnd:Object(o.useCallback)(()=>{a(!1)},[])}})(a,f),y={zIndex:r,...a,...s};return i.a.createElement(ke.Provider,{value:g},i.a.createElement("div",{className:ye("window-frame"),style:y,ref:g,tabIndex:"0"},i.a.createElement(ce,{className:b,title:t,isFocused:c,onMinimize:l,onClose:d,onDragStart:w,onDrag:v,onDragEnd:h},n),i.a.createElement(we,{id:e}),i.a.createElement("div",{ref:m,className:ye("window-frame_shadow",b)})))},je=({id:e,active:t,hasOutline:n,onClick:o,children:r})=>i.a.createElement(I,{active:t,onClick:o},r,n&&i.a.createElement(we,{id:e})),_e=Object(o.createContext)(),Oe=({background:e,windows:t,desktopItems:n,taskbarExtras:o})=>{const r=t.map(({id:e,title:t,content:n,state:o,actions:r})=>"open"===o.visibility&&i.a.createElement(Ee,{key:e,id:e,title:t,order:o.order,position:o.position,dimensions:o.dimensions,isFocused:o.isFocused,onMinimize:r.minimize,onClose:r.close,onFocus:r.focus,onBlur:r.blur,onMove:r.move},n)),a=t.map(({id:e,title:n,state:o,actions:r})=>"closed"!==o.visibility&&i.a.createElement(je,{key:e,id:e,active:"open"===o.visibility&&o.isFocused,hasOutline:"minimized"===o.visibility,onClick:"open"===o.visibility&&o.order===t.length?r.minimize:r.open},n));return i.a.createElement(Q,null,i.a.createElement(P,null,i.a.createElement(_e.Provider,{value:t},i.a.createElement(R,{background:e,desktopItems:n,windowItems:r,taskbarItems:a,taskbarExtras:o}))))};var Ce=n(18),Ie=n.n(Ce);const De=d.a.bind(Ie.a),Ne={state:{}},Se=({icon:e,label:t,id:n,onDoubleClick:r})=>{const a="closed"===((()=>Object(o.useContext)(_e))().find(e=>e.id===n)||Ne).state.visibility;return i.a.createElement("div",{className:De("file-grid-item")},i.a.createElement(w,{icon:e,label:t,onDoubleClick:r}),i.a.createElement("div",{className:De("file-grid-item_origin")},a&&i.a.createElement(we,{id:n})))},Re={get:e=>e,set:(e,t)=>t,name:"id"},Te=(e,t)=>({get:n=>t.get(e.get(n)),set:(n,o)=>{const i=e.get(n);return e.set(n,t.set(i,o))},name:"".concat(e.name," ").concat(t.name)}),Le=(...e)=>{return((e,t)=>({get:n=>{try{return e.get(n)}catch(e){return t}},set:e.set,name:"safe(".concat(e.name,")")}))(e.map(e=>"number"==typeof e?(e=>({get:t=>t[e],set:(t,n)=>{const o=[...t];return o[e]=n,o},name:"[".concat(e,"]")}))(e):(e=>({get:t=>t[e],set:(t,n)=>({...t,[e]:n}),name:".".concat(e)}))(e)).reduce(Te,Re),void 0)},We=(e,t)=>n=>e.set(n,t(e.get(n)));var ze=(e,t)=>n=>n===e?t:n<e&&n<t?n:n>e&&n>t?n:t>e?n-1:t<e?n+1:n;const Ae=(e,t)=>{return Object.keys(e).map((e,n)=>{const o=Le(e);return We(o,o=>t(e,o,n))}).reduce((e,t)=>t(e),e)},Fe=e=>{const t=Object.entries(e),[n]=t.filter(([,e])=>"open"===e.visibility).sort(([,e],[,t])=>e.order-t.order).pop()||[];return n},Be=(e,t,n)=>({position:{top:50+50*n,left:200+100*n},visibility:"closed",...t,order:n+1}),Pe=e=>Ae(e,Be),He=(e,t)=>t.type.startsWith("window.")?Ge(e,t):t.type.startsWith("top.")?Ze(e,t):e,Ze=(e,{type:t,id:n,window:o,newState:i})=>{const r=Le(n);switch(t){case"top.create":{const t=Object.keys(e).length,n=(e=>{const t=Fe(e)||-1,n=Le(t,"position").get(e);return n?{left:n.left+40,top:n.top+20}:{left:200,top:100}})(e),i=Be(0,{position:n,...o},t);return r.set(e,i)}case"top.destroy":{const t={...e};return delete t[n],t}case"top.focusNext":{const t=Fe(e);return t?Le(t,"isFocused").set(e,!0):e}case"top.reset":return Pe(i)}},Ge=(e,{type:t,id:n,position:o})=>{const i=Le(n,"visibility"),r=Le(n,"position"),a=Le(n,"isFocused");switch(t){case"window.open":return i.set(e,"open");case"window.minimize":return i.set(e,"minimized");case"window.close":return i.set(e,"closed");case"window.focus":return a.set(e,!0);case"window.blur":return a.set(e,!1);case"window.move":return We(r,e=>({...e,...o}))(e);case"window.bringToFront":return((e,t)=>n=>{const o=We(Le("order"),ze(e,t));return Ae(n,(e,t)=>o(t))})(e[n].order,Object.keys(e).length)(e)}},Ue=e=>{const[t,n]=Object(o.useReducer)(He,e,Pe),i=e=>({open:()=>{n({type:"window.open",id:e}),n({type:"window.bringToFront",id:e}),n({type:"window.focus",id:e})},focus:()=>{n({type:"window.bringToFront",id:e}),n({type:"window.focus",id:e})},close:()=>{n({type:"window.close",id:e}),n({type:"window.blur",id:e}),n({type:"top.focusNext"})},minimize:()=>{n({type:"window.minimize",id:e}),n({type:"top.focusNext"})},blur:()=>n({type:"window.blur",id:e}),move:t=>n({type:"window.move",id:e,position:t})}),r=(e,o)=>{void 0===t[e]&&n({type:"top.create",id:e,window:o})},a=Object.keys(t).length,s={createWindow:r,destroyWindow:e=>{void 0!==t[e]&&(n({type:"top.destroy",id:e}),n({type:"top.focusNext"}))},openWindow:async(e,n)=>{void 0===t[e]?(r(e,n),setTimeout(()=>{i(e).open()},0)):i(e).open()},closeWindow:e=>{void 0!==t[e]&&i(e).close()},reset:e=>{n({type:"top.reset",newState:e})},window:Object(o.useMemo)(()=>Ae(t,i),[a])};return[t,s]};n.d(t,"WindowManager",(function(){return Oe})),n.d(t,"WMWindow",(function(){return Ee})),n.d(t,"WMTaskbarButton",(function(){return je})),n.d(t,"WMFileGridItem",(function(){return Se})),n.d(t,"useWindowState",(function(){return Ue})),n.d(t,"useWMWindowState",(function(){return Ue})),n.d(t,"useWMWindowElement",(function(){return Me})),n.d(t,"WMFileGrid",(function(){return f})),n.d(t,"BSOD",(function(){return X})),n.d(t,"BSODErrorBoundary",(function(){return Q}))}])})); | ||
*/!function(){"use strict";var n={}.hasOwnProperty;function i(){for(var e=[],t=0;t<arguments.length;t++){var o=arguments[t];if(o){var r=typeof o;if("string"===r||"number"===r)e.push(o);else if(Array.isArray(o)&&o.length){var a=i.apply(null,o);a&&e.push(a)}else if("object"===r)for(var s in o)n.call(o,s)&&o[s]&&e.push(s)}}return e.join(" ")}e.exports?(i.default=i,e.exports=i):void 0===(o=function(){return i}.apply(t,[]))||(e.exports=o)}()},function(e,t,n){var o=n(25);"string"==typeof o&&(o=[[e.i,o,""]]);var i={insert:"head",singleton:!1};n(4)(o,i);o.locals&&(e.exports=o.locals)},function(e,t,n){var o=n(26);"string"==typeof o&&(o=[[e.i,o,""]]);var i={insert:"head",singleton:!1};n(4)(o,i);o.locals&&(e.exports=o.locals)},function(e,t){e.exports="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2ZXJzaW9uPSIxLjEiICB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCI+CiAgIDxnIHRyYW5zZm9ybT0idHJhbnNsYXRlKC00LDEyKSI+CiAgICAgIDxwYXRoIGZpbGw9IiNmZmZmZmYiIGQ9Ik0yMCwxNEg0VjEwSDIwIiAvPgogICA8L2c+Cjwvc3ZnPg=="},function(e,t){e.exports="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPCFET0NUWVBFIHN2ZyBQVUJMSUMgIi0vL1czQy8vRFREIFNWRyAxLjEvL0VOIiAiaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkIj4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB2ZXJzaW9uPSIxLjEiICB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCI+CiAgIDxwYXRoIGZpbGw9IiNmZmZmZmYiIGQ9Ik0xOSw2LjQxTDE3LjU5LDVMMTIsMTAuNTlMNi40MSw1TDUsNi40MUwxMC41OSwxMkw1LDE3LjU5TDYuNDEsMTlMMTIsMTMuNDFMMTcuNTksMTlMMTksMTcuNTlMMTMuNDEsMTJMMTksNi40MVoiIC8+Cjwvc3ZnPg=="},function(e,t,n){var o=n(27);"string"==typeof o&&(o=[[e.i,o,""]]);var i={insert:"head",singleton:!1};n(4)(o,i);o.locals&&(e.exports=o.locals)},function(e,t,n){var o=n(28);"string"==typeof o&&(o=[[e.i,o,""]]);var i={insert:"head",singleton:!1};n(4)(o,i);o.locals&&(e.exports=o.locals)},function(e,t,n){var o=n(29);"string"==typeof o&&(o=[[e.i,o,""]]);var i={insert:"head",singleton:!1};n(4)(o,i);o.locals&&(e.exports=o.locals)},function(e,t,n){(t=e.exports=n(3)(!1)).push([e.i,".file-grid--1BGOO{flex:1;padding:24px 24px 24px 24px;display:grid;grid-template-rows:repeat(auto-fill, 72px);grid-template-columns:repeat(auto-fill, 72px);grid-gap:24px}.file-grid--row--Da16I{grid-auto-flow:row}.file-grid--column--2Otzt{grid-auto-flow:column}\n",""]),t.locals={"file-grid":"file-grid--1BGOO","file-grid--row":"file-grid--row--Da16I","file-grid--column":"file-grid--column--2Otzt"}},function(e,t,n){(t=e.exports=n(3)(!1)).push([e.i,".file-grid-item--_0fiq{padding:0;margin:0;border:0;background:0;-webkit-user-select:none;user-select:none}.file-grid-item--_0fiq:focus{outline:none}.file-grid-item_inner--1MCIk{display:grid;width:72px;grid-template-rows:48px auto;grid-gap:6px;justify-items:center;align-items:center;text-align:center}.file-grid-item_icon--1GOHW{width:48px;height:48px}.file-grid-item--_0fiq:focus .file-grid-item_icon--1GOHW{filter:sepia(1) saturate(2) hue-rotate(185deg) brightness(0.7)}.file-grid-item_label--3FSa2{display:block;padding:3px 3px 3px 3px;font-size:12px;max-width:72px;text-overflow:ellipsis;overflow:hidden}.file-grid-item--_0fiq:focus .file-grid-item_label--3FSa2{background:#228be6;color:#fff;text-shadow:0 1px rgba(33,37,41,0.5),0 0 3px rgba(33,37,41,0.5)}.file-grid-item--light--e24lp .file-grid-item_label--3FSa2{color:#fff;text-shadow:0 1px rgba(33,37,41,0.5),0 0 3px rgba(33,37,41,0.5)}.file-grid-item--dark--3xDRl .file-grid-item_label--3FSa2{color:#212529}\n",""]),t.locals={"file-grid-item":"file-grid-item--_0fiq","file-grid-item_inner":"file-grid-item_inner--1MCIk","file-grid-item_icon":"file-grid-item_icon--1GOHW","file-grid-item_label":"file-grid-item_label--3FSa2","file-grid-item--light":"file-grid-item--light--e24lp","file-grid-item--dark":"file-grid-item--dark--3xDRl"}},function(e,t,n){(t=e.exports=n(3)(!1)).push([e.i,".desktop--2U5pg{display:flex;position:relative;flex:1;background:#339af0}.desktop--2U5pg>*{position:relative}.desktop_items--3tDWi{flex:1;padding:24px 24px 24px 24px;display:grid;grid-auto-flow:column;grid-template-rows:repeat(auto-fill, 72px);grid-template-columns:repeat(auto-fill, 72px);grid-gap:24px}.desktop_background--11u5_{position:absolute;top:0;bottom:0;left:0;right:0;background-position:top center;background-size:cover;transition:background 3s}\n",""]),t.locals={desktop:"desktop--2U5pg",desktop_items:"desktop_items--3tDWi",desktop_background:"desktop_background--11u5_"}},function(e,t,n){(t=e.exports=n(3)(!1)).push([e.i,".taskbar--Ap6Iu{display:grid;grid-auto-flow:column;grid-auto-columns:min-content;grid-gap:3px;position:relative;padding:3px 3px 3px 3px;height:48px;border:2px outset #339af0;background:linear-gradient(to bottom, #74c0fc 0%, #228be6 10%, #339af0 30%, #339af0 80%, #1c7ed6 100%);z-index:100}\n",""]),t.locals={taskbar:"taskbar--Ap6Iu"}},function(e,t,n){(t=e.exports=n(3)(!1)).push([e.i,".taskbar-button--MzJmj{position:relative;margin:0;padding:6px 12px;border:2px outset #4dabf7;border-radius:6px;background:linear-gradient(to bottom, #74c0fc 0%, #339af0 10%, #4dabf7 30%, #4dabf7 80%, #228be6 100%);cursor:pointer;font-family:inherit;font-size:inherit;color:#fff;text-shadow:0 1px rgba(33,37,41,0.5);white-space:nowrap}.taskbar-button--MzJmj svg{margin:-6px}.taskbar-button--borderless--f8oH7{border:2px solid transparent;background:none}.taskbar-button--MzJmj:focus{outline:0;box-shadow:0 0 0 2px #ffa94d}.taskbar-button--MzJmj:hover{filter:brightness(1.1)}.taskbar-button--active--2SrnT{border:2px outset #228be6;background:linear-gradient(to bottom, #228be6 0%, #1c7ed6 10%, #1c7ed6 30%, #1c7ed6 80%, #1971c2 100%)}.taskbar-button--MzJmj:active:not([disabled]){border:2px inset #4dabf7 !important;background:linear-gradient(to top, #74c0fc 0%, #339af0 10%, #4dabf7 30%, #4dabf7 80%, #228be6 100%) !important}.taskbar-button--MzJmj[disabled]{opacity:0.25;cursor:default}\n",""]),t.locals={"taskbar-button":"taskbar-button--MzJmj","taskbar-button--borderless":"taskbar-button--borderless--f8oH7","taskbar-button--active":"taskbar-button--active--2SrnT"}},function(e,t,n){(t=e.exports=n(3)(!1)).push([e.i,".window-manager--KrBjA{display:grid;grid-template-rows:1fr min-content;height:100vh;overflow:hidden}.window-manager_layer-group--Yt68A{position:relative}.window-manager_layer--YHnOX{display:flex;pointer-events:none;overflow:hidden;position:absolute;top:0;bottom:0;left:0;right:0}.window-manager_layer--YHnOX>*{pointer-events:initial}\n",""]),t.locals={"window-manager":"window-manager--KrBjA","window-manager_layer-group":"window-manager_layer-group--Yt68A","window-manager_layer":"window-manager_layer--YHnOX"}},function(e,t,n){(t=e.exports=n(3)(!1)).push([e.i,".bsod--1H_0P{display:flex;flex-direction:column;align-items:center;justify-content:center;font-family:monospace;text-align:center;height:100vh;padding:24px 24px 24px 24px;background-color:#1e00ff;color:#fff}.bsod--1H_0P pre{white-space:pre-wrap;text-align:left}.bsod_column--4A5cn{max-width:960px;max-height:100%;overflow:hidden}\n",""]),t.locals={bsod:"bsod--1H_0P",bsod_column:"bsod_column--4A5cn"}},function(e,t,n){(t=e.exports=n(3)(!1)).push([e.i,".window--13ujq{display:flex;flex:1;flex-direction:column;max-width:100%;-webkit-user-select:none;user-select:none;border:2px outset #74c0fc;border-top-right-radius:6px;border-top-left-radius:6px;background-color:#f5eee5}.window--focused--2-nSM{border:2px outset #339af0}.window_header--1A5sM{display:flex;background:linear-gradient(to bottom, #74c0fc 0%, #228be6 10%, #339af0 30%, #339af0 80%, #1c7ed6 100%);border-top-right-radius:4px;border-top-left-radius:4px;filter:saturate(0.65) brightness(1.25)}.window--focused--2-nSM .window_header--1A5sM{filter:none}.window_title--DWigu{flex:1;color:#fff;padding:12px 18px;text-shadow:0 1px rgba(33,37,41,0.5)}.window_buttons--2k5ol{display:grid;grid-auto-flow:column;grid-gap:3px;padding:3px 3px 3px 3px}.window_body--2TbKa{display:flex;flex:1;overflow:hidden;-webkit-user-select:none;user-select:none}.window--focused--2-nSM .window_body--2TbKa{-webkit-user-select:text;user-select:text}.window-button--2A-WI{display:flex;align-items:center;justify-content:center;width:36px;height:36px;margin:0;padding:0;border-radius:3px;border:1px solid #fff;background:linear-gradient(to bottom, rgba(255,255,255,0) 0%, rgba(255,255,255,0.4) 5%, rgba(255,255,255,0) 15%, rgba(255,255,255,0) 85%, rgba(33,37,41,0.1) 100%),#339af0;cursor:pointer}.window-button--2A-WI:focus{outline:none;box-shadow:0 0 0 2px #ffa94d}.window-button--close--X4miR{background:linear-gradient(to bottom, rgba(255,255,255,0) 0%, rgba(255,255,255,0.4) 5%, rgba(255,255,255,0) 15%, rgba(255,255,255,0) 85%, rgba(33,37,41,0.1) 100%),#ff6b6b}\n",""]),t.locals={window:"window--13ujq","window--focused":"window--focused--2-nSM",window_header:"window_header--1A5sM",window_title:"window_title--DWigu",window_buttons:"window_buttons--2k5ol",window_body:"window_body--2TbKa","window-button":"window-button--2A-WI","window-button--close":"window-button--close--X4miR"}},function(e,t,n){(t=e.exports=n(3)(!1)).push([e.i,".outline--7Bks2{opacity:0;position:absolute;border:2px solid #212529;pointer-events:none;z-index:100}.outline--animate--PlkLC{opacity:1;transition:top 250ms steps(6),left 250ms steps(6),bottom 250ms steps(6),right 250ms steps(6)}\n",""]),t.locals={outline:"outline--7Bks2","outline--animate":"outline--animate--PlkLC"}},function(e,t,n){(t=e.exports=n(3)(!1)).push([e.i,".window-frame--1e6t8{display:flex;flex:1;position:absolute;background:#339af0;outline:none}@media (min-width: 576px){.window-frame--1e6t8{background:none}}@media screen and (max-width: 575px){.window-frame--1e6t8{top:0 !important;left:0 !important;bottom:0 !important;right:0 !important;width:unset !important;height:unset !important}}.window-frame_shadow--3vWl4{position:absolute;pointer-events:none;top:0;bottom:0;left:0;right:0;box-shadow:0 8px 24px rgba(33,37,41,0.5);border-radius:6px}.appear--enter--OGbDx{opacity:0}.appear--enter-active--Z7uiF{transition:opacity;transition-delay:250ms;opacity:1}.appear--enter-done--2Vnuw{opacity:1}\n",""]),t.locals={"window-frame":"window-frame--1e6t8","window-frame_shadow":"window-frame_shadow--3vWl4","appear--enter":"appear--enter--OGbDx","appear--enter-active":"appear--enter-active--Z7uiF","appear--enter-done":"appear--enter-done--2Vnuw"}},function(e,t,n){(t=e.exports=n(3)(!1)).push([e.i,".file-grid-item--AGvUH{position:relative}.file-grid-item_origin--2YABG{position:absolute;pointer-events:none;top:50%;left:50%;bottom:50%;right:50%}\n",""]),t.locals={"file-grid-item":"file-grid-item--AGvUH","file-grid-item_origin":"file-grid-item_origin--2YABG"}},function(e,t,n){"use strict";n.r(t);var o=n(0),i=n.n(o),r=n(1),a=n.n(r),s=n(5),c=n.n(s),l=n(2),d=n.n(l);const u=d.a.bind(c.a),p=Object(o.createContext)(),f=({children:e,layout:t,color:n})=>i.a.createElement(p.Provider,{value:n},i.a.createElement("div",{className:u("file-grid",{"file-grid--row":"row"===t,"file-grid--column":"column"===t})},e));f.propTypes={children:a.a.node,layout:a.a.oneOf(["row","column"]),color:a.a.oneOf(["light","dark"])},f.defaultProps={layout:"row",color:"dark"};var m=n(6),b=n.n(m);const g=d.a.bind(b.a),w=({onDoubleClick:e,icon:t,label:n})=>{const r=(()=>Object(o.useContext)(p))();return i.a.createElement("button",{className:g("file-grid-item",{"file-grid-item--light":"light"===r,"file-grid-item--dark":"dark"===r}),onDoubleClick:e},i.a.createElement("div",{className:g("file-grid-item_inner")},i.a.createElement("img",{className:g("file-grid-item_icon"),src:t,draggable:"false"}),i.a.createElement("span",{className:g("file-grid-item_label")},n)))};w.propTypes={onDoubleClick:a.a.func,icon:a.a.string,label:a.a.node};var v=n(7),h=n.n(v);const y=d.a.bind(h.a),x=({background:e,children:t})=>i.a.createElement("div",{className:y("desktop")},i.a.createElement("div",{className:y("desktop_background"),style:{backgroundImage:"url(".concat(e,")")}}),t);var k=n(8),M=n.n(k);const E=d.a.bind(M.a),j=({children:e})=>i.a.createElement("div",{className:E("taskbar")},e);var _=n(9),O=n.n(_);const C=d.a.bind(O.a),I=({name:e,active:t,borderless:n,children:o,disabled:r,onClick:a,onMouseDown:s,onMouseUp:c,onMouseLeave:l,onKeyDown:d,onKeyUp:u,onFocus:p,onBlur:f})=>i.a.createElement("button",{name:e,className:C("taskbar-button",{"taskbar-button--active":t,"taskbar-button--borderless":n}),disabled:r,onClick:a,onMouseDown:s,onMouseUp:c,onMouseLeave:l,onKeyDown:d,onKeyUp:u,onFocus:p,onBlur:f},o);I.propTypes={name:a.a.string,active:a.a.bool,borderless:a.a.bool,children:a.a.node.isRequired,disabled:a.a.bool,onClick:a.a.func,onMouseDown:a.a.func,onMouseUp:a.a.func,onMouseLeave:a.a.func,onKeyDown:a.a.func,onKeyUp:a.a.func,onFocus:a.a.func,onBlur:a.a.func};var D=n(10),N=n.n(D);const S=d.a.bind(N.a),R=(Object(o.createContext)(),({background:e,windowItems:t,desktopItems:n,taskbarItems:o,taskbarExtras:r})=>i.a.createElement("div",{className:S("window-manager")},i.a.createElement("div",{className:S("window-manager_layer-group")},i.a.createElement("div",{className:S("window-manager_layer")},i.a.createElement(x,{background:e},i.a.createElement(f,{layout:"column",color:"light"},n))),i.a.createElement("div",{className:S("window-manager_layer")},t)),i.a.createElement(j,null,o,r)));class T{constructor(){this._promise=new Promise(e=>{this._resolve=e})}static create(){return new T}resolve(...e){this._resolve(...e)}then(...e){return this._promise.then(...e)}catch(...e){return this._promise.catch(...e)}}var L=T.create;var W=()=>new Promise(e=>window.requestAnimationFrame(e));class z{constructor(){this.map=new Map}ensureKey(e){return this.map.has(e)||this.map.set(e,L()),this.map.get(e)}async get(e){return Promise.race([this.ensureKey(e),W().then(()=>!1)])}async set(e,t){this.ensureKey(e).resolve(t),await W(),this.map.delete(e)}}class A{constructor(){this.inMap=new z,this.outMap=new z}static create(){return new A}async in(e,t){return this.inMap.set(e,t),this.outMap.get(e)}async out(e,t){return this.outMap.set(e,t),this.inMap.get(e)}}const F=A.create,B=i.a.createContext(),P=({children:e})=>{const[t]=Object(o.useState)(F);return i.a.createElement(B.Provider,{value:t},e)},H=(e,t,n,i)=>{Object(o.useLayoutEffect)(()=>t?(()=>n(e.current))():(()=>i(e.current))(),[t])};var Z=n(11),G=n.n(Z);var U=e=>(...t)=>{const n=e(...t);let o=!1;return(async()=>{for await(const e of n)if(o)break})(),()=>{o=!0}};const K=e=>{const[t,n]=Object(o.useState)([]);return[t,U((e=>(async function*(t){e.setup(),yield await W(),e.run(),yield await new Promise(e=>t.addEventListener("transitionend",e,{once:!0})),e.teardown()}))({setup:()=>n([e]),run:()=>n([e,"".concat(e,"-active")]),teardown:()=>n([e,"".concat(e,"-done")])}))]},q=(e,t,n)=>{const[o,i]=K("enter"),[r,a]=K("exit");return H(e,t,i,a),((e,t)=>G()(e.map(e=>t[e])))([...o,...r],n)};var J=n(12),V=n.n(J);const Y=d.a.bind(V.a),X=({error:e})=>i.a.createElement("div",{className:Y("bsod")},i.a.createElement("div",{className:Y("bsod_column")},i.a.createElement("h2",null,"Error"),i.a.createElement("pre",null,"An exception has occurred and the application cannot continue"),i.a.createElement("pre",null,e&&e.stack)));class Q extends o.Component{constructor(e){super(e),this.state={error:null}}static getDerivedStateFromError(e){return{error:e}}render(){const{children:e}=this.props,{error:t}=this.state;return t?i.a.createElement(X,{error:t}):e}}const $={left:0,top:0},ee=()=>{};var te=n(13),ne=n.n(te),oe=n(14),ie=n.n(oe),re=n(15),ae=n.n(re);const se=d.a.bind(ne.a),ce=({title:e,children:t,className:n,isFocused:r,onMinimize:a,onClose:s,onDragStart:c,onDrag:l,onDragEnd:d})=>{const u=(({onDragStart:e=ee,onDrag:t=ee,onDragEnd:n=ee})=>{const[i,r]=Object(o.useState)($),[a,s]=Object(o.useState)(!1),c=Object(o.useCallback)(({clientX:t,clientY:n,button:o})=>{2!==o&&(s(!0),r({left:t,top:n}),e())},[]),l=Object(o.useCallback)(({clientX:e,clientY:n})=>{const o={left:e-i.left,top:n-i.top};t(o)},[i,t]),d=Object(o.useCallback)(()=>{s(!1),n()},[n]);return Object(o.useEffect)(()=>{if(a)return window.addEventListener("mousemove",l),window.addEventListener("mouseup",d),()=>{window.removeEventListener("mousemove",l),window.removeEventListener("mouseup",d)}},[a,l,d]),c})({onDragStart:c,onDrag:l,onDragEnd:d});return i.a.createElement("div",{className:se(n,"window",{"window--focused":r})},i.a.createElement("div",{className:se("window_header"),onMouseDown:u},i.a.createElement("span",{className:se("window_title")},e),i.a.createElement("div",{className:se("window_buttons")},i.a.createElement("button",{onClick:a,className:se("window-button","window-button--minimize"),name:"minimize window"},i.a.createElement("img",{src:ie.a,alt:""})),i.a.createElement("button",{onClick:s,className:se("window-button","window-button--close"),name:"close window"},i.a.createElement("img",{src:ae.a,alt:""})))),i.a.createElement("div",{className:se("window_body")},t))};var le=n(16),de=n.n(le);const ue=d.a.bind(de.a),pe=Object(o.forwardRef)(({animate:e,rect:t},n)=>{const o={top:t.top,left:t.left,bottom:t.bottom,right:t.right},r=ue("outline",{"outline--animate":e});return i.a.createElement("div",{ref:n,className:r,style:o})});pe.propTypes={animate:a.a.bool,rect:a.a.shape({top:a.a.number.isRequired,left:a.a.number.isRequired,bottom:a.a.number.isRequired,right:a.a.number.isRequired}).isRequired};const fe={left:0,top:0,right:0,bottom:0},me=(e,t)=>({top:e.top-t.top,left:e.left-t.left,bottom:-(e.bottom-t.bottom),right:-(e.right-t.right)}),be=async function*(){},ge=(e,t)=>{const[n,i]=Object(o.useState)(fe),[r,a]=Object(o.useState)(!1);return((e,t,n,i,r)=>{const a=Object(o.useContext)(B);H(t,n,U((async function*(){const n=await a.in(e,t.current);yield,n&&(yield*i(n,t.current))})),U((async function*(){const n=await a.out(e,t.current);yield,n&&(yield*r(t.current,n))}))),Object(o.useEffect)(()=>()=>{a.out(e,(e=>{const t=e.getBoundingClientRect();return{getBoundingClientRect:()=>t}})(t.current))},[])})(e,t,!0,(e=>(async function*(t,n){e.setup(t,n),await W(),yield,e.run(t,n),await new Promise(e=>n.addEventListener("transitionend",e)),yield,e.teardown(t,n)}))({setup:(e,t)=>{i(((e,t)=>{const n=e.getBoundingClientRect(),o=t.getBoundingClientRect();return me(n,o)})(e,t)),a(!1)},run:()=>{i(fe),a(!0)},teardown:()=>{a(!1)}}),be),{rect:n,isAnimating:r}},we=({id:e})=>{const t=Object(o.useRef)(),{isAnimating:n,rect:r}=ge(e,t);return i.a.createElement(pe,{ref:t,rect:r,animate:n})};var ve=n(17),he=n.n(ve);const ye=d.a.bind(he.a),xe={enter:ye("appear--enter"),"enter-active":ye("appear--enter-active"),"enter-done":ye("appear--enter-done")},ke=Object(o.createContext)(),Me=()=>Object(o.useContext)(ke),Ee=({id:e,title:t,children:n,order:r,position:a,dimensions:s,isFocused:c,onMinimize:l,onClose:d,onFocus:u,onBlur:p,onMove:f})=>{const m=Object(o.useRef)(),b=q(m,!0,xe),g=Object(o.useRef)();((e,{isFocused:t,onFocus:n,onBlur:i})=>{const r=Object(o.useRef)();r.current=t,Object(o.useEffect)(()=>{t&&!e.current.contains(document.activeElement)&&e.current.focus({preventScroll:!0})},[t]),Object(o.useEffect)(()=>{const t=()=>{window.setTimeout(()=>{const t=e.current.contains(document.activeElement)||e.current===document.activeElement,o=r.current;o&&!t&&i(),!o&&t&&n()},0)};return document.addEventListener("focusout",t),document.addEventListener("focusin",t),()=>{document.removeEventListener("focusout",t),document.removeEventListener("focusin",t)}},[])})(g,{isFocused:c,onFocus:u,onBlur:p});const{onDragStart:w,onDrag:v,onDragEnd:h}=((e,t)=>{const n=Object(o.useRef)(),i=Object(o.useRef)();n.current=e;const[r,a]=Object(o.useState)(!1);return{isDragging:r,onDragStart:Object(o.useCallback)(()=>{i.current=n.current,a(!0)},[]),onDrag:Object(o.useCallback)(e=>{const n={top:i.current.top+e.top,left:i.current.left+e.left};t(n)},[t]),onDragEnd:Object(o.useCallback)(()=>{a(!1)},[])}})(a,f),y={zIndex:r,...a,...s};return i.a.createElement(ke.Provider,{value:g},i.a.createElement("div",{className:ye("window-frame"),style:y,ref:g,tabIndex:"0"},i.a.createElement(ce,{className:b,title:t,isFocused:c,onMinimize:l,onClose:d,onDragStart:w,onDrag:v,onDragEnd:h},n),i.a.createElement(we,{id:e}),i.a.createElement("div",{ref:m,className:ye("window-frame_shadow",b)})))},je=({id:e,active:t,hasOutline:n,onClick:o,children:r})=>i.a.createElement(I,{active:t,onClick:o},r,n&&i.a.createElement(we,{id:e})),_e=Object(o.createContext)(),Oe=({background:e,windows:t,desktopItems:n,taskbarExtras:o})=>{const r=t.map(({id:e,title:t,content:n,state:o,actions:r})=>"open"===o.visibility&&i.a.createElement(Ee,{key:e,id:e,title:t,order:o.order,position:o.position,dimensions:o.dimensions,isFocused:o.isFocused,onMinimize:r.minimize,onClose:r.close,onFocus:r.focus,onBlur:r.blur,onMove:r.move},n)),a=t.map(({id:e,title:n,state:o,actions:r})=>"closed"!==o.visibility&&i.a.createElement(je,{key:e,id:e,active:"open"===o.visibility&&o.isFocused,hasOutline:"minimized"===o.visibility,onClick:"open"===o.visibility&&o.order===t.length?r.minimize:r.open},n));return i.a.createElement(Q,null,i.a.createElement(P,null,i.a.createElement(_e.Provider,{value:t},i.a.createElement(R,{background:e,desktopItems:n,windowItems:r,taskbarItems:a,taskbarExtras:o}))))};var Ce=n(18),Ie=n.n(Ce);const De=d.a.bind(Ie.a),Ne={state:{}},Se=({icon:e,label:t,id:n,onDoubleClick:r})=>{const a="closed"===((()=>Object(o.useContext)(_e))().find(e=>e.id===n)||Ne).state.visibility;return i.a.createElement("div",{className:De("file-grid-item")},i.a.createElement(w,{icon:e,label:t,onDoubleClick:r}),i.a.createElement("div",{className:De("file-grid-item_origin")},a&&i.a.createElement(we,{id:n})))},Re={get:e=>e,set:(e,t)=>t,name:"id"},Te=(e,t)=>({get:n=>t.get(e.get(n)),set:(n,o)=>{const i=e.get(n);return e.set(n,t.set(i,o))},name:"".concat(e.name," ").concat(t.name)}),Le=(...e)=>{return((e,t)=>({get:n=>{try{return e.get(n)}catch(e){return t}},set:e.set,name:"safe(".concat(e.name,")")}))(e.map(e=>"number"==typeof e?(e=>({get:t=>t[e],set:(t,n)=>{const o=[...t];return o[e]=n,o},name:"[".concat(e,"]")}))(e):(e=>({get:t=>t[e],set:(t,n)=>({...t,[e]:n}),name:".".concat(e)}))(e)).reduce(Te,Re),void 0)},We=(e,t)=>n=>e.set(n,t(e.get(n)));var ze=(e,t)=>n=>n===e?t:n<e&&n<t?n:n>e&&n>t?n:t>e?n-1:t<e?n+1:n;const Ae=(e,t)=>{return Object.keys(e).map((e,n)=>{const o=Le(e);return We(o,o=>t(e,o,n))}).reduce((e,t)=>t(e),e)},Fe=e=>{const t=Object.entries(e),[n]=t.filter(([,e])=>"open"===e.visibility).sort(([,e],[,t])=>e.order-t.order).pop()||[];return n},Be=(e,t,n)=>({position:{top:50+50*n,left:200+100*n},visibility:"closed",...t,order:n+1}),Pe=e=>Ae(e,Be),He=(e,t)=>t.type.startsWith("window.")?Ge(e,t):t.type.startsWith("top.")?Ze(e,t):e,Ze=(e,{type:t,id:n,window:o,newState:i})=>{const r=Le(n);switch(t){case"top.create":{const t=Object.keys(e).length,n=(e=>{const t=Fe(e)||-1,n=Le(t,"position").get(e);return n?{left:n.left+40,top:n.top+20}:{left:200,top:100}})(e),i=Be(0,{position:n,...o},t);return r.set(e,i)}case"top.destroy":{const t={...e};return delete t[n],t}case"top.focusNext":{const t=Fe(e);return t?Le(t,"isFocused").set(e,!0):e}case"top.reset":return Pe(i)}},Ge=(e,{type:t,id:n,position:o})=>{const i=Le(n,"visibility"),r=Le(n,"position"),a=Le(n,"isFocused");switch(t){case"window.open":return i.set(e,"open");case"window.minimize":return i.set(e,"minimized");case"window.close":return i.set(e,"closed");case"window.focus":return a.set(e,!0);case"window.blur":return a.set(e,!1);case"window.move":return We(r,e=>({...e,...o}))(e);case"window.bringToFront":return((e,t)=>n=>{const o=We(Le("order"),ze(e,t));return Ae(n,(e,t)=>o(t))})(e[n].order,Object.keys(e).length)(e)}},Ue=e=>{const[t,n]=Object(o.useReducer)(He,e,Pe),i=e=>({open:()=>{n({type:"window.open",id:e}),n({type:"window.bringToFront",id:e}),n({type:"window.focus",id:e})},focus:()=>{n({type:"window.bringToFront",id:e}),n({type:"window.focus",id:e})},close:()=>{n({type:"window.close",id:e}),n({type:"window.blur",id:e}),n({type:"top.focusNext"})},minimize:()=>{n({type:"window.minimize",id:e}),n({type:"top.focusNext"})},blur:()=>n({type:"window.blur",id:e}),move:t=>n({type:"window.move",id:e,position:t})}),r=(e,o)=>{void 0===t[e]&&n({type:"top.create",id:e,window:o})},a=Object.keys(t).length,s={createWindow:r,destroyWindow:e=>{void 0!==t[e]&&(n({type:"top.destroy",id:e}),n({type:"top.focusNext"}))},openWindow:async(e,n)=>{void 0===t[e]?(r(e,n),setTimeout(()=>{i(e).open()},0)):i(e).open()},closeWindow:e=>{void 0!==t[e]&&i(e).close()},reset:e=>{n({type:"top.reset",newState:e})},window:Object(o.useMemo)(()=>Ae(t,i),[a])};return[t,s]};n.d(t,"WindowManager",(function(){return Oe})),n.d(t,"WMWindow",(function(){return Ee})),n.d(t,"WMTaskbarButton",(function(){return je})),n.d(t,"WMFileGridItem",(function(){return Se})),n.d(t,"useWindowState",(function(){return Ue})),n.d(t,"useWMWindowState",(function(){return Ue})),n.d(t,"useWMWindowElement",(function(){return Me})),n.d(t,"WMFileGrid",(function(){return f})),n.d(t,"BSOD",(function(){return X})),n.d(t,"BSODErrorBoundary",(function(){return Q}))}])})); | ||
//# sourceMappingURL=main.js.map |
@@ -7,3 +7,3 @@ { | ||
}, | ||
"version": "0.10.0", | ||
"version": "0.10.1", | ||
"description": "Throwback Windows-XP style react components", | ||
@@ -10,0 +10,0 @@ "main": "dist/main.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
291859
91
1528