@base-web-kits/base-tools-web 1.2.8 → 1.2.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -623,8 +623,237 @@ function preloadImage(src) {
623
623
  });
624
624
  }
625
625
 
626
- // src/web/network/request.ts
627
- var import_es_toolkit = require("es-toolkit");
626
+ // node_modules/.pnpm/es-toolkit@1.44.0/node_modules/es-toolkit/dist/predicate/isPrimitive.mjs
627
+ function isPrimitive(value) {
628
+ return value == null || typeof value !== "object" && typeof value !== "function";
629
+ }
630
+
631
+ // node_modules/.pnpm/es-toolkit@1.44.0/node_modules/es-toolkit/dist/predicate/isTypedArray.mjs
632
+ function isTypedArray(x) {
633
+ return ArrayBuffer.isView(x) && !(x instanceof DataView);
634
+ }
635
+
636
+ // node_modules/.pnpm/es-toolkit@1.44.0/node_modules/es-toolkit/dist/compat/_internal/getSymbols.mjs
637
+ function getSymbols(object) {
638
+ return Object.getOwnPropertySymbols(object).filter((symbol) => Object.prototype.propertyIsEnumerable.call(object, symbol));
639
+ }
640
+
641
+ // node_modules/.pnpm/es-toolkit@1.44.0/node_modules/es-toolkit/dist/compat/_internal/getTag.mjs
642
+ function getTag(value) {
643
+ if (value == null) {
644
+ return value === void 0 ? "[object Undefined]" : "[object Null]";
645
+ }
646
+ return Object.prototype.toString.call(value);
647
+ }
648
+
649
+ // node_modules/.pnpm/es-toolkit@1.44.0/node_modules/es-toolkit/dist/compat/_internal/tags.mjs
650
+ var regexpTag = "[object RegExp]";
651
+ var stringTag = "[object String]";
652
+ var numberTag = "[object Number]";
653
+ var booleanTag = "[object Boolean]";
654
+ var argumentsTag = "[object Arguments]";
655
+ var symbolTag = "[object Symbol]";
656
+ var dateTag = "[object Date]";
657
+ var mapTag = "[object Map]";
658
+ var setTag = "[object Set]";
659
+ var arrayTag = "[object Array]";
660
+ var arrayBufferTag = "[object ArrayBuffer]";
661
+ var objectTag = "[object Object]";
662
+ var dataViewTag = "[object DataView]";
663
+ var uint8ArrayTag = "[object Uint8Array]";
664
+ var uint8ClampedArrayTag = "[object Uint8ClampedArray]";
665
+ var uint16ArrayTag = "[object Uint16Array]";
666
+ var uint32ArrayTag = "[object Uint32Array]";
667
+ var int8ArrayTag = "[object Int8Array]";
668
+ var int16ArrayTag = "[object Int16Array]";
669
+ var int32ArrayTag = "[object Int32Array]";
670
+ var float32ArrayTag = "[object Float32Array]";
671
+ var float64ArrayTag = "[object Float64Array]";
672
+
673
+ // node_modules/.pnpm/es-toolkit@1.44.0/node_modules/es-toolkit/dist/object/cloneDeepWith.mjs
674
+ function cloneDeepWithImpl(valueToClone, keyToClone, objectToClone, stack = /* @__PURE__ */ new Map(), cloneValue = void 0) {
675
+ const cloned = cloneValue == null ? void 0 : cloneValue(valueToClone, keyToClone, objectToClone, stack);
676
+ if (cloned !== void 0) {
677
+ return cloned;
678
+ }
679
+ if (isPrimitive(valueToClone)) {
680
+ return valueToClone;
681
+ }
682
+ if (stack.has(valueToClone)) {
683
+ return stack.get(valueToClone);
684
+ }
685
+ if (Array.isArray(valueToClone)) {
686
+ const result = new Array(valueToClone.length);
687
+ stack.set(valueToClone, result);
688
+ for (let i = 0; i < valueToClone.length; i++) {
689
+ result[i] = cloneDeepWithImpl(valueToClone[i], i, objectToClone, stack, cloneValue);
690
+ }
691
+ if (Object.hasOwn(valueToClone, "index")) {
692
+ result.index = valueToClone.index;
693
+ }
694
+ if (Object.hasOwn(valueToClone, "input")) {
695
+ result.input = valueToClone.input;
696
+ }
697
+ return result;
698
+ }
699
+ if (valueToClone instanceof Date) {
700
+ return new Date(valueToClone.getTime());
701
+ }
702
+ if (valueToClone instanceof RegExp) {
703
+ const result = new RegExp(valueToClone.source, valueToClone.flags);
704
+ result.lastIndex = valueToClone.lastIndex;
705
+ return result;
706
+ }
707
+ if (valueToClone instanceof Map) {
708
+ const result = /* @__PURE__ */ new Map();
709
+ stack.set(valueToClone, result);
710
+ for (const [key, value] of valueToClone) {
711
+ result.set(key, cloneDeepWithImpl(value, key, objectToClone, stack, cloneValue));
712
+ }
713
+ return result;
714
+ }
715
+ if (valueToClone instanceof Set) {
716
+ const result = /* @__PURE__ */ new Set();
717
+ stack.set(valueToClone, result);
718
+ for (const value of valueToClone) {
719
+ result.add(cloneDeepWithImpl(value, void 0, objectToClone, stack, cloneValue));
720
+ }
721
+ return result;
722
+ }
723
+ if (typeof Buffer !== "undefined" && Buffer.isBuffer(valueToClone)) {
724
+ return valueToClone.subarray();
725
+ }
726
+ if (isTypedArray(valueToClone)) {
727
+ const result = new (Object.getPrototypeOf(valueToClone)).constructor(valueToClone.length);
728
+ stack.set(valueToClone, result);
729
+ for (let i = 0; i < valueToClone.length; i++) {
730
+ result[i] = cloneDeepWithImpl(valueToClone[i], i, objectToClone, stack, cloneValue);
731
+ }
732
+ return result;
733
+ }
734
+ if (valueToClone instanceof ArrayBuffer || typeof SharedArrayBuffer !== "undefined" && valueToClone instanceof SharedArrayBuffer) {
735
+ return valueToClone.slice(0);
736
+ }
737
+ if (valueToClone instanceof DataView) {
738
+ const result = new DataView(valueToClone.buffer.slice(0), valueToClone.byteOffset, valueToClone.byteLength);
739
+ stack.set(valueToClone, result);
740
+ copyProperties(result, valueToClone, objectToClone, stack, cloneValue);
741
+ return result;
742
+ }
743
+ if (typeof File !== "undefined" && valueToClone instanceof File) {
744
+ const result = new File([valueToClone], valueToClone.name, {
745
+ type: valueToClone.type
746
+ });
747
+ stack.set(valueToClone, result);
748
+ copyProperties(result, valueToClone, objectToClone, stack, cloneValue);
749
+ return result;
750
+ }
751
+ if (typeof Blob !== "undefined" && valueToClone instanceof Blob) {
752
+ const result = new Blob([valueToClone], { type: valueToClone.type });
753
+ stack.set(valueToClone, result);
754
+ copyProperties(result, valueToClone, objectToClone, stack, cloneValue);
755
+ return result;
756
+ }
757
+ if (valueToClone instanceof Error) {
758
+ const result = new valueToClone.constructor();
759
+ stack.set(valueToClone, result);
760
+ result.message = valueToClone.message;
761
+ result.name = valueToClone.name;
762
+ result.stack = valueToClone.stack;
763
+ result.cause = valueToClone.cause;
764
+ copyProperties(result, valueToClone, objectToClone, stack, cloneValue);
765
+ return result;
766
+ }
767
+ if (valueToClone instanceof Boolean) {
768
+ const result = new Boolean(valueToClone.valueOf());
769
+ stack.set(valueToClone, result);
770
+ copyProperties(result, valueToClone, objectToClone, stack, cloneValue);
771
+ return result;
772
+ }
773
+ if (valueToClone instanceof Number) {
774
+ const result = new Number(valueToClone.valueOf());
775
+ stack.set(valueToClone, result);
776
+ copyProperties(result, valueToClone, objectToClone, stack, cloneValue);
777
+ return result;
778
+ }
779
+ if (valueToClone instanceof String) {
780
+ const result = new String(valueToClone.valueOf());
781
+ stack.set(valueToClone, result);
782
+ copyProperties(result, valueToClone, objectToClone, stack, cloneValue);
783
+ return result;
784
+ }
785
+ if (typeof valueToClone === "object" && isCloneableObject(valueToClone)) {
786
+ const result = Object.create(Object.getPrototypeOf(valueToClone));
787
+ stack.set(valueToClone, result);
788
+ copyProperties(result, valueToClone, objectToClone, stack, cloneValue);
789
+ return result;
790
+ }
791
+ return valueToClone;
792
+ }
793
+ function copyProperties(target, source, objectToClone = target, stack, cloneValue) {
794
+ const keys = [...Object.keys(source), ...getSymbols(source)];
795
+ for (let i = 0; i < keys.length; i++) {
796
+ const key = keys[i];
797
+ const descriptor = Object.getOwnPropertyDescriptor(target, key);
798
+ if (descriptor == null || descriptor.writable) {
799
+ target[key] = cloneDeepWithImpl(source[key], key, objectToClone, stack, cloneValue);
800
+ }
801
+ }
802
+ }
803
+ function isCloneableObject(object) {
804
+ switch (getTag(object)) {
805
+ case argumentsTag:
806
+ case arrayTag:
807
+ case arrayBufferTag:
808
+ case dataViewTag:
809
+ case booleanTag:
810
+ case dateTag:
811
+ case float32ArrayTag:
812
+ case float64ArrayTag:
813
+ case int8ArrayTag:
814
+ case int16ArrayTag:
815
+ case int32ArrayTag:
816
+ case mapTag:
817
+ case numberTag:
818
+ case objectTag:
819
+ case regexpTag:
820
+ case setTag:
821
+ case stringTag:
822
+ case symbolTag:
823
+ case uint8ArrayTag:
824
+ case uint8ClampedArrayTag:
825
+ case uint16ArrayTag:
826
+ case uint32ArrayTag: {
827
+ return true;
828
+ }
829
+ default: {
830
+ return false;
831
+ }
832
+ }
833
+ }
834
+
835
+ // node_modules/.pnpm/es-toolkit@1.44.0/node_modules/es-toolkit/dist/object/cloneDeep.mjs
836
+ function cloneDeep(obj) {
837
+ return cloneDeepWithImpl(obj, void 0, obj, /* @__PURE__ */ new Map(), void 0);
838
+ }
839
+
840
+ // node_modules/.pnpm/es-toolkit@1.44.0/node_modules/es-toolkit/dist/predicate/isPlainObject.mjs
841
+ function isPlainObject(value) {
842
+ if (!value || typeof value !== "object") {
843
+ return false;
844
+ }
845
+ const proto = Object.getPrototypeOf(value);
846
+ const hasObjectPrototype = proto === null || proto === Object.prototype || Object.getPrototypeOf(proto) === null;
847
+ if (!hasObjectPrototype) {
848
+ return false;
849
+ }
850
+ return Object.prototype.toString.call(value) === "[object Object]";
851
+ }
852
+
853
+ // node_modules/.pnpm/es-toolkit@1.44.0/node_modules/es-toolkit/dist/_internal/isUnsafeProperty.mjs
854
+ function isUnsafeProperty(key) {
855
+ return key === "__proto__";
856
+ }
628
857
 
