ziko 0.51.1 → 0.53.0

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/ziko.js CHANGED
@@ -2,7 +2,7 @@
2
2
  /*
3
3
  Project: ziko.js
4
4
  Author: Zakaria Elalaoui
5
- Date : Thu Dec 04 2025 12:08:41 GMT+0100 (UTC+01:00)
5
+ Date : Fri Dec 05 2025 17:08:57 GMT+0100 (UTC+01:00)
6
6
  Git-Repo : https://github.com/zakarialaoui10/ziko.js
7
7
  Git-Wiki : https://github.com/zakarialaoui10/ziko.js/wiki
8
8
  Released under MIT License
@@ -17,75 +17,107 @@
17
17
  const { PI: PI$2, E } = Math;
18
18
  const EPSILON=Number.EPSILON;
19
19
 
20
- const {PI: PI$1, cos: cos$3, sin: sin$3, tan: tan$1, acos: acos$2, asin: asin$1, atan: atan$1, cosh: cosh$2, sinh: sinh$2, tanh: tanh$1, acosh: acosh$1, asinh: asinh$1, atanh: atanh$1, log: log$1} = Math;
20
+ const {PI: PI$1, cos: cos$3, sin: sin$3, tan: tan$1, atan: atan$1, cosh: cosh$2, sinh: sinh$2, tanh: tanh$1, acosh: acosh$1, asinh: asinh$1, atanh: atanh$1, log: log$1} = Math;
21
21
  let Fixed={
22
- cos: cos$3,
23
- sin: sin$3,
24
- tan: tan$1,
22
+ cos : x=> {
23
+ if(x.isComplex?.()) return new x.constructor(
24
+ cos$3(x.a)*cosh$2(x.b),
25
+ -(sin$3(x.a)*sinh$2(x.b))
26
+ );
27
+ return cos$3(x)
28
+ },
29
+ sin : x=>{
30
+ if(x?.isComplex) return new x.constructor(
31
+ sin$3(x.a)*cosh$2(x.b),
32
+ cos$3(x.a)*sinh$2(x.b)
33
+ );
34
+ return sin$3(x)
35
+ },
36
+ tan : x=>{
37
+ if(x?.isComplex){
38
+ const DEN = cos$3(2*x.a)+cosh$2(2*x.b);
39
+ return new x.constructor(
40
+ sin$3(2*x.a)/DEN,
41
+ sinh$2(2*x.b)/DEN
42
+ );
43
+ }
44
+ return tan$1(x)
45
+ },
25
46
  sinc: x => sin$3(PI$1*x)/(PI$1*x),
26
47
  sec: x => 1/cos$3(x),
27
48
  csc: x => 1/sin$3(x),
28
49
  cot: x => 1/tan$1(x),
29
- acos: acos$2,
30
- asin: asin$1,
31
- atan: atan$1,
50
+ acos: x=>{
51
+ if(x?.isComplex) return
52
+ return sin$3(x)
53
+ },
54
+ asin: x=>{
55
+ if(x?.isComplex) return
56
+ return sin$3(x)
57
+ },
58
+ atan: x=>{
59
+ if(x?.isComplex) return
60
+ return sin$3(x)
61
+ },
32
62
  acot: x => PI$1/2-atan$1(x),
33
- cosh: cosh$2,
34
- sinh: sinh$2,
35
- tanh: tanh$1,
63
+ cosh: x=>{
64
+ if(x?.isComplex) return new x.constructor(
65
+ cosh$2(x.a)*cos$3(x.b),
66
+ sinh$2(x.a)*sin$3(x.b)
67
+ );
68
+ return cosh$2(x)
69
+ },
70
+ sinh: x=>{
71
+ if(x?.isComplex) return new x.constructor(
72
+ sinh$2(x.a)*cos$3(x.b),
73
+ cosh$2(x.a)*sin$3(x.b)
74
+ );
75
+ return sinh$2(x)
76
+ },
77
+ tanh: x=>{
78
+ if(x?.isComplex){
79
+ const DEN=cosh$2(2*a)+cos$3(2*b);
80
+ return new x.constructor(
81
+ sinh$2(2*a)/DEN,
82
+ sin$3(2*b)/DEN
83
+ )
84
+ }
85
+ return tanh$1(x)
86
+ },
36
87
  coth: n => (1/2*log$1((1+n)/(1-n))),
37
88
  acosh: acosh$1,
38
89
  asinh: asinh$1,
39
90
  atanh: atanh$1,
40
91
  };
41
92
 
42
- Fixed = new Proxy(Fixed, {
43
- get(target, prop) {
44
- if(prop in target){
45
- return x => + target[prop](x).toFixed(15);
46
- }
47
- return undefined;
48
- }
49
- });
93
+ // Fixed = new Proxy(Fixed, {
94
+ // get(target, prop) {
95
+ // if(prop in target){
96
+ // return x => + target[prop](x).toFixed(15);
97
+ // }
98
+ // return undefined;
99
+ // }
100
+ // })
101
+
102
+ const is_primitive = value => typeof value !== 'object' && typeof value !== 'function' || value === null;
50
103
 
51
- // To generalise
52
104
  const mapfun$1=(fun,...X)=>{
53
105
  const Y=X.map(x=>{
54
- if(x===null) return fun(null);
55
- if(["number","string","boolean","bigint","undefined"].includes(typeof x)) return fun(x);
106
+ if(is_primitive(x) || x?.__mapfun__) return fun(x)
56
107
  if(x instanceof Array) return x.map(n=>mapfun$1(fun,n));
57
108
  if(ArrayBuffer.isView(x)) return x.map(n=>fun(n));
58
109
  if(x instanceof Set) return new Set(mapfun$1(fun,...[...x]));
59
110
  if(x instanceof Map) return new Map([...x].map(n=>[n[0],mapfun$1(fun,n[1])]));
60
111
  if(x.isMatrix?.()) return new x.constructor(x.rows, x.cols, mapfun$1(x.arr.flat(1)))
61
- if(x.isComplex?.()){
62
- const complex = (...args) => new x.constructor(...args);
63
- const [a,b,z,phi]=[x.a,x.b,x.z,x.phi];
64
- switch(fun){
65
- case Math.log: return complex(ln(z),phi); // Done
66
- case Math.exp: return complex(e(a)*cos$2(b),e(a)*sin$2(b)); // Done
67
- case Math.abs: return z; // Done
68
- case Math.sqrt: return complex(sqrt$2(z)*cos$2(phi/2),sqrt$2(z)*sin$2(phi/2)); // Done
69
- case Fixed.cos: return complex(cos$2(a)*cosh$1(b),-(sin$2(a)*sinh$1(b)));
70
- case Fixed.sin: return complex(sin$2(a)*cosh$1(b),cos$2(a)*sinh$1(b));
71
- case Fixed.tan:{
72
- const DEN = cos$2(2*a)+cosh$1(2*b);
73
- return complex(sin$2(2*a)/DEN,sinh$1(2*b)/DEN);
74
- }
75
- case Fixed.cosh:return complex(cosh$1(a)*cos$2(b),sinh$1(a)*sin$2(b));
76
- case Fixed.sinh:return complex(sinh$1(a)*cos$2(b),cosh$1(a)*sin$2(b));
77
- case Fixed.tanh:{
78
- const DEN=cosh$1(2*a)+cos$2(2*b);
79
- return complex(sinh$1(2*a)/DEN,sin$2(2*b)/DEN)
80
- }
81
- default : return fun(x)
82
- }
83
- }
84
112
  else if(x instanceof Object){
85
- return Object.fromEntries(Object.entries(x).map(n=>n=[n[0],mapfun$1(fun,n[1])]))
113
+ return Object.fromEntries(
114
+ Object.entries(x).map(
115
+ n=>n=[n[0],mapfun$1(fun,n[1])]
116
+ )
117
+ )
86
118
  }
87
119
  });
88
- return Y.length==1?Y[0]:Y;
120
+ return Y.length==1? Y[0]: Y;
89
121
  };
90
122
 
91
123
  // Mixed calcul
@@ -694,8 +726,8 @@
694
726
  this.a=a.b/tan(a.phi);
695
727
  }
696
728
  else if(("z" in a && "phi" in a)){
697
- this.a=a.z*cos$2(a.phi);
698
- this.a=a.z*sin$2(a.phi);
729
+ this.a = +a.z*cos$2(a.phi).toFixed(15);
730
+ this.b = +a.z*sin$2(a.phi).toFixed(15);
699
731
  }
700
732
  }
701
733
  else if(typeof(a)==="number"&&typeof(b)==="number"){
@@ -703,6 +735,9 @@
703
735
  this.b = +b.toFixed(32);
704
736
  }
705
737
  }
738
+ get __mapfun__(){
739
+ return true
740
+ }
706
741
  isComplex(){
707
742
  return true
708
743
  }
@@ -995,6 +1030,35 @@
995
1030
 
996
1031
  // globalThis.node = (node) => new UINode(node);
997
1032
 
1033
+ function parseQueryParams$1(queryString) {
1034
+ const params = {};
1035
+ queryString.replace(/[A-Z0-9]+?=([\w|:|\/\.]*)/gi, (match) => {
1036
+ const [key, value] = match.split('=');
1037
+ params[key] = value;
1038
+ });
1039
+ return params;
1040
+ }
1041
+
1042
+ function defineParamsGetter$1(target ){
1043
+ Object.defineProperties(target, {
1044
+ 'QueryParams': {
1045
+ get: function() {
1046
+ return parseQueryParams$1(globalThis.location.search.substring(1));
1047
+ },
1048
+ configurable: false,
1049
+ enumerable: true
1050
+ },
1051
+ 'HashParams': {
1052
+ get: function() {
1053
+ const hash = globalThis.location.hash.substring(1);
1054
+ return hash.split("#");
1055
+ },
1056
+ configurable: false,
1057
+ enumerable: true
1058
+ }
1059
+ });
1060
+ }
1061
+
998
1062
  class UIStore extends Array {
999
1063
  constructor(...args) {
1000
1064
  super(...args);
@@ -1028,202 +1092,6 @@
1028
1092
  // create the singleton
1029
1093
  const __UI__ = new UIStore();
1030
1094
 
1031
- // __init__global__()
1032
- class UIElementCore extends UINode{
1033
- constructor(){
1034
- super();
1035
- }
1036
- init(element, name, type, render){
1037
- this.target = globalThis.__Ziko__.__Config__.default.target||globalThis?.document?.body;
1038
- if(typeof element === "string") {
1039
- switch(type){
1040
- case "html" : {
1041
- element = globalThis?.document?.createElement(element);
1042
- // console.log('1')
1043
- } break;
1044
- case "svg" : {
1045
- element = globalThis?.document?.createElementNS("http://www.w3.org/2000/svg", element);
1046
- // console.log('2')
1047
- } break;
1048
- default : throw Error("Not supported")
1049
- }
1050
- }
1051
- else this.target = element?.parentElement;
1052
- Object.assign(this.cache, {
1053
- name,
1054
- isInteractive : false,
1055
- parent:null,
1056
- isBody:false,
1057
- isRoot:false,
1058
- isHidden: false,
1059
- isFrozzen:false,
1060
- legacyParent : null,
1061
- attributes: {},
1062
- filters: {},
1063
- temp:{}
1064
- });
1065
- this.events = {
1066
- ptr:null,
1067
- mouse:null,
1068
- wheel:null,
1069
- key:null,
1070
- drag:null,
1071
- drop:null,
1072
- click:null,
1073
- clipboard:null,
1074
- focus:null,
1075
- swipe:null,
1076
- custom:null,
1077
- };
1078
- this.observer={
1079
- resize:null,
1080
- intersection:null
1081
- };
1082
- if(element) Object.assign(this.cache,{element});
1083
- // useDefaultStyle && this.style({
1084
- // position: "relative",
1085
- // boxSizing:"border-box",
1086
- // margin:0,
1087
- // padding:0,
1088
- // width : "auto",
1089
- // height : "auto"
1090
- // });
1091
- this.items = new UIStore();
1092
- globalThis.__Ziko__.__UI__[this.cache.name]?globalThis.__Ziko__.__UI__[this.cache.name]?.push(this):globalThis.__Ziko__.__UI__[this.cache.name]=[this];
1093
- element && render && this?.render?.();
1094
- globalThis.__Ziko__.__UI__.push(this);
1095
- }
1096
- get element(){
1097
- return this.cache.element;
1098
- }
1099
- [Symbol.iterator]() {
1100
- return this.items[Symbol.iterator]();
1101
- }
1102
- maintain() {
1103
- for (let i = 0; i < this.items.length; i++) {
1104
- Object.defineProperty(this, i, {
1105
- value: this.items[i],
1106
- writable: true,
1107
- configurable: true,
1108
- enumerable: false
1109
- });
1110
- }
1111
- }
1112
- isInteractive(){
1113
- return this.cache.isInteractive;
1114
- }
1115
- isUIElement(){
1116
- return true;
1117
- }
1118
- }
1119
-
1120
- function register_to_class(target, ...mixins){
1121
- mixins.forEach(n => _register_to_class_(target, n));
1122
- }
1123
- function _register_to_class_(target, mixin) {
1124
- const descriptors = Object.getOwnPropertyDescriptors(mixin);
1125
- for (const key of Reflect.ownKeys(descriptors)) {
1126
- const desc = descriptors[key];
1127
- if ('get' in desc || 'set' in desc || typeof desc.value !== 'function') {
1128
- Object.defineProperty(Object.getPrototypeOf(target), key, desc);
1129
- } else if (typeof desc.value === 'function') {
1130
- if (!Object.getPrototypeOf(target).hasOwnProperty(key)) {
1131
- Object.defineProperty(Object.getPrototypeOf(target), key, desc);
1132
- }
1133
- }
1134
- }
1135
- }
1136
-
1137
- // export function mount(target = this.target) {
1138
- // if(this.isBody) return ;
1139
- // if(target?.isUIElement)target=target.element;
1140
- // this.target=target;
1141
- // this.target?.appendChild(this.element);
1142
- // return this;
1143
- // }
1144
- // export function unmount(){
1145
- // if(this.cache.parent)this.cache.parent.remove(this);
1146
- // else if(this.target?.children?.length && [...this.target?.children].includes(this.element)) this.target.removeChild(this.element);
1147
- // return this;
1148
- // }
1149
-
1150
- // export function mountAfter(target = this.target, t = 1) {
1151
- // setTimeout(() => this.mount(), t);
1152
- // return this;
1153
- // }
1154
- // export function unmountAfter(t = 1) {
1155
- // setTimeout(() => this.unmount(), t);
1156
- // return this;
1157
- // }
1158
-
1159
- function mount(target = this.target, delay = 0) {
1160
- if (delay > 0) {
1161
- setTimeout(() => this.mount(target, 0), delay);
1162
- return this;
1163
- }
1164
-
1165
- if (this.isBody) return this;
1166
-
1167
- if (target?.isUIElement) target = target.element;
1168
- this.target = target;
1169
-
1170
- this.target?.appendChild(this.element);
1171
- return this;
1172
- }
1173
-
1174
- function unmount(delay = 0) {
1175
- if (delay > 0) {
1176
- setTimeout(() => this.unmount(0), delay);
1177
- return this;
1178
- }
1179
-
1180
- if (this.cache.parent) {
1181
- this.cache.parent.remove(this);
1182
- } else if (
1183
- this.target?.children?.length &&
1184
- [...this.target.children].includes(this.element)
1185
- ) {
1186
- this.target.removeChild(this.element);
1187
- }
1188
-
1189
- return this;
1190
- }
1191
-
1192
- var LifecycleMethods = /*#__PURE__*/Object.freeze({
1193
- __proto__: null,
1194
- mount: mount,
1195
- unmount: unmount
1196
- });
1197
-
1198
- function parseQueryParams$1(queryString) {
1199
- const params = {};
1200
- queryString.replace(/[A-Z0-9]+?=([\w|:|\/\.]*)/gi, (match) => {
1201
- const [key, value] = match.split('=');
1202
- params[key] = value;
1203
- });
1204
- return params;
1205
- }
1206
-
1207
- function defineParamsGetter$1(target ){
1208
- Object.defineProperties(target, {
1209
- 'QueryParams': {
1210
- get: function() {
1211
- return parseQueryParams$1(globalThis.location.search.substring(1));
1212
- },
1213
- configurable: false,
1214
- enumerable: true
1215
- },
1216
- 'HashParams': {
1217
- get: function() {
1218
- const hash = globalThis.location.hash.substring(1);
1219
- return hash.split("#");
1220
- },
1221
- configurable: false,
1222
- enumerable: true
1223
- }
1224
- });
1225
- }
1226
-
1227
1095
  const __Config__ = {
1228
1096
  default:{
1229
1097
  target:null,
@@ -1267,384 +1135,6 @@
1267
1135
  }
1268
1136
  };
