helper-js
Advanced tools
Comparing version 1.4.4 to 1.4.5
/*! | ||
* helper-js v1.4.4 | ||
* helper-js v1.4.5 | ||
* (c) phphe <phphe@outlook.com> (https://github.com/phphe) | ||
@@ -2094,3 +2094,3 @@ * Released under the MIT License. | ||
// id | ||
function CrossWindowEventProcessor(timeout) { | ||
function CrossWindowEventProcessor(opt) { | ||
var _this7; | ||
@@ -2110,3 +2110,6 @@ | ||
_this7.timeout = timeout; | ||
if (opt) { | ||
Object.assign(_assertThisInitialized(_this7), opt); | ||
} | ||
onDOM(window, 'storage', function (ev) { | ||
@@ -2113,0 +2116,0 @@ if (ev.key === _this7.storageName) { |
/*! | ||
* helper-js v1.4.4 | ||
* helper-js v1.4.5 | ||
* (c) phphe <phphe@outlook.com> (https://github.com/phphe) | ||
@@ -2090,3 +2090,3 @@ * Released under the MIT License. | ||
// id | ||
function CrossWindowEventProcessor(timeout) { | ||
function CrossWindowEventProcessor(opt) { | ||
var _this7; | ||
@@ -2106,3 +2106,6 @@ | ||
_this7.timeout = timeout; | ||
if (opt) { | ||
Object.assign(_assertThisInitialized(_this7), opt); | ||
} | ||
onDOM(window, 'storage', function (ev) { | ||
@@ -2109,0 +2112,0 @@ if (ev.key === _this7.storageName) { |
/*! | ||
* helper-js v1.4.4 | ||
* helper-js v1.4.5 | ||
* (c) phphe <phphe@outlook.com> (https://github.com/phphe) | ||
* Released under the MIT License. | ||
*/ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self)["helper-js"]={})}(this,function(e){"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function o(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function c(e,t){return(c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function u(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function l(e,t,n){return(l="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=a(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(n):o.value}})(e,t,n||e)}function s(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var f={};function d(){if(f.glb)return f.glb;var e;try{e=global}catch(t){e=window}return f.glb=e,e}function v(e){return void 0!==e}function p(e){return"[object Array]"===Object.prototype.toString.call(e)}function h(e){return"[object Boolean]"===Object.prototype.toString.call(e)}function y(e){return"[object Number]"===Object.prototype.toString.call(e)}function g(e){return isFinite(e)&&!isNaN(parseFloat(e))}function m(e){return"[object String]"===Object.prototype.toString.call(e)}function w(e){return"[object Object]"===Object.prototype.toString.call(e)}function b(e){return"function"==typeof e}function x(e,t){return 1===arguments.length&&(t=e,e=0),Math.floor(Math.random()*(t-e+1)+e)}function O(e,t){return e<t?e:t}function S(e){return e&&e[0].toUpperCase()+e.substr(1)}function j(e){return e.replace(/ /g,"-").replace(/_/g,"-").replace(/([A-Z])/g,"-$1").replace(/--+/g,"-").replace(/^-|-$|/g,"").toLowerCase()}function E(e){for(var t=e.toString().split(/[-_]/),n=1;n<t.length;n++)t[n]=S(t[n]);return t.join("")}function P(e){return e.toString().trim().split(/(?=[A-Z])/)}function k(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:8,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n="",r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",o=0;o<e;o++)n+=r[x(r.length-1)];return t+n}function A(e,t){for(var n,r=0;(n=e.indexOf(t))>-1;)e.splice(n,1),r++;return r}function _(e){return e[e.length-1]}function T(e){return p(e)?e:[e]}function C(e,t){var n=[];if(b(t))for(var r=t,o=1,i=0;i<e.length;){var a=i+r(o);n.push(e.slice(i,a)),i=a,o++}else for(var c=0;c<e.length;){var u=c+t;n.push(e.slice(c,u)),c=u}return n}function I(e,t,n){var r=p(t)?t:t.split("."),o=e;try{var i=!0,a=!1,c=void 0;try{for(var u,l=r[Symbol.iterator]();!(i=(u=l.next()).done);i=!0){o=o[u.value]}}catch(e){a=!0,c=e}finally{try{i||null==l.return||l.return()}finally{if(a)throw c}}}catch(e){if(n)throw"Path does not exist"}return o}function N(e,t){for(var n={},r=e.length,o=0;o<r;o++){var i=e[o];n[b(t)?t(i,o):i[t]]=i}return n}function L(e){var t,n,r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=[],a=[],c=function(){for(var c=this,u=arguments.length,l=new Array(u),f=0;f<u;f++)l[f]=arguments[f];return new Promise(function(u,f){i.push(u),a.push(f),r=l,n||(n=!0,t=setTimeout(function(){var o=e.call.apply(e,[c].concat(s(r)));t=null,n=!1,i.forEach(function(e){return e(o)}),i=[],a=[]},o))})};return c.stop=function(){t&&(clearTimeout(t),t=null),n=!1,i=[],a.forEach(function(e){return e()}),a=[]},c}function R(e){var t,n,r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=function(){var i=this;return new Promise(function(a,c){n?a(r):(n=!0,a(r=e.call.apply(e,[i].concat(s(lastArgs)))),t=setTimeout(function(){t=null,n=!1,r=null},o))})};return i.stop=function(){t&&(clearTimeout(t),t=null),n=!1},i}function M(){if("undefined"!=typeof pageYOffset)return{top:pageYOffset,left:pageXOffset};var e=document.body,t=document.documentElement;return{top:(t=t.clientHeight?t:e).scrollTop,left:t.scrollLeft}}function B(e){var t=e.getBoundingClientRect(),n=M();return{x:t.left+n.left,y:t.top+n.top}}function D(e){var t=e.offsetParent;return(!t||t===document.body&&"static"===getComputedStyle(document.body).position)&&(t=document.body.parentElement),t}function F(e,t,n){for(var r=n&&n.withSelf?e:e.parentElement;r;){var o=t(r);if("break"===o)return;if(o)return r;r=r.parentElement}}function H(e,t){return e.classList?e.classList.contains(t):new RegExp("(^| )"+t+"( |$)","gi").test(e.className)}function W(e,t,n){for(var r=arguments.length,o=new Array(r>3?r-3:0),i=3;i<r;i++)o[i-3]=arguments[i];e.addEventListener?e.addEventListener.apply(e,[t,n].concat(o)):e.attachEvent&&e.attachEvent.apply(e,["on".concat(t),n].concat(o))}function U(e,t,n){for(var r=arguments.length,o=new Array(r>3?r-3:0),i=3;i<r;i++)o[i-3]=arguments[i];e.removeEventListener?e.removeEventListener.apply(e,[t,n].concat(o)):e.detachEvent&&e.detachEvent.apply(e,["on".concat(t),n].concat(o))}function q(e,t,n,r,o){var i,a,c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1e3;null==n&&(n=0,r=e.length-1);for(var u,l=0;n>=0&&n<=r;){if(l>=c)throw Error("binarySearch: loop times is over ".concat(c,", you can increase the limit."));if((u=t(a=e[i=Math.floor((r-n)/2+n)],l))>0)r=i-1;else{if(!(u<0))return{index:i,value:a,count:l+1,hit:!0};n=i+1}l++}return o?{index:i,value:a,count:l+1,hit:!1,bigger:u>0}:null}function z(e,t){return new Promise(function(n,r){setTimeout(function(){t&&t(),n()},e)})}function G(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};d().open(e,t,Object.keys(n).map(function(e){return"".concat(e,"=").concat(n[e])}).join(","))}var J=function(){function e(t){var r=this;n(this,e),i(this,"baseUrl",""),i(this,"search",{});var o=decodeURI(t).split("?");this.baseUrl=o[0],o[1]&&o[1].split("&").forEach(function(e){var t=e.split("=");r.search[t[0]]=null==t[1]?"":decodeURIComponent(t[1])})}return o(e,[{key:"getHref",value:function(){var e=this,t=[this.baseUrl],n=Object.keys(this.search).map(function(t){return"".concat(t,"=").concat(encodeURIComponent(e.search[t]))}).join("&");return n&&t.push(n),t.join("?")}}]),e}();function $(e){return{storage:e,set:function(e,t,n){null==t?this.storage.removeItem(e):this.storage.setItem(e,JSON.stringify({value:t,expired_at:n?(new Date).getTime()+60*n*1e3:null}))},get:function(e){var t=this.storage.getItem(e);if(t){if(!(t=JSON.parse(t)).expired_at||t.expired_at>(new Date).getTime())return t.value;this.storage.removeItem(e)}return null},clear:function(){this.storage.clear()}}}var Q=function(){function e(){n(this,e),i(this,"eventStore",[])}return o(e,[{key:"on",value:function(e,t){this.eventStore.push({name:e,handler:t})}},{key:"once",value:function(e,t){var n=this,r=function(){n.off(e,o)},o=function(){t.apply(void 0,arguments),r()};return this.on(e,o),r}},{key:"onceTimeout",value:function(e,t,n){var r,o=this;return{off:function(){r&&r()},promise:new Promise(function(i,a){r=o.once(e,function(){t.apply(void 0,arguments),i()}),z(n).then(function(){r(),a()})})}}},{key:"off",value:function(e,t){for(var n=[],r=this.eventStore.length,o=0;o<r;o++){var i=this.eventStore[o];i.name===e&&i.handler===t&&n.unshift(o)}for(var a=0,c=n;a<c.length;a++){var u=c[a];this.eventStore.splice(u,1)}}},{key:"emit",value:function(e){var t=[],n=!0,r=!1,o=void 0;try{for(var i,a=this.eventStore[Symbol.iterator]();!(n=(i=a.next()).done);n=!0){var c=i.value;c.name===e&&t.push(c)}}catch(e){r=!0,o=e}finally{try{n||null==a.return||a.return()}finally{if(r)throw o}}for(var u=arguments.length,l=new Array(u>1?u-1:0),s=1;s<u;s++)l[s-1]=arguments[s];for(var f=0,d=t;f<d.length;f++){var v=d[f];v.handler.apply(v,l)}}}]),e}(),Y=function(e){function t(e){var r,o,c;return n(this,t),o=this,c=a(t).call(this),r=!c||"object"!=typeof c&&"function"!=typeof c?u(o):c,i(u(r),"storageName","_crossWindow"),i(u(r),"windows",[]),i(u(r),"timeout",200),i(u(r),"BROADCAST","__BROADCAST__"),r.timeout=e,W(window,"storage",function(e){if(e.key===r.storageName){var t,n=JSON.parse(e.newValue);if(!n.targets||n.targets.includes(r.id))(t=r).emitLocal.apply(t,[n.name].concat(s(n.args)))}}),r.id=k(),r.windows=[r.id],r.ready=new Promise(function(e,t){r.onceTimeout("_windows_updated",function(e){var t=e.windows;r.windows=t},r.timeout).promise.then(function(){e()},function(){e()}),r.broadcast("_join",r.id)}),r.ready.then(function(){r.on("_join",function(e){r.windows.push(e),r.isMain()&&r.broadcast("_windows_updated",{windows:r.windows,type:"join",id:e})}),r.on("_windows_updated",function(e){var t=e.windows;r.windows=t}),r.on("_exit",function(e){var t=r.windows[0];A(r.windows,e),r.isMain()&&(r.emit("_windows_updated",{windows:r.windows,type:"exit",id:e}),t!=r.id&&(console.log("_main_updated"),r.emit("_main_updated",{windows:r.windows,old:t,new:r.id})))}),W(window,"beforeunload",function(){r.exitGroup()})}),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&c(e,t)}(t,Q),o(t,[{key:"isMain",value:function(){return this.id===this.windows[0]}},{key:"emitTo",value:function(e,n){for(var r=arguments.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];var c;n===this.BROADCAST?n=null:(n&&!p(n)&&(n=[n]),n.includes(this.id)&&(c=l(a(t.prototype),"emit",this)).call.apply(c,[this,e].concat(o)));d().localStorage.setItem(this.storageName,JSON.stringify({name:e,targets:n,args:o,random:Math.random()}))}},{key:"emitLocal",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];this.emitTo.apply(this,[e,this.id].concat(n))}},{key:"broadcast",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];this.emitTo.apply(this,[e,this.BROADCAST].concat(n))}},{key:"emit",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];this.emitTo.apply(this,[e,this.windows].concat(n))}},{key:"exitGroup",value:function(){this.broadcast("_exit",this.id)}}]),t}(),Z=Y;e.CrossWindow=Z,e.CrossWindowEventProcessor=Y,e.EventProcessor=Q,e.URLHelper=J,e.addClass=function(e,t){H(e,t)||(e.classList?e.classList.add(t):e.className+=" "+t)},e.arrayAt=function(e,t){return e[t>=0?t:e.length+t]},e.arrayDiff=function(e,t){for(var n=e.length,r=[];n--;)t.indexOf(e[n])<0&&r.push(e[n]);return r},e.arrayDistinct=function(e){return d().Set?s(new Set(e)):e.filter(function(e,t,n){return n.indexOf(e)===t})},e.arrayFirst=function(e){return e[0]},e.arrayLast=_,e.arrayRemove=A,e.arrayRemoveBySortedIndexes=function(e,t){for(var n=t.length-1;n>=0;n--){var r=t[n];e.splice(r,1)}},e.arraySibling=function(e,t,n){var r=e.indexOf(t);if(-1===r)throw"item is not in array";return p(n)?n.map(function(t){return e[r+t]}):e[r+n]},e.assignIfDifferent=function(e,t,n){e[t]!==n&&(e[t]=n)},e.backupAttr=function(e,t){e["original_".concat(t)]=e.getAttribute(t)},e.binarySearch=q,e.camelCase=E,e.camelToWords=P,e.cloneObj=function e(n,r){switch(t(n)){case"undefined":case"boolean":case"nuber":case"string":case"function":return n;case"object":if(null===n)return n;var o;if(p(n)){o=[];var i=!0,a=!1,c=void 0;try{for(var u,l=n[Symbol.iterator]();!(i=(u=l.next()).done);i=!0){var s=u.value;o.push(e(s,r))}}catch(e){a=!0,c=e}finally{try{i||null==l.return||l.return()}finally{if(a)throw c}}}else{o={};for(var f=0,d=Object.keys(n);f<d.length;f++){var v=d[f];r&&(!p(r)||r.includes(v))&&r(v,n[v],n)||(o[v]=e(n[v],r))}}return o;default:return n}},e.copyTextToClipboard=function(e){try{return void navigator.clipboard.writeText(e)}catch(e){}var t=document.createElement("textarea");t.style.position="fixed",t.style.top=0,t.style.left=0,t.style.width="2em",t.style.height="2em",t.style.padding=0,t.style.border="none",t.style.outline="none",t.style.boxShadow="none",t.style.background="transparent",t.value=e,document.body.appendChild(t),t.select();try{var n=document.execCommand("copy")?"successful":"unsuccessful";console.log("Copying text command was "+n)}catch(e){console.log("Oops, unable to copy")}document.body.removeChild(t)},e.debounce=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).immediate?R(e,t):L(e,t)},e.debounceImmediate=R,e.debounceTrailing=L,e.empty=function(e){return null==e||(null!=e.length?0===e.length:!h(e)&&(y(e)?isNaN(e):w(e)?0===Object.keys(e).length:void 0))},e.executeOnceInScopeByName=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:scope_executeOnceInScopeByName,r=arguments.length>3?arguments[3]:void 0;if(e="executeOnceInScopeByName_".concat(e),!n[e]){var o=t();n[e]={destroy:function(){delete n[e]}},r&&(n[e].value=o)}return n[e]},e.executePromiseGetters=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return{promise:new Promise(function(r,o){var i=[],a=C(e,n),c=Promise.resolve();a.forEach(function(e){c=c.then(function(n){if(n&&i.push.apply(i,s(n)),!t)return Promise.all(e.map(function(e){return e()}));o("stopped")})}),c.then(function(e){i.push.apply(i,s(e)),r(i)})}),destroy:function(){t=!0}}},e.executeWithCount=function(e){var t=0;return function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return e.call.apply(e,[this,t++].concat(r))}},e.findParent=F,e.forAll=function(e,t,n){if(n){if(p(e)||m(e))for(var r=e.length-1;r>=0&&!1!==t(e[r],r);r--);else if(w(e)){var o=Object.keys(e);o.reverse();for(var i=0,a=o;i<a.length;i++){var c=a[i];if(!1===t(e[c],c))break}}else if(Number.isInteger(e))for(var u=e-1;u>=0&&!1!==t(u,u);u--);}else if(p(e)||m(e))for(var l=0;l<e.length&&!1!==t(e[l],l);l++);else if(w(e))for(var s=0,f=Object.keys(e);s<f.length;s++){var d=f[s];if(!1===t(e[d],d))break}else if(Number.isInteger(e))for(var v=0;v<e&&!1!==t(v,v);v++);},e.getBorder=function(e){var t=document.body,n=F(e,function(e){return H(e,"work-area")}),r=B(n);return{left:r.x,right:r.x+n.offsetWidth,top:r.y+50,bottom:t.offsetHeight<d().innerHeight?d().innerHeight:t.offsetHeight}},e.getCss3Prefix=function(){return((arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).noCache||null==f.css3Prefix)&&(f.css3Prefix=function(){var e=document.createElement("div");e.style.cssText="-webkit-transition:all .1s; -moz-transition:all .1s; -o-transition:all .1s; -ms-transition:all .1s; transition:all .1s;";var t=e.style;return t.webkitTransition?"-webkit-":t.MozTransition?"-moz-":t.oTransition?"-o-":t.msTransition?"-ms-":""}()),f.css3Prefix},e.getElSize=function(e){var t=e.style.display;e.style.display="block";var n={width:e.offsetWidth,height:e.offsetHeight};return e.style.display=t,n},e.getLocalStorage2=function(){return f.localStorage2||(f.localStorage2=$(d().localStorage)),f.localStorage2},e.getOffset=B,e.getOffsetParent=D,e.getPosition=function(e){for(var t=D(e),n={x:e.offsetLeft,y:e.offsetTop},r=e;(r=r.parentElement)!==t&&r;)n.x-=r.scrollLeft,n.y-=r.scrollTop;return n},e.getPositionFromOffset=function(e,t){var n=B(D(e));return{x:t.x-n.x,y:t.y-n.y}},e.getScroll=M,e.getSessionStorage2=function(){return f.sessionStorage2||(f.sessionStorage2=$(d().sessionStorage)),f.sessionStorage2},e.getUrlParam=function(e){var t=document.location.href,n=t.indexOf(e+"=");if(-1==n)return!1;var r=t.slice(e.length+n+1),o=r.indexOf("&");return-1!=o&&(r=r.slice(0,o)),r},e.glb=d,e.groupArray=function(e,t){var n=new Map;e.forEach(function(e){var r=t(e);n.has(r)||n.set(r,[]),n.get(r).push(e)});var r=[];return n.forEach(function(e,t){r.push([t,e])}),r},e.hasClass=H,e.isArray=p,e.isBool=h,e.isDescendantOf=function(e,t){for(;;){if(null==e.parentElement)return!1;if(e.parentElement===t)return!0;e=e.parentElement}},e.isFunction=b,e.isNumber=y,e.isNumeric=g,e.isObject=w,e.isOffsetInEl=function(e,t,n){var r=B(n);return r.x<=e&&r.x+n.offsetWidth>=e&&r.y<=t&&r.y+n.offsetHeight>=t},e.isPromise=function(e){return"[object Promise]"===Object.prototype.toString.call(e)},e.isString=m,e.isset=v,e.joinMethods=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"value",r=!0,o=!1,i=void 0;try{for(var a,c=function(){var e=a.value,r=t;t=r?function(){for(var t=arguments.length,o=new Array(t),i=0;i<t;i++)o[i]=arguments[i];return e.call.apply(e,[this,"value"===n?r.call.apply(r,[this].concat(o)):r].concat(o))}:e},u=e[Symbol.iterator]();!(r=(a=u.next()).done);r=!0)c()}catch(e){o=!0,i=e}finally{try{r||null==u.return||u.return()}finally{if(o)throw i}}return t},e.jqFixedSize=function(e){var t=d().jQuery;t(e).each(function(){var e=t(this);e.css({width:e.width()+"px",height:e.height()+"px"})})},e.jqMakeCarousel=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1e3,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:16,i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"left",a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0;o.toString().match(/^\d+$/)&&(o+="px");var c=parseFloat(o),u=d().jQuery,l=u(e),s=l.find(t);l.css({position:"relative",height:l.height()+"px"});var f=s.find(n);f.css({margin:"0",marginRight:o});var v=(Math.ceil(f.width())+c)*f.length;s.css({position:"absolute",margin:"0",width:v+"px"});var p=s.height(),h=s.clone(),y=s.clone();s.css({left:0}),h.css({left:v+"px"}),y.css({left:2*v+"px"});var g=u("<div></div>");g.css({position:"absolute",width:3*v+"px",height:p+"px",left:0,top:a}),g.append(s).append(h).append(y),l.append(g);var m=0;!function e(){"left"===i?m-=100:m+=100,g.animate({left:"".concat(m,"px")},r,"linear",function(){Math.abs(m)>v&&("left"===i?m+=v:m-=v,g.css({left:m+"px"})),e()})}()},e.kebabCase=j,e.makeStorageHelper=$,e.mapObjectTree=function(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e4,o=0,i=[{value:e}],a=function(){if(o>=r)throw"mapObjectTree: limit(".concat(r,") reached, object may has circular reference");o++;var e=i.shift(),a=e.value,c=e.key,u=e.parent,l=e.newParent,s=t(a,c,u,l),f=function(e,t,r){return p(e)?e=[]:w(e)&&(e={}),u?p(l)&&r?l.push(e):l[t]=e:n=e,e},d=void 0,v=void 0,h=void 0,y=void 0,g=void 0;if(s){var m=s.key,b=s.value;v=b,s.delete||!1===m?h=!0:null==m?d=f(b,c,!0):s.hasOwnProperty("value")&&(d=f(b,m)),y=s.stop,g=s.skip}else v=a,d=f(a,c);if(h)return"continue";if(g)return"continue";if(y)return"break";if(p(v))for(var x=v.length,O=0;O<x;O++)i.push({value:v[O],key:O,parent:v,newParent:d});else w(v)&&Object.keys(v).forEach(function(e){i.push({value:v[e],key:e,parent:v,newParent:d})})};e:for(;i.length>0;)switch(a()){case"continue":continue;case"break":break e}return n},e.mapObjects=N,e.max=O,e.min=function(e,t){return e<t?t:e},e.newArrayRemoveAt=function(e,t){t=T(t);var n={},r=!0,o=!1,i=void 0;try{for(var a,c=t[Symbol.iterator]();!(r=(a=c.next()).done);r=!0)n[a.value]=!0}catch(e){o=!0,i=e}finally{try{r||null==c.return||c.return()}finally{if(o)throw i}}for(var u=[],l=e.length,s=0;s<l;s++)n[s]||u.push(e[s]);return u},e.numPad=function(e,t){for(var n=e.toString().length;n<t;)e="0"+e,n++;return e},e.numRand=x,e.objectExcept=function(e,t){var n={};for(var r in e)-1===t.indexOf(r)&&(n[r]=e[r]);return n},e.objectGet=I,e.objectMap=function(e,t){var n={};for(var r in e)n[r]=t(e[r],r,e);return n},e.objectMerge=function(e,t){for(var n in t)e.hasOwnProperty(n)&&w(e[n])&&w(t[n])?Object.assign(e[n],t[n]):e[n]=t[n];return e},e.objectOnly=function(e,t){var n={};for(var r in e)t.indexOf(r)>-1&&(n[r]=e[r]);return n},e.objectSet=function(e,t,n){var r=p(t)?t:t.split("."),o=_(r),i=I(e,r.slice(0,r.length-1));if(!i)throw"Path does not exist";i[o]=n},e.offDOM=U,e.onDOM=W,e.onDOMMany=function(e,t,n){e=T(e),t=T(t);for(var r=arguments.length,o=new Array(r>3?r-3:0),i=3;i<r;i++)o[i-3]=arguments[i];var a=!0,c=!1,u=void 0;try{for(var l,s=e[Symbol.iterator]();!(a=(l=s.next()).done);a=!0){var f=l.value,d=!0,v=!1,p=void 0;try{for(var h,y=t[Symbol.iterator]();!(d=(h=y.next()).done);d=!0){var g=h.value;W.apply(void 0,[f,g,n].concat(o))}}catch(e){v=!0,p=e}finally{try{d||null==y.return||y.return()}finally{if(v)throw p}}}}catch(e){c=!0,u=e}finally{try{a||null==s.return||s.return()}finally{if(c)throw u}}return function(){var r=!0,o=!1,i=void 0;try{for(var a,c=e[Symbol.iterator]();!(r=(a=c.next()).done);r=!0){var u=a.value,l=!0,s=!1,f=void 0;try{for(var d,v=t[Symbol.iterator]();!(l=(d=v.next()).done);l=!0)U(u,d.value,n)}catch(e){s=!0,f=e}finally{try{l||null==v.return||v.return()}finally{if(s)throw f}}}}catch(e){o=!0,i=e}finally{try{r||null==c.return||c.return()}finally{if(o)throw i}}}},e.openCenterWindow=function(e,t,n,r){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},i={width:n,height:r,top:(d().screen.availHeight-30-r)/2,left:(d().screen.availWidth-30-n)/2};Object.assign(i,o),G(e,t,i)},e.openWindow=G,e.pairRows=function(e,t,n,r){r||(r=n);var o=N(t,r);return e.map(function(e){return[e,o[e[n]]]})},e.promiseTimeout=function(e,t){return new Promise(function(n,r){var o,i;e.then(function(){clearTimeout(o),n.apply(void 0,arguments)},function(){i||(clearTimeout(o),r.apply(void 0,arguments))}),o=setTimeout(function(){i=!0;var e=new Error("Promise timeout!");e.name="timeout",r(e)},t)})},e.removeClass=function(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp("(^|\\b)"+t.split(" ").join("|")+"(\\b|$)","gi")," ")},e.removeEl=function(e){if(null!==e.parentNode)return e.parentNode.removeChild(e)},e.replaceMultiple=function(e,t){var n=new RegExp(Object.keys(e).join("|"),"g");return t.replace(n,function(t){return e[t]})},e.resolveArgsByType=function(e,t){var n=0;return t.map(function(t){var r,o;if(p(t)?(r=t[0],o=t[1]):(r=t,o=void 0),!b(r))if(null==r)r=function(){return!0};else{var i=r;r=function(e){return Object.prototype.toString.call(e)==="[object ".concat(i,"]")}}var a=e[n];return r(a)?(n++,a):o})},e.restoreAttr=function(e,t){var n="original_".concat(t);e.setAttribute(t,e[n])},e.retry=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;f.retry||(f.retry={});var r=e,o=function e(){var t=Math.random()+"";return r[t]?e():t}();return r[o]=0,function e(i,a,c){return t(i,a,c).then(function(e){return delete r[o],e}).catch(function(t){return r[o]++,r[o]>=n?(delete r[o],Promise.reject(t)):e(i,a,c)})}},e.setElChildByIndex=function(e,t,n){n.childComponentIndex=t;var r=e.childNodes.length;if(0===r)e.appendChild(n);else if(0===t)e.insertBefore(n,e.childNodes[0]);else{var o=q(e.childNodes,function(e){return e.childComponentIndex-t},0,O(t,r-1),!0),i=o.index,a=o.value;if(o.bigger)e.insertBefore(n,a);else{var c=e.childNodes[i+1];c?e.insertBefore(n,c):e.appendChild(n)}}},e.snakeCase=function(e){return j(e).replace(/-/g,"_")},e.splitArray=C,e.store=f,e.store_executeOnceInScopeByName={},e.strRand=k,e.studlyCase=S,e.titleCase=function(e){return P(S(E(e))).join(" ").replace(/\bid\b/gi,"ID")},e.toArrayIfNot=T,e.uniqueId=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"id_",n=t+k();f.uniqueId||(f.uniqueId={});var r=f.uniqueId;return document.getElementById(n)||r[n]?e(t):(r[n]=!0,n)},e.unset=function(e,t){e[t]=void 0;try{delete e[t]}catch(e){}},e.waitFor=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:100,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1e3;b(e)&&(r=n,n=g(t)?t:100,t=e,e=null),f.waitFor||(f.waitFor={});var o=f.waitFor;return e&&v(o[e])&&(d().clearInterval(o[e]),delete o[e]),new Promise(function(i,a){var c=0;function u(n){c<=r?t()&&(l(n,e),i()):(l(n,e),a(new Error("waitFor: Limit is reached"))),c++}function l(e,t){e&&(t&&v(o[t])?(d().clearInterval(o[t]),delete o[t]):d().clearInterval(e))}var s=d().setInterval(function(){u(s)},n);e&&(o[e]=s),u()})},e.waitTime=z,e.watchChange=function(e,t){var n;return function(){for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];var a=e.apply(void 0,o);n!==a&&t.apply(void 0,[a].concat(o)),n=a}},e.windowLoaded=function(){return new Promise(function(e,t){document&&"complete"===document.readyState?e():d().addEventListener("load",function t(){e(),d().removeEventListener("load",t)})})},Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e=e||self)["helper-js"]={})}(this,function(e){"use strict";function t(e){return(t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function o(e,t,n){return t&&r(e.prototype,t),n&&r(e,n),e}function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e){return(a=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function c(e,t){return(c=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function u(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function l(e,t,n){return(l="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=a(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(n):o.value}})(e,t,n||e)}function s(e){return function(e){if(Array.isArray(e)){for(var t=0,n=new Array(e.length);t<e.length;t++)n[t]=e[t];return n}}(e)||function(e){if(Symbol.iterator in Object(e)||"[object Arguments]"===Object.prototype.toString.call(e))return Array.from(e)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var f={};function d(){if(f.glb)return f.glb;var e;try{e=global}catch(t){e=window}return f.glb=e,e}function v(e){return void 0!==e}function p(e){return"[object Array]"===Object.prototype.toString.call(e)}function h(e){return"[object Boolean]"===Object.prototype.toString.call(e)}function y(e){return"[object Number]"===Object.prototype.toString.call(e)}function g(e){return isFinite(e)&&!isNaN(parseFloat(e))}function m(e){return"[object String]"===Object.prototype.toString.call(e)}function b(e){return"[object Object]"===Object.prototype.toString.call(e)}function w(e){return"function"==typeof e}function x(e,t){return 1===arguments.length&&(t=e,e=0),Math.floor(Math.random()*(t-e+1)+e)}function O(e,t){return e<t?e:t}function S(e){return e&&e[0].toUpperCase()+e.substr(1)}function j(e){return e.replace(/ /g,"-").replace(/_/g,"-").replace(/([A-Z])/g,"-$1").replace(/--+/g,"-").replace(/^-|-$|/g,"").toLowerCase()}function E(e){for(var t=e.toString().split(/[-_]/),n=1;n<t.length;n++)t[n]=S(t[n]);return t.join("")}function P(e){return e.toString().trim().split(/(?=[A-Z])/)}function k(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:8,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n="",r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",o=0;o<e;o++)n+=r[x(r.length-1)];return t+n}function A(e,t){for(var n,r=0;(n=e.indexOf(t))>-1;)e.splice(n,1),r++;return r}function _(e){return e[e.length-1]}function T(e){return p(e)?e:[e]}function C(e,t){var n=[];if(w(t))for(var r=t,o=1,i=0;i<e.length;){var a=i+r(o);n.push(e.slice(i,a)),i=a,o++}else for(var c=0;c<e.length;){var u=c+t;n.push(e.slice(c,u)),c=u}return n}function I(e,t,n){var r=p(t)?t:t.split("."),o=e;try{var i=!0,a=!1,c=void 0;try{for(var u,l=r[Symbol.iterator]();!(i=(u=l.next()).done);i=!0){o=o[u.value]}}catch(e){a=!0,c=e}finally{try{i||null==l.return||l.return()}finally{if(a)throw c}}}catch(e){if(n)throw"Path does not exist"}return o}function N(e,t){for(var n={},r=e.length,o=0;o<r;o++){var i=e[o];n[w(t)?t(i,o):i[t]]=i}return n}function L(e){var t,n,r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=[],a=[],c=function(){for(var c=this,u=arguments.length,l=new Array(u),f=0;f<u;f++)l[f]=arguments[f];return new Promise(function(u,f){i.push(u),a.push(f),r=l,n||(n=!0,t=setTimeout(function(){var o=e.call.apply(e,[c].concat(s(r)));t=null,n=!1,i.forEach(function(e){return e(o)}),i=[],a=[]},o))})};return c.stop=function(){t&&(clearTimeout(t),t=null),n=!1,i=[],a.forEach(function(e){return e()}),a=[]},c}function R(e){var t,n,r,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=function(){var i=this;return new Promise(function(a,c){n?a(r):(n=!0,a(r=e.call.apply(e,[i].concat(s(lastArgs)))),t=setTimeout(function(){t=null,n=!1,r=null},o))})};return i.stop=function(){t&&(clearTimeout(t),t=null),n=!1},i}function M(){if("undefined"!=typeof pageYOffset)return{top:pageYOffset,left:pageXOffset};var e=document.body,t=document.documentElement;return{top:(t=t.clientHeight?t:e).scrollTop,left:t.scrollLeft}}function B(e){var t=e.getBoundingClientRect(),n=M();return{x:t.left+n.left,y:t.top+n.top}}function D(e){var t=e.offsetParent;return(!t||t===document.body&&"static"===getComputedStyle(document.body).position)&&(t=document.body.parentElement),t}function F(e,t,n){for(var r=n&&n.withSelf?e:e.parentElement;r;){var o=t(r);if("break"===o)return;if(o)return r;r=r.parentElement}}function H(e,t){return e.classList?e.classList.contains(t):new RegExp("(^| )"+t+"( |$)","gi").test(e.className)}function W(e,t,n){for(var r=arguments.length,o=new Array(r>3?r-3:0),i=3;i<r;i++)o[i-3]=arguments[i];e.addEventListener?e.addEventListener.apply(e,[t,n].concat(o)):e.attachEvent&&e.attachEvent.apply(e,["on".concat(t),n].concat(o))}function U(e,t,n){for(var r=arguments.length,o=new Array(r>3?r-3:0),i=3;i<r;i++)o[i-3]=arguments[i];e.removeEventListener?e.removeEventListener.apply(e,[t,n].concat(o)):e.detachEvent&&e.detachEvent.apply(e,["on".concat(t),n].concat(o))}function q(e,t,n,r,o){var i,a,c=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1e3;null==n&&(n=0,r=e.length-1);for(var u,l=0;n>=0&&n<=r;){if(l>=c)throw Error("binarySearch: loop times is over ".concat(c,", you can increase the limit."));if((u=t(a=e[i=Math.floor((r-n)/2+n)],l))>0)r=i-1;else{if(!(u<0))return{index:i,value:a,count:l+1,hit:!0};n=i+1}l++}return o?{index:i,value:a,count:l+1,hit:!1,bigger:u>0}:null}function z(e,t){return new Promise(function(n,r){setTimeout(function(){t&&t(),n()},e)})}function G(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};d().open(e,t,Object.keys(n).map(function(e){return"".concat(e,"=").concat(n[e])}).join(","))}var J=function(){function e(t){var r=this;n(this,e),i(this,"baseUrl",""),i(this,"search",{});var o=decodeURI(t).split("?");this.baseUrl=o[0],o[1]&&o[1].split("&").forEach(function(e){var t=e.split("=");r.search[t[0]]=null==t[1]?"":decodeURIComponent(t[1])})}return o(e,[{key:"getHref",value:function(){var e=this,t=[this.baseUrl],n=Object.keys(this.search).map(function(t){return"".concat(t,"=").concat(encodeURIComponent(e.search[t]))}).join("&");return n&&t.push(n),t.join("?")}}]),e}();function $(e){return{storage:e,set:function(e,t,n){null==t?this.storage.removeItem(e):this.storage.setItem(e,JSON.stringify({value:t,expired_at:n?(new Date).getTime()+60*n*1e3:null}))},get:function(e){var t=this.storage.getItem(e);if(t){if(!(t=JSON.parse(t)).expired_at||t.expired_at>(new Date).getTime())return t.value;this.storage.removeItem(e)}return null},clear:function(){this.storage.clear()}}}var Q=function(){function e(){n(this,e),i(this,"eventStore",[])}return o(e,[{key:"on",value:function(e,t){this.eventStore.push({name:e,handler:t})}},{key:"once",value:function(e,t){var n=this,r=function(){n.off(e,o)},o=function(){t.apply(void 0,arguments),r()};return this.on(e,o),r}},{key:"onceTimeout",value:function(e,t,n){var r,o=this;return{off:function(){r&&r()},promise:new Promise(function(i,a){r=o.once(e,function(){t.apply(void 0,arguments),i()}),z(n).then(function(){r(),a()})})}}},{key:"off",value:function(e,t){for(var n=[],r=this.eventStore.length,o=0;o<r;o++){var i=this.eventStore[o];i.name===e&&i.handler===t&&n.unshift(o)}for(var a=0,c=n;a<c.length;a++){var u=c[a];this.eventStore.splice(u,1)}}},{key:"emit",value:function(e){var t=[],n=!0,r=!1,o=void 0;try{for(var i,a=this.eventStore[Symbol.iterator]();!(n=(i=a.next()).done);n=!0){var c=i.value;c.name===e&&t.push(c)}}catch(e){r=!0,o=e}finally{try{n||null==a.return||a.return()}finally{if(r)throw o}}for(var u=arguments.length,l=new Array(u>1?u-1:0),s=1;s<u;s++)l[s-1]=arguments[s];for(var f=0,d=t;f<d.length;f++){var v=d[f];v.handler.apply(v,l)}}}]),e}(),Y=function(e){function t(e){var r,o,c;return n(this,t),o=this,c=a(t).call(this),r=!c||"object"!=typeof c&&"function"!=typeof c?u(o):c,i(u(r),"storageName","_crossWindow"),i(u(r),"windows",[]),i(u(r),"timeout",200),i(u(r),"BROADCAST","__BROADCAST__"),e&&Object.assign(u(r),e),W(window,"storage",function(e){if(e.key===r.storageName){var t,n=JSON.parse(e.newValue);if(!n.targets||n.targets.includes(r.id))(t=r).emitLocal.apply(t,[n.name].concat(s(n.args)))}}),r.id=k(),r.windows=[r.id],r.ready=new Promise(function(e,t){r.onceTimeout("_windows_updated",function(e){var t=e.windows;r.windows=t},r.timeout).promise.then(function(){e()},function(){e()}),r.broadcast("_join",r.id)}),r.ready.then(function(){r.on("_join",function(e){r.windows.push(e),r.isMain()&&r.broadcast("_windows_updated",{windows:r.windows,type:"join",id:e})}),r.on("_windows_updated",function(e){var t=e.windows;r.windows=t}),r.on("_exit",function(e){var t=r.windows[0];A(r.windows,e),r.isMain()&&(r.emit("_windows_updated",{windows:r.windows,type:"exit",id:e}),t!=r.id&&(console.log("_main_updated"),r.emit("_main_updated",{windows:r.windows,old:t,new:r.id})))}),W(window,"beforeunload",function(){r.exitGroup()})}),r}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&c(e,t)}(t,Q),o(t,[{key:"isMain",value:function(){return this.id===this.windows[0]}},{key:"emitTo",value:function(e,n){for(var r=arguments.length,o=new Array(r>2?r-2:0),i=2;i<r;i++)o[i-2]=arguments[i];var c;n===this.BROADCAST?n=null:(n&&!p(n)&&(n=[n]),n.includes(this.id)&&(c=l(a(t.prototype),"emit",this)).call.apply(c,[this,e].concat(o)));d().localStorage.setItem(this.storageName,JSON.stringify({name:e,targets:n,args:o,random:Math.random()}))}},{key:"emitLocal",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];this.emitTo.apply(this,[e,this.id].concat(n))}},{key:"broadcast",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];this.emitTo.apply(this,[e,this.BROADCAST].concat(n))}},{key:"emit",value:function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];this.emitTo.apply(this,[e,this.windows].concat(n))}},{key:"exitGroup",value:function(){this.broadcast("_exit",this.id)}}]),t}(),Z=Y;e.CrossWindow=Z,e.CrossWindowEventProcessor=Y,e.EventProcessor=Q,e.URLHelper=J,e.addClass=function(e,t){H(e,t)||(e.classList?e.classList.add(t):e.className+=" "+t)},e.arrayAt=function(e,t){return e[t>=0?t:e.length+t]},e.arrayDiff=function(e,t){for(var n=e.length,r=[];n--;)t.indexOf(e[n])<0&&r.push(e[n]);return r},e.arrayDistinct=function(e){return d().Set?s(new Set(e)):e.filter(function(e,t,n){return n.indexOf(e)===t})},e.arrayFirst=function(e){return e[0]},e.arrayLast=_,e.arrayRemove=A,e.arrayRemoveBySortedIndexes=function(e,t){for(var n=t.length-1;n>=0;n--){var r=t[n];e.splice(r,1)}},e.arraySibling=function(e,t,n){var r=e.indexOf(t);if(-1===r)throw"item is not in array";return p(n)?n.map(function(t){return e[r+t]}):e[r+n]},e.assignIfDifferent=function(e,t,n){e[t]!==n&&(e[t]=n)},e.backupAttr=function(e,t){e["original_".concat(t)]=e.getAttribute(t)},e.binarySearch=q,e.camelCase=E,e.camelToWords=P,e.cloneObj=function e(n,r){switch(t(n)){case"undefined":case"boolean":case"nuber":case"string":case"function":return n;case"object":if(null===n)return n;var o;if(p(n)){o=[];var i=!0,a=!1,c=void 0;try{for(var u,l=n[Symbol.iterator]();!(i=(u=l.next()).done);i=!0){var s=u.value;o.push(e(s,r))}}catch(e){a=!0,c=e}finally{try{i||null==l.return||l.return()}finally{if(a)throw c}}}else{o={};for(var f=0,d=Object.keys(n);f<d.length;f++){var v=d[f];r&&(!p(r)||r.includes(v))&&r(v,n[v],n)||(o[v]=e(n[v],r))}}return o;default:return n}},e.copyTextToClipboard=function(e){try{return void navigator.clipboard.writeText(e)}catch(e){}var t=document.createElement("textarea");t.style.position="fixed",t.style.top=0,t.style.left=0,t.style.width="2em",t.style.height="2em",t.style.padding=0,t.style.border="none",t.style.outline="none",t.style.boxShadow="none",t.style.background="transparent",t.value=e,document.body.appendChild(t),t.select();try{var n=document.execCommand("copy")?"successful":"unsuccessful";console.log("Copying text command was "+n)}catch(e){console.log("Oops, unable to copy")}document.body.removeChild(t)},e.debounce=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return(arguments.length>2&&void 0!==arguments[2]?arguments[2]:{}).immediate?R(e,t):L(e,t)},e.debounceImmediate=R,e.debounceTrailing=L,e.empty=function(e){return null==e||(null!=e.length?0===e.length:!h(e)&&(y(e)?isNaN(e):b(e)?0===Object.keys(e).length:void 0))},e.executeOnceInScopeByName=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:scope_executeOnceInScopeByName,r=arguments.length>3?arguments[3]:void 0;if(e="executeOnceInScopeByName_".concat(e),!n[e]){var o=t();n[e]={destroy:function(){delete n[e]}},r&&(n[e].value=o)}return n[e]},e.executePromiseGetters=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return{promise:new Promise(function(r,o){var i=[],a=C(e,n),c=Promise.resolve();a.forEach(function(e){c=c.then(function(n){if(n&&i.push.apply(i,s(n)),!t)return Promise.all(e.map(function(e){return e()}));o("stopped")})}),c.then(function(e){i.push.apply(i,s(e)),r(i)})}),destroy:function(){t=!0}}},e.executeWithCount=function(e){var t=0;return function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return e.call.apply(e,[this,t++].concat(r))}},e.findParent=F,e.forAll=function(e,t,n){if(n){if(p(e)||m(e))for(var r=e.length-1;r>=0&&!1!==t(e[r],r);r--);else if(b(e)){var o=Object.keys(e);o.reverse();for(var i=0,a=o;i<a.length;i++){var c=a[i];if(!1===t(e[c],c))break}}else if(Number.isInteger(e))for(var u=e-1;u>=0&&!1!==t(u,u);u--);}else if(p(e)||m(e))for(var l=0;l<e.length&&!1!==t(e[l],l);l++);else if(b(e))for(var s=0,f=Object.keys(e);s<f.length;s++){var d=f[s];if(!1===t(e[d],d))break}else if(Number.isInteger(e))for(var v=0;v<e&&!1!==t(v,v);v++);},e.getBorder=function(e){var t=document.body,n=F(e,function(e){return H(e,"work-area")}),r=B(n);return{left:r.x,right:r.x+n.offsetWidth,top:r.y+50,bottom:t.offsetHeight<d().innerHeight?d().innerHeight:t.offsetHeight}},e.getCss3Prefix=function(){return((arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).noCache||null==f.css3Prefix)&&(f.css3Prefix=function(){var e=document.createElement("div");e.style.cssText="-webkit-transition:all .1s; -moz-transition:all .1s; -o-transition:all .1s; -ms-transition:all .1s; transition:all .1s;";var t=e.style;return t.webkitTransition?"-webkit-":t.MozTransition?"-moz-":t.oTransition?"-o-":t.msTransition?"-ms-":""}()),f.css3Prefix},e.getElSize=function(e){var t=e.style.display;e.style.display="block";var n={width:e.offsetWidth,height:e.offsetHeight};return e.style.display=t,n},e.getLocalStorage2=function(){return f.localStorage2||(f.localStorage2=$(d().localStorage)),f.localStorage2},e.getOffset=B,e.getOffsetParent=D,e.getPosition=function(e){for(var t=D(e),n={x:e.offsetLeft,y:e.offsetTop},r=e;(r=r.parentElement)!==t&&r;)n.x-=r.scrollLeft,n.y-=r.scrollTop;return n},e.getPositionFromOffset=function(e,t){var n=B(D(e));return{x:t.x-n.x,y:t.y-n.y}},e.getScroll=M,e.getSessionStorage2=function(){return f.sessionStorage2||(f.sessionStorage2=$(d().sessionStorage)),f.sessionStorage2},e.getUrlParam=function(e){var t=document.location.href,n=t.indexOf(e+"=");if(-1==n)return!1;var r=t.slice(e.length+n+1),o=r.indexOf("&");return-1!=o&&(r=r.slice(0,o)),r},e.glb=d,e.groupArray=function(e,t){var n=new Map;e.forEach(function(e){var r=t(e);n.has(r)||n.set(r,[]),n.get(r).push(e)});var r=[];return n.forEach(function(e,t){r.push([t,e])}),r},e.hasClass=H,e.isArray=p,e.isBool=h,e.isDescendantOf=function(e,t){for(;;){if(null==e.parentElement)return!1;if(e.parentElement===t)return!0;e=e.parentElement}},e.isFunction=w,e.isNumber=y,e.isNumeric=g,e.isObject=b,e.isOffsetInEl=function(e,t,n){var r=B(n);return r.x<=e&&r.x+n.offsetWidth>=e&&r.y<=t&&r.y+n.offsetHeight>=t},e.isPromise=function(e){return"[object Promise]"===Object.prototype.toString.call(e)},e.isString=m,e.isset=v,e.joinMethods=function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"value",r=!0,o=!1,i=void 0;try{for(var a,c=function(){var e=a.value,r=t;t=r?function(){for(var t=arguments.length,o=new Array(t),i=0;i<t;i++)o[i]=arguments[i];return e.call.apply(e,[this,"value"===n?r.call.apply(r,[this].concat(o)):r].concat(o))}:e},u=e[Symbol.iterator]();!(r=(a=u.next()).done);r=!0)c()}catch(e){o=!0,i=e}finally{try{r||null==u.return||u.return()}finally{if(o)throw i}}return t},e.jqFixedSize=function(e){var t=d().jQuery;t(e).each(function(){var e=t(this);e.css({width:e.width()+"px",height:e.height()+"px"})})},e.jqMakeCarousel=function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1e3,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:16,i=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"left",a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:0;o.toString().match(/^\d+$/)&&(o+="px");var c=parseFloat(o),u=d().jQuery,l=u(e),s=l.find(t);l.css({position:"relative",height:l.height()+"px"});var f=s.find(n);f.css({margin:"0",marginRight:o});var v=(Math.ceil(f.width())+c)*f.length;s.css({position:"absolute",margin:"0",width:v+"px"});var p=s.height(),h=s.clone(),y=s.clone();s.css({left:0}),h.css({left:v+"px"}),y.css({left:2*v+"px"});var g=u("<div></div>");g.css({position:"absolute",width:3*v+"px",height:p+"px",left:0,top:a}),g.append(s).append(h).append(y),l.append(g);var m=0;!function e(){"left"===i?m-=100:m+=100,g.animate({left:"".concat(m,"px")},r,"linear",function(){Math.abs(m)>v&&("left"===i?m+=v:m-=v,g.css({left:m+"px"})),e()})}()},e.kebabCase=j,e.makeStorageHelper=$,e.mapObjectTree=function(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e4,o=0,i=[{value:e}],a=function(){if(o>=r)throw"mapObjectTree: limit(".concat(r,") reached, object may has circular reference");o++;var e=i.shift(),a=e.value,c=e.key,u=e.parent,l=e.newParent,s=t(a,c,u,l),f=function(e,t,r){return p(e)?e=[]:b(e)&&(e={}),u?p(l)&&r?l.push(e):l[t]=e:n=e,e},d=void 0,v=void 0,h=void 0,y=void 0,g=void 0;if(s){var m=s.key,w=s.value;v=w,s.delete||!1===m?h=!0:null==m?d=f(w,c,!0):s.hasOwnProperty("value")&&(d=f(w,m)),y=s.stop,g=s.skip}else v=a,d=f(a,c);if(h)return"continue";if(g)return"continue";if(y)return"break";if(p(v))for(var x=v.length,O=0;O<x;O++)i.push({value:v[O],key:O,parent:v,newParent:d});else b(v)&&Object.keys(v).forEach(function(e){i.push({value:v[e],key:e,parent:v,newParent:d})})};e:for(;i.length>0;)switch(a()){case"continue":continue;case"break":break e}return n},e.mapObjects=N,e.max=O,e.min=function(e,t){return e<t?t:e},e.newArrayRemoveAt=function(e,t){t=T(t);var n={},r=!0,o=!1,i=void 0;try{for(var a,c=t[Symbol.iterator]();!(r=(a=c.next()).done);r=!0)n[a.value]=!0}catch(e){o=!0,i=e}finally{try{r||null==c.return||c.return()}finally{if(o)throw i}}for(var u=[],l=e.length,s=0;s<l;s++)n[s]||u.push(e[s]);return u},e.numPad=function(e,t){for(var n=e.toString().length;n<t;)e="0"+e,n++;return e},e.numRand=x,e.objectExcept=function(e,t){var n={};for(var r in e)-1===t.indexOf(r)&&(n[r]=e[r]);return n},e.objectGet=I,e.objectMap=function(e,t){var n={};for(var r in e)n[r]=t(e[r],r,e);return n},e.objectMerge=function(e,t){for(var n in t)e.hasOwnProperty(n)&&b(e[n])&&b(t[n])?Object.assign(e[n],t[n]):e[n]=t[n];return e},e.objectOnly=function(e,t){var n={};for(var r in e)t.indexOf(r)>-1&&(n[r]=e[r]);return n},e.objectSet=function(e,t,n){var r=p(t)?t:t.split("."),o=_(r),i=I(e,r.slice(0,r.length-1));if(!i)throw"Path does not exist";i[o]=n},e.offDOM=U,e.onDOM=W,e.onDOMMany=function(e,t,n){e=T(e),t=T(t);for(var r=arguments.length,o=new Array(r>3?r-3:0),i=3;i<r;i++)o[i-3]=arguments[i];var a=!0,c=!1,u=void 0;try{for(var l,s=e[Symbol.iterator]();!(a=(l=s.next()).done);a=!0){var f=l.value,d=!0,v=!1,p=void 0;try{for(var h,y=t[Symbol.iterator]();!(d=(h=y.next()).done);d=!0){var g=h.value;W.apply(void 0,[f,g,n].concat(o))}}catch(e){v=!0,p=e}finally{try{d||null==y.return||y.return()}finally{if(v)throw p}}}}catch(e){c=!0,u=e}finally{try{a||null==s.return||s.return()}finally{if(c)throw u}}return function(){var r=!0,o=!1,i=void 0;try{for(var a,c=e[Symbol.iterator]();!(r=(a=c.next()).done);r=!0){var u=a.value,l=!0,s=!1,f=void 0;try{for(var d,v=t[Symbol.iterator]();!(l=(d=v.next()).done);l=!0)U(u,d.value,n)}catch(e){s=!0,f=e}finally{try{l||null==v.return||v.return()}finally{if(s)throw f}}}}catch(e){o=!0,i=e}finally{try{r||null==c.return||c.return()}finally{if(o)throw i}}}},e.openCenterWindow=function(e,t,n,r){var o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{},i={width:n,height:r,top:(d().screen.availHeight-30-r)/2,left:(d().screen.availWidth-30-n)/2};Object.assign(i,o),G(e,t,i)},e.openWindow=G,e.pairRows=function(e,t,n,r){r||(r=n);var o=N(t,r);return e.map(function(e){return[e,o[e[n]]]})},e.promiseTimeout=function(e,t){return new Promise(function(n,r){var o,i;e.then(function(){clearTimeout(o),n.apply(void 0,arguments)},function(){i||(clearTimeout(o),r.apply(void 0,arguments))}),o=setTimeout(function(){i=!0;var e=new Error("Promise timeout!");e.name="timeout",r(e)},t)})},e.removeClass=function(e,t){e.classList?e.classList.remove(t):e.className=e.className.replace(new RegExp("(^|\\b)"+t.split(" ").join("|")+"(\\b|$)","gi")," ")},e.removeEl=function(e){if(null!==e.parentNode)return e.parentNode.removeChild(e)},e.replaceMultiple=function(e,t){var n=new RegExp(Object.keys(e).join("|"),"g");return t.replace(n,function(t){return e[t]})},e.resolveArgsByType=function(e,t){var n=0;return t.map(function(t){var r,o;if(p(t)?(r=t[0],o=t[1]):(r=t,o=void 0),!w(r))if(null==r)r=function(){return!0};else{var i=r;r=function(e){return Object.prototype.toString.call(e)==="[object ".concat(i,"]")}}var a=e[n];return r(a)?(n++,a):o})},e.restoreAttr=function(e,t){var n="original_".concat(t);e.setAttribute(t,e[n])},e.retry=function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;f.retry||(f.retry={});var r=e,o=function e(){var t=Math.random()+"";return r[t]?e():t}();return r[o]=0,function e(i,a,c){return t(i,a,c).then(function(e){return delete r[o],e}).catch(function(t){return r[o]++,r[o]>=n?(delete r[o],Promise.reject(t)):e(i,a,c)})}},e.setElChildByIndex=function(e,t,n){n.childComponentIndex=t;var r=e.childNodes.length;if(0===r)e.appendChild(n);else if(0===t)e.insertBefore(n,e.childNodes[0]);else{var o=q(e.childNodes,function(e){return e.childComponentIndex-t},0,O(t,r-1),!0),i=o.index,a=o.value;if(o.bigger)e.insertBefore(n,a);else{var c=e.childNodes[i+1];c?e.insertBefore(n,c):e.appendChild(n)}}},e.snakeCase=function(e){return j(e).replace(/-/g,"_")},e.splitArray=C,e.store=f,e.store_executeOnceInScopeByName={},e.strRand=k,e.studlyCase=S,e.titleCase=function(e){return P(S(E(e))).join(" ").replace(/\bid\b/gi,"ID")},e.toArrayIfNot=T,e.uniqueId=function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"id_",n=t+k();f.uniqueId||(f.uniqueId={});var r=f.uniqueId;return document.getElementById(n)||r[n]?e(t):(r[n]=!0,n)},e.unset=function(e,t){e[t]=void 0;try{delete e[t]}catch(e){}},e.waitFor=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:100,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1e3;w(e)&&(r=n,n=g(t)?t:100,t=e,e=null),f.waitFor||(f.waitFor={});var o=f.waitFor;return e&&v(o[e])&&(d().clearInterval(o[e]),delete o[e]),new Promise(function(i,a){var c=0;function u(n){c<=r?t()&&(l(n,e),i()):(l(n,e),a(new Error("waitFor: Limit is reached"))),c++}function l(e,t){e&&(t&&v(o[t])?(d().clearInterval(o[t]),delete o[t]):d().clearInterval(e))}var s=d().setInterval(function(){u(s)},n);e&&(o[e]=s),u()})},e.waitTime=z,e.watchChange=function(e,t){var n;return function(){for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];var a=e.apply(void 0,o);n!==a&&t.apply(void 0,[a].concat(o)),n=a}},e.windowLoaded=function(){return new Promise(function(e,t){document&&"complete"===document.readyState?e():d().addEventListener("load",function t(){e(),d().removeEventListener("load",t)})})},Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=helper-js.min.js.map |
{ | ||
"name": "helper-js", | ||
"version": "1.4.4", | ||
"version": "1.4.5", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/helper-js.cjs.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
284481
6123