629
858
  // src/ts/day/index.ts
630
859
  var import_dayjs = __toESM(require("dayjs"), 1);
@@ -661,9 +890,189 @@ function toDayjs(t, fmt) {
661
890
  return (0, import_dayjs.default)(t, fmt);
662
891
  }
663
892
 
893
+ // node_modules/.pnpm/es-toolkit@1.44.0/node_modules/es-toolkit/dist/compat/_internal/isDeepKey.mjs
894
+ function isDeepKey(key) {
895
+ switch (typeof key) {
896
+ case "number":
897
+ case "symbol": {
898
+ return false;
899
+ }
900
+ case "string": {
901
+ return key.includes(".") || key.includes("[") || key.includes("]");
902
+ }
903
+ }
904
+ }
905
+
906
+ // node_modules/.pnpm/es-toolkit@1.44.0/node_modules/es-toolkit/dist/compat/_internal/toKey.mjs
907
+ function toKey(value) {
908
+ var _a;
909
+ if (typeof value === "string" || typeof value === "symbol") {
910
+ return value;
911
+ }
912
+ if (Object.is((_a = value == null ? void 0 : value.valueOf) == null ? void 0 : _a.call(value), -0)) {
913
+ return "-0";
914
+ }
915
+ return String(value);
916
+ }
917
+
918
+ // node_modules/.pnpm/es-toolkit@1.44.0/node_modules/es-toolkit/dist/compat/util/toString.mjs
919
+ function toString(value) {
920
+ if (value == null) {
921
+ return "";
922
+ }
923
+ if (typeof value === "string") {
924
+ return value;
925
+ }
926
+ if (Array.isArray(value)) {
927
+ return value.map(toString).join(",");
928
+ }
929
+ const result = String(value);
930
+ if (result === "0" && Object.is(Number(value), -0)) {
931
+ return "-0";
932
+ }
933
+ return result;
934
+ }
935
+
936
+ // node_modules/.pnpm/es-toolkit@1.44.0/node_modules/es-toolkit/dist/compat/util/toPath.mjs
937
+ function toPath(deepKey) {
938
+ if (Array.isArray(deepKey)) {
939
+ return deepKey.map(toKey);
940
+ }
941
+ if (typeof deepKey === "symbol") {
942
+ return [deepKey];
943
+ }
944
+ deepKey = toString(deepKey);
945
+ const result = [];
946
+ const length = deepKey.length;
947
+ if (length === 0) {
948
+ return result;
949
+ }
950
+ let index = 0;
951
+ let key = "";
952
+ let quoteChar = "";
953
+ let bracket = false;
954
+ if (deepKey.charCodeAt(0) === 46) {
955
+ result.push("");
956
+ index++;
957
+ }
958
+ while (index < length) {
959
+ const char = deepKey[index];
960
+ if (quoteChar) {
961
+ if (char === "\\" && index + 1 < length) {
962
+ index++;
963
+ key += deepKey[index];
964
+ } else if (char === quoteChar) {
965
+ quoteChar = "";
966
+ } else {
967
+ key += char;
968
+ }
969
+ } else if (bracket) {
970
+ if (char === '"' || char === "'") {
971
+ quoteChar = char;
972
+ } else if (char === "]") {
973
+ bracket = false;
974
+ result.push(key);
975
+ key = "";
976
+ } else {
977
+ key += char;
978
+ }
979
+ } else {
980
+ if (char === "[") {
981
+ bracket = true;
982
+ if (key) {
983
+ result.push(key);
984
+ key = "";
985
+ }
986
+ } else if (char === ".") {
987
+ if (key) {
988
+ result.push(key);
989
+ key = "";
990
+ }
991
+ } else {
992
+ key += char;
993
+ }
994
+ }
995
+ index++;
996
+ }
997
+ if (key) {
998
+ result.push(key);
999
+ }
1000
+ return result;
1001
+ }
1002
+
1003
+ // node_modules/.pnpm/es-toolkit@1.44.0/node_modules/es-toolkit/dist/compat/object/get.mjs
1004
+ function get(object, path, defaultValue) {
1005
+ if (object == null) {
1006
+ return defaultValue;
1007
+ }
1008
+ switch (typeof path) {
1009
+ case "string": {
1010
+ if (isUnsafeProperty(path)) {
1011
+ return defaultValue;
1012
+ }
1013
+ const result = object[path];
1014
+ if (result === void 0) {
1015
+ if (isDeepKey(path)) {
1016
+ return get(object, toPath(path), defaultValue);
1017
+ } else {
1018
+ return defaultValue;
1019
+ }
1020
+ }
1021
+ return result;
1022
+ }
1023
+ case "number":
1024
+ case "symbol": {
1025
+ if (typeof path === "number") {
1026
+ path = toKey(path);
1027
+ }
1028
+ const result = object[path];
1029
+ if (result === void 0) {
1030
+ return defaultValue;
1031
+ }
1032
+ return result;
1033
+ }
1034
+ default: {
1035
+ if (Array.isArray(path)) {
1036
+ return getWithPath(object, path, defaultValue);
1037
+ }
1038
+ if (Object.is(path == null ? void 0 : path.valueOf(), -0)) {
1039
+ path = "-0";
1040
+ } else {
1041
+ path = String(path);
1042
+ }
1043
+ if (isUnsafeProperty(path)) {
1044
+ return defaultValue;
1045
+ }
1046
+ const result = object[path];
1047
+ if (result === void 0) {
1048
+ return defaultValue;
1049
+ }
1050
+ return result;
1051
+ }
1052
+ }
1053
+ }
1054
+ function getWithPath(object, path, defaultValue) {
1055
+ if (path.length === 0) {
1056
+ return defaultValue;
1057
+ }
1058
+ let current = object;
1059
+ for (let index = 0; index < path.length; index++) {
1060
+ if (current == null) {
1061
+ return defaultValue;
1062
+ }
1063
+ if (isUnsafeProperty(path[index])) {
1064
+ return defaultValue;
1065
+ }
1066
+ current = current[path[index]];
1067
+ }
1068
+ if (current === void 0) {
1069
+ return defaultValue;
1070
+ }
1071
+ return current;
1072
+ }
1073
+
664
1074
  // src/ts/object/index.ts