1269
1137
 
1270
- const powerSet=originalSet=>{
1271
- const subSets = [];
1272
- const NUMBER_OF_COMBINATIONS = 2 ** originalSet.length;
1273
- for (let i = 0; i < NUMBER_OF_COMBINATIONS; i += 1) {
1274
- const subSet = [];
1275
- for (let j = 0; j < originalSet.length; j += 1) {
1276
- if (i & (1 << j)) {
1277
- subSet.push(originalSet[j]);
1278
- }
1279
- }
1280
- subSets.push(subSet);
1281
- }
1282
- return subSets;
1283
- };
1284
-
1285
- // const subSet = (...arr) => {
1286
- // let list = arange(0, 2 ** arr.length, 1);
1287
- // let bin = list.map((n) => n.toString(2).padStart(arr.length, '0')).map((n) => n.split("").map((n) => +n));
1288
- // let sub = bin.map((n) => n.map((m, i) => (m === 1 ? arr[i] : null))).map((n) => n.filter((x) => x !== null));
1289
- // return sub;
1290
- // };
1291
- const subSet = null;
1292
-
1293
- const Base={
1294
- _mode:Number,
1295
- _map:function(func,number,toBase){
1296
- if (number instanceof Matrix)
1297
- return new Matrix(
1298
- number.rows,
1299
- number.cols,
1300
- number.arr.flat(1).map(n=>func(n,toBase))
1301
- );
1302
- else if (number instanceof Complex) return new Complex(func(number.a,toBase),func(number.b,toBase));
1303
- else if (number instanceof Array) return number.map((n) =>func(n,toBase));
1304
- },
1305
- dec2base(dec,base){
1306
- base<=10?this._mode=Number:this._mode=String;
1307
- //this._mode=String
1308
- if (typeof dec === "number") return this._mode((dec >>> 0).toString(base));
1309
- return this._map(this.dec2base,dec,base)
1310
- },
1311
- dec2bin(dec){
1312
- return this.dec2base(dec,2);
1313
- },
1314
- dec2oct(dec){
1315
- return this.dec2base(dec,8);
1316
- },
1317
- dec2hex(dec){
1318
- return this.dec2base(dec,16);
1319
- },
1320
- bin2base(bin, base) {
1321
- return this.dec2base(this.bin2dec(bin),base)
1322
- },
1323
- bin2dec(bin){
1324
- return this._mode("0b"+bin);
1325
- },
1326
- bin2oct(bin){
1327
- return this.bin2base(bin,8);
1328
- },
1329
- bin2hex(bin){
1330
- return this.bin2base(bin,16);
1331
- },
1332
- oct2dec(oct){
1333
- return this._mode("0o"+oct);
1334
- },
1335
- oct2bin(oct){
1336
- return this.dec2bin(this.oct2dec(oct))
1337
- },
1338
- oct2hex(oct){
1339
- return this.dec2hex(this.oct2dec(oct))
1340
- },
1341
- oct2base(oct, base) {
1342
- return this.dec2base(this.oct2dec(oct),base)
1343
- },
1344
- hex2dec(hex){
1345
- return this._mode("0x"+hex);
1346
- },
1347
- hex2bin(hex){
1348
- return this.dec2bin(this.hex2dec(hex))
1349
- },
1350
- hex2oct(hex){
1351
- return this.dec2oct(this.hex2dec(hex))
1352
- },
1353
- hex2base(hex, base) {
1354
- return this.dec2base(this.hex2dec(hex),base)
1355
- },
1356
- IEEE32toDec(Bin){
1357
- let IEEE32=Bin.split(" ").join("").padEnd(32,"0");
1358
- let s=IEEE32[0];
1359
- let e=2**(+("0b"+IEEE32.slice(1,9))-127);
1360
- let m=IEEE32.slice(9,32).split("").map(n=>+n);
1361
- let M=m.map((n,i)=>n*(2**(-i-1))).reduce((a,b)=>a+b,0);
1362
- let dec=(-1)**s*(1+M)*e;
1363
- return dec
1364
- },
1365
- IEEE64toDec(Bin){
1366
- let IEEE64=Bin.split(" ").join("").padEnd(64,"0");
1367
- let s=IEEE64[0];
1368
- let e=2**(+("0b"+IEEE64.slice(1,12))-1023);
1369
- let m=IEEE64.slice(13,64).split("").map(n=>+n);
1370
- let M=m.map((n,i)=>n*(2**(-i-1))).reduce((a,b)=>a+b,0);
1371
- let dec=(-1)**s*(1+M)*e;
1372
- return dec;
1373
- }
1374
- };
1375
-
1376
- const Logic$1={
1377
- _mode:Number,
1378
- _map:function(func,a,b){
1379
- if (a instanceof Matrix)
1380
- return new Matrix(
1381
- a.rows,
1382
- a.cols,
1383
- a.arr.flat(1).map((n) => func(n, b))
1384
- );
1385
- else if (a instanceof Complex) return new Complex(func(a.a, b), func(a.b, b));
1386
- else if (a instanceof Array) return a.map((n) => func(n, b));
1387
- },
1388
- not:function(input){
1389
- if(["number","boolean"].includes(typeof input)) return Logic$1._mode(!input);
1390
- else return this._map(this.not,input)
1391
- },
1392
- and:function(a, ...b){
1393
- if(["number","boolean"].includes(typeof a))return Logic$1._mode(b.reduce((n, m) => (n &= m), a));
1394
- else return this._map(this.and,a,b)
1395
- },
1396
- or:function(a, ...b) {
1397
- if(["number","boolean"].includes(typeof a)) return Logic$1._mode(b.reduce((n, m) => (n |= m), a));
1398
- else return this._map(this.or,a,b);
1399
- },
1400
- nand:function(a, ...b) {
1401
- return this.not(this.and(a, b));
1402
- },
1403
- nor:function(a, ...b) {
1404
- return this.not(this.or(a, b));
1405
- },
1406
- xor:function(a,...b){
1407
- let arr=[a,...b];
1408
- if(["number","boolean"].includes(typeof a))return this._mode(arr.reduce((length,cur)=>{
1409
- if(+cur===1)length+=1;
1410
- return length;
1411
- },0)===1);
1412
- else return this._map(this.xor,a,b);
1413
- },
1414
- xnor:function(a,...b){
1415
- return Logic$1.not(Logic$1.xor(a,b))
1416
- }
1417
-
1418
- };
1419
-
1420
- class Permutation {
1421
- static withDiscount(arr, l = arr.length) {
1422
- if (l === 1) return arr.map((n) => [n]);
1423
- const permutations = [];
1424
- let smallerPermutations;
1425
- smallerPermutations = this.withDiscount(arr, l - 1);
1426
- arr.forEach((currentOption) => {
1427
- smallerPermutations.forEach((smallerPermutation) => {
1428
- permutations.push([currentOption].concat(smallerPermutation));
1429
- });
1430
- });
1431
- return permutations;
1432
- }
1433
- static withoutDiscount(arr) {
1434
- const l = arr.length;
1435
- if (l === 1) return arr.map((n) => [n]);
1436
- const permutations = [];
1437
- const smallerPermutations = this.withoutDiscount(arr.slice(1));
1438
- const firstOption = arr[0];
1439
- for (let i = 0; i < smallerPermutations.length; i++) {
1440
- const smallerPermutation = smallerPermutations[i];
1441
- for (let j = 0; j <= smallerPermutation.length; j++) {
1442
- const permutationPrefix = smallerPermutation.slice(0, j);
1443
- const permutationSuffix = smallerPermutation.slice(j);
1444
- permutations.push(permutationPrefix.concat([firstOption], permutationSuffix));
1445
- }
1446
- }
1447
- return permutations;
1448
- }
1449
- }
1450
-
1451
- class Combinaison {
1452
- static withDiscount(comboOptions, comboLength) {
1453
- if (comboLength === 1) {
1454
- return comboOptions.map((comboOption) => [comboOption]);
1455
- }
1456
- const combos = [];
1457
- comboOptions.forEach((currentOption, optionIndex) => {
1458
- const smallerCombos = this.withDiscount(comboOptions.slice(optionIndex), comboLength - 1);
1459
- smallerCombos.forEach((smallerCombo) => {
1460
- combos.push([currentOption].concat(smallerCombo));
1461
- });
1462
- });
1463
- return combos;
1464
- }
1465
- static withoutDiscount(comboOptions, comboLength) {
1466
- if (comboLength === 1) {
1467
- return comboOptions.map((comboOption) => [comboOption]);
1468
- }
1469
- const combos = [];
1470
- comboOptions.forEach((currentOption, optionIndex) => {
1471
- const smallerCombos = this.withoutDiscount(comboOptions.slice(optionIndex + 1), comboLength - 1);
1472
- smallerCombos.forEach((smallerCombo) => {
1473
- combos.push([currentOption].concat(smallerCombo));
1474
- });
1475
- });
1476
-
1477
- return combos;
1478
- }
1479
- }
1480
- const combinaison=(comboOptions, comboLength, discount=false)=>Combinaison[discount?"withDiscount":"withoutDiscount"](comboOptions, comboLength);
1481
-
1482
- class Random {
1483
- static float(a = 1, b) {
1484
- return b ? Math.random() * (b - a) + a : a * Math.random();
1485
- }
1486
- static int(a, b) {
1487
- return Math.floor(this.float(a, b));
1488
- }
1489
- static char(upperCase){
1490
- upperCase=upperCase??this.bool();
1491
- const Char=String.fromCharCode(this.int(97,120));
1492
- return upperCase?Char.toUpperCase():Char;
1493
- }
1494
- static bool(){
1495
- return [false,true][Math.floor(Math.random()*2)];
1496
- }
1497
- static string(length,upperCase){
1498
- return length instanceof Array?
1499
- new Array(this.int(...length)).fill(0).map(() => this.char(upperCase)).join(""):
1500
- new Array(length).fill(0).map(() => this.char(upperCase)).join("");
1501
- }
1502
- static bin() {
1503
- return this.int(2);
1504
- }
1505
- static oct() {
1506
- return this.int(8);
1507
- }
1508
- static dec() {
1509
- return this.int(8);
1510
- }
1511
- static hex() {
1512
- return this.int(16);
1513
- }
1514
- static choice(choices = [1, 2, 3], p = new Array(choices.length).fill(1 / choices.length)) {
1515
- let newchoice = new Array(100);
1516
- p=Utils.accum(...p).map(n=>n*100);
1517
- newchoice.fill(choices[0], 0, p[0]);
1518
- for (let i = 1; i < choices.length; i++) newchoice.fill(choices[i], p[i - 1], p[i]);
1519
- return newchoice[this.int(newchoice.length - 1)];
1520
- }
1521
- static shuffleArr(arr){
1522
- return arr.sort(()=>0.5-Math.random())
1523
- }
1524
- static floats(n, a, b) {
1525
- return new Array(n).fill(0).map(() => this.float(a, b));
1526
- }
1527
- static ints(n, a, b) {
1528
- return new Array(n).fill(0).map(() => this.int(a, b));
1529
- }
1530
- static bools(n){
1531
- return new Array(n).fill(0).map(() => this.bool());
1532
- }
1533
- static bins(n) {
1534
- return new Array(n).fill(0).map(() => this.int(2));
1535
- }
1536
- static octs(n) {
1537
- return new Array(n).fill(0).map(() => this.int(8));
1538
- }
1539
- static decs(n) {
1540
- return new Array(n).fill(0).map(() => this.int(10));
1541
- }
1542
- static hexs(n) {
1543
- return new Array(n).fill(0).map(() => this.int(16));
1544
- }
1545
- static choices(n, choices, p) {
1546
- return new Array(n).fill(0).map(() => this.choice(choices, p));
1547
- }
1548
- static perm(...arr) {
1549
- // permutation
1550
- return arr.permS[this.int(arr.length)];
1551
- }
1552
- static color() {
1553
- return "#" + Base.dec2hex(this.float(16777216)).padStart(6,0);
1554
- }
1555
- static colors(n) {
1556
- return new Array(n).fill(null).map(()=>this.color());
1557
- }
1558
-
1559
- // Should be Moved to Matrix and Complex to avoid Circular dependencies
1560
- // static complex(a = [0,1], b = [0,1]) {
1561
- // return a instanceof Array?
1562
- // new Complex(
1563
- // this.float(a[0], a[1]),
1564
- // this.float(b[0], b[1])
1565
- // ):
1566
- // new Complex(
1567
- // ...this.floats(2,a,b)
1568
- // )
1569
-
1570
- // }
1571
- // static complexInt(a = [0,1], b = [0,1]) {
1572
- // return new Complex(
1573
- // this.int(a[0], a[1]),
1574
- // this.int(b[0], b[1])
1575
- // );
1576
- // }
1577
- // static complexBin() {
1578
- // return new Complex(...this.bins(2));
1579
- // }
1580
- // static complexOct() {
1581
- // return new Complex(...this.octs(2));
1582
- // }
1583
- // static complexDec() {
1584
- // return new Complex(...this.decs(10));
1585
- // }
1586
- // static complexHex() {
1587
- // return new Complex(...this.octs(2));
1588
- // }
1589
- // static complexes(n, a = 0, b = 1) {
1590
- // return new Array(n).fill(0).map(() => this.complex(a, b));
1591
- // }
1592
- // static complexesInt(n, a = 0, b = 1) {
1593
- // return new Array(n).fill(0).map(() => this.complexInt(a, b));
1594
- // }
1595
- // static complexesBin(n) {
1596
- // return new Array(n).fill(0).map(() => this.complexBin());
1597
- // }
1598
- // static complexesOct(n) {
1599
- // return new Array(n).fill(0).map(() => this.complexOct());
1600
- // }
1601
- // static complexesDec(n) {
1602
- // return new Array(n).fill(0).map(() => this.complexDec());
1603
- // }
1604
- // static complexesHex(n) {
1605
- // return new Array(n).fill(0).map(() => this.complexHex());
1606
- // }
1607
- // static matrix(r,c,min,max){
1608
- // return matrix(r,c,this.floats(r*c,min,max))
1609
- // }
1610
- // static matrixInt(r,c,min,max){
1611
- // return matrix(r,c,this.ints(r*c,min,max))
1612
- // }
1613
- // static matrixBin(r,c){
1614
- // return matrix(r,c,this.bins(r*c))
1615
- // }
1616
- // static matrixOct(r,c){
1617
- // return matrix(r,c,this.octs(r*c))
1618
- // }
1619
- // static matrixDec(r,c){
1620
- // return matrix(r,c,this.decs(r*c))
1621
- // }
1622
- // static matrixHex(r,c){
1623
- // return matrix(r,c,this.hex(r*c))
1624
- // }
1625
- // static matrixColor(r,c){
1626
- // return matrix(r,c,this.colors(r*c))
1627
- // }
1628
- // static matrixComplex(r,c,a,b){
1629
- // return matrix(r,c,this.complexes(r*c,a,b))
1630
- // }
1631
- // static matrixComplexInt(r,c,a,b){
1632
- // return matrix(r,c,this.complexesInt(r*c,a,b))
1633
- // }
1634
- // static matrixComplexBin(r,c){
1635
- // return matrix(r,c,this.complexesBin(r*c))
1636
- // }
1637
- // static matrixComplexOct(r,c){
1638
- // return matrix(r,c,this.complexesBin(r*c))
1639
- // }
1640
- // static matrixComplexDec(r,c){
1641
- // return matrix(r,c,this.complexesBin(r*c))
1642
- // }
1643
- // static matrixComplexHex(r,c){
1644
- // return matrix(r,c,this.complexesBin(r*c))
1645
- // }
1646
- }
1647
-
1648
1138
  class UseIPC {
1649
1139
  #channel;
1650
1140
  #eventData;
@@ -1656,7 +1146,7 @@
1656
1146
  this.#channel = new BroadcastChannel(name);
1657
1147
  this.#eventData = new Map();
1658
1148
  this.#handlers = new Map(); // Map<event, Array<{fn, rooms}>>
1659
- this.#uuid = "ziko-channel:" + Random.string(10);
1149
+ this.#uuid = "ziko-channel:" + (Math.random()*10e16); // To Be Replaced by UUID
1660
1150
  this.#subscribers = new Set([this.#uuid]);
1661
1151
  this.#currentRooms = new Set();
1662
1152
  this.#channel.addEventListener("message", (e) => {
@@ -1840,21 +1330,188 @@
1840
1330
  }
