chunk-4AK4GF4H.js 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379
  1. // node_modules/.pnpm/min-dash@4.2.1/node_modules/min-dash/dist/index.esm.js
  2. function flatten(arr) {
  3. return Array.prototype.concat.apply([], arr);
  4. }
  5. var nativeToString = Object.prototype.toString;
  6. var nativeHasOwnProperty = Object.prototype.hasOwnProperty;
  7. function isUndefined(obj) {
  8. return obj === void 0;
  9. }
  10. function isDefined(obj) {
  11. return obj !== void 0;
  12. }
  13. function isNil(obj) {
  14. return obj == null;
  15. }
  16. function isArray(obj) {
  17. return nativeToString.call(obj) === "[object Array]";
  18. }
  19. function isObject(obj) {
  20. return nativeToString.call(obj) === "[object Object]";
  21. }
  22. function isNumber(obj) {
  23. return nativeToString.call(obj) === "[object Number]";
  24. }
  25. function isFunction(obj) {
  26. const tag = nativeToString.call(obj);
  27. return tag === "[object Function]" || tag === "[object AsyncFunction]" || tag === "[object GeneratorFunction]" || tag === "[object AsyncGeneratorFunction]" || tag === "[object Proxy]";
  28. }
  29. function isString(obj) {
  30. return nativeToString.call(obj) === "[object String]";
  31. }
  32. function ensureArray(obj) {
  33. if (isArray(obj)) {
  34. return;
  35. }
  36. throw new Error("must supply array");
  37. }
  38. function has(target, key) {
  39. return nativeHasOwnProperty.call(target, key);
  40. }
  41. function find(collection, matcher) {
  42. const matchFn = toMatcher(matcher);
  43. let match;
  44. forEach(collection, function(val, key) {
  45. if (matchFn(val, key)) {
  46. match = val;
  47. return false;
  48. }
  49. });
  50. return match;
  51. }
  52. function findIndex(collection, matcher) {
  53. const matchFn = toMatcher(matcher);
  54. let idx = isArray(collection) ? -1 : void 0;
  55. forEach(collection, function(val, key) {
  56. if (matchFn(val, key)) {
  57. idx = key;
  58. return false;
  59. }
  60. });
  61. return idx;
  62. }
  63. function filter(collection, matcher) {
  64. const matchFn = toMatcher(matcher);
  65. let result = [];
  66. forEach(collection, function(val, key) {
  67. if (matchFn(val, key)) {
  68. result.push(val);
  69. }
  70. });
  71. return result;
  72. }
  73. function forEach(collection, iterator) {
  74. let val, result;
  75. if (isUndefined(collection)) {
  76. return;
  77. }
  78. const convertKey = isArray(collection) ? toNum : identity;
  79. for (let key in collection) {
  80. if (has(collection, key)) {
  81. val = collection[key];
  82. result = iterator(val, convertKey(key));
  83. if (result === false) {
  84. return val;
  85. }
  86. }
  87. }
  88. }
  89. function without(arr, matcher) {
  90. if (isUndefined(arr)) {
  91. return [];
  92. }
  93. ensureArray(arr);
  94. const matchFn = toMatcher(matcher);
  95. return arr.filter(function(el, idx) {
  96. return !matchFn(el, idx);
  97. });
  98. }
  99. function reduce(collection, iterator, result) {
  100. forEach(collection, function(value, idx) {
  101. result = iterator(result, value, idx);
  102. });
  103. return result;
  104. }
  105. function every(collection, matcher) {
  106. return !!reduce(collection, function(matches, val, key) {
  107. return matches && matcher(val, key);
  108. }, true);
  109. }
  110. function some(collection, matcher) {
  111. return !!find(collection, matcher);
  112. }
  113. function map(collection, fn) {
  114. let result = [];
  115. forEach(collection, function(val, key) {
  116. result.push(fn(val, key));
  117. });
  118. return result;
  119. }
  120. function keys(collection) {
  121. return collection && Object.keys(collection) || [];
  122. }
  123. function size(collection) {
  124. return keys(collection).length;
  125. }
  126. function values(collection) {
  127. return map(collection, (val) => val);
  128. }
  129. function groupBy(collection, extractor, grouped = {}) {
  130. extractor = toExtractor(extractor);
  131. forEach(collection, function(val) {
  132. let discriminator = extractor(val) || "_";
  133. let group = grouped[discriminator];
  134. if (!group) {
  135. group = grouped[discriminator] = [];
  136. }
  137. group.push(val);
  138. });
  139. return grouped;
  140. }
  141. function uniqueBy(extractor, ...collections) {
  142. extractor = toExtractor(extractor);
  143. let grouped = {};
  144. forEach(collections, (c) => groupBy(c, extractor, grouped));
  145. let result = map(grouped, function(val, key) {
  146. return val[0];
  147. });
  148. return result;
  149. }
  150. var unionBy = uniqueBy;
  151. function sortBy(collection, extractor) {
  152. extractor = toExtractor(extractor);
  153. let sorted = [];
  154. forEach(collection, function(value, key) {
  155. let disc = extractor(value, key);
  156. let entry = {
  157. d: disc,
  158. v: value
  159. };
  160. for (var idx = 0; idx < sorted.length; idx++) {
  161. let { d } = sorted[idx];
  162. if (disc < d) {
  163. sorted.splice(idx, 0, entry);
  164. return;
  165. }
  166. }
  167. sorted.push(entry);
  168. });
  169. return map(sorted, (e) => e.v);
  170. }
  171. function matchPattern(pattern) {
  172. return function(el) {
  173. return every(pattern, function(val, key) {
  174. return el[key] === val;
  175. });
  176. };
  177. }
  178. function toExtractor(extractor) {
  179. return isFunction(extractor) ? extractor : (e) => {
  180. return e[extractor];
  181. };
  182. }
  183. function toMatcher(matcher) {
  184. return isFunction(matcher) ? matcher : (e) => {
  185. return e === matcher;
  186. };
  187. }
  188. function identity(arg) {
  189. return arg;
  190. }
  191. function toNum(arg) {
  192. return Number(arg);
  193. }
  194. function debounce(fn, timeout) {
  195. let timer;
  196. let lastArgs;
  197. let lastThis;
  198. let lastNow;
  199. function fire(force) {
  200. let now = Date.now();
  201. let scheduledDiff = force ? 0 : lastNow + timeout - now;
  202. if (scheduledDiff > 0) {
  203. return schedule(scheduledDiff);
  204. }
  205. fn.apply(lastThis, lastArgs);
  206. clear();
  207. }
  208. function schedule(timeout2) {
  209. timer = setTimeout(fire, timeout2);
  210. }
  211. function clear() {
  212. if (timer) {
  213. clearTimeout(timer);
  214. }
  215. timer = lastNow = lastArgs = lastThis = void 0;
  216. }
  217. function flush() {
  218. if (timer) {
  219. fire(true);
  220. }
  221. clear();
  222. }
  223. function callback(...args) {
  224. lastNow = Date.now();
  225. lastArgs = args;
  226. lastThis = this;
  227. if (!timer) {
  228. schedule(timeout);
  229. }
  230. }
  231. callback.flush = flush;
  232. callback.cancel = clear;
  233. return callback;
  234. }
  235. function throttle(fn, interval) {
  236. let throttling = false;
  237. return function(...args) {
  238. if (throttling) {
  239. return;
  240. }
  241. fn(...args);
  242. throttling = true;
  243. setTimeout(() => {
  244. throttling = false;
  245. }, interval);
  246. };
  247. }
  248. function bind(fn, target) {
  249. return fn.bind(target);
  250. }
  251. function assign(target, ...others) {
  252. return Object.assign(target, ...others);
  253. }
  254. function set(target, path, value) {
  255. let currentTarget = target;
  256. forEach(path, function(key, idx) {
  257. if (typeof key !== "number" && typeof key !== "string") {
  258. throw new Error("illegal key type: " + typeof key + ". Key should be of type number or string.");
  259. }
  260. if (key === "constructor") {
  261. throw new Error("illegal key: constructor");
  262. }
  263. if (key === "__proto__") {
  264. throw new Error("illegal key: __proto__");
  265. }
  266. let nextKey = path[idx + 1];
  267. let nextTarget = currentTarget[key];
  268. if (isDefined(nextKey) && isNil(nextTarget)) {
  269. nextTarget = currentTarget[key] = isNaN(+nextKey) ? {} : [];
  270. }
  271. if (isUndefined(nextKey)) {
  272. if (isUndefined(value)) {
  273. delete currentTarget[key];
  274. } else {
  275. currentTarget[key] = value;
  276. }
  277. } else {
  278. currentTarget = nextTarget;
  279. }
  280. });
  281. return target;
  282. }
  283. function get(target, path, defaultValue) {
  284. let currentTarget = target;
  285. forEach(path, function(key) {
  286. if (isNil(currentTarget)) {
  287. currentTarget = void 0;
  288. return false;
  289. }
  290. currentTarget = currentTarget[key];
  291. });
  292. return isUndefined(currentTarget) ? defaultValue : currentTarget;
  293. }
  294. function pick(target, properties) {
  295. let result = {};
  296. let obj = Object(target);
  297. forEach(properties, function(prop) {
  298. if (prop in obj) {
  299. result[prop] = target[prop];
  300. }
  301. });
  302. return result;
  303. }
  304. function omit(target, properties) {
  305. let result = {};
  306. let obj = Object(target);
  307. forEach(obj, function(prop, key) {
  308. if (properties.indexOf(key) === -1) {
  309. result[key] = prop;
  310. }
  311. });
  312. return result;
  313. }
  314. function merge(target, ...sources) {
  315. if (!sources.length) {
  316. return target;
  317. }
  318. forEach(sources, function(source) {
  319. if (!source || !isObject(source)) {
  320. return;
  321. }
  322. forEach(source, function(sourceVal, key) {
  323. if (key === "__proto__") {
  324. return;
  325. }
  326. let targetVal = target[key];
  327. if (isObject(sourceVal)) {
  328. if (!isObject(targetVal)) {
  329. targetVal = {};
  330. }
  331. target[key] = merge(targetVal, sourceVal);
  332. } else {
  333. target[key] = sourceVal;
  334. }
  335. });
  336. });
  337. return target;
  338. }
  339. export {
  340. flatten,
  341. isUndefined,
  342. isDefined,
  343. isNil,
  344. isArray,
  345. isObject,
  346. isNumber,
  347. isFunction,
  348. isString,
  349. ensureArray,
  350. has,
  351. find,
  352. findIndex,
  353. filter,
  354. forEach,
  355. without,
  356. reduce,
  357. every,
  358. some,
  359. map,
  360. keys,
  361. size,
  362. values,
  363. groupBy,
  364. uniqueBy,
  365. unionBy,
  366. sortBy,
  367. matchPattern,
  368. debounce,
  369. throttle,
  370. bind,
  371. assign,
  372. set,
  373. get,
  374. pick,
  375. omit,
  376. merge
  377. };
  378. //# sourceMappingURL=chunk-4AK4GF4H.js.map