fa-toolkit
Version:
a devtool for fast app
1 lines • 12.7 kB
JavaScript
"use strict";var _0xbad6b0=_0x48a7;function _typeof(r){var e=_0x48a7;return(_typeof=e(438)==typeof Symbol&&e(426)==typeof Symbol[e(369)]?function(r){return typeof r}:function(r){var t=e;return r&&"function"==typeof Symbol&&r[t(376)]===Symbol&&r!==Symbol[t(458)]?t(426):typeof r})(r)}function _slicedToArray(r,t){return _arrayWithHoles(r)||_iterableToArrayLimit(r,t)||_unsupportedIterableToArray(r,t)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError(_0x48a7(445))}function _unsupportedIterableToArray(r,t){var e=_0x48a7;if(r){if(typeof r===e(374))return _arrayLikeToArray(r,t);var n=Object[e(458)][e(378)][e(441)](r).slice(8,-1);return(n=n===e(372)&&r[e(376)]?r[e(376)][e(371)]:n)===e(433)||n===e(461)?Array[e(417)](r):n===e(411)||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/[e(432)](n)?_arrayLikeToArray(r,t):void 0}}function _0x48a7(r,t){var e=_0x197f();return(_0x48a7=function(r,t){return e[r-=349]})(r,t)}function _arrayLikeToArray(r,t){(null==t||t>r[_0x48a7(437)])&&(t=r.length);for(var e=0,n=new Array(t);e<t;e++)n[e]=r[e];return n}function _iterableToArrayLimit(r,t){var e=_0x48a7,n=null==r?null:"undefined"!=typeof Symbol&&r[Symbol[e(369)]]||r[e(414)];if(null!=n){var i,a,o,u,c=[],s=!0,f=!1;try{if(o=(n=n[e(441)](r))[e(467)],0===t){if(Object(n)!==n)return;s=!1}else for(;!(s=(i=o[e(441)](n))[e(471)])&&(c[e(350)](i[e(446)]),c.length!==t);s=!0);}catch(r){f=!0,a=r}finally{try{if(!s&&null!=n[e(429)]&&(u=n[e(429)](),Object(u)!==u))return}finally{if(f)throw a}}return c}}function _arrayWithHoles(r){if(Array.isArray(r))return r}function _regeneratorRuntime(){var s=_0x48a7;_regeneratorRuntime=function(){return u};var u={},r=Object.prototype,f=r[s(439)],p=Object[s(413)]||function(r,t,e){r[t]=e[s(446)]},t="function"==typeof Symbol?Symbol:{},a=t.iterator||s(414),e=t[s(419)]||s(381),n=t[s(360)]||"@@toStringTag";function i(r,t,e){return Object[s(413)](r,t,{value:e,enumerable:!0,configurable:!0,writable:!0}),r[t]}try{i({},"")}catch(r){i=function(r,t,e){return r[t]=e}}function c(r,t,e,n){var a,o,u,c,i=s,t=t&&t[i(458)]instanceof y?t:y,t=Object.create(t[i(458)]),n=new x(n||[]);return p(t,i(408),{value:(a=r,o=e,u=n,c="suspendedStart",function(r,t){var e=_0x48a7;if(e(451)===c)throw new Error(e(423));if("completed"===c){if(e(404)===r)throw t;return j()}for(u[e(465)]=r,u[e(365)]=t;;){var n=u[e(449)];if(n){var i=function r(t,e){var n=s,i=e[n(465)],a=t[n(369)][i];if(void 0===a)return e[n(449)]=null,n(404)===i&&t[n(369)][n(429)]&&(e[n(465)]=n(429),e[n(365)]=void 0,r(t,e),n(404)===e[n(465)])||n(429)!==i&&(e[n(465)]=n(404),e[n(365)]=new TypeError(n(428)+i+n(395))),l;a=h(a,t[n(369)],e[n(365)]);if(n(404)===a.type)return e[n(465)]=n(404),e[n(365)]=a[n(365)],e[n(449)]=null,l;var a=a[n(365)];return a?a[n(471)]?(e[t[n(354)]]=a[n(446)],e[n(467)]=t.nextLoc,n(429)!==e[n(465)]&&(e[n(465)]="next",e[n(365)]=void 0),e[n(449)]=null,l):a:(e.method=n(404),e.arg=new TypeError(n(406)),e[n(449)]=null,l)}(n,u);if(i){if(i===l)continue;return i}}if(e(467)===u[e(465)])u[e(407)]=u[e(412)]=u[e(365)];else if(e(404)===u[e(465)]){if(e(409)===c)throw c="completed",u.arg;u[e(391)](u.arg)}else e(429)===u[e(465)]&&u[e(453)]("return",u[e(365)]);c=e(451);i=h(a,o,u);if(e(440)===i[e(379)]){if(c=u[e(471)]?e(386):e(468),i[e(365)]===l)continue;return{value:i[e(365)],done:u[e(471)]}}"throw"===i[e(379)]&&(c="completed",u[e(465)]="throw",u.arg=i[e(365)])}})}),t}function h(r,t,e){var n=s;try{return{type:"normal",arg:r[n(441)](t,e)}}catch(r){return{type:"throw",arg:r}}}u[s(431)]=c;var l={};function y(){}function o(){}function v(){}var d={};i(d,a,function(){return this});t=Object[s(418)],t=t&&t(t(A([])));t&&t!==r&&f.call(t,a)&&(d=t);var _=v[s(458)]=y.prototype=Object.create(d);function m(r){var t=s;["next",t(404),t(429)][t(382)](function(t){i(r,t,function(r){return this._invoke(t,r)})})}function b(u,c){var t,i=s;p(this,i(408),{value:function(e,n){function r(){return new c(function(r,t){!function t(r,e,n,i){var a=_0x48a7,r=h(u[r],u,e);if(a(404)!==r.type){var o=r[a(365)],e=o.value;return e&&a(363)==_typeof(e)&&f[a(441)](e,a(366))?c[a(383)](e[a(366)])[a(447)](function(r){t(a(467),r,n,i)},function(r){t("throw",r,n,i)}):c[a(383)](e)[a(447)](function(r){o[a(446)]=r,n(o)},function(r){return t(a(404),r,n,i)})}i(r[a(365)])}(e,n,r,t)})}return t=t?t[i(447)](r,r):r()}})}function g(r){var t=s,e={tryLoc:r[0]};1 in r&&(e[t(452)]=r[1]),2 in r&&(e[t(415)]=r[2],e[t(357)]=r[3]),this[t(394)][t(350)](e)}function w(r){var t=s,e=r[t(425)]||{};e[t(379)]=t(440),delete e.arg,r.completion=e}function x(r){var t=s;this[t(394)]=[{tryLoc:t(456)}],r[t(382)](g,this),this[t(359)](!0)}function A(e){var n=s;if(e){var r=e[a];if(r)return r[n(441)](e);if(n(438)==typeof e.next)return e;if(!isNaN(e[n(437)])){var i=-1,r=function r(){for(var t=n;++i<e[t(437)];)if(f.call(e,i))return r.value=e[i],r.done=!1,r;return r[t(446)]=void 0,r.done=!0,r};return r.next=r}}return{next:j}}function j(){return{value:void 0,done:!0}}return o.prototype=v,p(_,s(376),{value:v,configurable:!0}),p(v,"constructor",{value:o,configurable:!0}),o[s(380)]=i(v,n,s(421)),u[s(466)]=function(r){var t=s,r="function"==typeof r&&r[t(376)];return!!r&&(r===o||t(421)===(r.displayName||r[t(371)]))},u[s(436)]=function(r){var t=s;return Object[t(410)]?Object[t(410)](r,v):(r[t(444)]=v,i(r,n,t(421))),r[t(458)]=Object.create(_),r},u[s(420)]=function(r){return{__await:r}},m(b[s(458)]),i(b.prototype,e,function(){return this}),u[s(457)]=b,u[s(355)]=function(r,t,e,n,i){var a=s;void 0===i&&(i=Promise);var o=new b(c(r,t,e,n),i);return u.isGeneratorFunction(t)?o:o[a(467)]()[a(447)](function(r){var t=a;return r.done?r[t(446)]:o[t(467)]()})},m(_),i(_,n,"Generator"),i(_,a,function(){return this}),i(_,s(378),function(){return s(459)}),u[s(396)]=function(r){var t,n=s,i=Object(r),a=[];for(t in i)a[n(350)](t);return a[n(387)](),function r(){for(var t=n;a.length;){var e=a[t(368)]();if(e in i)return r[t(446)]=e,r[t(471)]=!1,r}return r[t(471)]=!0,r}},u.values=A,x[s(458)]={constructor:x,reset:function(r){var t=s;if(this[t(405)]=0,this[t(467)]=0,this[t(407)]=this._sent=void 0,this[t(471)]=!1,this.delegate=null,this[t(465)]=t(467),this[t(365)]=void 0,this[t(394)].forEach(w),!r)for(var e in this)"t"===e[t(434)](0)&&f[t(441)](this,e)&&!isNaN(+e[t(370)](1))&&(this[e]=void 0)},stop:function(){var r=s;this[r(471)]=!0;var t=this.tryEntries[0][r(425)];if(r(404)===t.type)throw t[r(365)];return this[r(389)]},dispatchException:function(n){var i=s;if(this[i(471)])throw n;var a=this;function r(r,t){var e=i;return o.type=e(404),o.arg=n,a.next=r,t&&(a[e(465)]=e(467),a.arg=void 0),!!t}for(var t=this[i(394)][i(437)]-1;0<=t;--t){var e=this.tryEntries[t],o=e[i(425)];if(i(456)===e[i(361)])return r(i(463));if(e[i(361)]<=this.prev){var u=f[i(441)](e,i(452)),c=f[i(441)](e,i(415));if(u&&c){if(this[i(405)]<e[i(452)])return r(e[i(452)],!0);if(this[i(405)]<e.finallyLoc)return r(e[i(415)])}else if(u){if(this[i(405)]<e[i(452)])return r(e[i(452)],!0)}else{if(!c)throw new Error(i(403));if(this.prev<e.finallyLoc)return r(e[i(415)])}}}},abrupt:function(r,t){for(var e=s,n=this.tryEntries[e(437)]-1;0<=n;--n){var i=this[e(394)][n];if(i.tryLoc<=this.prev&&f[e(441)](i,e(415))&&this[e(405)]<i[e(415)]){var a=i;break}}var o=(a=a&&(e(356)===r||e(435)===r)&&a[e(361)]<=t&&t<=a[e(415)]?null:a)?a[e(425)]:{};return o[e(379)]=r,o[e(365)]=t,a?(this.method=e(467),this[e(467)]=a[e(415)],l):this[e(430)](o)},complete:function(r,t){var e=s;if(e(404)===r[e(379)])throw r[e(365)];return e(356)===r.type||e(435)===r[e(379)]?this[e(467)]=r[e(365)]:e(429)===r[e(379)]?(this[e(389)]=this[e(365)]=r.arg,this[e(465)]=e(429),this[e(467)]=e(463)):e(440)===r.type&&t&&(this[e(467)]=t),l},finish:function(r){for(var t=s,e=this.tryEntries[t(437)]-1;0<=e;--e){var n=this[t(394)][e];if(n[t(415)]===r)return this[t(430)](n[t(425)],n.afterLoc),w(n),l}},catch:function(r){for(var t=s,e=this.tryEntries[t(437)]-1;0<=e;--e){var n=this[t(394)][e];if(n[t(361)]===r){var i,a=n[t(425)];return"throw"===a.type&&(i=a.arg,w(n)),i}}throw new Error(t(454))},delegateYield:function(r,t,e){var n=s;return this[n(449)]={iterator:A(r),resultName:t,nextLoc:e},n(467)===this[n(465)]&&(this[n(365)]=void 0),l}},u}function asyncGeneratorStep(r,t,e,n,i,a,o){var u=_0x48a7;try{var c=r[a](o),s=c[u(446)]}catch(r){return void e(r)}c[u(471)]?t(s):Promise.resolve(s).then(n,i)}function _asyncToGenerator(c){return function(){var r=this,u=arguments;return new Promise(function(t,e){var n=_0x48a7,i=c[n(442)](r,u);function a(r){asyncGeneratorStep(i,t,e,a,o,n(467),r)}function o(r){asyncGeneratorStep(i,t,e,a,o,"throw",r)}a(void 0)})}}function _0x197f(){var r=["slice","name","Object","assets","string","4thdQPQ","constructor","statSync","toString","type","displayName","@@asyncIterator","forEach","resolve","composite","11336wSqIxS","completed","reverse","some","rval","existsSync","dispatchException","jimp","read","tryEntries","' method","keys",'ERROR: manifest.json configuration item "icon" ',"20MABPlV","mkdirSync",'only support "png, jpg, jpeg" format when you build the beta version.',"5845LGhrAw","3391888LxiOAt","try statement without catch or finally","throw","prev","iterator result is not an object","sent","_invoke","suspendedStart","setPrototypeOf","Arguments","_sent","defineProperty","@@iterator","finallyLoc","jpeg","from","getPrototypeOf","asyncIterator","awrap","GeneratorFunction","stop","Generator is already running","849552ndVMrS","completion","symbol","but the logo image in current project do not support adding watermarks.","The iterator does not provide a '","return","complete","wrap","test","Map","charAt","continue","mark","length","function","hasOwnProperty","normal","call","apply","join","__proto__","Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.","value","then","isFile","delegate","jpg","executing","catchLoc","abrupt","illegal catch attempt","height","root","AsyncIterator","prototype","[object Generator]","resize","Set","17786989SBltYi","end","ERROR: The app logo of the beta version needs watermark, ","method","isGeneratorFunction","next","suspendedYield","BLEND_SOURCE_OVER","70CMMsDj","done","672wtjJhz","push","bitmap","width","620865mDdIpV","resultName","async","break","afterLoc","beta.png","reset","toStringTag","tryLoc","writeAsync","object","411435uXfYZm","arg","__await","AUTO","pop","iterator"];return(_0x197f=function(){return r})()}!function(){for(var r=_0x48a7,t=_0x197f();;)try{if(698059==-parseInt(r(375))*(-parseInt(r(385))/2)+parseInt(r(424))/3+-parseInt(r(398))/4*(parseInt(r(364))/5)+parseInt(r(349))/6*(parseInt(r(401))/7)+-parseInt(r(402))/8+-parseInt(r(353))/9*(parseInt(r(470))/10)+parseInt(r(462))/11)break;t.push(t.shift())}catch(r){t.push(t.shift())}}();var _path=require("path"),_fs=require("fs"),Jimp=require(_0xbad6b0(392)),WATERMARK_PATH=_path[_0xbad6b0(443)](__dirname,"..",_0xbad6b0(373),_0xbad6b0(358)),WATERMARK_RATIO=.62,MARGIN_PERCENTAGE=.38;function addWatermark(r,t){return _addWatermark[_0xbad6b0(442)](this,arguments)}function _addWatermark(){return(_addWatermark=_asyncToGenerator(_regeneratorRuntime().mark(function r(e,n){var i=_0x48a7;return _regeneratorRuntime()[i(431)](function(r){for(var t=i;;)switch(r[t(405)]=r[t(467)]){case 0:if(mkParentDir(_path.join(n,"..")),_fs[t(390)](e)&&isSupportedType(e))return r[t(405)]=2,r[t(467)]=5,jimpMarker(e,WATERMARK_PATH,n);r.next=10;break;case 5:r[t(467)]=10;break;case 7:throw r[t(405)]=7,r.t0=r.catch(2),t(464)+t(427);case 10:case t(463):return r[t(422)]()}},r,null,[[2,7]])}))).apply(this,arguments)}function jimpMarker(r,t,e){return _jimpMarker.apply(this,arguments)}function _jimpMarker(){var r=_0xbad6b0;return(_jimpMarker=_asyncToGenerator(_regeneratorRuntime()[r(436)](function r(e,n,i){var a,o,u,c;return _regeneratorRuntime().wrap(function(r){for(var t=_0x48a7;;)switch(r[t(405)]=r[t(467)]){case 0:return r[t(467)]=2,Promise.all([Jimp[t(393)](e),Jimp[t(393)](n)]);case 2:return u=r[t(407)],c=_slicedToArray(u,2),a=c[0],(o=c[1])[t(460)](a[t(351)].width*WATERMARK_RATIO,Jimp[t(367)]),u=a.bitmap[t(352)]*MARGIN_PERCENTAGE,c=a[t(351)][t(352)]*MARGIN_PERCENTAGE,u=a[t(351)].width-o[t(351)].width-u,c=a[t(351)][t(455)]-o[t(351)][t(455)]-c,a[t(384)](o,u,c,[{mode:Jimp[t(469)],opacitySource:.1,opacityDest:1}]),r[t(467)]=14,a[t(362)](i);case 14:case t(463):return r.stop()}},r)})))[r(442)](this,arguments)}function isSupportedType(r){var t=_0xbad6b0,e=["png",t(450),t(416)],n=r.split(".")[t(368)]();if(!e[t(388)](function(r){return n===r}))throw t(397)+t(400);return!0}function mkParentDir(r){var t,e=_0xbad6b0;_fs[e(390)](r)&&_fs.statSync(r).isDirectory()||(t=_path.join(r,".."),_fs[e(390)](t)&&!_fs[e(377)](t)[e(448)]()||mkParentDir(t),_fs[e(399)](r))}module.exports={addWatermark:addWatermark};