1841
1331
  },
1842
1332
 
1843
- };
1844
-
1845
- function __init__global__(){
1846
- if ( !globalThis?.__Ziko__ ){
1847
- globalThis.__Ziko__ = {
1848
- __UI__,
1849
- __HYDRATION__,
1850
- __State__,
1851
- __Config__,
1852
- __CACHE__,
1853
- };
1854
- defineParamsGetter$1(__Ziko__);
1333
+ };
1334
+
1335
+ function __init__global__(){
1336
+ if ( !globalThis?.__Ziko__ ){
1337
+ globalThis.__Ziko__ = {
1338
+ __UI__,
1339
+ __HYDRATION__,
1340
+ __State__,
1341
+ __Config__,
1342
+ __CACHE__,
1343
+ };
1344
+ defineParamsGetter$1(__Ziko__);
1345
+ }
1346
+ }
1347
+
1348
+ __init__global__();
1349
+ class UIElementCore extends UINode{
1350
+ constructor(){
1351
+ super();
1352
+ }
1353
+ init(element, name, type, render){
1354
+ this.target = globalThis.__Ziko__.__Config__.default.target||globalThis?.document?.body;
1355
+ if(typeof element === "string") {
1356
+ switch(type){
1357
+ case "html" : {
1358
+ element = globalThis?.document?.createElement(element);
1359
+ // console.log('1')
1360
+ } break;
1361
+ case "svg" : {
1362
+ element = globalThis?.document?.createElementNS("http://www.w3.org/2000/svg", element);
1363
+ // console.log('2')
1364
+ } break;
1365
+ default : throw Error("Not supported")
1366
+ }
1367
+ }
1368
+ else this.target = element?.parentElement;
1369
+ Object.assign(this.cache, {
1370
+ name,
1371
+ isInteractive : false,
1372
+ parent:null,
1373
+ isBody:false,
1374
+ isRoot:false,
1375
+ isHidden: false,
1376
+ isFrozzen:false,
1377
+ legacyParent : null,
1378
+ attributes: {},
1379
+ filters: {},
1380
+ temp:{}
1381
+ });
1382
+ this.events = {
1383
+ ptr:null,
1384
+ mouse:null,
1385
+ wheel:null,
1386
+ key:null,
1387
+ drag:null,
1388
+ drop:null,
1389
+ click:null,
1390
+ clipboard:null,
1391
+ focus:null,
1392
+ swipe:null,
1393
+ custom:null,
1394
+ };
1395
+ this.observer={
1396
+ resize:null,
1397
+ intersection:null
1398
+ };
1399
+ if(element) Object.assign(this.cache,{element});
1400
+ // useDefaultStyle && this.style({
1401
+ // position: "relative",
1402
+ // boxSizing:"border-box",
1403
+ // margin:0,
1404
+ // padding:0,
1405
+ // width : "auto",
1406
+ // height : "auto"
1407
+ // });
1408
+ this.items = new UIStore();
1409
+ globalThis.__Ziko__.__UI__[this.cache.name]?globalThis.__Ziko__.__UI__[this.cache.name]?.push(this):globalThis.__Ziko__.__UI__[this.cache.name]=[this];
1410
+ element && render && this?.render?.();
1411
+ globalThis.__Ziko__.__UI__.push(this);
1412
+ }
1413
+ get element(){
1414
+ return this.cache.element;
1415
+ }
1416
+ [Symbol.iterator]() {
1417
+ return this.items[Symbol.iterator]();
1418
+ }
1419
+ maintain() {
1420
+ for (let i = 0; i < this.items.length; i++) {
1421
+ Object.defineProperty(this, i, {
1422
+ value: this.items[i],
1423
+ writable: true,
1424
+ configurable: true,
1425
+ enumerable: false
1426
+ });
1427
+ }
1428
+ }
1429
+ isInteractive(){
1430
+ return this.cache.isInteractive;
1431
+ }
1432
+ isUIElement(){
1433
+ return true;
1434
+ }
1435
+ }
1436
+
1437
+ function register_to_class(target, ...mixins){
1438
+ mixins.forEach(n => _register_to_class_(target, n));
1439
+ }
1440
+ function _register_to_class_(target, mixin) {
1441
+ const descriptors = Object.getOwnPropertyDescriptors(mixin);
1442
+ for (const key of Reflect.ownKeys(descriptors)) {
1443
+ const desc = descriptors[key];
1444
+ if ('get' in desc || 'set' in desc || typeof desc.value !== 'function') {
1445
+ Object.defineProperty(Object.getPrototypeOf(target), key, desc);
1446
+ } else if (typeof desc.value === 'function') {
1447
+ if (!Object.getPrototypeOf(target).hasOwnProperty(key)) {
1448
+ Object.defineProperty(Object.getPrototypeOf(target), key, desc);
1449
+ }
1450
+ }
1451
+ }
1452
+ }
1453
+
1454
+ // export function mount(target = this.target) {
1455
+ // if(this.isBody) return ;
1456
+ // if(target?.isUIElement)target=target.element;
1457
+ // this.target=target;
1458
+ // this.target?.appendChild(this.element);
1459
+ // return this;
1460
+ // }
1461
+ // export function unmount(){
1462
+ // if(this.cache.parent)this.cache.parent.remove(this);
1463
+ // else if(this.target?.children?.length && [...this.target?.children].includes(this.element)) this.target.removeChild(this.element);
1464
+ // return this;
1465
+ // }
1466
+
1467
+ // export function mountAfter(target = this.target, t = 1) {
1468
+ // setTimeout(() => this.mount(), t);
1469
+ // return this;
1470
+ // }
1471
+ // export function unmountAfter(t = 1) {
1472
+ // setTimeout(() => this.unmount(), t);
1473
+ // return this;
1474
+ // }
1475
+
1476
+ function mount(target = this.target, delay = 0) {
1477
+ if (delay > 0) {
1478
+ setTimeout(() => this.mount(target, 0), delay);
1479
+ return this;
1480
+ }
1481
+
1482
+ if (this.isBody) return this;
1483
+
1484
+ if (target?.isUIElement) target = target.element;
1485
+ this.target = target;
1486
+
1487
+ this.target?.appendChild(this.element);
1488
+ return this;
1489
+ }
1490
+
1491
+ function unmount(delay = 0) {
1492
+ if (delay > 0) {
1493
+ setTimeout(() => this.unmount(0), delay);
1494
+ return this;
1495
+ }
1496
+
1497
+ if (this.cache.parent) {
1498
+ this.cache.parent.remove(this);
1499
+ } else if (
1500
+ this.target?.children?.length &&
1501
+ [...this.target.children].includes(this.element)
1502
+ ) {
1503
+ this.target.removeChild(this.element);
1855
1504
  }
1505
+
1506
+ return this;
1856
1507
  }
1857
1508
 
1509
+ var LifecycleMethods = /*#__PURE__*/Object.freeze({
1510
+ __proto__: null,
1511
+ mount: mount,
1512
+ unmount: unmount
1513
+ });
1514
+
1858
1515
  if(!globalThis.__Ziko__) __init__global__();
1859
1516
 
1860
1517
  function useState(initialValue) {
@@ -2851,6 +2508,14 @@
2851
2508
  style: style
2852
2509
  });
