extra-string.web
Version:
A collection of common string functions {web}.
1 lines • 19.8 kB
JavaScript
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).extra_string=t()}}((function(){return function t(e,n,r){function i(u,a){if(!n[u]){if(!e[u]){var c="function"==typeof require&&require;if(!a&&c)return c(u,!0);if(o)return o(u,!0);var l=new Error("Cannot find module '"+u+"'");throw l.code="MODULE_NOT_FOUND",l}var f=n[u]={exports:{}};e[u][0].call(f.exports,(function(t){return i(e[u][1][t]||t)}),f,f.exports,t,e,n,r)}return n[u].exports}for(var o="function"==typeof require&&require,u=0;u<r.length;u++)i(r[u]);return i}({1:[function(t,e,n){(function(t,n){(function(){"use strict";var r={},i={};Object.defineProperty(i,"__esModule",{value:!0});var o={};function u(t){return t}function a(t){return t.length}function c(t){return(...e)=>t(...e.reverse())}function l(t,...e){return(...n)=>t(...e,...n)}function f(t,...e){return(...n)=>t(...n,...e)}function s(...t){return(...e)=>{if(0!==t.length){for(var n=t[0](...e),r=1,i=t.length;r<i;r++)n=t[r](n);return n}}}function h(t,e=t.length){return(...n)=>n.length>=e?t(...n):h(((...e)=>t(...n,...e)),e-n.length)}function m(t,e,n=-1){var r=-1;return(...i)=>{if(++r<e!=(r<n||n<0))return t(...i)}}function d(t){return m(t,0,1)}function g(t,e){return m(t,0,e)}function p(t,e){return m(t,e)}Object.defineProperty(o,"__esModule",{value:!0}),i.throttleEarly=o.throttleEarly=i.throttle=o.throttle=i.debounceEarly=o.debounceEarly=i.debounce=o.debounce=i.after=o.after=i.restrictAfter=o.restrictAfter=i.before=o.before=i.restrictBefore=o.restrictBefore=i.once=o.once=i.restrictOnce=o.restrictOnce=i.restrict=o.restrict=i.delay=o.delay=i.defer=o.defer=i.curryRight=o.curryRight=i.curry=o.curry=i.composeRight=o.composeRight=i.compose=o.compose=i.partialRight=o.partialRight=i.attachRight=o.attachRight=i.partial=o.partial=i.attach=o.attach=i.unspread=o.unspread=i.spread=o.spread=i.flip=o.flip=i.reverse=o.reverse=i.memoize=o.memoize=i.negate=o.negate=i.decontextify=o.decontextify=i.contextify=o.contextify=i.isGenerator=o.isGenerator=i.isAsync=o.isAsync=i.is=o.is=i.apply=o.apply=i.call=o.call=i.bind=o.bind=i.arity=o.arity=i.length=o.length=i.name=o.name=i.ARGUMENTS=o.ARGUMENTS=i.COMPARE=o.COMPARE=i.IDENTITY=o.IDENTITY=i.TRUE=o.TRUE=i.FALSE=o.FALSE=i.NOOP=o.NOOP=void 0,i.NOOP=o.NOOP=function(...t){},i.FALSE=o.FALSE=function(...t){return!1},i.TRUE=o.TRUE=function(...t){return!0},i.IDENTITY=o.IDENTITY=u,i.COMPARE=o.COMPARE=function(t,e){return t<e?-1:t>e?1:0},i.ARGUMENTS=o.ARGUMENTS=function(...t){return t},i.name=o.name=function(t){return t.name},i.length=o.length=a,i.arity=o.arity=a,i.bind=o.bind=function(t,e,...n){return t.bind(e,...n)},i.call=o.call=function(t,e=null,...n){return t.call(e,...n)},i.apply=o.apply=function(t,e=null,n){return t.apply(e,n)},i.is=o.is=function(t){return"function"==typeof t},i.isAsync=o.isAsync=function(t){return t instanceof async function(){}.constructor},i.isGenerator=o.isGenerator=function(t){return t instanceof function*(){}.constructor},i.contextify=o.contextify=function(t){return function(...e){return t(this,...e)}},i.decontextify=o.decontextify=function(t){return(e=null,...n)=>t.call(e,...n)},i.negate=o.negate=function(t){return(...e)=>!t(...e)},i.memoize=o.memoize=function(t,e=null,n=null){return e=e||u,n=n||new Map,(...r)=>{var i=e(...r);if(n.has(i))return n.get(i);var o=t(...r);return n.set(i,o),o}},i.reverse=o.reverse=c,i.flip=o.flip=c,i.spread=o.spread=function(t){return(...e)=>t(e)},i.unspread=o.unspread=function(t){return e=>t(...e)},i.attach=o.attach=l,i.partial=o.partial=l,i.attachRight=o.attachRight=f,i.partialRight=o.partialRight=f,i.compose=o.compose=function(...t){return s(...t.reverse())},i.composeRight=o.composeRight=s,i.curry=o.curry=h,i.curryRight=o.curryRight=function(t,e=t.length){return h(c(t),e)},i.defer=o.defer=function(e){return(...r)=>{var i=t(u);function o(){n(i),i=null}function u(){e(...r),o()}return{clear:o,flush:u}}},i.delay=o.delay=function(t,e){return(...n)=>{var r=setTimeout(o,e);function i(){clearTimeout(r),r=null}function o(){t(...n),i()}return{clear:i,flush:o}}},i.restrict=o.restrict=m,i.restrictOnce=o.restrictOnce=d,i.once=o.once=d,i.restrictBefore=o.restrictBefore=g,i.before=o.before=g,i.restrictAfter=o.restrictAfter=p,i.after=o.after=p,i.debounce=o.debounce=function(t,e,n=-1){var r,i=null,o=null;function u(){clearTimeout(i),clearTimeout(o),i=o=null}function a(){t(...r),u()}return(...t)=>(r=t,n>=0&&(o=o||setTimeout(a,n)),(n<0||e<n)&&(clearTimeout(i),i=setTimeout(a,e)),{clear:u,flush:a})},i.debounceEarly=o.debounceEarly=function(t,e,n=-1){var r=null,i=null;function o(){r=i=null}function u(){o()}return(...a)=>(r||i||t(...a),n>=0&&(i=i||setTimeout(u,n)),(n<0||e<n)&&(clearTimeout(r),r=setTimeout(u,e)),{clear:o,flush:u})},i.throttle=o.throttle=function(t,e){var n,r=null;function i(){r=null}function o(){t(...n),i()}return(...t)=>(n=t,r=r||setTimeout(o,e),{clear:i,flush:o})},i.throttleEarly=o.throttleEarly=function(t,e){var n=null;function r(){n=null}function i(){r()}return(...o)=>(n||t(...o),n=n||setTimeout(i,e),{clear:r,flush:i})},i.default=o,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.sort=t.reverse=t.splice=t.from=t.of=t.normalize=t.replace=t.toLocaleLowerCase=t.toLowerCase=t.toLocaleUpperCase=t.toUpperCase=t.padEnd=t.padStart=t.trim=t.trimEnd=t.trimStart=t.split=t.substring=t.slice=t.toString=t.matchAll=t.match=t.search=t.lastIndexOf=t.indexOf=t.endsWith=t.startsWith=t.includes=t.localeCompare=t.codePointAt=t.charCodeAt=t.charAt=t.size=t.length=t.valueOf=t.repeat=t.concat=t.fromCodePoint=t.fromCharCode=t.MAX_CODE_POINT=t.MIN_CODE_POINT=t.PRINTABLE=t.WHITESPACE=t.PUNCTUATION=t.LETTERS=t.LOWERCASE=t.UPPERCASE=t.HEX_DIGITS=t.OCT_DIGITS=t.DIGITS=void 0,t.jaccardDistance=t.jaccardIndex=t.hammingDistance=t.euclideanDistance=t.countUniqueMatchingNgrams=t.countEachMatchingNgram=t.countMatchingNgrams=t.uniqueMatchingNgrams=t.matchingNgrams=t.countEachNgram=t.countUniqueNgrams=t.countNgrams=t.uniqueNgrams=t.ngrams=t.toPascalCase=t.toCamelCase=t.toSnakeCase=t.toKebabCase=t.toSubscript=t.toSuperscript=t.toBaseline=t.longestUncommonInfixes=t.longestCommonSuffix=t.longestCommonPrefix=t.longestCommonInfix=t.right=t.suffix=t.end=t.infix=t.middle=t.left=t.prefix=t.begin=t.set=t.getAll=t.at=t.get=t.isInfix=t.isSuffix=t.isPrefix=t.isEqual=t.compare=t.codePointRange=t.indexRange=t.index=t.isCharacter=t.isEmpty=t.is=t.spaces=t.filter=void 0,t.damerauLevenshteinDistance=t.levenshteinDistance=t.jaroWinklerDistance=t.jaroWinklerSimilarity=t.jaroDistance=t.jaroSimilarity=t.tverskyDistance=t.tverskyIndex=t.sorensenDiceDistance=t.sorensenDiceIndex=void 0;const e=i;function n(t){return t.length}function r(t,e,n){return t.includes(e,n)}function o(t,e,n){return t.startsWith(e,n)}function u(t,e,n){return t.endsWith(e,n)}t.DIGITS="0123456789",t.OCT_DIGITS="01234567",t.HEX_DIGITS="0123456789ABCDEFabcdef",t.UPPERCASE="ABCDEFGHIJKLMNOPQRSTUVWXYZ",t.LOWERCASE="abcdefghijklmnopqrstuvwxyz",t.LETTERS=t.UPPERCASE+t.LOWERCASE,t.PUNCTUATION="!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~",t.WHITESPACE="\t\n\v\f\r ",t.PRINTABLE=t.DIGITS+t.LETTERS+t.PUNCTUATION+t.WHITESPACE,t.MIN_CODE_POINT=0,t.MAX_CODE_POINT=1114111,t.fromCharCode=function(...t){return String.fromCharCode(...t)},t.fromCodePoint=function(...t){return String.fromCodePoint(...t)},t.concat=function(...t){return"".concat(...t)},t.repeat=function(t,e){return t.repeat(e)},t.valueOf=function(t){return t.valueOf()},t.length=n,t.size=n,t.charAt=function(t,e){return t.charAt(e)},t.charCodeAt=function(t,e){return t.charCodeAt(e)},t.codePointAt=function(t,e){return t.codePointAt(e)},t.localeCompare=function(t,e,n,r){return t.localeCompare(e,n,r)},t.includes=r,t.isInfix=r,t.startsWith=o,t.isPrefix=o,t.endsWith=u,t.isSuffix=u,t.indexOf=function(t,e,n){return t.indexOf(e,n)},t.lastIndexOf=function(t,e,n){return t.lastIndexOf(e,n)},t.search=function(t,e){return t.search(e)},t.match=function(t,e){return t.match(e)},t.matchAll=function(t,e){return t.matchAll(e)},t.toString=function(t){return t.toString()},t.slice=function(t,e,n){return t.slice(e,n)},t.substring=function(t,e,n){return t.substring(e,n)},t.split=function(t,e,n){return t.split(e,n)},t.trimStart=function(t){return t.trimStart()},t.trimEnd=function(t){return t.trimEnd()},t.trim=function(t){return t.trim()},t.padStart=function(t,e,n=" "){return t.padStart(e,n)},t.padEnd=function(t,e,n=" "){return t.padEnd(e,n)},t.toUpperCase=function(t){return t.toUpperCase()},t.toLocaleUpperCase=function(t,e){return t.toLocaleUpperCase(e)},t.toLowerCase=function(t){return t.toLowerCase()},t.toLocaleLowerCase=function(t,e){return t.toLocaleLowerCase(e)},t.replace=function(t,e,n){return t.replace(e,n)},t.normalize=function(t,e){return t.normalize(e)},t.of=function(...t){for(var e="",n=0,r=t.length;n<r;n++)e+=t[n];return e},t.from=function(t,e,n){var r="",i=0;for(var o of t)r+=e?e.call(n,o,i):o,i++;return r},t.splice=function(t,e,n=0,r=""){return t.slice(0,e)+r+t.slice(e+n)},t.reverse=function(t){return[...t].reverse().join("")},t.sort=function(t,e){return[...t].sort(e).join("")},t.filter=function(t,e,n){var r="",i=0;for(var o of t)e.call(n,o,i++)&&(r+=o);return r};const a=" ".repeat(1024);function c(t,e){return e<0?Math.max(0,t.length+e):Math.min(e,t.length)}function l(t,e){return t.charAt(e>=0?e:t.length+e)}function f(t,e=1){return t.slice(0,e)}function s(t,e,n=1){return t.slice(e,e+n)}function h(t,e=1){return t.slice(t.length-e)}function m(t,e){for(var n=0,r=Math.min(t.length,e.length);n<r&&t[n]===e[n];n++);return t.substring(0,n)}function d(t,e){for(var n=t.length-1,r=e.length-1;n>=0&&r>=0&&t[n]===e[r];n--,r--);return t.substring(n+1)}function g(t,e){var n=t.length,r=e.length,i=m(t,e).length,o=d(t,e).length;return[t.substring(i,n-o),e.substring(i,r-o)]}t.spaces=function(t){var e=a.length;return t<e?a.slice(0,t):a.repeat(t/e)+" ".repeat(t%e)},t.is=function(t){return"string"==typeof t},t.isEmpty=function(t){return 0===t.length},t.isCharacter=function(t){return 1===t.length},t.index=c,t.indexRange=function(t,e,n){return e=c(t,e),n=c(t,n),[Math.min(e,n),Math.max(e,n)]},t.codePointRange=function(e){var n=t.MAX_CODE_POINT,r=t.MIN_CODE_POINT;for(var i of e){var o=i.codePointAt(0);n=Math.min(n,o),r=Math.max(r,o)}return[n,r]},t.compare=function(t,e){return t<e?-1:t>e?1:0},t.isEqual=function(t,e){return t===e},t.get=l,t.at=l,t.getAll=function(t,e){var n="";for(var r of e)n+=l(t,r);return n},t.set=function(t,e,n){return t.slice(0,e)+n+t.slice(e+n.length)},t.begin=f,t.prefix=f,t.left=f,t.middle=s,t.infix=s,t.end=h,t.suffix=h,t.right=h,t.longestCommonInfix=function(t,e){for(var n=0,r=0,i=0,o=t.length;i<o;i++)for(var u=0,a=e.length,c=0;u<a;u++)(c=t[i+c]===e[u]?c+1:0)>r&&(n=u-c+1,r=c);return e.substring(n,n+r)},t.longestCommonPrefix=m,t.longestCommonSuffix=d,t.longestUncommonInfixes=g;const p="⁰¹²³⁴⁵⁶⁷⁸⁹⁺⁻⁼⁽⁾ᵝᵞᵟᶿᶥᵠᵡᴬᴮᴰᴱᴳᴴᴵᴶᴷᴸᴹᴺᴼᴾᴿᵀᵁⱽᵂᶦᶫᶰᶸᵃᵇᶜᵈᵉᶠᵍʰⁱʲᵏˡᵐⁿᵒᵖʳˢᵗᵘᵛʷˣʸᶻ",v="0123456789+-=()βγδθιφχABDEGHIJKLMNOPRTUVWILNUabcdefghijklmnoprstuvwxyz",T="₀₁₂₃₄₅₆₇₈₉₊₋₌₍₎ₔᵦᵧᵨᵩᵪₐₑₕᵢⱼₖₗₘₙₒₚᵣₛₜᵤᵥₓ";t.toBaseline=function(t,n=null,r=null){return n||r?function(t,n,r){var i="",o=0,u="",a=0;for(var c of(n=n||e.IDENTITY,r=r||e.IDENTITY,t)){var l=u.length,f=p.indexOf(c),s=T.indexOf(c),h=(f>=0?1:0)+(s>=0?2:0);h!==a&&l&&(i+=0===a?u:1===a?n(u,o-l):r(u,o-l)),u+=0===h?c:1===h?v[f]:"0123456789+-=()əβγρφχaehijklmnoprstuvx"[s],a=h,o++}return u&&(i+=0===a?u:1===a?n(u,o-l):r(u,o-l)),i}(t,n||e.IDENTITY,r||e.IDENTITY):function(t){var e="";for(var n of t){var r=p.indexOf(n),i=T.indexOf(n);r>=0&&(n=v[r]),i>=0&&(n=v[i]),e+=n}return e}(t)};t.toSuperscript=function(t){var e="";for(var n of t){var r=" ⁽⁾ ⁺ ⁻ ⁰¹²³⁴⁵⁶⁷⁸⁹ ⁼ ᴬᴮ ᴰᴱ ᴳᴴᴵᴶᴷᴸᴹᴺᴼᴾ ᴿ ᵀᵁ ᵂ ᵃᵇᶜᵈᵉᶠᵍʰⁱʲᵏˡᵐⁿᵒᵖ ʳˢᵗᵘᵛʷˣʸᶻ "[n.charCodeAt(0)-32]||" ";e+=" "===r?n:r}return e};function y(t){return t.slice(0,1).toUpperCase()+t.slice(1)}function E(t){return t.length<=2?t.toUpperCase():t.slice(0,1).toUpperCase()+t.slice(1,-1).toLowerCase()+t.slice(-1).toUpperCase()}function I(t,n=null,r="-"){for(var i=t.split(n||/[^0-9A-Za-z]+/g).filter(e.IDENTITY),o=0,u=i.length;o<u;++o)i[o]=i[o].replace(/[A-Z]+/g,(t=>1===t.length?r+t:r+t.slice(0,-1)+r+t.slice(-1))),i[o].startsWith(r)&&(i[o]=i[o].slice(r.length));return i.join(r).toLowerCase()}function C(t,n=null,r=!1){var i="",o=t.split(n||/[^0-9A-Za-z]+/g).filter(e.IDENTITY);for(var u of o)i+=y(u.replace(/[A-Z]+/g,E));return r?i:function(t){return t.slice(0,1).toUpperCase()+t.slice(1)}(i)}function A(t,e){for(var n=new Set,r=0,i=t.length-e+1;r<i;r++)n.add(t.substring(r,r+e));return n}function x(t,e){return Math.max(0,t.length-e+1)}function O(t,e){for(var n=new Map,r=0,i=t.length-e+1;r<i;r++){var o=t.substring(r,r+e);n.set(o,(n.get(o)||0)+1)}return n}function b(t,e,n){for(var r=O(t,n),i=0,o=0,u=e.length-n+1;o<u;o++){var a=e.substring(o,o+n),c=r.get(a)||0;c&&(i++,r.set(a,c-1))}return i}function N(t,e){for(var n=0,r=0,i=Math.max(t.length,e.length);r<i;r++)t.charAt(r)!==e.charAt(r)&&n++;return n}function S(t,e,n){var r=x(t,n),i=x(e,n),o=b(t,e,n);return r+i?o/(r+i-o):1}function P(t,e,n){var r=x(t,n),i=x(e,n),o=b(t,e,n);return r+i?2*o/(r+i):1}function D(t,e,n,r=1,i=1){var o=x(t,n),u=x(e,n),a=b(t,e,n);return o+u?a/(a+r*(o-a)+i*(u-a)):1}function M(t,e){var n=t.length,r=e.length,i=Math.floor(Math.max(n,r)/2)-1,[o,u]=function(t,e,n){for(var r="",i="",o=Array.from(e),u=0,a=t.length;u<a;u++)((c=o.lastIndexOf(t.charAt(u),u))<0||u-c>n)&&(c=o.indexOf(t.charAt(u),u+1)),c<0||c-u>n||(r+=t.charAt(u),o[c]=null);for(var c=0,l=e.length;c<l;c++)null==o[c]&&(i+=e.charAt(c));return[r,i]}(t,e,i),a=o.length,c=N(o,u)/2;return a?(a/n+a/r+(a-c)/a)/3:0}function w(t,e,n=.1){var r=M(t,e);return r+m(t,e.substring(0,4)).length*n*(1-r)}t.toSubscript=function(t){var e="";for(var n of t){var r=" ₍₎ ₊ ₋ ₀₁₂₃₄₅₆₇₈₉ ₌ ₐ ₑ ₕᵢⱼₖₗₘₙₒₚ ᵣₛₜᵤᵥ ₓ "[n.charCodeAt(0)-32]||" ";e+=" "===r?n:r}return e},t.toKebabCase=I,t.toSnakeCase=function(t,e=null){return I(t,e,"_")},t.toCamelCase=C,t.toPascalCase=function(t,e=null){return C(t,e,!0)},t.ngrams=function(t,e){for(var n=[],r=0,i=t.length-e+1;r<i;r++)n[r]=t.substring(r,r+e);return n},t.uniqueNgrams=A,t.countNgrams=x,t.countUniqueNgrams=function(t,e){return A(t,e).size},t.countEachNgram=O,t.matchingNgrams=function(t,e,n){for(var r=O(t,n),i=[],o=0,u=e.length-n+1;o<u;o++){var a=e.substring(o,o+n),c=r.get(a)||0;c&&(i.push(a),r.set(a,c-1))}return i},t.uniqueMatchingNgrams=function(t,e,n){for(var r=new Set,i=A(t,n),o=0,u=e.length-n+1;o<u;o++){var a=e.substring(o,o+n);i.has(a)&&r.add(a)}return r},t.countMatchingNgrams=b,t.countEachMatchingNgram=function(t,e,n){for(var r=new Map,i=O(t,n),o=0,u=e.length-n+1;o<u;o++){var a=e.substring(o,o+n),c=i.get(a)||0;c&&(r.set(a,(r.get(a)||0)+1),i.set(a,c-1))}return r},t.countUniqueMatchingNgrams=function(t,e,n){for(var r=A(t,n),i=0,o=0,u=e.length-n+1;o<u;o++){var a=e.substring(o,o+n);r.has(a)&&(i++,r.delete(a))}return i},t.euclideanDistance=function(t,e){for(var n=0,r=0,i=Math.max(t.length,e.length);r<i;r++){var o=(t.codePointAt(r)||0)-(e.codePointAt(r)||0);n+=o*o}return Math.sqrt(n)},t.hammingDistance=N,t.jaccardIndex=S,t.jaccardDistance=function(t,e,n){return 1-S(t,e,n)},t.sorensenDiceIndex=P,t.sorensenDiceDistance=function(t,e,n){return 1-P(t,e,n)},t.tverskyIndex=D,t.tverskyDistance=function(t,e,n,r=1,i=1){return 1-D(t,e,n,r,i)},t.jaroSimilarity=M,t.jaroDistance=function(t,e){return 1-M(t,e)},t.jaroWinklerSimilarity=w,t.jaroWinklerDistance=function(t,e,n=.1){return 1-w(t,e,n)},t.levenshteinDistance=function(t,e,n=1,r=1,i=1){for(var[t,e]=g(t,e),o=t.length,u=e.length,a=[],c=[],l=0,f=0;l<=u;f+=n)a[l++]=f;for(var s=1;s<=o;s++){var h=1&s?c:a,m=1&s?a:c;h[0]=m[0]+r;for(l=1;l<=u;l++){var d=t[s-1]===e[l-1]?0:i;h[l]=Math.min(m[l]+r,h[l-1]+n,m[l-1]+d)}}return(1&o?c:a)[u]},t.damerauLevenshteinDistance=function(t,e,n=1,r=1,i=1,o=1){for(var[t,e]=g(t,e),u=t.length,a=e.length,c=u+2,l=a+2,f=u+a,s=[f],h=[f],m=[s,h],d=new Map,p=1,v=0;p<l;p++,v+=n)s[p]=f,h[p]=v;for(var T=2;T<c;T++){var y=0,E=m[T-1],I=[f,E[1]+r];m[T]=I;for(p=2;p<l;p++){var C=d.get(e[p-2])||0,A=y,x=i;t[T-2]===e[p-2]&&(y=p-1,x=0),I[p]=Math.min(I[p-1]+n,E[p]+r,E[p-1]+x,m[C][A]+(T-C-2)+o+(p-A-2))}d.set(t[T-2],T-1)}return m[u+1][a+1]}}(r);var v,T=(v=r)&&v.__esModule&&Object.prototype.hasOwnProperty.call(v,"default")?v.default:v;e.exports=T}).call(this)}).call(this,t("timers").setImmediate,t("timers").clearImmediate)},{timers:3}],2:[function(t,e,n){var r,i,o=e.exports={};function u(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function c(t){if(r===setTimeout)return setTimeout(t,0);if((r===u||!r)&&setTimeout)return r=setTimeout,setTimeout(t,0);try{return r(t,0)}catch(e){try{return r.call(null,t,0)}catch(e){return r.call(this,t,0)}}}!function(){try{r="function"==typeof setTimeout?setTimeout:u}catch(t){r=u}try{i="function"==typeof clearTimeout?clearTimeout:a}catch(t){i=a}}();var l,f=[],s=!1,h=-1;function m(){s&&l&&(s=!1,l.length?f=l.concat(f):h=-1,f.length&&d())}function d(){if(!s){var t=c(m);s=!0;for(var e=f.length;e;){for(l=f,f=[];++h<e;)l&&l[h].run();h=-1,e=f.length}l=null,s=!1,function(t){if(i===clearTimeout)return clearTimeout(t);if((i===a||!i)&&clearTimeout)return i=clearTimeout,clearTimeout(t);try{return i(t)}catch(e){try{return i.call(null,t)}catch(e){return i.call(this,t)}}}(t)}}function g(t,e){this.fun=t,this.array=e}function p(){}o.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];f.push(new g(t,e)),1!==f.length||s||c(d)},g.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=p,o.addListener=p,o.once=p,o.off=p,o.removeListener=p,o.removeAllListeners=p,o.emit=p,o.prependListener=p,o.prependOnceListener=p,o.listeners=function(t){return[]},o.binding=function(t){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(t){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},{}],3:[function(t,e,n){(function(e,r){(function(){var i=t("process/browser.js").nextTick,o=Function.prototype.apply,u=Array.prototype.slice,a={},c=0;function l(t,e){this._id=t,this._clearFn=e}n.setTimeout=function(){return new l(o.call(setTimeout,window,arguments),clearTimeout)},n.setInterval=function(){return new l(o.call(setInterval,window,arguments),clearInterval)},n.clearTimeout=n.clearInterval=function(t){t.close()},l.prototype.unref=l.prototype.ref=function(){},l.prototype.close=function(){this._clearFn.call(window,this._id)},n.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},n.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},n._unrefActive=n.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout((function(){t._onTimeout&&t._onTimeout()}),e))},n.setImmediate="function"==typeof e?e:function(t){var e=c++,r=!(arguments.length<2)&&u.call(arguments,1);return a[e]=!0,i((function(){a[e]&&(r?t.apply(null,r):t.call(null),n.clearImmediate(e))})),e},n.clearImmediate="function"==typeof r?r:function(t){delete a[t]}}).call(this)}).call(this,t("timers").setImmediate,t("timers").clearImmediate)},{"process/browser.js":2,timers:3}]},{},[1])(1)}));