diff --git a/dist/public/main.js b/dist/public/main.js index b550b83..91939ab 100644 --- a/dist/public/main.js +++ b/dist/public/main.js @@ -104,4 +104,4 @@ function a(){return a=Object.assign?Object.assign.bind():function(e){for(var t=1 * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. - */var r=n(7294),o=n(1688);var a="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},i=o.useSyncExternalStore,u=r.useRef,l=r.useEffect,c=r.useMemo,s=r.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,n,r,o){var f=u(null);if(null===f.current){var d={hasValue:!1,value:null};f.current=d}else d=f.current;f=c((function(){function e(e){if(!l){if(l=!0,i=e,e=r(e),void 0!==o&&d.hasValue){var t=d.value;if(o(t,e))return u=t}return u=e}if(t=u,a(i,e))return t;var n=r(e);return void 0!==o&&o(t,n)?t:(i=e,u=n)}var i,u,l=!1,c=void 0===n?null:n;return[function(){return e(t())},null===c?void 0:function(){return e(c())}]}),[t,n,r,o]);var p=i(e,f[0],f[1]);return l((function(){d.hasValue=!0,d.value=p}),[p]),s(p),p}},1688:function(e,t,n){"use strict";e.exports=n(3250)},2798:function(e,t,n){"use strict";e.exports=n(139)},2419:function(e,t,n){var r={"./admin.js":6468,"./color.js":3810,"./modal.js":9927,"./user.js":3262};function o(e){var t=a(e);return n(t)}function a(e){if(!n.o(r,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return r[e]}o.keys=function(){return Object.keys(r)},o.resolve=a,e.exports=o,o.id=2419},8287:function(e,t,n){var r={"./admin.js":598,"./color.js":6616,"./modal.js":1141,"./user.js":1137};function o(e){var t=a(e);return n(t)}function a(e){if(!n.o(r,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return r[e]}o.keys=function(){return Object.keys(r)},o.resolve=a,e.exports=o,o.id=8287},7582:function(e,t,n){"use strict";n.d(t,{CR:function(){return c},FC:function(){return d},Jh:function(){return u},KL:function(){return p},XA:function(){return l},ZT:function(){return o},ev:function(){return s},mG:function(){return i},pi:function(){return a},qq:function(){return f}});var r=function(e,t){return r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},r(e,t)};function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var a=function(){return a=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&o[o.length-1])||6!==u[0]&&2!==u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function c(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,a=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=a.next()).done;)i.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(o)throw o.error}}return i}function s(e,t,n){if(n||2===arguments.length)for(var r,o=0,a=t.length;o1||u(e,t)}))})}function u(e,t){try{(n=o[e](t)).value instanceof f?Promise.resolve(n.value.v).then(l,c):s(a[0][2],n)}catch(e){s(a[0][3],e)}var n}function l(e){u("next",e)}function c(e){u("throw",e)}function s(e,t){e(t),a.shift(),a.length&&u(a[0][0],a[0][1])}}function p(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=l(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,o){(function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)})(r,o,(t=e[n](t)).done,t.value)}))}}}Object.create},4147:function(e){"use strict";e.exports=JSON.parse('{"name":"vp","version":"1.29.0","description":"source code of react.colorpk.com","engines":{"node":">= 16.x"},"scripts":{"dev":"webpack --config ./webpack/develop.js","lint":"eslint ./webpack ./src","test":"jest --coverage","t":"yarn lint && yarn test","build":"webpack --config ./webpack/production.js","start":"node dist/server"},"repository":"git+https://github.com/im6/vp.git","author":"im6","license":"ISC","bugs":{"url":"https://github.com/im6/vp/issues"},"homepage":"https://github.com/im6/vp#readme","devDependencies":{"@babel/core":"^7.22.1","@babel/preset-env":"7.22.4","@babel/preset-react":"^7.22.3","@testing-library/react":"^14.0.0","autoprefixer":"^10.4.14","babel-loader":"^9.1.2","bulma":"^0.9.4","clean-webpack-plugin":"^4.0.0","compression-webpack-plugin":"^10.0.0","copy-webpack-plugin":"^11.0.0","css-loader":"^6.8.1","css-minimizer-webpack-plugin":"^5.0.0","dotenv":"^16.1.4","eslint":"^8.42.0","eslint-config-airbnb":"^19.0.4","eslint-config-prettier":"^8.8.0","eslint-plugin-import":"^2.27.5","eslint-plugin-jest":"^27.2.1","eslint-plugin-jsx-a11y":"^6.7.1","eslint-plugin-prettier":"^4.2.1","eslint-plugin-react":"7.32.2","eslint-plugin-react-hooks":"^4.6.0","jest":"^29.5.0","jest-environment-jsdom":"^29.5.0","js-cookie":"^3.0.5","mini-css-extract-plugin":"^2.7.6","node-sass":"^9.0.0","postcss":"^8.4.24","postcss-loader":"^7.3.2","prettier":"^2.8.8","react-color":"^2.19.3","redux-logger":"^3.0.6","redux-observable":"^2.0.0","rxjs":"^7.8.1","sass-loader":"^13.3.1","webpack":"^5.85.1","webpack-cli":"^5.1.3","webpack-node-externals":"^3.0.0"},"dependencies":{"@reduxjs/toolkit":"^1.9.5","axios":"^1.4.0","body-parser":"^1.20.2","connect-redis":"^7.1.0","cookie-parser":"^1.4.6","csurf":"^1.11.0","express":"^4.18.2","express-graphql":"^0.12.0","express-session":"^1.17.3","graphql":"^15.7.2","helmet":"^7.0.0","lodash.get":"^4.4.2","mongodb":"^5.6.0","prop-types":"^15.8.1","react":"^18.2.0","react-dom":"^18.2.0","react-redux":"^8.0.7","react-router-dom":"^6.12.0","redis":"^4.6.7","serialize-javascript":"^6.0.1","uuid":"^9.0.0"},"prettier":{"endOfLine":"auto","trailingComma":"es5","tabWidth":2,"semi":true,"singleQuote":true},"babel":{"presets":["@babel/preset-env",["@babel/preset-react",{"runtime":"automatic"}]]},"eslintConfig":{"extends":["airbnb","prettier","plugin:react-hooks/recommended"],"plugins":["react","jsx-a11y","import","prettier","jest"],"rules":{"prettier/prettier":2,"import/no-extraneous-dependencies":0,"react-hooks/rules-of-hooks":"error","react-hooks/exhaustive-deps":"warn","import/no-unresolved":[2,{"ignore":["^components/"]}],"no-param-reassign":["error",{"props":true,"ignorePropertyModificationsFor":["acc","req","res","draft"]}]},"env":{"browser":true,"jest/globals":true}},"jest":{"verbose":false,"testEnvironment":"jsdom","clearMocks":true,"moduleDirectories":["node_modules","/src/testing"],"moduleNameMapper":{"\\\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$":"/src/testing/fileMock.js","\\\\.(css|sass)$":"/src/testing/styleMock.js","^components/(.*)":"/src/components/$1"},"coverageDirectory":"coverage","coverageThreshold":{"global":{"branches":100,"functions":100,"lines":100,"statements":-10}}},"browserslist":["defaults","cover 99.5%"]}')}},n={};function r(e){var o=n[e];if(void 0!==o)return o.exports;var a=n[e]={id:e,loaded:!1,exports:{}};return t[e](a,a.exports,r),a.loaded=!0,a.exports}r.m=t,r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,{a:t}),t},r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.f={},r.e=function(e){return Promise.all(Object.keys(r.f).reduce((function(t,n){return r.f[n](e,t),t}),[]))},r.u=function(e){return{203:"adminPanel",951:"newColor"}[e]+".js"},r.miniCssF=function(e){return{203:"adminPanel",951:"newColor"}[e]+".css"},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},e={},r.l=function(t,n,o,a){if(e[t])e[t].push(n);else{var i,u;if(void 0!==o)for(var l=document.getElementsByTagName("script"),c=0;c0?e.prototype.schedule.call(this,t,n):(this.delay=n,this.state=t,this.scheduler.flush(this),this)},t.prototype.execute=function(t,n){return n>0||this.closed?e.prototype.execute.call(this,t,n):this._execute(t,n)},t.prototype.requestAsyncId=function(t,n,r){return void 0===r&&(r=0),null!=r&&r>0||null==r&&this.delay>0?e.prototype.requestAsyncId.call(this,t,n,r):(t.flush(this),0)},t}(r(8337).o),c=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,u.ZT)(t,e),t}(r(6580).v),s=new c(l),f=r(1480),d=r(5720),p=(0,r(1819).d)((function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),h=r(3699),v=r(8846),y=function(e){function t(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return(0,u.ZT)(t,e),t.prototype.lift=function(e){var t=new m(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new p},t.prototype.next=function(e){var t=this;(0,v.x)((function(){var n,r;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var o=(0,u.XA)(t.currentObservers),a=o.next();!a.done;a=o.next()){a.value.next(e)}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}}))},t.prototype.error=function(e){var t=this;(0,v.x)((function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var n=t.observers;n.length;)n.shift().error(e)}}))},t.prototype.complete=function(){var e=this;(0,v.x)((function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}}))},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return(null===(e=this.observers)||void 0===e?void 0:e.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var t=this,n=this,r=n.hasError,o=n.isStopped,a=n.observers;return r||o?d.Lc:(this.currentObservers=null,a.push(e),new d.w0((function(){t.currentObservers=null,(0,h.P)(a,e)})))},t.prototype._checkFinalizedStatuses=function(e){var t=this,n=t.hasError,r=t.thrownError,o=t.isStopped;n?e.error(r):o&&e.complete()},t.prototype.asObservable=function(){var e=new f.y;return e.source=this,e},t.create=function(e,t){return new m(e,t)},t}(f.y),m=function(e){function t(t,n){var r=e.call(this)||this;return r.destination=t,r.source=n,r}return(0,u.ZT)(t,e),t.prototype.next=function(e){var t,n;null===(n=null===(t=this.destination)||void 0===t?void 0:t.next)||void 0===n||n.call(t,e)},t.prototype.error=function(e){var t,n;null===(n=null===(t=this.destination)||void 0===t?void 0:t.error)||void 0===n||n.call(t,e)},t.prototype.complete=function(){var e,t;null===(t=null===(e=this.destination)||void 0===e?void 0:e.complete)||void 0===t||t.call(e)},t.prototype._subscribe=function(e){var t,n;return null!==(n=null===(t=this.source)||void 0===t?void 0:t.subscribe(e))&&void 0!==n?n:d.Lc},t}(y),b=r(9635),g=r(9526),w=r(9127),S=r(7877),k=r(8720),x=function(e,t){return x=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},x(e,t)};Object.create;Object.create;var C=function(e){function t(t,n){var r=e.call(this,(function(e){var t=r.__notifier.subscribe(e);return t&&!t.closed&&e.next(r.value),t}))||this;return r.__notifier=new y,r.value=n,t.subscribe((function(e){e!==r.value&&(r.value=e,r.__notifier.next(e))})),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}x(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),t}(f.y);var E=r(3071);function P(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n")+"\" does not return a stream. Double check you're not missing a return statement!");return n})))};try{Object.defineProperty(n,"name",{value:"combineEpics("+e.map((function(e){return e.name||""})).join(", ")+")"})}catch(e){}return n}.apply(void 0,function(e){if(Array.isArray(e))return P(e)}(O=j)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(O)||function(e,t){if(e){if("string"==typeof e)return P(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?P(e,t):void 0}}(O)||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.")}()),T=r(8287),R=T.keys().reduce((function(e,t){return e[t.replace(/\.js$/,"").replace(/^.\//,"")]=T(t).default,e}),{}),L=function(e){void 0===e&&(e={});var t,n=new(0,s.constructor)(s.schedulerActionCtor),r=new y,o=function(o){t=o;var a=new y,i=new y,u=a.asObservable().pipe((0,g.Q)(n)),l=new C(i.pipe((0,g.Q)(n)),t.getState());return r.pipe((0,w.U)((function(t){var n=t(u,l,e.dependencies);if(!n)throw new TypeError('Your root Epic "'+(t.name||"")+"\" does not return a stream. Double check you're not missing a return statement!");return n})),(0,S.z)((function(e){return(0,b.D)(e).pipe((0,k.R)(n),(0,g.Q)(n))}))).subscribe(t.dispatch),function(e){return function(n){var r=e(n);return i.next(t.getState()),a.next(n),r}}};return o.run=function(e){r.next(e)},o}(),I=[L],z=(0,i.xC)({reducer:R,middleware:I,devTools:!1,preloadedState:window[t.kl]});L.run(N);var A=z,D=r(9250),M=r(5697),U=r.n(M),F="j2T5y",$="Clw7p",q=r(2513),B=r(6098),H="Vl75d",W="QbDsU",V=r(5348),Q=r(5893);function K(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,u=[],l=!0,c=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=a.call(n)).done)&&(u.push(r.value),u.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw o}}return u}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Z(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Z(e,t)}(e,t)||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 Z(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&o[o.length-1])||6!==u[0]&&2!==u[0])){i=0;continue}if(3===u[0]&&(!o||u[1]>o[0]&&u[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function c(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,o,a=n.call(e),i=[];try{for(;(void 0===t||t-- >0)&&!(r=a.next()).done;)i.push(r.value)}catch(e){o={error:e}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(o)throw o.error}}return i}function s(e,t,n){if(n||2===arguments.length)for(var r,o=0,a=t.length;o1||u(e,t)}))})}function u(e,t){try{(n=o[e](t)).value instanceof f?Promise.resolve(n.value.v).then(l,c):s(a[0][2],n)}catch(e){s(a[0][3],e)}var n}function l(e){u("next",e)}function c(e){u("throw",e)}function s(e,t){e(t),a.shift(),a.length&&u(a[0][0],a[0][1])}}function p(e){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var t,n=e[Symbol.asyncIterator];return n?n.call(e):(e=l(e),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(n){t[n]=e[n]&&function(t){return new Promise((function(r,o){(function(e,t,n,r){Promise.resolve(r).then((function(t){e({value:t,done:n})}),t)})(r,o,(t=e[n](t)).done,t.value)}))}}}Object.create},4147:function(e){"use strict";e.exports=JSON.parse('{"name":"vp","version":"1.30.0","description":"source code of react.colorpk.com","engines":{"node":">= 16.x"},"scripts":{"dev":"webpack --config ./webpack/develop.js","lint":"eslint ./webpack ./src","test":"jest --coverage","t":"yarn lint && yarn test","build":"webpack --config ./webpack/production.js","start":"node dist/server"},"repository":"git+https://github.com/im6/vp.git","author":"im6","license":"ISC","bugs":{"url":"https://github.com/im6/vp/issues"},"homepage":"https://github.com/im6/vp#readme","devDependencies":{"@babel/core":"^7.22.1","@babel/preset-env":"7.22.4","@babel/preset-react":"^7.22.3","@testing-library/react":"^14.0.0","autoprefixer":"^10.4.14","babel-loader":"^9.1.2","bulma":"^0.9.4","clean-webpack-plugin":"^4.0.0","compression-webpack-plugin":"^10.0.0","copy-webpack-plugin":"^11.0.0","css-loader":"^6.8.1","css-minimizer-webpack-plugin":"^5.0.0","dotenv":"^16.1.4","eslint":"^8.42.0","eslint-config-airbnb":"^19.0.4","eslint-config-prettier":"^8.8.0","eslint-plugin-import":"^2.27.5","eslint-plugin-jest":"^27.2.1","eslint-plugin-jsx-a11y":"^6.7.1","eslint-plugin-prettier":"^4.2.1","eslint-plugin-react":"7.32.2","eslint-plugin-react-hooks":"^4.6.0","jest":"^29.5.0","jest-environment-jsdom":"^29.5.0","js-cookie":"^3.0.5","mini-css-extract-plugin":"^2.7.6","node-sass":"^9.0.0","postcss":"^8.4.24","postcss-loader":"^7.3.2","prettier":"^2.8.8","react-color":"^2.19.3","redux-logger":"^3.0.6","redux-observable":"^2.0.0","rxjs":"^7.8.1","sass-loader":"^13.3.1","webpack":"^5.85.1","webpack-cli":"^5.1.3","webpack-node-externals":"^3.0.0"},"dependencies":{"@reduxjs/toolkit":"^1.9.5","axios":"^1.4.0","body-parser":"^1.20.2","connect-redis":"^7.1.0","cookie-parser":"^1.4.6","csurf":"^1.11.0","express":"^4.18.2","express-graphql":"^0.12.0","express-session":"^1.17.3","graphql":"^15.7.2","helmet":"^7.0.0","lodash.get":"^4.4.2","mongodb":"^5.6.0","prop-types":"^15.8.1","react":"^18.2.0","react-dom":"^18.2.0","react-redux":"^8.0.7","react-router-dom":"^6.12.0","redis":"^4.6.7","serialize-javascript":"^6.0.1","uuid":"^9.0.0"},"prettier":{"endOfLine":"auto","trailingComma":"es5","tabWidth":2,"semi":true,"singleQuote":true},"babel":{"presets":["@babel/preset-env",["@babel/preset-react",{"runtime":"automatic"}]]},"eslintConfig":{"extends":["airbnb","prettier","plugin:react-hooks/recommended"],"plugins":["react","jsx-a11y","import","prettier","jest"],"rules":{"prettier/prettier":2,"import/no-extraneous-dependencies":0,"react-hooks/rules-of-hooks":"error","react-hooks/exhaustive-deps":"warn","import/no-unresolved":[2,{"ignore":["^components/"]}],"no-param-reassign":["error",{"props":true,"ignorePropertyModificationsFor":["acc","req","res","draft"]}]},"env":{"browser":true,"jest/globals":true}},"jest":{"verbose":false,"testEnvironment":"jsdom","clearMocks":true,"moduleDirectories":["node_modules","/src/testing"],"moduleNameMapper":{"\\\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$":"/src/testing/fileMock.js","\\\\.(css|sass)$":"/src/testing/styleMock.js","^components/(.*)":"/src/components/$1"},"coverageDirectory":"coverage","coverageThreshold":{"global":{"branches":100,"functions":100,"lines":100,"statements":-10}}},"browserslist":["defaults","cover 99.5%"]}')}},n={};function r(e){var o=n[e];if(void 0!==o)return o.exports;var a=n[e]={id:e,loaded:!1,exports:{}};return t[e](a,a.exports,r),a.loaded=!0,a.exports}r.m=t,r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,{a:t}),t},r.d=function(e,t){for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.f={},r.e=function(e){return Promise.all(Object.keys(r.f).reduce((function(t,n){return r.f[n](e,t),t}),[]))},r.u=function(e){return{203:"adminPanel",951:"newColor"}[e]+".js"},r.miniCssF=function(e){return{203:"adminPanel",951:"newColor"}[e]+".css"},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},e={},r.l=function(t,n,o,a){if(e[t])e[t].push(n);else{var i,u;if(void 0!==o)for(var l=document.getElementsByTagName("script"),c=0;c0?e.prototype.schedule.call(this,t,n):(this.delay=n,this.state=t,this.scheduler.flush(this),this)},t.prototype.execute=function(t,n){return n>0||this.closed?e.prototype.execute.call(this,t,n):this._execute(t,n)},t.prototype.requestAsyncId=function(t,n,r){return void 0===r&&(r=0),null!=r&&r>0||null==r&&this.delay>0?e.prototype.requestAsyncId.call(this,t,n,r):(t.flush(this),0)},t}(r(8337).o),c=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return(0,u.ZT)(t,e),t}(r(6580).v),s=new c(l),f=r(1480),d=r(5720),p=(0,r(1819).d)((function(e){return function(){e(this),this.name="ObjectUnsubscribedError",this.message="object unsubscribed"}})),h=r(3699),v=r(8846),y=function(e){function t(){var t=e.call(this)||this;return t.closed=!1,t.currentObservers=null,t.observers=[],t.isStopped=!1,t.hasError=!1,t.thrownError=null,t}return(0,u.ZT)(t,e),t.prototype.lift=function(e){var t=new m(this,this);return t.operator=e,t},t.prototype._throwIfClosed=function(){if(this.closed)throw new p},t.prototype.next=function(e){var t=this;(0,v.x)((function(){var n,r;if(t._throwIfClosed(),!t.isStopped){t.currentObservers||(t.currentObservers=Array.from(t.observers));try{for(var o=(0,u.XA)(t.currentObservers),a=o.next();!a.done;a=o.next()){a.value.next(e)}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}}))},t.prototype.error=function(e){var t=this;(0,v.x)((function(){if(t._throwIfClosed(),!t.isStopped){t.hasError=t.isStopped=!0,t.thrownError=e;for(var n=t.observers;n.length;)n.shift().error(e)}}))},t.prototype.complete=function(){var e=this;(0,v.x)((function(){if(e._throwIfClosed(),!e.isStopped){e.isStopped=!0;for(var t=e.observers;t.length;)t.shift().complete()}}))},t.prototype.unsubscribe=function(){this.isStopped=this.closed=!0,this.observers=this.currentObservers=null},Object.defineProperty(t.prototype,"observed",{get:function(){var e;return(null===(e=this.observers)||void 0===e?void 0:e.length)>0},enumerable:!1,configurable:!0}),t.prototype._trySubscribe=function(t){return this._throwIfClosed(),e.prototype._trySubscribe.call(this,t)},t.prototype._subscribe=function(e){return this._throwIfClosed(),this._checkFinalizedStatuses(e),this._innerSubscribe(e)},t.prototype._innerSubscribe=function(e){var t=this,n=this,r=n.hasError,o=n.isStopped,a=n.observers;return r||o?d.Lc:(this.currentObservers=null,a.push(e),new d.w0((function(){t.currentObservers=null,(0,h.P)(a,e)})))},t.prototype._checkFinalizedStatuses=function(e){var t=this,n=t.hasError,r=t.thrownError,o=t.isStopped;n?e.error(r):o&&e.complete()},t.prototype.asObservable=function(){var e=new f.y;return e.source=this,e},t.create=function(e,t){return new m(e,t)},t}(f.y),m=function(e){function t(t,n){var r=e.call(this)||this;return r.destination=t,r.source=n,r}return(0,u.ZT)(t,e),t.prototype.next=function(e){var t,n;null===(n=null===(t=this.destination)||void 0===t?void 0:t.next)||void 0===n||n.call(t,e)},t.prototype.error=function(e){var t,n;null===(n=null===(t=this.destination)||void 0===t?void 0:t.error)||void 0===n||n.call(t,e)},t.prototype.complete=function(){var e,t;null===(t=null===(e=this.destination)||void 0===e?void 0:e.complete)||void 0===t||t.call(e)},t.prototype._subscribe=function(e){var t,n;return null!==(n=null===(t=this.source)||void 0===t?void 0:t.subscribe(e))&&void 0!==n?n:d.Lc},t}(y),b=r(9635),g=r(9526),w=r(9127),S=r(7877),k=r(8720),x=function(e,t){return x=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},x(e,t)};Object.create;Object.create;var C=function(e){function t(t,n){var r=e.call(this,(function(e){var t=r.__notifier.subscribe(e);return t&&!t.closed&&e.next(r.value),t}))||this;return r.__notifier=new y,r.value=n,t.subscribe((function(e){e!==r.value&&(r.value=e,r.__notifier.next(e))})),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}x(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}(t,e),t}(f.y);var E=r(3071);function P(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n")+"\" does not return a stream. Double check you're not missing a return statement!");return n})))};try{Object.defineProperty(n,"name",{value:"combineEpics("+e.map((function(e){return e.name||""})).join(", ")+")"})}catch(e){}return n}.apply(void 0,function(e){if(Array.isArray(e))return P(e)}(O=j)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(O)||function(e,t){if(e){if("string"==typeof e)return P(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?P(e,t):void 0}}(O)||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.")}()),T=r(8287),R=T.keys().reduce((function(e,t){return e[t.replace(/\.js$/,"").replace(/^.\//,"")]=T(t).default,e}),{}),L=function(e){void 0===e&&(e={});var t,n=new(0,s.constructor)(s.schedulerActionCtor),r=new y,o=function(o){t=o;var a=new y,i=new y,u=a.asObservable().pipe((0,g.Q)(n)),l=new C(i.pipe((0,g.Q)(n)),t.getState());return r.pipe((0,w.U)((function(t){var n=t(u,l,e.dependencies);if(!n)throw new TypeError('Your root Epic "'+(t.name||"")+"\" does not return a stream. Double check you're not missing a return statement!");return n})),(0,S.z)((function(e){return(0,b.D)(e).pipe((0,k.R)(n),(0,g.Q)(n))}))).subscribe(t.dispatch),function(e){return function(n){var r=e(n);return i.next(t.getState()),a.next(n),r}}};return o.run=function(e){r.next(e)},o}(),I=[L],z=(0,i.xC)({reducer:R,middleware:I,devTools:!1,preloadedState:window[t.kl]});L.run(N);var A=z,D=r(9250),M=r(5697),U=r.n(M),F="j2T5y",$="Clw7p",q=r(2513),B=r(6098),H="Vl75d",W="QbDsU",V=r(5348),Q=r(5893);function K(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,a,i,u=[],l=!0,c=!1;try{if(a=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=a.call(n)).done)&&(u.push(r.value),u.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw o}}return u}}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return Z(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Z(e,t)}(e,t)||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 Z(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n{var t={991:(t,e,r)=>{"use strict";r.d(e,{$q:()=>i,CT:()=>l,Qi:()=>c,Xx:()=>s,ZA:()=>a,jl:()=>u,kl:()=>f,yY:()=>o});var n=r(147).version,o="temp",i="en",a=!0,c="//dkny.oss-cn-hangzhou.aliyuncs.com/2",s="https://cdn.jsdelivr.net/gh/im6/vp@v".concat(n,"/dist/public"),u="canvas",l="lang",f="_REDUXSTATE_"},598:(t,e,r)=>{"use strict";r.r(e),r.d(e,{default:()=>o});var n=r(184);const o=(0,n.createReducer)({list:null,loading:!1},(function(t){t.addCase((0,n.createAction)("admin/getList"),(function(t){t.loading=!0})).addCase((0,n.createAction)("admin/getList/success"),(function(t,e){t.loading=!1,t.list=e.payload})).addCase((0,n.createAction)("admin/getList/fail"),(function(t){t.loading=!1,t.list=[]})).addCase((0,n.createAction)("admin/decideColor"),(function(t,e){t.list=t.list.filter((function(t){return t.id!==e.payload.id}))}))}))},616:(t,e,r)=>{"use strict";r.r(e),r.d(e,{default:()=>o});var n=r(184);const o=(0,n.createReducer)({loading:!1,colorDef:{},liked:{},colorIdAllByDate:[],colorIdAllByStar:[],colorIdByMyOwn:[]},(function(t){t.addCase((0,n.createAction)("color/get"),(function(t){t.loading=!0})).addCase((0,n.createAction)("color/get/success"),(function(t,e){var r=e.payload,n=[],o={};r.forEach((function(t){n.push(t.id),o[t.id]=t}));var i=r.sort((function(t,e){return e.star-t.star})).map((function(t){return t.id}));t.loading=!1,t.colorDef=o,t.colorIdAllByDate=n,t.colorIdAllByStar=i})).addCase((0,n.createAction)("color/get/fail"),(function(t){t.loading=!1,t.colorIdAllByDate=[],t.colorIdAllByStar=[]})).addCase((0,n.createAction)("color/toggleLike"),(function(t,e){var r=e.payload,n=r.willLike,o=r.id;n?t.liked[o]=!0:delete t.liked[o],t.colorDef[o].star+=n?1:-1})).addCase((0,n.createAction)("color/addNew/success"),(function(t,e){var r=e.payload,n=r.id;t.colorDef[n]=r,t.colorIdAllByDate.unshift(n),t.colorIdAllByStar.push(n)})).addCase((0,n.createAction)("color/set/likes"),(function(t,e){var r=e.payload.reduce((function(t,e){return t[e]=!0,t}),{});t.liked=r})).addCase((0,n.createAction)("color/set/owns"),(function(t,e){t.colorIdByMyOwn=e.payload}))}))},141:(t,e,r)=>{"use strict";r.r(e),r.d(e,{default:()=>i});var n=r(184),o={type:null,message:null,visible:!1};const i=(0,n.createReducer)(o,(function(t){t.addCase((0,n.createAction)("modal/reset"),(function(){return o})).addCase((0,n.createAction)("modal/set"),(function(t,e){return{type:e.payload[0],message:e.payload[1],visible:!1}})).addCase((0,n.createAction)("modal/show"),(function(t){t.visible=!0})).addCase((0,n.createAction)("modal/hide"),(function(t){t.visible=!1}))}))},137:(t,e,r)=>{"use strict";r.r(e),r.d(e,{default:()=>o});var n=r(184);const o=(0,n.createReducer)({detail:null,weiboUrl:null,githubUrl:null,facebookUrl:null,loading:!1},(function(t){t.addCase((0,n.createAction)("user/auth"),(function(t){t.loading=!0})).addCase((0,n.createAction)("user/auth/success"),(function(t,e){t.loading=!1,t.detail=e.payload})).addCase((0,n.createAction)("user/auth/fail"),(function(t){t.loading=!1,t.detail=null})).addCase((0,n.createAction)("user/logoff"),(function(t){t.detail=null})).addCase((0,n.createAction)("user/logoff/success"),(function(t,e){var r=e.payload,n=r.weiboUrl,o=r.githubUrl,i=r.facebookUrl;t.detail=null,t.weiboUrl=n,t.githubUrl=o,t.facebookUrl=i}))}))},470:(t,e,r)=>{"use strict";r.d(e,{Bu:()=>g,Fj:()=>h,Fq:()=>p,G:()=>s,G4:()=>f,GT:()=>v,Mh:()=>c,Ov:()=>b,QA:()=>y,TM:()=>j,X:()=>l,ZK:()=>m,_7:()=>w,_h:()=>d,bJ:()=>a,e8:()=>x,px:()=>i,xZ:()=>u});var n=r(991);var o=process.env,i=o.PORT,a=o.SESSION_SECRET,c=o.CSRF_EXCEPTION,s=o.FB_API_URL,u=o.FB_APP_KEY,l=o.FB_APP_SECRET,f=o.FB_REDIRECT_URL,p=o.WB_API_URL,d=o.WB_APP_KEY,h=o.WB_APP_SECRET,v=o.WB_REDIRECT_URL,m=o.GH_API_URL,y=o.GH_APP_KEY,g=o.GH_APP_SECRET,b=o.GH_REDIRECT_URL,w=n.Xx,x="./".concat("dist","/server"),j=["/robots.txt","/sitemap.xml","/favicon.ico"];c||console.log("No CSRF exception defined"),i||(console.error("No port defined."),process.exit(1))},619:(t,e,r)=>{"use strict";r.d(e,{Z:()=>c});var n=r(17),o=r.n(n),i=r(470),a=i.TM.reduce((function(t,e){return t[e]=!0,t}),{});const c=function(t,e,r){var n=t.url;if(Object.prototype.hasOwnProperty.call(a,n)){var c=o().resolve(process.cwd(),"".concat(i.e8).concat(n));e.sendFile(c)}else r(404)}},287:(t,e,r)=>{var n={"./admin.js":598,"./color.js":616,"./modal.js":141,"./user.js":137};function o(t){var e=i(t);return r(e)}function i(t){if(!r.o(n,t)){var e=new Error("Cannot find module '"+t+"'");throw e.code="MODULE_NOT_FOUND",e}return n[t]}o.keys=function(){return Object.keys(n)},o.resolve=i,t.exports=o,o.id=287},184:t=>{"use strict";t.exports=require("@reduxjs/toolkit")},17:t=>{"use strict";t.exports=require("path")},147:t=>{"use strict";t.exports=JSON.parse('{"name":"vp","version":"1.29.0","description":"source code of react.colorpk.com","engines":{"node":">= 16.x"},"scripts":{"dev":"webpack --config ./webpack/develop.js","lint":"eslint ./webpack ./src","test":"jest --coverage","t":"yarn lint && yarn test","build":"webpack --config ./webpack/production.js","start":"node dist/server"},"repository":"git+https://github.com/im6/vp.git","author":"im6","license":"ISC","bugs":{"url":"https://github.com/im6/vp/issues"},"homepage":"https://github.com/im6/vp#readme","devDependencies":{"@babel/core":"^7.22.1","@babel/preset-env":"7.22.4","@babel/preset-react":"^7.22.3","@testing-library/react":"^14.0.0","autoprefixer":"^10.4.14","babel-loader":"^9.1.2","bulma":"^0.9.4","clean-webpack-plugin":"^4.0.0","compression-webpack-plugin":"^10.0.0","copy-webpack-plugin":"^11.0.0","css-loader":"^6.8.1","css-minimizer-webpack-plugin":"^5.0.0","dotenv":"^16.1.4","eslint":"^8.42.0","eslint-config-airbnb":"^19.0.4","eslint-config-prettier":"^8.8.0","eslint-plugin-import":"^2.27.5","eslint-plugin-jest":"^27.2.1","eslint-plugin-jsx-a11y":"^6.7.1","eslint-plugin-prettier":"^4.2.1","eslint-plugin-react":"7.32.2","eslint-plugin-react-hooks":"^4.6.0","jest":"^29.5.0","jest-environment-jsdom":"^29.5.0","js-cookie":"^3.0.5","mini-css-extract-plugin":"^2.7.6","node-sass":"^9.0.0","postcss":"^8.4.24","postcss-loader":"^7.3.2","prettier":"^2.8.8","react-color":"^2.19.3","redux-logger":"^3.0.6","redux-observable":"^2.0.0","rxjs":"^7.8.1","sass-loader":"^13.3.1","webpack":"^5.85.1","webpack-cli":"^5.1.3","webpack-node-externals":"^3.0.0"},"dependencies":{"@reduxjs/toolkit":"^1.9.5","axios":"^1.4.0","body-parser":"^1.20.2","connect-redis":"^7.1.0","cookie-parser":"^1.4.6","csurf":"^1.11.0","express":"^4.18.2","express-graphql":"^0.12.0","express-session":"^1.17.3","graphql":"^15.7.2","helmet":"^7.0.0","lodash.get":"^4.4.2","mongodb":"^5.6.0","prop-types":"^15.8.1","react":"^18.2.0","react-dom":"^18.2.0","react-redux":"^8.0.7","react-router-dom":"^6.12.0","redis":"^4.6.7","serialize-javascript":"^6.0.1","uuid":"^9.0.0"},"prettier":{"endOfLine":"auto","trailingComma":"es5","tabWidth":2,"semi":true,"singleQuote":true},"babel":{"presets":["@babel/preset-env",["@babel/preset-react",{"runtime":"automatic"}]]},"eslintConfig":{"extends":["airbnb","prettier","plugin:react-hooks/recommended"],"plugins":["react","jsx-a11y","import","prettier","jest"],"rules":{"prettier/prettier":2,"import/no-extraneous-dependencies":0,"react-hooks/rules-of-hooks":"error","react-hooks/exhaustive-deps":"warn","import/no-unresolved":[2,{"ignore":["^components/"]}],"no-param-reassign":["error",{"props":true,"ignorePropertyModificationsFor":["acc","req","res","draft"]}]},"env":{"browser":true,"jest/globals":true}},"jest":{"verbose":false,"testEnvironment":"jsdom","clearMocks":true,"moduleDirectories":["node_modules","/src/testing"],"moduleNameMapper":{"\\\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$":"/src/testing/fileMock.js","\\\\.(css|sass)$":"/src/testing/styleMock.js","^components/(.*)":"/src/components/$1"},"coverageDirectory":"coverage","coverageThreshold":{"global":{"branches":100,"functions":100,"lines":100,"statements":-10}}},"browserslist":["defaults","cover 99.5%"]}')}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={exports:{}};return t[n](i,i.exports,r),i.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{"use strict";const t=require("child_process"),e=require("helmet");var n=r.n(e);const o=require("express");var i=r.n(o);const a=require("body-parser"),c=require("cookie-parser");var s=r.n(c);const u=require("redis"),l=require("express-session");var f=r.n(l);const p=require("connect-redis");var d=r.n(p),h=r(470),v=process.env,m=v.REDIS_HOST,y=v.REDIS_PORT,g=v.REDIS_PASSWORD;m&&y&&g||(console.error("missing redis connection info"),process.exit(1));var b=(0,u.createClient)({url:"redis://:".concat(g,"@").concat(m,":").concat(y)});b.on("error",(function(t){console.error(t),process.exit(1)})),b.on("reconnecting",(function(t,e){console.log("reconnecting, attempt: ".concat(e))})),b.on("connect",(function(){console.log("Redis connect successfully.")})),b.connect();const w=f()({store:new(d())({client:b}),secret:h.bJ,resave:!1,saveUninitialized:!1}),x=require("mongodb");function j(t){return j="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},j(t)}function k(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */k=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n=Object.defineProperty||function(t,e,r){t[e]=r.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function u(t,e,r,o){var i=e&&e.prototype instanceof p?e:p,a=Object.create(i.prototype),c=new E(o||[]);return n(a,"_invoke",{value:x(t,r,c)}),a}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var f={};function p(){}function d(){}function h(){}var v={};s(v,i,(function(){return this}));var m=Object.getPrototypeOf,y=m&&m(m(S([])));y&&y!==e&&r.call(y,i)&&(v=y);var g=h.prototype=p.prototype=Object.create(v);function b(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function o(n,i,a,c){var s=l(t[n],t,i);if("throw"!==s.type){var u=s.arg,f=u.value;return f&&"object"==j(f)&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){o("next",t,a,c)}),(function(t){o("throw",t,a,c)})):e.resolve(f).then((function(t){u.value=t,a(u)}),(function(t){return o("throw",t,a,c)}))}c(s.arg)}var i;n(this,"_invoke",{value:function(t,r){function n(){return new e((function(e,n){o(t,r,e,n)}))}return i=i?i.then(n,n):n()}})}function x(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return C()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=L(a,r);if(c){if(c===f)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=l(t,e,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===f)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}function L(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,L(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),f;var o=l(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,f;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function E(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function S(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(c&&s){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),_(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;_(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:S(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}function L(t,e,r,n,o,i,a){try{var c=t[i](a),s=c.value}catch(t){return void r(t)}c.done?e(s):Promise.resolve(s).then(n,o)}var O=process.env,_=O.MONGO_CONN,E=O.MONGO_CRED_PATH;if(!_||!E)throw console.log("MONGO_CONN",_),console.log("credentials",E),new Error("MongoDB connection info is missing.");var S=new x.MongoClient(_,{sslKey:E,sslCert:E,serverApi:x.ServerApiVersion.v1}),C=function(){var t,e=(t=k().mark((function t(){return k().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,S.connect();case 3:console.log("Connected to MongoDB successfully."),t.next=11;break;case 6:t.prev=6,t.t0=t.catch(0),console.error("MongoDB connection error!",t.t0),S.close(),process.exit(1);case 11:case"end":return t.stop()}}),t,null,[[0,6]])})),function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){L(i,n,o,a,c,"next",t)}function c(t){L(i,n,o,a,c,"throw",t)}a(void 0)}))});return function(){return e.apply(this,arguments)}}(),I=S;const A=require("lodash.get");var N=r.n(A);const P=require("uuid"),T=require("axios");var R=r.n(T),D=function(t,e){if("fb"===t)return"https://www.facebook.com/v3.3/dialog/oauth?client_id=".concat(h.xZ,"&response_type=code&state=").concat(e,"&redirect_uri=").concat(h.G4);if("wb"===t)return"https://api.weibo.com/oauth2/authorize?client_id=".concat(h._h,"&scope=follow_app_official_microblog&state=").concat(e,"&redirect_uri=").concat(h.GT);if("gh"===t)return"https://github.com/login/oauth/authorize?client_id=".concat(h.QA,"&state=").concat(e,"&redirect_uri=").concat(h.Ov);throw new Error},G=function(t){var e={client_id:h.xZ,client_secret:h.X,code:t,redirect_uri:h.G4};return R()({baseURL:h.G,method:"get",url:"/oauth/access_token",params:e}).then((function(t){var e=t.data;return{access_token:e.access_token,expires_in:e.expires_in}}))},q=function(t){var e={client_id:h._h,client_secret:h.Fj,code:t,redirect_uri:h.GT,grant_type:"authorization_code"};return R()({baseURL:h.Fq,method:"post",url:"/oauth2/access_token",params:e}).then((function(t){var e=t.data,r=e.access_token,n=e.expires_in;return{uid:e.uid,access_token:r,expires_in:n}}))},M=function(t){var e={client_id:h.QA,client_secret:h.Bu,code:t,redirect_uri:h.Ov};return R()({method:"post",url:"https://github.com/login/oauth/access_token",headers:{Accept:"application/json"},params:e}).then((function(t){return{access_token:t.data.access_token}}))},U=function(t){var e=t.uid,r=t.access_token;return R()({baseURL:h.Fq,method:"get",url:"/2/users/show.json",params:{uid:e,access_token:r}}).then((function(t){var e=t.data;return{oauthId:e.id,name:e.name,img:e.profile_image_url}}))},B=function(t){var e=t.access_token;return R()({baseURL:h.ZK,method:"get",url:"/user",headers:{Authorization:"token ".concat(e)}}).then((function(t){var e=t.data;return{oauthId:e.id,name:e.name||e.login,img:e.avatar_url}}))},F=function(t,e){return Boolean(N()(t,"session.app.isAuth",!1)&&(e||N()(t,"session.app.dbInfo.id",null)))},Y=function(t){return N()(t,"session.app.tokenInfo",null)},H=function(t){return F(t)&&N()(t,"session.app.dbInfo.isAdmin",!1)};function Q(t){return Q="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Q(t)}function z(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */z=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n=Object.defineProperty||function(t,e,r){t[e]=r.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function u(t,e,r,o){var i=e&&e.prototype instanceof p?e:p,a=Object.create(i.prototype),c=new O(o||[]);return n(a,"_invoke",{value:x(t,r,c)}),a}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var f={};function p(){}function d(){}function h(){}var v={};s(v,i,(function(){return this}));var m=Object.getPrototypeOf,y=m&&m(m(_([])));y&&y!==e&&r.call(y,i)&&(v=y);var g=h.prototype=p.prototype=Object.create(v);function b(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function o(n,i,a,c){var s=l(t[n],t,i);if("throw"!==s.type){var u=s.arg,f=u.value;return f&&"object"==Q(f)&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){o("next",t,a,c)}),(function(t){o("throw",t,a,c)})):e.resolve(f).then((function(t){u.value=t,a(u)}),(function(t){return o("throw",t,a,c)}))}c(s.arg)}var i;n(this,"_invoke",{value:function(t,r){function n(){return new e((function(e,n){o(t,r,e,n)}))}return i=i?i.then(n,n):n()}})}function x(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return E()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=j(a,r);if(c){if(c===f)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=l(t,e,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===f)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}function j(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,j(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),f;var o=l(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,f;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function k(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function _(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(c&&s){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),L(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:_(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}function $(t,e,r,n,o,i,a){try{var c=t[i](a),s=c.value}catch(t){return void r(t)}c.done?e(s):Promise.resolve(s).then(n,o)}var V=function(){var t,e=(t=z().mark((function t(e,r){var n,o,i,a,c;return z().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=N()(e,"query.code",null),o=N()(e,"query.state",null),i=N()(e,"params.oauth",null),a=N()(e,"session.app.oauthState",null),!n||!o||o!==a){t.next=29;break}if(console.log("redirected by ".concat(i," auth...")),c=null,"fb"!==i){t.next=13;break}return t.next=10,G(n);case 10:c=t.sent,t.next=26;break;case 13:if("wb"!==i){t.next=19;break}return t.next=16,q(n);case 16:c=t.sent,t.next=26;break;case 19:if("gh"!==i){t.next=25;break}return t.next=22,M(n);case 22:c=t.sent,t.next=26;break;case 25:throw new Error;case 26:e.session.app=c?{oauth:i,isAuth:!0,tokenInfo:c}:{isAuth:!1,authError:"get token failed."},t.next=31;break;case 29:console.log("inconsistant session, error msg in session"),e.session.app={isAuth:!1,authError:"Sorry, something error, please try again."};case 31:r.redirect("/");case 32:case"end":return t.stop()}}),t)})),function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){$(i,n,o,a,c,"next",t)}function c(t){$(i,n,o,a,c,"throw",t)}a(void 0)}))});return function(t,r){return e.apply(this,arguments)}}(),K=r(17),X=r.n(K)().resolve(process.cwd(),"".concat(h.e8,"/error.html"));const Z=require("csurf");var W=r.n(Z)()();const J=function(){for(var t=arguments.length,e=new Array(t),r=0;r=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(c&&s){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),L(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:_(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}function st(t,e,r,n,o,i,a){try{var c=t[i](a),s=c.value}catch(t){return void r(t)}c.done?e(s):Promise.resolve(s).then(n,o)}function ut(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){st(i,n,o,a,c,"next",t)}function c(t){st(i,n,o,a,c,"throw",t)}a(void 0)}))}}var lt=function(){var t=ut(ct().mark((function t(e){var r,n;return ct().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r=I.db("colorpk").collection("colors"),n=[],t.t0=e,t.next="PUBLIC"===t.t0?5:"ANONYMOUS"===t.t0?9:15;break;case 5:return t.next=7,r.find({hidden:!1}).sort({createdDate:-1}).toArray();case 7:case 13:return n=t.sent,t.abrupt("break",16);case 9:return t.next=11,r.find({hidden:!0}).toArray();case 11:return t.next=13,t.sent;case 15:return t.abrupt("break",16);case 16:return t.abrupt("return",n.map((function(t){return{id:t._id,star:t.star,color:t.color,userId:t.createdBy,createdDate:t.createdDate}})));case 17:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),ft=function(){var t=ut(ct().mark((function t(e){var r,n;return ct().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=I.db("colorpk").collection("colors"),t.next=3,r.find({createdBy:new x.ObjectId(e)}).toArray();case 3:return n=t.sent,t.abrupt("return",n.map((function(t){return t._id})));case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),pt=function(){var t=ut(ct().mark((function t(e,r){var n,o,i;return ct().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=I.db("colorpk").collection("colors"),o=it({},e),r&&(o.createdBy=new x.ObjectId(r)),t.next=5,n.insertOne(o);case 5:return i=t.sent,t.abrupt("return",i.insertedId);case 7:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}(),dt=function(){var t=ut(ct().mark((function t(e){var r,n;return ct().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=I.db("colorpk").collection("colors"),t.next=3,r.updateOne({_id:new x.ObjectId(e)},{$set:{hidden:!1}});case 3:return n=t.sent,t.abrupt("return",1===n.modifiedCount?0:1);case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),ht=function(){var t=ut(ct().mark((function t(e){var r,n;return ct().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=I.db("colorpk").collection("colors"),t.next=3,r.updateOne({_id:new x.ObjectId(e)},{$inc:{star:1}});case 3:return n=t.sent,t.abrupt("return",1===n.modifiedCount?0:1);case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),vt=function(){var t=ut(ct().mark((function t(e){var r,n;return ct().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=I.db("colorpk").collection("colors"),t.next=3,r.deleteOne({_id:new x.ObjectId(e)});case 3:return n=t.sent,t.abrupt("return",1===n.deletedCount?0:1);case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),mt=function(){var t=ut(ct().mark((function t(e,r){var n,o;return ct().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=I.db("colorpk").collection("users"),t.next=3,n.findOne({oAuthId:r,oAuthType:e});case 3:return o=t.sent,t.abrupt("return",o?{isAdmin:o.isAdmin,userId:o._id.toString()}:null);case 5:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}(),yt=function(){var t=ut(ct().mark((function t(e){var r,n;return ct().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=I.db("colorpk").collection("users"),t.next=3,r.insertOne(e);case 3:return n=t.sent,t.abrupt("return",n.insertedId);case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),gt=function(){var t=ut(ct().mark((function t(e){var r;return ct().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=I.db("colorpk").collection("users"),t.next=3,r.updateOne({_id:new x.ObjectId(e)},{$set:{lastLogin:new Date}});case 3:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),bt=function(){var t=ut(ct().mark((function t(e){var r,n;return ct().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=I.db("colorpk").collection("userSave"),t.next=3,r.find({user:new x.ObjectId(e)}).toArray();case 3:return n=t.sent,t.abrupt("return",n.map((function(t){return t.color})));case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),wt=function(){var t=ut(ct().mark((function t(e,r){var n,o,i;return ct().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=I.db("colorpk").collection("userSave"),o={user:new x.ObjectId(e),color:new x.ObjectId(r)},t.next=4,n.updateOne(o,{$setOnInsert:o},{upsert:!0});case 4:return i=t.sent,t.abrupt("return",i);case 6:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}(),xt=function(){var t=ut(ct().mark((function t(e,r){var n,o,i;return ct().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=I.db("colorpk").collection("userSave"),o={user:new x.ObjectId(e),color:new x.ObjectId(r)},t.next=4,n.deleteOne(o);case 4:return i=t.sent,t.abrupt("return",i);case 6:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}(),jt=function(){var t=ut(ct().mark((function t(e){var r,n,o;return ct().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=I.db("colorpk").collection("userSave"),n={color:new x.ObjectId(e)},t.next=4,r.deleteMany(n);case 4:return o=t.sent,t.abrupt("return",o);case 6:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}();function kt(t){return kt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},kt(t)}function Lt(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */Lt=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n=Object.defineProperty||function(t,e,r){t[e]=r.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function u(t,e,r,o){var i=e&&e.prototype instanceof p?e:p,a=Object.create(i.prototype),c=new O(o||[]);return n(a,"_invoke",{value:x(t,r,c)}),a}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var f={};function p(){}function d(){}function h(){}var v={};s(v,i,(function(){return this}));var m=Object.getPrototypeOf,y=m&&m(m(_([])));y&&y!==e&&r.call(y,i)&&(v=y);var g=h.prototype=p.prototype=Object.create(v);function b(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function o(n,i,a,c){var s=l(t[n],t,i);if("throw"!==s.type){var u=s.arg,f=u.value;return f&&"object"==kt(f)&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){o("next",t,a,c)}),(function(t){o("throw",t,a,c)})):e.resolve(f).then((function(t){u.value=t,a(u)}),(function(t){return o("throw",t,a,c)}))}c(s.arg)}var i;n(this,"_invoke",{value:function(t,r){function n(){return new e((function(e,n){o(t,r,e,n)}))}return i=i?i.then(n,n):n()}})}function x(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return E()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=j(a,r);if(c){if(c===f)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=l(t,e,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===f)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}function j(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,j(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),f;var o=l(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,f;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function k(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function _(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(c&&s){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),L(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:_(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}function Ot(t,e,r,n,o,i,a){try{var c=t[i](a),s=c.value}catch(t){return void r(t)}c.done?e(s):Promise.resolve(s).then(n,o)}function _t(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){Ot(i,n,o,a,c,"next",t)}function c(t){Ot(i,n,o,a,c,"throw",t)}a(void 0)}))}}const Et={user:function(t,e){return _t(Lt().mark((function t(){var r,n,o,i,a,c,s,u,l,f,p,d;return Lt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=Y(e),!F(e,!0)||!r){t.next=49;break}if(n=e.session.app.oauth,t.prev=3,o=null,"fb"!==n){t.next=11;break}return t.next=8,v=void 0,v=r.access_token,R()({baseURL:h.G,method:"get",url:"/me",params:{access_token:v,fields:"id,name,picture"}}).then((function(t){var e=t.data;return{oauthId:e.id,name:e.name,img:e.picture.data.url}}));case 8:o=t.sent,t.next=21;break;case 11:if("wb"!==n){t.next=17;break}return t.next=14,U(r);case 14:o=t.sent,t.next=21;break;case 17:if("gh"!==n){t.next=21;break}return t.next=20,B(r);case 20:o=t.sent;case 21:return a=(i=o).name,c=i.oauthId,t.next=24,mt(n,c);case 24:if(!(s=t.sent)){t.next=37;break}return u=s.isAdmin,l=s.userId,e.session.app.dbInfo={id:l,name:a,isAdmin:u},t.next=30,ft(l);case 30:return f=t.sent,t.next=33,bt(l);case 33:return p=t.sent,t.next=36,gt(l);case 36:return t.abrupt("return",{name:a,isAdmin:u,img:o.img||null,likes:p,owns:f});case 37:return t.next=39,yt({oAuthId:c,oAuthType:n,name:a,isAdmin:!1,lastLogin:new Date});case 39:return d=t.sent,e.session.app.dbInfo={id:d,name:a,isAdmin:!1},t.abrupt("return",{name:a,isAdmin:!1,img:N()(o,"picture.data.url",null),likes:[],owns:[]});case 44:return t.prev=44,t.t0=t.catch(3),t.abrupt("return",new et.GraphQLError(t.t0.toString()));case 47:t.next=50;break;case 49:return t.abrupt("return",null);case 50:case"end":return t.stop()}var v}),t,null,[[3,44]])})))()},color:function(t,e){return _t(Lt().mark((function r(){var n,o;return Lt().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(n=t.category,H(e)||"ANONYMOUS"!==n){r.next=3;break}return r.abrupt("return",new et.GraphQLError("color error: no admin access"));case 3:return r.prev=3,r.next=6,lt(n);case 6:return o=r.sent,r.abrupt("return",o);case 10:return r.prev=10,r.t0=r.catch(3),r.abrupt("return",new et.GraphQLError(r.t0.toString()));case 13:case"end":return r.stop()}}),r,null,[[3,10]])})))()},likeColor:function(t,e){return _t(Lt().mark((function r(){var n,o,i,a,c;return Lt().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(n=t.input,o=n.id,i=n.willLike,r.prev=2,!F(e)){r.next=12;break}if(a=N()(e,"session.app.dbInfo.id",null),!i){r.next=10;break}return r.next=8,wt(a,o);case 8:r.next=12;break;case 10:return r.next=12,xt(a,o);case 12:if(!i){r.next=17;break}return r.next=15,ht(o);case 15:return c=r.sent,r.abrupt("return",{status:c});case 17:return r.abrupt("return",{status:0});case 20:return r.prev=20,r.t0=r.catch(2),r.abrupt("return",new et.GraphQLError(r.t0.toString()));case 23:case"end":return r.stop()}}),r,null,[[2,20]])})))()},createColor:function(t,e){return _t(Lt().mark((function r(){var n,o,i,a,c;return Lt().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(n=t.input,o=n.color,rt("#".concat(o))){r.next=4;break}return r.abrupt("return",new et.GraphQLError("create error: invalid color input"));case 4:return i=N()(e,"session.app.dbInfo.id",null),a=F(e)?i:null,r.prev=6,r.next=9,pt({star:(20*Math.random()).toFixed(),color:o,createdBy:void 0,hidden:!a,createdDate:new Date},a);case 9:return c=r.sent,r.abrupt("return",{status:0,data:c});case 13:return r.prev=13,r.t0=r.catch(6),r.abrupt("return",new et.GraphQLError(r.t0.toString()));case 16:case"end":return r.stop()}}),r,null,[[6,13]])})))()},adjudicateColor:function(t,e){return _t(Lt().mark((function r(){var n,o,i,a,c;return Lt().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(n=t.input,H(e)){r.next=3;break}return r.abrupt("return",new et.GraphQLError("adjudicate error: no admin access"));case 3:if(o=n.id,i=n.willLike,r.prev=4,!i){r.next=10;break}return r.next=8,dt(o);case 8:return a=r.sent,r.abrupt("return",{status:a});case 10:return r.next=12,vt(o);case 12:return c=r.sent,r.next=15,jt(o);case 15:return r.abrupt("return",{status:c});case 18:return r.prev=18,r.t0=r.catch(4),r.abrupt("return",new et.GraphQLError(r.t0.toString()));case 21:case"end":return r.stop()}}),r,null,[[4,18]])})))()}};const St=(0,et.buildSchema)("\n enum ColorCategory {\n PUBLIC\n ANONYMOUS\n }\n\n interface MutationResponse {\n status: Int!\n }\n\n type Color {\n id: ID!\n star: Int!\n color: String!\n userId: ID\n username: String\n createdDate: String\n }\n\n type User {\n img: String\n isAdmin: Boolean\n name: String\n likes: [ID!]\n owns: [ID!]\n }\n\n input LikeColorInputType {\n id: ID!\n willLike: Boolean!\n }\n \n input CreateColorInputType {\n color: String!\n }\n\n type LikeColorOutputType implements MutationResponse {\n status: Int!\n }\n\n type AdjudicateColorOutputType implements MutationResponse {\n status: Int!\n }\n\n type CreateColorOutputType implements MutationResponse {\n status: Int!\n data: ID!\n }\n\n type Mutation {\n likeColor(input: LikeColorInputType!): LikeColorOutputType\n createColor(input: CreateColorInputType!): CreateColorOutputType\n adjudicateColor(input: LikeColorInputType!): AdjudicateColorOutputType\n }\n \n type Query {\n color(category: ColorCategory!): [Color]\n user: User\n }\n\n schema {\n query: Query\n mutation: Mutation\n } \n"),Ct=(0,tt.graphqlHTTP)({schema:St,rootValue:Et,graphiql:!1,pretty:!1}),It=require("react-redux"),At=require("react-router-dom/server");var Nt=r(184);const Pt=require("react-dom/server");var Tt=r(991);const Rt=require("prop-types");var Dt=r.n(Rt);const Gt=require("react"),qt=require("react/jsx-runtime");var Mt="ColorPK v1",Ut="colorpk",Bt="Your Best Color Picker | 全球最大色彩搭配网站 | 颜色搭配 | 艺术设计",Ft="https://repository-images.githubusercontent.com/75897824/b1278e80-8704-11ea-9acf-ac166e4ad4fd";const Yt=function(){return(0,qt.jsxs)(Gt.Fragment,{children:[(0,qt.jsx)("meta",{property:"og:title",content:Mt}),(0,qt.jsx)("meta",{property:"og:type",content:"website"}),(0,qt.jsx)("meta",{property:"og:url",content:"https://react.colorpk.com"}),(0,qt.jsx)("meta",{property:"og:description",content:Bt}),(0,qt.jsx)("meta",{property:"og:site_name",content:Ut}),(0,qt.jsx)("meta",{property:"og:image",content:Ft}),(0,qt.jsx)("meta",{property:"og:image:secure_url",content:Ft}),(0,qt.jsx)("meta",{property:"og:image:type",content:"image/png"}),(0,qt.jsx)("meta",{property:"og:image:width",content:1280}),(0,qt.jsx)("meta",{property:"og:image:height",content:640}),(0,qt.jsx)("meta",{property:"og:image:alt",content:Ut}),(0,qt.jsx)("meta",{name:"twitter:card",content:"summary_large_image"}),(0,qt.jsx)("meta",{name:"twitter:site",content:Ut}),(0,qt.jsx)("meta",{name:"twitter:title",content:Mt}),(0,qt.jsx)("meta",{name:"twitter:description",content:Bt}),(0,qt.jsx)("meta",{name:"twitter:image",content:Ft}),(0,qt.jsx)("meta",{name:"twitter:image:width",content:1280}),(0,qt.jsx)("meta",{name:"twitter:image:height",content:640}),(0,qt.jsx)("meta",{name:"twitter:image:alt",content:Ut})]})},Ht=require("serialize-javascript");var Qt=r.n(Ht),zt=function(t){var e=t.title,r=t.style,n=t.script,o=t.children,i=t.csrfToken,a=t.isVertical,c=t.languageCode,s=t.lastBuildDate,u=t.initState;return(0,qt.jsxs)("html",{lang:"en",children:[(0,qt.jsxs)("head",{children:[(0,qt.jsx)("meta",{charSet:"utf-8"}),(0,qt.jsx)("meta",{httpEquiv:"X-UA-Compatible",content:"IE=edge"}),(0,qt.jsx)(Yt,{}),(0,qt.jsx)("title",{children:e}),(0,qt.jsx)("meta",{name:"description",content:"ColorPK | Faster lighter and nicer than colorhunt | 全球最大色彩搭配网站 | 颜色搭配 | 艺术设计"}),(0,qt.jsx)("meta",{name:"viewport",content:"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"}),(0,qt.jsx)("meta",{name:"robots",content:"INDEX,FOLLOW"}),(0,qt.jsx)("meta",{name:"keywords",content:"colorpk, colorpicker, color picker, palette, color combination"}),(0,qt.jsx)("link",{rel:"shortcut icon",href:"//dkny.oss-cn-hangzhou.aliyuncs.com/3/fav.ico"}),(0,qt.jsx)("link",{href:r,rel:"stylesheet"}),(0,qt.jsx)("script",{dangerouslySetInnerHTML:{__html:"if(window.location.hostname.indexOf('colorpk.com') > -1){(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','GTM-5LX6LV3');} var initLoadTime = Date.now();window.addEventListener('_COLORPK_SCRIPT_READY', function(){window.dataLayer.push({'scriptLoadingTime': Date.now() - initLoadTime});console.log('server last build: ".concat(s,"');});\n ")}})]}),(0,qt.jsxs)("body",{children:[(0,qt.jsx)("noscript",{children:(0,qt.jsx)("iframe",{src:"https://www.googletagmanager.com/ns.html?id=GTM-5LX6LV3",height:"0",width:"0",style:{display:"none",visibility:"hidden"}})}),(0,qt.jsx)("div",{id:"app",dangerouslySetInnerHTML:{__html:o}}),(0,qt.jsx)("div",{id:Tt.yY}),(0,qt.jsx)("div",{id:"csrf","data-token":i}),(0,qt.jsx)("script",{dangerouslySetInnerHTML:{__html:"window.".concat(Tt.kl,"=").concat(Qt()(u),"; window.").concat(Tt.CT,'="').concat(c,'"; window.').concat(Tt.jl,"=").concat(a,"; ")}}),(0,qt.jsx)("script",{src:n,type:"text/javascript"})]})]})};zt.propTypes={title:Dt().string.isRequired,isVertical:Dt().bool.isRequired,languageCode:Dt().string.isRequired,lastBuildDate:Dt().string.isRequired,style:Dt().string.isRequired,script:Dt().string.isRequired,children:Dt().string.isRequired,csrfToken:Dt().string.isRequired,initState:Dt().object.isRequired};const $t=zt,Vt={container:"uCFqZ"},Kt=require("react-router-dom"),Xt={selected:"EQXN2",translationText:"nzlHR",rotate:"MaSpR",iconWrapper:"iYPlb",wideScreenOnly:"m_HVm"};const Zt=function(){return(0,qt.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",children:[(0,qt.jsx)("title",{children:"translation"}),(0,qt.jsx)("path",{d:"M0 0h24v24H0z",fill:"none"}),(0,qt.jsx)("path",{d:" M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z "})]})};var Wt=function(t){var e=t.languages,r=t.onChange;return(0,qt.jsx)("div",{className:"navbar-dropdown",children:e.map((function(t){return(0,qt.jsx)("a",{className:"navbar-item",onClick:function(){r(t.code)},children:t.name},t.code)}))})};Wt.propTypes={onChange:Dt().func.isRequired,languages:Dt().array.isRequired};const Jt=Wt;var te=function(t){var e=t.onClick;return(0,qt.jsxs)("a",{role:"nav toggle btn",className:"navbar-burger burger","aria-label":"nav menu","aria-expanded":"false",onClick:e,children:[(0,qt.jsx)("span",{"aria-hidden":"true"}),(0,qt.jsx)("span",{"aria-hidden":"true"}),(0,qt.jsx)("span",{"aria-hidden":"true"})]})};te.propTypes={onClick:Dt().func.isRequired};const ee=te;const re=function(){return(0,Gt.useContext)(Se)};var ne=[],oe={},ie={};function ae(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,c=[],s=!0,u=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=i.call(r)).done)&&(c.push(n.value),c.length!==e);s=!0);}catch(t){u=!0,o=t}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw o}}return c}}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return ce(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ce(t,e)}(t,e)||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 ce(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);rt.length)&&(e=t.length);for(var r=0,n=new Array(e);r0&&" (".concat(r,")")]}),(0,qt.jsx)(Kt.Link,{to:"/popular",className:"navbar-item ".concat(j?de:""),onClick:E,children:m.popular}),(0,qt.jsx)(Kt.Link,{to:"/latest",className:"navbar-item ".concat(k?de:""),onClick:E,children:m.latest}),(0,qt.jsxs)("div",{className:"navbar-item has-dropdown is-hoverable ".concat(Xt.wideScreenOnly),children:[(0,qt.jsx)("a",{className:"navbar-link",children:m.more}),(0,qt.jsxs)("div",{className:"navbar-dropdown",children:[(0,qt.jsx)("a",{className:"navbar-item",href:"//www.colorpk.com",children:"ColorPK v2.0"}),(0,qt.jsx)("a",{className:"navbar-item",href:"//www.colorpk.com/about",children:m.about}),(0,qt.jsx)("hr",{className:"navbar-divider"}),(0,qt.jsx)("a",{className:"navbar-item",href:"//github.com/im6/vp/issues",children:m.reportIssue})]})]}),(0,qt.jsxs)("div",{className:"navbar-item has-dropdown is-hoverable",children:[(0,qt.jsxs)("a",{className:"navbar-link",children:[(0,qt.jsx)(Zt,{}),(0,qt.jsx)("span",{className:Xt.translationText,children:m.language})]}),(0,qt.jsx)(Jt,{languages:a,onChange:y})]})]}),(0,qt.jsxs)("div",{className:"navbar-end",children:[!g&&(0,qt.jsxs)("div",{className:"navbar-item has-dropdown is-hoverable",children:[(0,qt.jsx)("a",{className:"navbar-link",children:m.navLogin}),(0,qt.jsxs)("div",{className:"navbar-dropdown",children:[(0,qt.jsx)("a",{className:"navbar-item",href:n,children:"微博"}),(0,qt.jsx)("a",{className:"navbar-item",href:o,children:"GitHub"}),i&&(0,qt.jsx)("a",{className:"navbar-item",href:i,children:"FaceBook"})]})]}),(0,qt.jsx)("div",{className:"navbar-item",children:(0,qt.jsxs)("div",{className:"buttons",children:[g&&(0,qt.jsx)(Kt.Link,{className:"button is-danger",to:"/",onClick:function(){c(),E()},children:m.logOut}),!_&&(0,qt.jsx)(Kt.Link,{to:"/new",className:"button is-primary",onClick:S,children:m.newColor})]})})]})]})]})};he.propTypes={detail:Dt().object,weiboUrl:Dt().string,githubUrl:Dt().string,facebookUrl:Dt().string,likeNum:Dt().number,languages:Dt().array.isRequired,onLogout:Dt().func.isRequired};const ve=he;const me=(0,It.connect)((function(t){var e=t.user,r=t.color,n=e.detail,o=e.weiboUrl,i=e.githubUrl,a=e.facebookUrl;return{detail:n,likeNum:r.liked.length,languages:ne,weiboUrl:o,githubUrl:i,facebookUrl:a}}),(function(t){return{onLogout:function(){var e=(0,Nt.createAction)("user/logoff");t(e())}}}))(ve);var ye=function(){return(0,qt.jsx)("div",{className:"spinContainer",children:(0,qt.jsx)("div",{className:"spinLoader"})})};const ge=(0,Gt.memo)(ye);function be(t){return be="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},be(t)}function we(t,e){for(var r=0;rt.length)&&(e=t.length);for(var r=0,n=new Array(e);r".concat(p))};var Pe=i()();C(),Pe.set("trust proxy",!0),Pe.use(n()({contentSecurityPolicy:!1,crossOriginEmbedderPolicy:!1})),Pe.use((0,a.json)()),Pe.use((0,a.urlencoded)({extended:!1})),Pe.use(s()()),Pe.use(w);var Te=r(619).Z;h.TM.forEach((function(t){Pe.get(t,Te)})),Pe.get("/_ah/:action",(function(t,e){var r=t.params.action;e.json({status:"".concat(r," - ok")})})),Pe.use(J),Pe.post("/graphql",Ct),Pe.get("/auth/logout",(function(t,e){var r=N()(t,"session.app.dbInfo.name","unknown");console.log("logoff (".concat(r,"), delete session")),delete t.session.app;var n=(0,P.v1)();t.session.app={oauthState:n},e.json({weiboUrl:D("wb",n),githubUrl:D("gh",n),facebookUrl:D("fb",n)})})),Pe.get("/auth/:oauth",V),["/","/latest","/popular","/color/:id","/new","/like"].forEach((function(t){Pe.get(t,Ne)})),Pe.get("/portfolio",(function(t,e,r){F(t)?r():r(401)}),Ne),Pe.get("/adminpanel",(function(t,e,r){H(t)?r():r(403)}),Ne),Pe.use((function(t,e){console.error("Error: 404, ".concat(t.url," not found")),e.status(400).sendFile(X)})),Pe.use((function(t,e,r,n){console.error("Error: ".concat(t.toString(),", ").concat(e.url)),"POST"===e.method?r.status(400).json({errors:!0}):r.status(400).sendFile(X)}));Pe.listen(h.px,(function(){return console.log("app (mode: ".concat("production",") is running on: http://localhost:").concat(h.px))})).timeout=5e3,(0,t.exec)("curl ifconfig.me",(function(t,e,r){t?console.error(r):console.log("public IP addr: ".concat(e))}))})()})(); \ No newline at end of file +(()=>{var t={991:(t,e,r)=>{"use strict";r.d(e,{$q:()=>i,CT:()=>l,Qi:()=>c,Xx:()=>s,ZA:()=>a,jl:()=>u,kl:()=>f,yY:()=>o});var n=r(147).version,o="temp",i="en",a=!0,c="//dkny.oss-cn-hangzhou.aliyuncs.com/2",s="https://cdn.jsdelivr.net/gh/im6/vp@v".concat(n,"/dist/public"),u="canvas",l="lang",f="_REDUXSTATE_"},598:(t,e,r)=>{"use strict";r.r(e),r.d(e,{default:()=>o});var n=r(184);const o=(0,n.createReducer)({list:null,loading:!1},(function(t){t.addCase((0,n.createAction)("admin/getList"),(function(t){t.loading=!0})).addCase((0,n.createAction)("admin/getList/success"),(function(t,e){t.loading=!1,t.list=e.payload})).addCase((0,n.createAction)("admin/getList/fail"),(function(t){t.loading=!1,t.list=[]})).addCase((0,n.createAction)("admin/decideColor"),(function(t,e){t.list=t.list.filter((function(t){return t.id!==e.payload.id}))}))}))},616:(t,e,r)=>{"use strict";r.r(e),r.d(e,{default:()=>o});var n=r(184);const o=(0,n.createReducer)({loading:!1,colorDef:{},liked:{},colorIdAllByDate:[],colorIdAllByStar:[],colorIdByMyOwn:[]},(function(t){t.addCase((0,n.createAction)("color/get"),(function(t){t.loading=!0})).addCase((0,n.createAction)("color/get/success"),(function(t,e){var r=e.payload,n=[],o={};r.forEach((function(t){n.push(t.id),o[t.id]=t}));var i=r.sort((function(t,e){return e.star-t.star})).map((function(t){return t.id}));t.loading=!1,t.colorDef=o,t.colorIdAllByDate=n,t.colorIdAllByStar=i})).addCase((0,n.createAction)("color/get/fail"),(function(t){t.loading=!1,t.colorIdAllByDate=[],t.colorIdAllByStar=[]})).addCase((0,n.createAction)("color/toggleLike"),(function(t,e){var r=e.payload,n=r.willLike,o=r.id;n?t.liked[o]=!0:delete t.liked[o],t.colorDef[o].star+=n?1:-1})).addCase((0,n.createAction)("color/addNew/success"),(function(t,e){var r=e.payload,n=r.id;t.colorDef[n]=r,t.colorIdAllByDate.unshift(n),t.colorIdAllByStar.push(n)})).addCase((0,n.createAction)("color/set/likes"),(function(t,e){var r=e.payload.reduce((function(t,e){return t[e]=!0,t}),{});t.liked=r})).addCase((0,n.createAction)("color/set/owns"),(function(t,e){t.colorIdByMyOwn=e.payload}))}))},141:(t,e,r)=>{"use strict";r.r(e),r.d(e,{default:()=>i});var n=r(184),o={type:null,message:null,visible:!1};const i=(0,n.createReducer)(o,(function(t){t.addCase((0,n.createAction)("modal/reset"),(function(){return o})).addCase((0,n.createAction)("modal/set"),(function(t,e){return{type:e.payload[0],message:e.payload[1],visible:!1}})).addCase((0,n.createAction)("modal/show"),(function(t){t.visible=!0})).addCase((0,n.createAction)("modal/hide"),(function(t){t.visible=!1}))}))},137:(t,e,r)=>{"use strict";r.r(e),r.d(e,{default:()=>o});var n=r(184);const o=(0,n.createReducer)({detail:null,weiboUrl:null,githubUrl:null,facebookUrl:null,loading:!1},(function(t){t.addCase((0,n.createAction)("user/auth"),(function(t){t.loading=!0})).addCase((0,n.createAction)("user/auth/success"),(function(t,e){t.loading=!1,t.detail=e.payload})).addCase((0,n.createAction)("user/auth/fail"),(function(t){t.loading=!1,t.detail=null})).addCase((0,n.createAction)("user/logoff"),(function(t){t.detail=null})).addCase((0,n.createAction)("user/logoff/success"),(function(t,e){var r=e.payload,n=r.weiboUrl,o=r.githubUrl,i=r.facebookUrl;t.detail=null,t.weiboUrl=n,t.githubUrl=o,t.facebookUrl=i}))}))},470:(t,e,r)=>{"use strict";r.d(e,{Bu:()=>g,Fj:()=>h,Fq:()=>p,G:()=>s,G4:()=>f,GT:()=>v,Mh:()=>c,Ov:()=>b,QA:()=>y,TM:()=>j,X:()=>l,ZK:()=>m,_7:()=>w,_h:()=>d,bJ:()=>a,e8:()=>x,px:()=>i,xZ:()=>u});var n=r(991);var o=process.env,i=o.PORT,a=o.SESSION_SECRET,c=o.CSRF_EXCEPTION,s=o.FB_API_URL,u=o.FB_APP_KEY,l=o.FB_APP_SECRET,f=o.FB_REDIRECT_URL,p=o.WB_API_URL,d=o.WB_APP_KEY,h=o.WB_APP_SECRET,v=o.WB_REDIRECT_URL,m=o.GH_API_URL,y=o.GH_APP_KEY,g=o.GH_APP_SECRET,b=o.GH_REDIRECT_URL,w=n.Xx,x="./".concat("dist","/server"),j=["/robots.txt","/sitemap.xml","/favicon.ico"];c||console.log("No CSRF exception defined"),i||(console.error("No port defined."),process.exit(1))},619:(t,e,r)=>{"use strict";r.d(e,{Z:()=>c});var n=r(17),o=r.n(n),i=r(470),a=i.TM.reduce((function(t,e){return t[e]=!0,t}),{});const c=function(t,e,r){var n=t.url;if(Object.prototype.hasOwnProperty.call(a,n)){var c=o().resolve(process.cwd(),"".concat(i.e8).concat(n));e.sendFile(c)}else r(404)}},287:(t,e,r)=>{var n={"./admin.js":598,"./color.js":616,"./modal.js":141,"./user.js":137};function o(t){var e=i(t);return r(e)}function i(t){if(!r.o(n,t)){var e=new Error("Cannot find module '"+t+"'");throw e.code="MODULE_NOT_FOUND",e}return n[t]}o.keys=function(){return Object.keys(n)},o.resolve=i,t.exports=o,o.id=287},184:t=>{"use strict";t.exports=require("@reduxjs/toolkit")},17:t=>{"use strict";t.exports=require("path")},147:t=>{"use strict";t.exports=JSON.parse('{"name":"vp","version":"1.30.0","description":"source code of react.colorpk.com","engines":{"node":">= 16.x"},"scripts":{"dev":"webpack --config ./webpack/develop.js","lint":"eslint ./webpack ./src","test":"jest --coverage","t":"yarn lint && yarn test","build":"webpack --config ./webpack/production.js","start":"node dist/server"},"repository":"git+https://github.com/im6/vp.git","author":"im6","license":"ISC","bugs":{"url":"https://github.com/im6/vp/issues"},"homepage":"https://github.com/im6/vp#readme","devDependencies":{"@babel/core":"^7.22.1","@babel/preset-env":"7.22.4","@babel/preset-react":"^7.22.3","@testing-library/react":"^14.0.0","autoprefixer":"^10.4.14","babel-loader":"^9.1.2","bulma":"^0.9.4","clean-webpack-plugin":"^4.0.0","compression-webpack-plugin":"^10.0.0","copy-webpack-plugin":"^11.0.0","css-loader":"^6.8.1","css-minimizer-webpack-plugin":"^5.0.0","dotenv":"^16.1.4","eslint":"^8.42.0","eslint-config-airbnb":"^19.0.4","eslint-config-prettier":"^8.8.0","eslint-plugin-import":"^2.27.5","eslint-plugin-jest":"^27.2.1","eslint-plugin-jsx-a11y":"^6.7.1","eslint-plugin-prettier":"^4.2.1","eslint-plugin-react":"7.32.2","eslint-plugin-react-hooks":"^4.6.0","jest":"^29.5.0","jest-environment-jsdom":"^29.5.0","js-cookie":"^3.0.5","mini-css-extract-plugin":"^2.7.6","node-sass":"^9.0.0","postcss":"^8.4.24","postcss-loader":"^7.3.2","prettier":"^2.8.8","react-color":"^2.19.3","redux-logger":"^3.0.6","redux-observable":"^2.0.0","rxjs":"^7.8.1","sass-loader":"^13.3.1","webpack":"^5.85.1","webpack-cli":"^5.1.3","webpack-node-externals":"^3.0.0"},"dependencies":{"@reduxjs/toolkit":"^1.9.5","axios":"^1.4.0","body-parser":"^1.20.2","connect-redis":"^7.1.0","cookie-parser":"^1.4.6","csurf":"^1.11.0","express":"^4.18.2","express-graphql":"^0.12.0","express-session":"^1.17.3","graphql":"^15.7.2","helmet":"^7.0.0","lodash.get":"^4.4.2","mongodb":"^5.6.0","prop-types":"^15.8.1","react":"^18.2.0","react-dom":"^18.2.0","react-redux":"^8.0.7","react-router-dom":"^6.12.0","redis":"^4.6.7","serialize-javascript":"^6.0.1","uuid":"^9.0.0"},"prettier":{"endOfLine":"auto","trailingComma":"es5","tabWidth":2,"semi":true,"singleQuote":true},"babel":{"presets":["@babel/preset-env",["@babel/preset-react",{"runtime":"automatic"}]]},"eslintConfig":{"extends":["airbnb","prettier","plugin:react-hooks/recommended"],"plugins":["react","jsx-a11y","import","prettier","jest"],"rules":{"prettier/prettier":2,"import/no-extraneous-dependencies":0,"react-hooks/rules-of-hooks":"error","react-hooks/exhaustive-deps":"warn","import/no-unresolved":[2,{"ignore":["^components/"]}],"no-param-reassign":["error",{"props":true,"ignorePropertyModificationsFor":["acc","req","res","draft"]}]},"env":{"browser":true,"jest/globals":true}},"jest":{"verbose":false,"testEnvironment":"jsdom","clearMocks":true,"moduleDirectories":["node_modules","/src/testing"],"moduleNameMapper":{"\\\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$":"/src/testing/fileMock.js","\\\\.(css|sass)$":"/src/testing/styleMock.js","^components/(.*)":"/src/components/$1"},"coverageDirectory":"coverage","coverageThreshold":{"global":{"branches":100,"functions":100,"lines":100,"statements":-10}}},"browserslist":["defaults","cover 99.5%"]}')}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={exports:{}};return t[n](i,i.exports,r),i.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{"use strict";const t=require("child_process"),e=require("helmet");var n=r.n(e);const o=require("express");var i=r.n(o);const a=require("body-parser"),c=require("cookie-parser");var s=r.n(c);const u=require("redis"),l=require("express-session");var f=r.n(l);const p=require("connect-redis");var d=r.n(p),h=r(470),v=process.env,m=v.REDIS_HOST,y=v.REDIS_PORT,g=v.REDIS_PASSWORD;m&&y&&g||(console.error("missing redis connection info"),process.exit(1));var b=(0,u.createClient)({url:"redis://:".concat(g,"@").concat(m,":").concat(y)});b.on("error",(function(t){console.error(t),process.exit(1)})),b.on("reconnecting",(function(t,e){console.log("reconnecting, attempt: ".concat(e))})),b.on("connect",(function(){console.log("Redis connect successfully.")})),b.connect();const w=f()({store:new(d())({client:b}),secret:h.bJ,resave:!1,saveUninitialized:!1}),x=require("mongodb");function j(t){return j="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},j(t)}function k(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */k=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n=Object.defineProperty||function(t,e,r){t[e]=r.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function u(t,e,r,o){var i=e&&e.prototype instanceof p?e:p,a=Object.create(i.prototype),c=new E(o||[]);return n(a,"_invoke",{value:x(t,r,c)}),a}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var f={};function p(){}function d(){}function h(){}var v={};s(v,i,(function(){return this}));var m=Object.getPrototypeOf,y=m&&m(m(S([])));y&&y!==e&&r.call(y,i)&&(v=y);var g=h.prototype=p.prototype=Object.create(v);function b(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function o(n,i,a,c){var s=l(t[n],t,i);if("throw"!==s.type){var u=s.arg,f=u.value;return f&&"object"==j(f)&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){o("next",t,a,c)}),(function(t){o("throw",t,a,c)})):e.resolve(f).then((function(t){u.value=t,a(u)}),(function(t){return o("throw",t,a,c)}))}c(s.arg)}var i;n(this,"_invoke",{value:function(t,r){function n(){return new e((function(e,n){o(t,r,e,n)}))}return i=i?i.then(n,n):n()}})}function x(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return C()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=L(a,r);if(c){if(c===f)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=l(t,e,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===f)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}function L(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,L(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),f;var o=l(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,f;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function O(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function _(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function E(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(O,this),this.reset(!0)}function S(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(c&&s){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),_(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;_(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:S(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}function L(t,e,r,n,o,i,a){try{var c=t[i](a),s=c.value}catch(t){return void r(t)}c.done?e(s):Promise.resolve(s).then(n,o)}var O=process.env,_=O.MONGO_CONN,E=O.MONGO_CRED_PATH;if(!_||!E)throw new Error("MongoDB connection info is missing.");var S=new x.MongoClient(_,{sslKey:E,sslCert:E,serverApi:x.ServerApiVersion.v1}),C=function(){var t,e=(t=k().mark((function t(){return k().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,S.connect();case 3:console.log("Connected to MongoDB successfully."),t.next=11;break;case 6:t.prev=6,t.t0=t.catch(0),console.error("MongoDB connection error!",t.t0),S.close(),process.exit(1);case 11:case"end":return t.stop()}}),t,null,[[0,6]])})),function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){L(i,n,o,a,c,"next",t)}function c(t){L(i,n,o,a,c,"throw",t)}a(void 0)}))});return function(){return e.apply(this,arguments)}}(),I=S;const A=require("lodash.get");var P=r.n(A);const T=require("uuid"),N=require("axios");var R=r.n(N),D=function(t,e){if("fb"===t)return"https://www.facebook.com/v3.3/dialog/oauth?client_id=".concat(h.xZ,"&response_type=code&state=").concat(e,"&redirect_uri=").concat(h.G4);if("wb"===t)return"https://api.weibo.com/oauth2/authorize?client_id=".concat(h._h,"&scope=follow_app_official_microblog&state=").concat(e,"&redirect_uri=").concat(h.GT);if("gh"===t)return"https://github.com/login/oauth/authorize?client_id=".concat(h.QA,"&state=").concat(e,"&redirect_uri=").concat(h.Ov);throw new Error},q=function(t){var e={client_id:h.xZ,client_secret:h.X,code:t,redirect_uri:h.G4};return R()({baseURL:h.G,method:"get",url:"/oauth/access_token",params:e}).then((function(t){var e=t.data;return{access_token:e.access_token,expires_in:e.expires_in}}))},G=function(t){var e={client_id:h._h,client_secret:h.Fj,code:t,redirect_uri:h.GT,grant_type:"authorization_code"};return R()({baseURL:h.Fq,method:"post",url:"/oauth2/access_token",params:e}).then((function(t){var e=t.data,r=e.access_token,n=e.expires_in;return{uid:e.uid,access_token:r,expires_in:n}}))},U=function(t){var e={client_id:h.QA,client_secret:h.Bu,code:t,redirect_uri:h.Ov};return R()({method:"post",url:"https://github.com/login/oauth/access_token",headers:{Accept:"application/json"},params:e}).then((function(t){return{access_token:t.data.access_token}}))},M=function(t){var e=t.uid,r=t.access_token;return R()({baseURL:h.Fq,method:"get",url:"/2/users/show.json",params:{uid:e,access_token:r}}).then((function(t){var e=t.data;return{oauthId:e.id,name:e.name,img:e.profile_image_url}}))},B=function(t){var e=t.access_token;return R()({baseURL:h.ZK,method:"get",url:"/user",headers:{Authorization:"token ".concat(e)}}).then((function(t){var e=t.data;return{oauthId:e.id,name:e.name||e.login,img:e.avatar_url}}))},F=function(t,e){return Boolean(P()(t,"session.app.isAuth",!1)&&(e||P()(t,"session.app.dbInfo.id",null)))},Y=function(t){return P()(t,"session.app.tokenInfo",null)},H=function(t){return F(t)&&P()(t,"session.app.dbInfo.isAdmin",!1)};function Q(t){return Q="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Q(t)}function z(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */z=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n=Object.defineProperty||function(t,e,r){t[e]=r.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function u(t,e,r,o){var i=e&&e.prototype instanceof p?e:p,a=Object.create(i.prototype),c=new O(o||[]);return n(a,"_invoke",{value:x(t,r,c)}),a}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var f={};function p(){}function d(){}function h(){}var v={};s(v,i,(function(){return this}));var m=Object.getPrototypeOf,y=m&&m(m(_([])));y&&y!==e&&r.call(y,i)&&(v=y);var g=h.prototype=p.prototype=Object.create(v);function b(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function o(n,i,a,c){var s=l(t[n],t,i);if("throw"!==s.type){var u=s.arg,f=u.value;return f&&"object"==Q(f)&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){o("next",t,a,c)}),(function(t){o("throw",t,a,c)})):e.resolve(f).then((function(t){u.value=t,a(u)}),(function(t){return o("throw",t,a,c)}))}c(s.arg)}var i;n(this,"_invoke",{value:function(t,r){function n(){return new e((function(e,n){o(t,r,e,n)}))}return i=i?i.then(n,n):n()}})}function x(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return E()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=j(a,r);if(c){if(c===f)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=l(t,e,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===f)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}function j(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,j(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),f;var o=l(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,f;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function k(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function _(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(c&&s){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),L(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:_(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}function $(t,e,r,n,o,i,a){try{var c=t[i](a),s=c.value}catch(t){return void r(t)}c.done?e(s):Promise.resolve(s).then(n,o)}var V=function(){var t,e=(t=z().mark((function t(e,r){var n,o,i,a,c;return z().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=P()(e,"query.code",null),o=P()(e,"query.state",null),i=P()(e,"params.oauth",null),a=P()(e,"session.app.oauthState",null),!n||!o||o!==a){t.next=29;break}if(console.log("redirected by ".concat(i," auth...")),c=null,"fb"!==i){t.next=13;break}return t.next=10,q(n);case 10:c=t.sent,t.next=26;break;case 13:if("wb"!==i){t.next=19;break}return t.next=16,G(n);case 16:c=t.sent,t.next=26;break;case 19:if("gh"!==i){t.next=25;break}return t.next=22,U(n);case 22:c=t.sent,t.next=26;break;case 25:throw new Error;case 26:e.session.app=c?{oauth:i,isAuth:!0,tokenInfo:c}:{isAuth:!1,authError:"get token failed."},t.next=31;break;case 29:console.log("inconsistant session, error msg in session"),e.session.app={isAuth:!1,authError:"Sorry, something error, please try again."};case 31:r.redirect("/");case 32:case"end":return t.stop()}}),t)})),function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){$(i,n,o,a,c,"next",t)}function c(t){$(i,n,o,a,c,"throw",t)}a(void 0)}))});return function(t,r){return e.apply(this,arguments)}}(),K=r(17),X=r.n(K)().resolve(process.cwd(),"".concat(h.e8,"/error.html"));const Z=require("csurf");var W=r.n(Z)()();const J=function(){for(var t=arguments.length,e=new Array(t),r=0;r=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(c&&s){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),L(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:_(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}function st(t,e,r,n,o,i,a){try{var c=t[i](a),s=c.value}catch(t){return void r(t)}c.done?e(s):Promise.resolve(s).then(n,o)}function ut(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){st(i,n,o,a,c,"next",t)}function c(t){st(i,n,o,a,c,"throw",t)}a(void 0)}))}}var lt=function(){var t=ut(ct().mark((function t(e){var r,n;return ct().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:r=I.db("colorpk").collection("colors"),n=[],t.t0=e,t.next="PUBLIC"===t.t0?5:"ANONYMOUS"===t.t0?9:15;break;case 5:return t.next=7,r.find({hidden:!1}).sort({createdDate:-1}).toArray();case 7:case 13:return n=t.sent,t.abrupt("break",16);case 9:return t.next=11,r.find({hidden:!0}).toArray();case 11:return t.next=13,t.sent;case 15:return t.abrupt("break",16);case 16:return t.abrupt("return",n.map((function(t){return{id:t._id,star:t.star,color:t.color,userId:t.createdBy,createdDate:t.createdDate}})));case 17:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),ft=function(){var t=ut(ct().mark((function t(e){var r,n;return ct().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=I.db("colorpk").collection("colors"),t.next=3,r.find({createdBy:new x.ObjectId(e)}).toArray();case 3:return n=t.sent,t.abrupt("return",n.map((function(t){return t._id})));case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),pt=function(){var t=ut(ct().mark((function t(e,r){var n,o,i;return ct().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=I.db("colorpk").collection("colors"),o=it({},e),r&&(o.createdBy=new x.ObjectId(r)),t.next=5,n.insertOne(o);case 5:return i=t.sent,t.abrupt("return",i.insertedId);case 7:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}(),dt=function(){var t=ut(ct().mark((function t(e){var r,n;return ct().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=I.db("colorpk").collection("colors"),t.next=3,r.updateOne({_id:new x.ObjectId(e)},{$set:{hidden:!1}});case 3:return n=t.sent,t.abrupt("return",1===n.modifiedCount?0:1);case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),ht=function(){var t=ut(ct().mark((function t(e){var r,n;return ct().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=I.db("colorpk").collection("colors"),t.next=3,r.updateOne({_id:new x.ObjectId(e)},{$inc:{star:1}});case 3:return n=t.sent,t.abrupt("return",1===n.modifiedCount?0:1);case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),vt=function(){var t=ut(ct().mark((function t(e){var r,n;return ct().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=I.db("colorpk").collection("colors"),t.next=3,r.deleteOne({_id:new x.ObjectId(e)});case 3:return n=t.sent,t.abrupt("return",1===n.deletedCount?0:1);case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),mt=function(){var t=ut(ct().mark((function t(e,r){var n,o;return ct().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=I.db("colorpk").collection("users"),t.next=3,n.findOne({oAuthId:r,oAuthType:e});case 3:return o=t.sent,t.abrupt("return",o?{isAdmin:o.isAdmin,userId:o._id.toString()}:null);case 5:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}(),yt=function(){var t=ut(ct().mark((function t(e){var r,n;return ct().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=I.db("colorpk").collection("users"),t.next=3,r.insertOne(e);case 3:return n=t.sent,t.abrupt("return",n.insertedId);case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),gt=function(){var t=ut(ct().mark((function t(e){var r;return ct().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=I.db("colorpk").collection("users"),t.next=3,r.updateOne({_id:new x.ObjectId(e)},{$set:{lastLogin:new Date}});case 3:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),bt=function(){var t=ut(ct().mark((function t(e){var r,n;return ct().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=I.db("colorpk").collection("userSave"),t.next=3,r.find({user:new x.ObjectId(e)}).toArray();case 3:return n=t.sent,t.abrupt("return",n.map((function(t){return t.color})));case 5:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),wt=function(){var t=ut(ct().mark((function t(e,r){var n,o,i;return ct().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=I.db("colorpk").collection("userSave"),o={user:new x.ObjectId(e),color:new x.ObjectId(r)},t.next=4,n.updateOne(o,{$setOnInsert:o},{upsert:!0});case 4:return i=t.sent,t.abrupt("return",i);case 6:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}(),xt=function(){var t=ut(ct().mark((function t(e,r){var n,o,i;return ct().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=I.db("colorpk").collection("userSave"),o={user:new x.ObjectId(e),color:new x.ObjectId(r)},t.next=4,n.deleteOne(o);case 4:return i=t.sent,t.abrupt("return",i);case 6:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}(),jt=function(){var t=ut(ct().mark((function t(e){var r,n,o;return ct().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return r=I.db("colorpk").collection("userSave"),n={color:new x.ObjectId(e)},t.next=4,r.deleteMany(n);case 4:return o=t.sent,t.abrupt("return",o);case 6:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}();function kt(t){return kt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},kt(t)}function Lt(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */Lt=function(){return t};var t={},e=Object.prototype,r=e.hasOwnProperty,n=Object.defineProperty||function(t,e,r){t[e]=r.value},o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",a=o.asyncIterator||"@@asyncIterator",c=o.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function u(t,e,r,o){var i=e&&e.prototype instanceof p?e:p,a=Object.create(i.prototype),c=new O(o||[]);return n(a,"_invoke",{value:x(t,r,c)}),a}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}t.wrap=u;var f={};function p(){}function d(){}function h(){}var v={};s(v,i,(function(){return this}));var m=Object.getPrototypeOf,y=m&&m(m(_([])));y&&y!==e&&r.call(y,i)&&(v=y);var g=h.prototype=p.prototype=Object.create(v);function b(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function w(t,e){function o(n,i,a,c){var s=l(t[n],t,i);if("throw"!==s.type){var u=s.arg,f=u.value;return f&&"object"==kt(f)&&r.call(f,"__await")?e.resolve(f.__await).then((function(t){o("next",t,a,c)}),(function(t){o("throw",t,a,c)})):e.resolve(f).then((function(t){u.value=t,a(u)}),(function(t){return o("throw",t,a,c)}))}c(s.arg)}var i;n(this,"_invoke",{value:function(t,r){function n(){return new e((function(e,n){o(t,r,e,n)}))}return i=i?i.then(n,n):n()}})}function x(t,e,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return E()}for(r.method=o,r.arg=i;;){var a=r.delegate;if(a){var c=j(a,r);if(c){if(c===f)continue;return c}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=l(t,e,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===f)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}function j(t,e){var r=e.method,n=t.iterator[r];if(void 0===n)return e.delegate=null,"throw"===r&&t.iterator.return&&(e.method="return",e.arg=void 0,j(t,e),"throw"===e.method)||"return"!==r&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+r+"' method")),f;var o=l(n,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,f;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,f):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,f)}function k(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function L(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function O(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(k,this),this.reset(!0)}function _(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,o=function e(){for(;++n=0;--o){var i=this.tryEntries[o],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=r.call(i,"catchLoc"),s=r.call(i,"finallyLoc");if(c&&s){if(this.prev=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),L(r),f}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:_(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},t}function Ot(t,e,r,n,o,i,a){try{var c=t[i](a),s=c.value}catch(t){return void r(t)}c.done?e(s):Promise.resolve(s).then(n,o)}function _t(t){return function(){var e=this,r=arguments;return new Promise((function(n,o){var i=t.apply(e,r);function a(t){Ot(i,n,o,a,c,"next",t)}function c(t){Ot(i,n,o,a,c,"throw",t)}a(void 0)}))}}const Et={user:function(t,e){return _t(Lt().mark((function t(){var r,n,o,i,a,c,s,u,l,f,p,d;return Lt().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r=Y(e),!F(e,!0)||!r){t.next=49;break}if(n=e.session.app.oauth,t.prev=3,o=null,"fb"!==n){t.next=11;break}return t.next=8,v=void 0,v=r.access_token,R()({baseURL:h.G,method:"get",url:"/me",params:{access_token:v,fields:"id,name,picture"}}).then((function(t){var e=t.data;return{oauthId:e.id,name:e.name,img:e.picture.data.url}}));case 8:o=t.sent,t.next=21;break;case 11:if("wb"!==n){t.next=17;break}return t.next=14,M(r);case 14:o=t.sent,t.next=21;break;case 17:if("gh"!==n){t.next=21;break}return t.next=20,B(r);case 20:o=t.sent;case 21:return a=(i=o).name,c=i.oauthId,t.next=24,mt(n,c);case 24:if(!(s=t.sent)){t.next=37;break}return u=s.isAdmin,l=s.userId,e.session.app.dbInfo={id:l,name:a,isAdmin:u},t.next=30,ft(l);case 30:return f=t.sent,t.next=33,bt(l);case 33:return p=t.sent,t.next=36,gt(l);case 36:return t.abrupt("return",{name:a,isAdmin:u,img:o.img||null,likes:p,owns:f});case 37:return t.next=39,yt({oAuthId:c,oAuthType:n,name:a,isAdmin:!1,lastLogin:new Date});case 39:return d=t.sent,e.session.app.dbInfo={id:d,name:a,isAdmin:!1},t.abrupt("return",{name:a,isAdmin:!1,img:P()(o,"picture.data.url",null),likes:[],owns:[]});case 44:return t.prev=44,t.t0=t.catch(3),t.abrupt("return",new et.GraphQLError(t.t0.toString()));case 47:t.next=50;break;case 49:return t.abrupt("return",null);case 50:case"end":return t.stop()}var v}),t,null,[[3,44]])})))()},color:function(t,e){return _t(Lt().mark((function r(){var n,o;return Lt().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(n=t.category,H(e)||"ANONYMOUS"!==n){r.next=3;break}return r.abrupt("return",new et.GraphQLError("color error: no admin access"));case 3:return r.prev=3,r.next=6,lt(n);case 6:return o=r.sent,r.abrupt("return",o);case 10:return r.prev=10,r.t0=r.catch(3),r.abrupt("return",new et.GraphQLError(r.t0.toString()));case 13:case"end":return r.stop()}}),r,null,[[3,10]])})))()},likeColor:function(t,e){return _t(Lt().mark((function r(){var n,o,i,a,c;return Lt().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(n=t.input,o=n.id,i=n.willLike,r.prev=2,!F(e)){r.next=12;break}if(a=P()(e,"session.app.dbInfo.id",null),!i){r.next=10;break}return r.next=8,wt(a,o);case 8:r.next=12;break;case 10:return r.next=12,xt(a,o);case 12:if(!i){r.next=17;break}return r.next=15,ht(o);case 15:return c=r.sent,r.abrupt("return",{status:c});case 17:return r.abrupt("return",{status:0});case 20:return r.prev=20,r.t0=r.catch(2),r.abrupt("return",new et.GraphQLError(r.t0.toString()));case 23:case"end":return r.stop()}}),r,null,[[2,20]])})))()},createColor:function(t,e){return _t(Lt().mark((function r(){var n,o,i,a,c;return Lt().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(n=t.input,o=n.color,rt("#".concat(o))){r.next=4;break}return r.abrupt("return",new et.GraphQLError("create error: invalid color input"));case 4:return i=P()(e,"session.app.dbInfo.id",null),a=F(e)?i:null,r.prev=6,r.next=9,pt({star:(20*Math.random()).toFixed(),color:o,createdBy:void 0,hidden:!a,createdDate:new Date},a);case 9:return c=r.sent,r.abrupt("return",{status:0,data:c});case 13:return r.prev=13,r.t0=r.catch(6),r.abrupt("return",new et.GraphQLError(r.t0.toString()));case 16:case"end":return r.stop()}}),r,null,[[6,13]])})))()},adjudicateColor:function(t,e){return _t(Lt().mark((function r(){var n,o,i,a,c;return Lt().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(n=t.input,H(e)){r.next=3;break}return r.abrupt("return",new et.GraphQLError("adjudicate error: no admin access"));case 3:if(o=n.id,i=n.willLike,r.prev=4,!i){r.next=10;break}return r.next=8,dt(o);case 8:return a=r.sent,r.abrupt("return",{status:a});case 10:return r.next=12,vt(o);case 12:return c=r.sent,r.next=15,jt(o);case 15:return r.abrupt("return",{status:c});case 18:return r.prev=18,r.t0=r.catch(4),r.abrupt("return",new et.GraphQLError(r.t0.toString()));case 21:case"end":return r.stop()}}),r,null,[[4,18]])})))()}};const St=(0,et.buildSchema)("\n enum ColorCategory {\n PUBLIC\n ANONYMOUS\n }\n\n interface MutationResponse {\n status: Int!\n }\n\n type Color {\n id: ID!\n star: Int!\n color: String!\n userId: ID\n username: String\n createdDate: String\n }\n\n type User {\n img: String\n isAdmin: Boolean\n name: String\n likes: [ID!]\n owns: [ID!]\n }\n\n input LikeColorInputType {\n id: ID!\n willLike: Boolean!\n }\n \n input CreateColorInputType {\n color: String!\n }\n\n type LikeColorOutputType implements MutationResponse {\n status: Int!\n }\n\n type AdjudicateColorOutputType implements MutationResponse {\n status: Int!\n }\n\n type CreateColorOutputType implements MutationResponse {\n status: Int!\n data: ID!\n }\n\n type Mutation {\n likeColor(input: LikeColorInputType!): LikeColorOutputType\n createColor(input: CreateColorInputType!): CreateColorOutputType\n adjudicateColor(input: LikeColorInputType!): AdjudicateColorOutputType\n }\n \n type Query {\n color(category: ColorCategory!): [Color]\n user: User\n }\n\n schema {\n query: Query\n mutation: Mutation\n } \n"),Ct=(0,tt.graphqlHTTP)({schema:St,rootValue:Et,graphiql:!1,pretty:!1}),It=require("react-redux"),At=require("react-router-dom/server");var Pt=r(184);const Tt=require("react-dom/server");var Nt=r(991);const Rt=require("prop-types");var Dt=r.n(Rt);const qt=require("react"),Gt=require("react/jsx-runtime");var Ut="ColorPK v1",Mt="colorpk",Bt="Your Best Color Picker | 全球最大色彩搭配网站 | 颜色搭配 | 艺术设计",Ft="https://repository-images.githubusercontent.com/75897824/b1278e80-8704-11ea-9acf-ac166e4ad4fd";const Yt=function(){return(0,Gt.jsxs)(qt.Fragment,{children:[(0,Gt.jsx)("meta",{property:"og:title",content:Ut}),(0,Gt.jsx)("meta",{property:"og:type",content:"website"}),(0,Gt.jsx)("meta",{property:"og:url",content:"https://react.colorpk.com"}),(0,Gt.jsx)("meta",{property:"og:description",content:Bt}),(0,Gt.jsx)("meta",{property:"og:site_name",content:Mt}),(0,Gt.jsx)("meta",{property:"og:image",content:Ft}),(0,Gt.jsx)("meta",{property:"og:image:secure_url",content:Ft}),(0,Gt.jsx)("meta",{property:"og:image:type",content:"image/png"}),(0,Gt.jsx)("meta",{property:"og:image:width",content:1280}),(0,Gt.jsx)("meta",{property:"og:image:height",content:640}),(0,Gt.jsx)("meta",{property:"og:image:alt",content:Mt}),(0,Gt.jsx)("meta",{name:"twitter:card",content:"summary_large_image"}),(0,Gt.jsx)("meta",{name:"twitter:site",content:Mt}),(0,Gt.jsx)("meta",{name:"twitter:title",content:Ut}),(0,Gt.jsx)("meta",{name:"twitter:description",content:Bt}),(0,Gt.jsx)("meta",{name:"twitter:image",content:Ft}),(0,Gt.jsx)("meta",{name:"twitter:image:width",content:1280}),(0,Gt.jsx)("meta",{name:"twitter:image:height",content:640}),(0,Gt.jsx)("meta",{name:"twitter:image:alt",content:Mt})]})},Ht=require("serialize-javascript");var Qt=r.n(Ht),zt=function(t){var e=t.title,r=t.style,n=t.script,o=t.children,i=t.csrfToken,a=t.isVertical,c=t.languageCode,s=t.lastBuildDate,u=t.initState;return(0,Gt.jsxs)("html",{lang:"en",children:[(0,Gt.jsxs)("head",{children:[(0,Gt.jsx)("meta",{charSet:"utf-8"}),(0,Gt.jsx)("meta",{httpEquiv:"X-UA-Compatible",content:"IE=edge"}),(0,Gt.jsx)(Yt,{}),(0,Gt.jsx)("title",{children:e}),(0,Gt.jsx)("meta",{name:"description",content:"ColorPK | Faster lighter and nicer than colorhunt | 全球最大色彩搭配网站 | 颜色搭配 | 艺术设计"}),(0,Gt.jsx)("meta",{name:"viewport",content:"width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"}),(0,Gt.jsx)("meta",{name:"robots",content:"INDEX,FOLLOW"}),(0,Gt.jsx)("meta",{name:"keywords",content:"colorpk, colorpicker, color picker, palette, color combination"}),(0,Gt.jsx)("link",{rel:"shortcut icon",href:"//dkny.oss-cn-hangzhou.aliyuncs.com/3/fav.ico"}),(0,Gt.jsx)("link",{href:r,rel:"stylesheet"}),(0,Gt.jsx)("script",{dangerouslySetInnerHTML:{__html:"if(window.location.hostname.indexOf('colorpk.com') > -1){(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src='https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);})(window,document,'script','dataLayer','GTM-5LX6LV3');} var initLoadTime = Date.now();window.addEventListener('_COLORPK_SCRIPT_READY', function(){if(!Array.isArray(window.dataLayer)){return;} window.dataLayer.push({'scriptLoadingTime': Date.now() - initLoadTime});console.log('server last build: ".concat(s,"');});\n ")}})]}),(0,Gt.jsxs)("body",{children:[(0,Gt.jsx)("noscript",{children:(0,Gt.jsx)("iframe",{src:"https://www.googletagmanager.com/ns.html?id=GTM-5LX6LV3",height:"0",width:"0",style:{display:"none",visibility:"hidden"}})}),(0,Gt.jsx)("div",{id:"app",dangerouslySetInnerHTML:{__html:o}}),(0,Gt.jsx)("div",{id:Nt.yY}),(0,Gt.jsx)("div",{id:"csrf","data-token":i}),(0,Gt.jsx)("script",{dangerouslySetInnerHTML:{__html:"window.".concat(Nt.kl,"=").concat(Qt()(u),"; window.").concat(Nt.CT,'="').concat(c,'"; window.').concat(Nt.jl,"=").concat(a,"; ")}}),(0,Gt.jsx)("script",{src:n,type:"text/javascript"})]})]})};zt.propTypes={title:Dt().string.isRequired,isVertical:Dt().bool.isRequired,languageCode:Dt().string.isRequired,lastBuildDate:Dt().string.isRequired,style:Dt().string.isRequired,script:Dt().string.isRequired,children:Dt().string.isRequired,csrfToken:Dt().string.isRequired,initState:Dt().object.isRequired};const $t=zt,Vt={container:"uCFqZ"},Kt=require("react-router-dom"),Xt={selected:"EQXN2",translationText:"nzlHR",rotate:"MaSpR",iconWrapper:"iYPlb",wideScreenOnly:"m_HVm"};const Zt=function(){return(0,Gt.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 24 24",children:[(0,Gt.jsx)("title",{children:"translation"}),(0,Gt.jsx)("path",{d:"M0 0h24v24H0z",fill:"none"}),(0,Gt.jsx)("path",{d:" M12.87 15.07l-2.54-2.51.03-.03c1.74-1.94 2.98-4.17 3.71-6.53H17V4h-7V2H8v2H1v1.99h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z "})]})};var Wt=function(t){var e=t.languages,r=t.onChange;return(0,Gt.jsx)("div",{className:"navbar-dropdown",children:e.map((function(t){return(0,Gt.jsx)("a",{className:"navbar-item",onClick:function(){r(t.code)},children:t.name},t.code)}))})};Wt.propTypes={onChange:Dt().func.isRequired,languages:Dt().array.isRequired};const Jt=Wt;var te=function(t){var e=t.onClick;return(0,Gt.jsxs)("a",{role:"nav toggle btn",className:"navbar-burger burger","aria-label":"nav menu","aria-expanded":"false",onClick:e,children:[(0,Gt.jsx)("span",{"aria-hidden":"true"}),(0,Gt.jsx)("span",{"aria-hidden":"true"}),(0,Gt.jsx)("span",{"aria-hidden":"true"})]})};te.propTypes={onClick:Dt().func.isRequired};const ee=te;const re=function(){return(0,qt.useContext)(Se)};var ne=[],oe={},ie={};function ae(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,o,i,a,c=[],s=!0,u=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;s=!1}else for(;!(s=(n=i.call(r)).done)&&(c.push(n.value),c.length!==e);s=!0);}catch(t){u=!0,o=t}finally{try{if(!s&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(u)throw o}}return c}}(t,e)||function(t,e){if(!t)return;if("string"==typeof t)return ce(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);"Object"===r&&t.constructor&&(r=t.constructor.name);if("Map"===r||"Set"===r)return Array.from(t);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return ce(t,e)}(t,e)||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 ce(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);rt.length)&&(e=t.length);for(var r=0,n=new Array(e);r0&&" (".concat(r,")")]}),(0,Gt.jsx)(Kt.Link,{to:"/popular",className:"navbar-item ".concat(j?de:""),onClick:E,children:m.popular}),(0,Gt.jsx)(Kt.Link,{to:"/latest",className:"navbar-item ".concat(k?de:""),onClick:E,children:m.latest}),(0,Gt.jsxs)("div",{className:"navbar-item has-dropdown is-hoverable ".concat(Xt.wideScreenOnly),children:[(0,Gt.jsx)("a",{className:"navbar-link",children:m.more}),(0,Gt.jsxs)("div",{className:"navbar-dropdown",children:[(0,Gt.jsx)("a",{className:"navbar-item",href:"//www.colorpk.com",children:"ColorPK v2.0"}),(0,Gt.jsx)("a",{className:"navbar-item",href:"//www.colorpk.com/about",children:m.about}),(0,Gt.jsx)("hr",{className:"navbar-divider"}),(0,Gt.jsx)("a",{className:"navbar-item",href:"//github.com/im6/vp/issues",children:m.reportIssue})]})]}),(0,Gt.jsxs)("div",{className:"navbar-item has-dropdown is-hoverable",children:[(0,Gt.jsxs)("a",{className:"navbar-link",children:[(0,Gt.jsx)(Zt,{}),(0,Gt.jsx)("span",{className:Xt.translationText,children:m.language})]}),(0,Gt.jsx)(Jt,{languages:a,onChange:y})]})]}),(0,Gt.jsxs)("div",{className:"navbar-end",children:[!g&&(0,Gt.jsxs)("div",{className:"navbar-item has-dropdown is-hoverable",children:[(0,Gt.jsx)("a",{className:"navbar-link",children:m.navLogin}),(0,Gt.jsxs)("div",{className:"navbar-dropdown",children:[(0,Gt.jsx)("a",{className:"navbar-item",href:n,children:"微博"}),(0,Gt.jsx)("a",{className:"navbar-item",href:o,children:"GitHub"}),i&&(0,Gt.jsx)("a",{className:"navbar-item",href:i,children:"FaceBook"})]})]}),(0,Gt.jsx)("div",{className:"navbar-item",children:(0,Gt.jsxs)("div",{className:"buttons",children:[g&&(0,Gt.jsx)(Kt.Link,{className:"button is-danger",to:"/",onClick:function(){c(),E()},children:m.logOut}),!_&&(0,Gt.jsx)(Kt.Link,{to:"/new",className:"button is-primary",onClick:S,children:m.newColor})]})})]})]})]})};he.propTypes={detail:Dt().object,weiboUrl:Dt().string,githubUrl:Dt().string,facebookUrl:Dt().string,likeNum:Dt().number,languages:Dt().array.isRequired,onLogout:Dt().func.isRequired};const ve=he;const me=(0,It.connect)((function(t){var e=t.user,r=t.color,n=e.detail,o=e.weiboUrl,i=e.githubUrl,a=e.facebookUrl;return{detail:n,likeNum:r.liked.length,languages:ne,weiboUrl:o,githubUrl:i,facebookUrl:a}}),(function(t){return{onLogout:function(){var e=(0,Pt.createAction)("user/logoff");t(e())}}}))(ve);var ye=function(){return(0,Gt.jsx)("div",{className:"spinContainer",children:(0,Gt.jsx)("div",{className:"spinLoader"})})};const ge=(0,qt.memo)(ye);function be(t){return be="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},be(t)}function we(t,e){for(var r=0;rt.length)&&(e=t.length);for(var r=0,n=new Array(e);r".concat(p))};var Te=i()();C(),Te.set("trust proxy",!0),Te.use(n()({contentSecurityPolicy:!1,crossOriginEmbedderPolicy:!1})),Te.use((0,a.json)()),Te.use((0,a.urlencoded)({extended:!1})),Te.use(s()()),Te.use(w);var Ne=r(619).Z;h.TM.forEach((function(t){Te.get(t,Ne)})),Te.get("/_ah/:action",(function(t,e){var r=t.params.action;e.json({status:"".concat(r," - ok")})})),Te.use(J),Te.post("/graphql",Ct),Te.get("/auth/logout",(function(t,e){var r=P()(t,"session.app.dbInfo.name","unknown");console.log("logoff (".concat(r,"), delete session")),delete t.session.app;var n=(0,T.v1)();t.session.app={oauthState:n},e.json({weiboUrl:D("wb",n),githubUrl:D("gh",n),facebookUrl:D("fb",n)})})),Te.get("/auth/:oauth",V),["/","/latest","/popular","/color/:id","/new","/like"].forEach((function(t){Te.get(t,Pe)})),Te.get("/portfolio",(function(t,e,r){F(t)?r():r(401)}),Pe),Te.get("/adminpanel",(function(t,e,r){H(t)?r():r(403)}),Pe),Te.use((function(t,e){console.error("Error: 404, ".concat(t.url," not found")),e.status(400).sendFile(X)})),Te.use((function(t,e,r,n){console.error("Error: ".concat(t.toString(),", ").concat(e.url)),"POST"===e.method?r.status(400).json({errors:!0}):r.status(400).sendFile(X)}));Te.listen(h.px,(function(){return console.log("app (mode: ".concat("production",") is running on: http://localhost:").concat(h.px))})).timeout=5e3,(0,t.exec)("curl ifconfig.me",(function(t,e,r){t?console.error(r):console.log("public IP addr: ".concat(e))}))})()})(); \ No newline at end of file diff --git a/package.json b/package.json index 7d53df5..d44be8b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "vp", - "version": "1.29.0", + "version": "1.30.0", "description": "source code of react.colorpk.com", "engines": { "node": ">= 16.x" diff --git a/src/components/Html.jsx b/src/components/Html.jsx index 20282ac..d1a5aeb 100644 --- a/src/components/Html.jsx +++ b/src/components/Html.jsx @@ -45,7 +45,7 @@ const Html = ({