2853
2510
 
2511
+ // import {
2512
+ // // useCustomEvent,
2513
+ // // useSwipeEvent,
2514
+ // // watchIntersection,
2515
+ // // watchSize,
2516
+ // // watchAttr,
2517
+ // // watchChildren
2518
+ // } from "../../--reactivity-deprecated/events/custom-event.js"
2854
2519
  let UIElement$1 = class UIElement extends UIElementCore{
2855
2520
  constructor({element, name ='', type='html', render = __Ziko__.__Config__.default.render}={}){
2856
2521
  super();
@@ -4077,213 +3742,591 @@
4077
3742
  filterByCols(item){
4078
3743
  return new Matrix(this.T.arr.filter(n=>n.includes(item)))
4079
3744
  }
4080
- sortAll(calback=undefined){
4081
- let newArr=this.arr.flat(1).sort(calback);
4082
- return new Matrix(this.rows, this.cols, newArr);
3745
+ sortAll(calback=undefined){
3746
+ let newArr=this.arr.flat(1).sort(calback);
3747
+ return new Matrix(this.rows, this.cols, newArr);
3748
+ }
3749
+ count(n) {
3750
+ return this.arr.flat(1).count(n);
3751
+ }
3752
+ // toBase(n) {
3753
+ // let newArr = this.arr.flat(1).toBase(n);
3754
+ // return new Matrix(this.rows, this.cols, newArr);
3755
+ // }
3756
+
3757
+ splice(r0,c0,deleteCount,...items){
3758
+
3759
+ }
3760
+ getRows(ri, rf = ri + 1) {
3761
+ return this.slice(ri, 0, rf, this.cols);
3762
+ }
3763
+ getCols(ci, cf = ci + 1) {
3764
+ return this.slice(0, ci, this.rows, cf);
3765
+ }
3766
+ static getRows(m, ri, rf = ri + 1) {
3767
+ return m.slice(ri, 0, rf, m.cols);
3768
+ }
3769
+ static getCols(m, ci, cf = ci + 1) {
3770
+ return m.slice(0, ci, m.rows, cf);
3771
+ }
3772
+ add(...matr) {
3773
+ for (let k = 0; k < matr.length; k++) {
3774
+ if (typeof matr[k] == "number"||matr[k] instanceof Complex) matr[k] = Matrix.nums(this.rows, this.cols, matr[k]);
3775
+ for (let i = 0; i < this.rows; i++) for (var j = 0; j < this.cols; j++) this.arr[i][j] = add(this.arr[i][j],matr[k].arr[i][j]);
3776
+ }
3777
+ return new Matrix(this.rows, this.cols, this.arr.flat(1));
3778
+ }
3779
+ sub(...matr) {
3780
+ for (let k = 0; k < matr.length; k++) {
3781
+ if (typeof matr[k] == "number") matr[k] = Matrix.nums(this.rows, this.cols, matr[k]);
3782
+ for (let i = 0; i < this.rows; i++) for (var j = 0; j < this.cols; j++) this.arr[i][j] = sub(this.arr[i][j],matr[k].arr[i][j]);
3783
+ }
3784
+ return new Matrix(this.rows, this.cols, this.arr.flat(1));
3785
+ }
3786
+ static add(m1, ...m2) {
3787
+ return m1.clone().add(...m2);
3788
+ }
3789
+ static sub(m1, ...m2) {
3790
+ return m1.clone().sub(...m2);
3791
+ }
3792
+ mul(...matr) {
3793
+ for (let k = 0; k < matr.length; k++) {
3794
+ if (typeof matr[k] == "number") matr[k] = Matrix.nums(this.rows, this.cols, matr[k]);
3795
+ for (var i = 0; i < this.rows; i++) for (var j = 0; j < this.cols; j++) this.arr[i][j] = mul(this.arr[i][j],matr[k].arr[i][j]);
3796
+ }
3797
+ return new Matrix(this.rows, this.cols, this.arr.flat(1));
3798
+ }
3799
+ div(...matr) {
3800
+ for (let k = 0; k < matr.length; k++) {
3801
+ if (typeof matr[k] == "number") matr[k] = Matrix.nums(this.rows, this.cols, matr[k]);
3802
+ for (let i = 0; i < this.rows; i++) for (var j = 0; j < this.cols; j++) this.arr[i][j] = div(this.arr[i][j],matr[k].arr[i][j]);
3803
+ }
3804
+ return new Matrix(this.rows, this.cols, this.arr.flat(1));
3805
+ }
3806
+ static div(m1, ...m2) {
3807
+ return m1.clone().div(...m2);
3808
+ }
3809
+ static mul(m1, ...m2) {
3810
+ return m1.clone().mul(...m2);
3811
+ }
3812
+ modulo(...matr) {
3813
+ for (let k = 0; k < matr.length; k++) {
3814
+ if (typeof matr[k] == "number") matr[k] = Matrix.nums(this.rows, this.cols, matr[k]);
3815
+ for (let i = 0; i < this.rows; i++)
3816
+ for (var j = 0; j < this.cols; j++)
3817
+ this.arr[i][j]=modulo(this.arr[i][j],matr[k].arr[i][j]);
3818
+ }
3819
+ return new Matrix(this.rows, this.cols, this.arr.flat(1));
3820
+ }
3821
+ static modulo(m1, ...m2) {
3822
+ return m1.clone().modulo(...m2);
3823
+ }
3824
+ dot(matrix) {
3825
+ var res = [];
3826
+ for (var i = 0; i < this.arr.length; i++) {
3827
+ res[i] = [];
3828
+ for (var j = 0; j < matrix.arr[0].length; j++) {
3829
+ res[i][j] = 0;
3830
+ for (var k = 0; k < this.arr[0].length; k++) {
3831
+ res[i][j] = add(
3832
+ res[i][j],
3833
+ mul(this.arr[i][k],matrix.arr[k][j])
3834
+ );
3835
+ }
3836
+ }
3837
+ }
3838
+ return new Matrix(this.arr.length, matrix.arr[0].length, res.flat(1));
3839
+ }
3840
+ static dot(matrix1, matrix2) {
3841
+ return matrix1.dot(matrix2);
3842
+ }
3843
+ pow(n) {
3844
+ let a = this.clone(),
3845
+ p = this.clone();
3846
+ for (let i = 0; i < n - 1; i++) p = p.dot(a);
3847
+ return p;
3848
+ }
3849
+ static pow(m, n) {
3850
+ return m.clone().pow(n);
3851
+ }
3852
+ get somme() {
3853
+ let S = 0;
3854
+ for (let i = 0; i < this.rows; i++) for (let j = 0; j < this.cols; j++) S += this.arr[i][j];
3855
+ return S;
3856
+ }
3857
+ get hasComplex() {
3858
+ return this.arr.flat(Infinity).some((n) => n instanceof Complex);
3859
+ }
3860
+ get min() {
3861
+ if (this.hasComplex) console.error("Complex numbers are not comparable");
3862
+ let minRow = [];
3863
+ for (let i = 0; i < this.rows; i++) minRow.push(min(...this.arr[i]));
3864
+ return min(...minRow);
3865
+ }
3866
+ get max() {
3867
+ if (this.hasComplex) console.error("Complex numbers are not comparable");
3868
+ let maxRow = [];
3869
+ for (let i = 0; i < this.rows; i++) maxRow.push(max(...this.arr[i]));
3870
+ return max(...maxRow);
3871
+ }
3872
+ get minRows() {
3873
+ if (this.hasComplex) console.error("Complex numbers are not comparable");
3874
+ let minRow = [];
3875
+ for (let i = 0; i < this.rows; i++) minRow.push(min(...this.arr[i]));
3876
+ return minRow;
3877
+ }
3878
+ get maxRows() {
3879
+ if (this.hasComplex) console.error("Complex numbers are not comparable");
3880
+ let maxRow = [];
3881
+ for (let i = 0; i < this.rows; i++) maxRow.push(max(...this.arr[i]));
3882
+ return maxRow;
3883
+ }
3884
+ get minCols() {
3885
+ if (this.hasComplex) console.error("Complex numbers are not comparable");
3886
+ return this.T.minRows;
3887
+ }
3888
+ get maxCols() {
3889
+ if (this.hasComplex) console.error("Complex numbers are not comparable");
3890
+ return this.T.maxRows;
3891
+ }
3892
+ static fromVector(v) {
3893
+ return new Matrix(v.length, 1, v);
3894
+ }
3895
+ get toArray() {
3896
+ let arr = [];
3897
+ for (let i = 0; i < this.rows; i++) {
3898
+ for (let j = 0; j < this.cols; j++) {
3899
+ arr.push(this.arr[i][j]);
3900
+ }
3901
+ }
3902
+ return arr;
3903
+ }
3904
+ get serialize() {
3905
+ return JSON.stringify(this);
3906
+ }
3907
+ static deserialize(data) {
3908
+ if (typeof data == "string") data = JSON.parse(data);
3909
+ let matrix = new Matrix(data.rows, data.cols);
3910
+ matrix.arr = data.arr;
3911
+ return matrix;
3912
+ }
3913
+ sortTable(n=0,{type="num",order="asc"}={}) {
3914
+ var obj=this.T.arr.map(n=>n.map((n,i)=>Object.assign({},{x:n,y:i})));
3915
+ var newObj=this.T.arr.map(n=>n.map((n,i)=>Object.assign({},{x:n,y:i})));
3916
+ if(type==="num"){
3917
+ if(order==="asc")obj[n].sort((a,b)=>a.x-b.x);
3918
+ else if(order==="desc")obj[n].sort((a,b)=>b.x-a.x);
3919
+ else if(order==="toggle"){
3920
+ // console.log(obj[n][0])
3921
+ //console.log(obj[n][1])
3922
+ if(obj[n][0].x>obj[n][1].x)obj[n].sort((a,b)=>b.x-a.x);
3923
+ else obj[n].sort((a,b)=>a.x-b.x);
3924
+ }
3925
+ }
3926
+ else if(type==="alpha"){
3927
+ if(order==="asc")obj[n].sort((a,b)=>(""+a.x).localeCompare(""+b.x));
3928
+ else if(order==="desc")obj[n].sort((a,b)=>(""+b.x).localeCompare(""+a.x));
3929
+ }
3930
+ //var order=obj[n].map(n=>n.y);
3931
+ order=obj[n].map(n=>n.y);
3932
+ for(let i=0;i<obj.length;i++){
3933
+ if(i!==n)obj[i].map((n,j)=>n.y=order[j]);
3934
+ }
3935
+ for(let i=0;i<obj.length;i++){
3936
+ if(i!==n)newObj[i].map((n,j)=>n.x=obj[i][order[j]].x);
3937
+ }
3938
+ newObj[n]=obj[n];
3939
+ var newArr=newObj.map(n=>n.map(m=>m.x));
3940
+ return new Matrix(newArr).T;
3941
+ }
3942
+ }
3943
+
3944
+
3945
+ /**
3946
+ * @returns {Matrix}
3947
+ */
3948
+ const matrix=(r, c, element)=>new Matrix(r, c, element);
3949
+ const matrix2=(...element)=>new Matrix(2, 2, element);
3950
+ const matrix3=(...element)=>new Matrix(3, 3, element);
3951
+ const matrix4=(...element)=>new Matrix(4, 4, element);
3952
+
3953
+ const powerSet=originalSet=>{
3954
+ const subSets = [];
3955
+ const NUMBER_OF_COMBINATIONS = 2 ** originalSet.length;
3956
+ for (let i = 0; i < NUMBER_OF_COMBINATIONS; i += 1) {
3957
+ const subSet = [];
3958
+ for (let j = 0; j < originalSet.length; j += 1) {
3959
+ if (i & (1 << j)) {
3960
+ subSet.push(originalSet[j]);
3961
+ }
3962
+ }
3963
+ subSets.push(subSet);
3964
+ }
3965
+ return subSets;
3966
+ };
3967
+
3968
+ // const subSet = (...arr) => {
3969
+ // let list = arange(0, 2 ** arr.length, 1);
3970
+ // let bin = list.map((n) => n.toString(2).padStart(arr.length, '0')).map((n) => n.split("").map((n) => +n));
3971
+ // let sub = bin.map((n) => n.map((m, i) => (m === 1 ? arr[i] : null))).map((n) => n.filter((x) => x !== null));
3972
+ // return sub;
3973
+ // };
3974
+ const subSet = null;
3975
+
3976
+ const Base={
3977
+ _mode:Number,
3978
+ _map:function(func,number,toBase){
3979
+ if (number instanceof Matrix)
3980
+ return new Matrix(
3981
+ number.rows,
3982
+ number.cols,
3983
+ number.arr.flat(1).map(n=>func(n,toBase))
3984
+ );
3985
+ else if (number instanceof Complex) return new Complex(func(number.a,toBase),func(number.b,toBase));
3986
+ else if (number instanceof Array) return number.map((n) =>func(n,toBase));
3987
+ },
3988
+ dec2base(dec,base){
3989
+ base<=10?this._mode=Number:this._mode=String;
3990
+ //this._mode=String
3991
+ if (typeof dec === "number") return this._mode((dec >>> 0).toString(base));
3992
+ return this._map(this.dec2base,dec,base)
3993
+ },
3994
+ dec2bin(dec){
3995
+ return this.dec2base(dec,2);
3996
+ },
3997
+ dec2oct(dec){
3998
+ return this.dec2base(dec,8);
3999
+ },
4000
+ dec2hex(dec){
4001
+ return this.dec2base(dec,16);
4002
+ },
4003
+ bin2base(bin, base) {
4004
+ return this.dec2base(this.bin2dec(bin),base)
4005
+ },
4006
+ bin2dec(bin){
4007
+ return this._mode("0b"+bin);
4008
+ },
4009
+ bin2oct(bin){
4010
+ return this.bin2base(bin,8);
4011
+ },
4012
+ bin2hex(bin){
4013
+ return this.bin2base(bin,16);
4014
+ },
4015
+ oct2dec(oct){
4016
+ return this._mode("0o"+oct);
4017
+ },
4018
+ oct2bin(oct){
4019
+ return this.dec2bin(this.oct2dec(oct))
4020
+ },
4021
+ oct2hex(oct){
4022
+ return this.dec2hex(this.oct2dec(oct))
4023
+ },
4024
+ oct2base(oct, base) {
4025
+ return this.dec2base(this.oct2dec(oct),base)
4026
+ },
4027
+ hex2dec(hex){
4028
+ return this._mode("0x"+hex);
4029
+ },
4030
+ hex2bin(hex){
4031
+ return this.dec2bin(this.hex2dec(hex))
4032
+ },
4033
+ hex2oct(hex){
4034
+ return this.dec2oct(this.hex2dec(hex))
4035
+ },
4036
+ hex2base(hex, base) {
4037
+ return this.dec2base(this.hex2dec(hex),base)
4038
+ },
4039
+ IEEE32toDec(Bin){
4040
+ let IEEE32=Bin.split(" ").join("").padEnd(32,"0");
4041
+ let s=IEEE32[0];
4042
+ let e=2**(+("0b"+IEEE32.slice(1,9))-127);
4043
+ let m=IEEE32.slice(9,32).split("").map(n=>+n);
4044
+ let M=m.map((n,i)=>n*(2**(-i-1))).reduce((a,b)=>a+b,0);
4045
+ let dec=(-1)**s*(1+M)*e;
4046
+ return dec
4047
+ },
4048
+ IEEE64toDec(Bin){
4049
+ let IEEE64=Bin.split(" ").join("").padEnd(64,"0");
4050
+ let s=IEEE64[0];
4051
+ let e=2**(+("0b"+IEEE64.slice(1,12))-1023);
4052
+ let m=IEEE64.slice(13,64).split("").map(n=>+n);
4053
+ let M=m.map((n,i)=>n*(2**(-i-1))).reduce((a,b)=>a+b,0);
4054
+ let dec=(-1)**s*(1+M)*e;
4055
+ return dec;
4083
4056
  }
4084
- count(n) {
4085
- return this.arr.flat(1).count(n);
4057
+ };
4058
+
4059
+ const Logic$1={
4060
+ _mode:Number,
4061
+ _map:function(func,a,b){
4062
+ if (a instanceof Matrix)
4063
+ return new Matrix(
4064
+ a.rows,
4065
+ a.cols,
4066
+ a.arr.flat(1).map((n) => func(n, b))
4067
+ );
4068
+ else if (a instanceof Complex) return new Complex(func(a.a, b), func(a.b, b));
4069
+ else if (a instanceof Array) return a.map((n) => func(n, b));
4070
+ },
4071
+ not:function(input){
4072
+ if(["number","boolean"].includes(typeof input)) return Logic$1._mode(!input);
4073
+ else return this._map(this.not,input)
4074
+ },
4075
+ and:function(a, ...b){
4076
+ if(["number","boolean"].includes(typeof a))return Logic$1._mode(b.reduce((n, m) => (n &= m), a));
4077
+ else return this._map(this.and,a,b)
4078
+ },
4079
+ or:function(a, ...b) {
4080
+ if(["number","boolean"].includes(typeof a)) return Logic$1._mode(b.reduce((n, m) => (n |= m), a));
4081
+ else return this._map(this.or,a,b);
4082
+ },
4083
+ nand:function(a, ...b) {
4084
+ return this.not(this.and(a, b));
4085
+ },
4086
+ nor:function(a, ...b) {
4087
+ return this.not(this.or(a, b));
4088
+ },
4089
+ xor:function(a,...b){
4090
+ let arr=[a,...b];
4091
+ if(["number","boolean"].includes(typeof a))return this._mode(arr.reduce((length,cur)=>{
4092
+ if(+cur===1)length+=1;
4093
+ return length;
4094
+ },0)===1);
4095
+ else return this._map(this.xor,a,b);
4096
+ },
4097
+ xnor:function(a,...b){
4098
+ return Logic$1.not(Logic$1.xor(a,b))
4086
4099
  }
4087
- // toBase(n) {
4088
- // let newArr = this.arr.flat(1).toBase(n);
4089
- // return new Matrix(this.rows, this.cols, newArr);
4090
- // }
4091
4100
 
4092
- splice(r0,c0,deleteCount,...items){
4093
-
4094
- }
4095
- getRows(ri, rf = ri + 1) {
4096
- return this.slice(ri, 0, rf, this.cols);
4097
- }
4098
- getCols(ci, cf = ci + 1) {
4099
- return this.slice(0, ci, this.rows, cf);
4100
- }
4101
- static getRows(m, ri, rf = ri + 1) {
4102
- return m.slice(ri, 0, rf, m.cols);
4103
- }
4104
- static getCols(m, ci, cf = ci + 1) {
4105
- return m.slice(0, ci, m.rows, cf);
4101
+ };
4102
+
4103
+ class Permutation {
4104
+ static withDiscount(arr, l = arr.length) {
4105
+ if (l === 1) return arr.map((n) => [n]);
4106
+ const permutations = [];
4107
+ let smallerPermutations;
4108
+ smallerPermutations = this.withDiscount(arr, l - 1);
4109
+ arr.forEach((currentOption) => {
4110
+ smallerPermutations.forEach((smallerPermutation) => {
4111
+ permutations.push([currentOption].concat(smallerPermutation));
4112
+ });
4113
+ });
4114
+ return permutations;
4106
4115
  }
4107
- add(...matr) {
4108
- for (let k = 0; k < matr.length; k++) {
4109
- if (typeof matr[k] == "number"||matr[k] instanceof Complex) matr[k] = Matrix.nums(this.rows, this.cols, matr[k]);
4110
- for (let i = 0; i < this.rows; i++) for (var j = 0; j < this.cols; j++) this.arr[i][j] = add(this.arr[i][j],matr[k].arr[i][j]);
4116
+ static withoutDiscount(arr) {
4117
+ const l = arr.length;
4118
+ if (l === 1) return arr.map((n) => [n]);
4119
+ const permutations = [];
4120
+ const smallerPermutations = this.withoutDiscount(arr.slice(1));
4121
+ const firstOption = arr[0];
4122
+ for (let i = 0; i < smallerPermutations.length; i++) {
4123
+ const smallerPermutation = smallerPermutations[i];
4124
+ for (let j = 0; j <= smallerPermutation.length; j++) {
4125
+ const permutationPrefix = smallerPermutation.slice(0, j);
4126
+ const permutationSuffix = smallerPermutation.slice(j);
4127
+ permutations.push(permutationPrefix.concat([firstOption], permutationSuffix));
4128
+ }
4111
4129
  }
4112
- return new Matrix(this.rows, this.cols, this.arr.flat(1));
4130
+ return permutations;
4113
4131
  }
4114
- sub(...matr) {
4115
- for (let k = 0; k < matr.length; k++) {
4116
- if (typeof matr[k] == "number") matr[k] = Matrix.nums(this.rows, this.cols, matr[k]);
4117
- for (let i = 0; i < this.rows; i++) for (var j = 0; j < this.cols; j++) this.arr[i][j] = sub(this.arr[i][j],matr[k].arr[i][j]);
4132
+ }
4133
+
4134
+ class Combinaison {
4135
+ static withDiscount(comboOptions, comboLength) {
4136
+ if (comboLength === 1) {
4137
+ return comboOptions.map((comboOption) => [comboOption]);
4118
4138
  }
4119
- return new Matrix(this.rows, this.cols, this.arr.flat(1));
4120
- }
4121
- static add(m1, ...m2) {
4122
- return m1.clone().add(...m2);
4123
- }
4124
- static sub(m1, ...m2) {
4125
- return m1.clone().sub(...m2);
4139
+ const combos = [];
4140
+ comboOptions.forEach((currentOption, optionIndex) => {
4141
+ const smallerCombos = this.withDiscount(comboOptions.slice(optionIndex), comboLength - 1);
4142
+ smallerCombos.forEach((smallerCombo) => {
4143
+ combos.push([currentOption].concat(smallerCombo));
4144
+ });
4145
+ });
4146
+ return combos;
4126
4147
  }
4127
- mul(...matr) {
4128
- for (let k = 0; k < matr.length; k++) {
4129
- if (typeof matr[k] == "number") matr[k] = Matrix.nums(this.rows, this.cols, matr[k]);
4130
- for (var i = 0; i < this.rows; i++) for (var j = 0; j < this.cols; j++) this.arr[i][j] = mul(this.arr[i][j],matr[k].arr[i][j]);
4148
+ static withoutDiscount(comboOptions, comboLength) {
4149
+ if (comboLength === 1) {
4150
+ return comboOptions.map((comboOption) => [comboOption]);
4131
4151
  }
4132
- return new Matrix(this.rows, this.cols, this.arr.flat(1));
4152
+ const combos = [];
4153
+ comboOptions.forEach((currentOption, optionIndex) => {
4154
+ const smallerCombos = this.withoutDiscount(comboOptions.slice(optionIndex + 1), comboLength - 1);
4155
+ smallerCombos.forEach((smallerCombo) => {
4156
+ combos.push([currentOption].concat(smallerCombo));
4157
+ });
4158
+ });
4159
+
4160
+ return combos;
4133
4161
  }
4134
- div(...matr) {
4135
- for (let k = 0; k < matr.length; k++) {
4136
- if (typeof matr[k] == "number") matr[k] = Matrix.nums(this.rows, this.cols, matr[k]);
4137
- for (let i = 0; i < this.rows; i++) for (var j = 0; j < this.cols; j++) this.arr[i][j] = div(this.arr[i][j],matr[k].arr[i][j]);
4138
- }
4139
- return new Matrix(this.rows, this.cols, this.arr.flat(1));
4162
+ }
4163
+ const combinaison=(comboOptions, comboLength, discount=false)=>Combinaison[discount?"withDiscount":"withoutDiscount"](comboOptions, comboLength);
4164
+
4165
+ class Random {
4166
+ static float(a = 1, b) {
4167
+ return b ? Math.random() * (b - a) + a : a * Math.random();
4140
4168
  }
4141
- static div(m1, ...m2) {
4142
- return m1.clone().div(...m2);
4169
+ static int(a, b) {
4170
+ return Math.floor(this.float(a, b));
4143
4171
  }
4144
- static mul(m1, ...m2) {
4145
- return m1.clone().mul(...m2);
4172
+ static char(upperCase){
4173
+ upperCase=upperCase??this.bool();
4174
+ const Char=String.fromCharCode(this.int(97,120));
4175
+ return upperCase?Char.toUpperCase():Char;
4146
4176
  }
4147
- modulo(...matr) {
4148
- for (let k = 0; k < matr.length; k++) {
4149
- if (typeof matr[k] == "number") matr[k] = Matrix.nums(this.rows, this.cols, matr[k]);
4150
- for (let i = 0; i < this.rows; i++)
4151
- for (var j = 0; j < this.cols; j++)
4152
- this.arr[i][j]=modulo(this.arr[i][j],matr[k].arr[i][j]);
4153
- }
4154
- return new Matrix(this.rows, this.cols, this.arr.flat(1));
4177
+ static bool(){
4178
+ return [false,true][Math.floor(Math.random()*2)];
4155
4179
  }
4156
- static modulo(m1, ...m2) {
4157
- return m1.clone().modulo(...m2);
4180
+ static string(length,upperCase){
4181
+ return length instanceof Array?
4182
+ new Array(this.int(...length)).fill(0).map(() => this.char(upperCase)).join(""):
4183
+ new Array(length).fill(0).map(() => this.char(upperCase)).join("");
4158
4184
  }
4159
- dot(matrix) {
4160
- var res = [];
4161
- for (var i = 0; i < this.arr.length; i++) {
4162
- res[i] = [];
4163
- for (var j = 0; j < matrix.arr[0].length; j++) {
4164
- res[i][j] = 0;
4165
- for (var k = 0; k < this.arr[0].length; k++) {
4166
- res[i][j] = add(
4167
- res[i][j],
4168
- mul(this.arr[i][k],matrix.arr[k][j])
4169
- );
4170
- }
4171
- }
4172
- }
4173
- return new Matrix(this.arr.length, matrix.arr[0].length, res.flat(1));
4185
+ static bin() {
4186
+ return this.int(2);
4174
4187
  }
4175
- static dot(matrix1, matrix2) {
4176
- return matrix1.dot(matrix2);
4188
+ static oct() {
4189
+ return this.int(8);
4177
4190
  }
4178
- pow(n) {
4179
- let a = this.clone(),
4180
- p = this.clone();
4181
- for (let i = 0; i < n - 1; i++) p = p.dot(a);
4182
- return p;
4191
+ static dec() {
4192
+ return this.int(8);
4183
4193
  }
4184
- static pow(m, n) {
4185
- return m.clone().pow(n);
4194
+ static hex() {
4195
+ return this.int(16);
4186
4196
  }
4187
- get somme() {
4188
- let S = 0;
4189
- for (let i = 0; i < this.rows; i++) for (let j = 0; j < this.cols; j++) S += this.arr[i][j];
4190
- return S;
4197
+ static choice(choices = [1, 2, 3], p = new Array(choices.length).fill(1 / choices.length)) {
4198
+ let newchoice = new Array(100);
4199
+ p=Utils.accum(...p).map(n=>n*100);
4200
+ newchoice.fill(choices[0], 0, p[0]);
4201
+ for (let i = 1; i < choices.length; i++) newchoice.fill(choices[i], p[i - 1], p[i]);
4202
+ return newchoice[this.int(newchoice.length - 1)];
4191
4203
  }
4192
- get hasComplex() {
4193
- return this.arr.flat(Infinity).some((n) => n instanceof Complex);
4204
+ static shuffleArr(arr){
4205
+ return arr.sort(()=>0.5-Math.random())
4194
4206
  }
4195
- get min() {
4196
- if (this.hasComplex) console.error("Complex numbers are not comparable");
4197
- let minRow = [];
4198
- for (let i = 0; i < this.rows; i++) minRow.push(min(...this.arr[i]));
4199
- return min(...minRow);
4207
+ static floats(n, a, b) {
4208
+ return new Array(n).fill(0).map(() => this.float(a, b));
4200
4209
  }
4201
- get max() {
4202
- if (this.hasComplex) console.error("Complex numbers are not comparable");
4203
- let maxRow = [];
4204
- for (let i = 0; i < this.rows; i++) maxRow.push(max(...this.arr[i]));
4205
- return max(...maxRow);
4210
+ static ints(n, a, b) {
4211
+ return new Array(n).fill(0).map(() => this.int(a, b));
4206
4212
  }
4207
- get minRows() {
4208
- if (this.hasComplex) console.error("Complex numbers are not comparable");
4209
- let minRow = [];
4210
- for (let i = 0; i < this.rows; i++) minRow.push(min(...this.arr[i]));
4211
- return minRow;
4213
+ static bools(n){
4214
+ return new Array(n).fill(0).map(() => this.bool());
4212
4215
  }
4213
- get maxRows() {
4214
- if (this.hasComplex) console.error("Complex numbers are not comparable");
4215
- let maxRow = [];
4216
- for (let i = 0; i < this.rows; i++) maxRow.push(max(...this.arr[i]));
4217
- return maxRow;
4216
+ static bins(n) {
4217
+ return new Array(n).fill(0).map(() => this.int(2));
4218
4218
  }
4219
- get minCols() {
4220
- if (this.hasComplex) console.error("Complex numbers are not comparable");
4221
- return this.T.minRows;
4219
+ static octs(n) {
4220
+ return new Array(n).fill(0).map(() => this.int(8));
4222
4221
  }
4223
- get maxCols() {
4224
- if (this.hasComplex) console.error("Complex numbers are not comparable");
4225
- return this.T.maxRows;
4222
+ static decs(n) {
4223
+ return new Array(n).fill(0).map(() => this.int(10));
4226
4224
  }
4227
- static fromVector(v) {
4228
- return new Matrix(v.length, 1, v);
4225
+ static hexs(n) {
4226
+ return new Array(n).fill(0).map(() => this.int(16));
4229
4227
  }
4230
- get toArray() {
4231
- let arr = [];
4232
- for (let i = 0; i < this.rows; i++) {
4233
- for (let j = 0; j < this.cols; j++) {
4234
- arr.push(this.arr[i][j]);
4235
- }
4236
- }
4237
- return arr;
4228
+ static choices(n, choices, p) {
4229
+ return new Array(n).fill(0).map(() => this.choice(choices, p));
4238
4230
  }
4239
- get serialize() {
4240
- return JSON.stringify(this);
4231
+ static perm(...arr) {
4232
+ // permutation
4233
+ return arr.permS[this.int(arr.length)];
4241
4234
  }
4242
- static deserialize(data) {
4243
- if (typeof data == "string") data = JSON.parse(data);
4244
- let matrix = new Matrix(data.rows, data.cols);
4245
- matrix.arr = data.arr;
4246
- return matrix;
4235
+ static color() {
4236
+ return "#" + Base.dec2hex(this.float(16777216)).padStart(6,0);
4247
4237
  }
4248
- sortTable(n=0,{type="num",order="asc"}={}) {
4249
- var obj=this.T.arr.map(n=>n.map((n,i)=>Object.assign({},{x:n,y:i})));
4250
- var newObj=this.T.arr.map(n=>n.map((n,i)=>Object.assign({},{x:n,y:i})));
4251
- if(type==="num"){
4252
- if(order==="asc")obj[n].sort((a,b)=>a.x-b.x);
4253
- else if(order==="desc")obj[n].sort((a,b)=>b.x-a.x);
4254
- else if(order==="toggle"){
4255
- // console.log(obj[n][0])
4256
- //console.log(obj[n][1])
4257
- if(obj[n][0].x>obj[n][1].x)obj[n].sort((a,b)=>b.x-a.x);
4258
- else obj[n].sort((a,b)=>a.x-b.x);
4259
- }
4260
- }
4261
- else if(type==="alpha"){
4262
- if(order==="asc")obj[n].sort((a,b)=>(""+a.x).localeCompare(""+b.x));
4263
- else if(order==="desc")obj[n].sort((a,b)=>(""+b.x).localeCompare(""+a.x));
4264
- }
4265
- //var order=obj[n].map(n=>n.y);
4266
- order=obj[n].map(n=>n.y);
4267
- for(let i=0;i<obj.length;i++){
4268
- if(i!==n)obj[i].map((n,j)=>n.y=order[j]);
4269
- }
4270
- for(let i=0;i<obj.length;i++){
4271
- if(i!==n)newObj[i].map((n,j)=>n.x=obj[i][order[j]].x);
4272
- }
4273
- newObj[n]=obj[n];
4274
- var newArr=newObj.map(n=>n.map(m=>m.x));
4275
- return new Matrix(newArr).T;
4238
+ static colors(n) {
4239
+ return new Array(n).fill(null).map(()=>this.color());
4276
4240
  }
4277
- }
4278
4241
 
4279
-
4280
- /**
4281
- * @returns {Matrix}
4282
- */
4283
- const matrix=(r, c, element)=>new Matrix(r, c, element);
4284
- const matrix2=(...element)=>new Matrix(2, 2, element);
4285
- const matrix3=(...element)=>new Matrix(3, 3, element);
4286
- const matrix4=(...element)=>new Matrix(4, 4, element);
4242
+ // Should be Moved to Matrix and Complex to avoid Circular dependencies
4243
+ // static complex(a = [0,1], b = [0,1]) {
4244
+ // return a instanceof Array?
4245
+ // new Complex(
4246
+ // this.float(a[0], a[1]),
4247
+ // this.float(b[0], b[1])
4248
+ // ):
4249
+ // new Complex(
4250
+ // ...this.floats(2,a,b)
4251
+ // )
4252
+
4253
+ // }
4254
+ // static complexInt(a = [0,1], b = [0,1]) {
4255
+ // return new Complex(
4256
+ // this.int(a[0], a[1]),
4257
+ // this.int(b[0], b[1])
4258
+ // );
4259
+ // }
4260
+ // static complexBin() {
4261
+ // return new Complex(...this.bins(2));
4262
+ // }
4263
+ // static complexOct() {
4264
+ // return new Complex(...this.octs(2));
4265
+ // }
4266
+ // static complexDec() {
4267
+ // return new Complex(...this.decs(10));
4268
+ // }
4269
+ // static complexHex() {
4270
+ // return new Complex(...this.octs(2));
4271
+ // }
4272
+ // static complexes(n, a = 0, b = 1) {
4273
+ // return new Array(n).fill(0).map(() => this.complex(a, b));
4274
+ // }
4275
+ // static complexesInt(n, a = 0, b = 1) {
4276
+ // return new Array(n).fill(0).map(() => this.complexInt(a, b));
4277
+ // }
4278
+ // static complexesBin(n) {
4279
+ // return new Array(n).fill(0).map(() => this.complexBin());
4280
+ // }
4281
+ // static complexesOct(n) {
4282
+ // return new Array(n).fill(0).map(() => this.complexOct());
4283
+ // }
4284
+ // static complexesDec(n) {
4285
+ // return new Array(n).fill(0).map(() => this.complexDec());
4286
+ // }
4287
+ // static complexesHex(n) {
4288
+ // return new Array(n).fill(0).map(() => this.complexHex());
4289
+ // }
4290
+ // static matrix(r,c,min,max){
4291
+ // return matrix(r,c,this.floats(r*c,min,max))
4292
+ // }
4293
+ // static matrixInt(r,c,min,max){
4294
+ // return matrix(r,c,this.ints(r*c,min,max))
4295
+ // }
4296
+ // static matrixBin(r,c){
4297
+ // return matrix(r,c,this.bins(r*c))
4298
+ // }
4299
+ // static matrixOct(r,c){
4300
+ // return matrix(r,c,this.octs(r*c))
4301
+ // }
4302
+ // static matrixDec(r,c){
4303
+ // return matrix(r,c,this.decs(r*c))
4304
+ // }
4305
+ // static matrixHex(r,c){
4306
+ // return matrix(r,c,this.hex(r*c))
4307
+ // }
4308
+ // static matrixColor(r,c){
4309
+ // return matrix(r,c,this.colors(r*c))
4310
+ // }
4311
+ // static matrixComplex(r,c,a,b){
4312
+ // return matrix(r,c,this.complexes(r*c,a,b))
4313
+ // }
4314
+ // static matrixComplexInt(r,c,a,b){
4315
+ // return matrix(r,c,this.complexesInt(r*c,a,b))
4316
+ // }
4317
+ // static matrixComplexBin(r,c){
4318
+ // return matrix(r,c,this.complexesBin(r*c))
4319
+ // }
4320
+ // static matrixComplexOct(r,c){
4321
+ // return matrix(r,c,this.complexesBin(r*c))
4322
+ // }
4323
+ // static matrixComplexDec(r,c){
4324
+ // return matrix(r,c,this.complexesBin(r*c))
4325
+ // }
4326
+ // static matrixComplexHex(r,c){
4327
+ // return matrix(r,c,this.complexesBin(r*c))
4328
+ // }
4329
+ }
4287
4330
 
4288
4331
  const { PI, sqrt: sqrt$1, cos: cos$1, sin: sin$1, acos, pow } = Math;
4289
4332