665
- var import_compat = require("es-toolkit/compat");
666
- var getObjectValue = import_compat.get;
1075
+ var getObjectValue = get;
667
1076
 
668
1077
  // src/ts/url/param/index.ts
669
1078
  function appendUrlParam(url, param) {
@@ -724,7 +1133,7 @@ function request(config) {
724
1133
  const execute = () => __async(null, null, function* () {
725
1134
  var _a, _b, _c, _d, _e, _f, _g, _h;
726
1135
  const isGet = method === "GET";
727
- const isObjectData = (0, import_es_toolkit.isPlainObject)(data);
1136
+ const isObjectData = isPlainObject(data);
728
1137
  const isArrayData = !isObjectData && Array.isArray(data);
729
1138
  const fillData = isObjectData ? filterRequestData(data) : data;
730
1139
  const fillHeader = filterRequestHeader(header);
@@ -869,7 +1278,7 @@ function logRequestInfo(options) {
869
1278
  duration: endTime - startTime
870
1279
  }, logExtra);
871
1280
  if (status === "success") {
872
- info.res = (0, import_es_toolkit.cloneDeep)(res);
1281
+ info.res = cloneDeep(res);
873
1282
  log("info", info);
874
1283
  } else {
875
1284
  info.e = e;
@@ -957,7 +1366,6 @@ function toFormData(data) {
957
1366
  }
958
1367
 
959
1368
  // src/web/async/index.ts
960
- var import_es_toolkit2 = require("es-toolkit");
961
1369
  function enhanceWebApi(webApi, apiName) {
962
1370
  return (option, config) => {
963
1371
  const finalConfig = config || {};
@@ -988,9 +1396,9 @@ function enhanceWebApi(webApi, apiName) {
988
1396
  const logData = __spreadValues({ name: fname, status: "success", option }, logExtra);
989
1397
  if (resMap) {
990
1398
  logData.res = res;
991
- logData.resMap = (0, import_es_toolkit2.cloneDeep)(finalRes);
1399
+ logData.resMap = cloneDeep(finalRes);
992
1400
  } else {
993
- logData.res = (0, import_es_toolkit2.cloneDeep)(res);
1401
+ logData.res = cloneDeep(res);
994
1402
  }
995
1403
  log == null ? void 0 : log("info", logData);
996
1404
  }