@sarafapp/iron_core 1.0.33 → 1.0.35
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/IronCore.js +35 -34
- package/dist/IronCore.umd.cjs +1 -1
- package/dist/src/BaseModel.d.ts +1 -1
- package/package.json +3 -2
package/dist/IronCore.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import L from "dayjs";
|
|
2
|
-
import { toRaw as xe, reactive as
|
|
3
|
-
import { JsonConvert as tt, JsonProperty as
|
|
2
|
+
import { toRaw as xe, reactive as Ne, ref as M, watch as Qe, computed as S, onBeforeUnmount as et } from "vue";
|
|
3
|
+
import { JsonConvert as tt, JsonProperty as N, JsonObject as be } from "json2typescript";
|
|
4
4
|
import { defineStore as je } from "pinia";
|
|
5
5
|
var we = /* @__PURE__ */ ((t) => (t.BankCard = "####-####-####-####", t.Iban = "##-####-####-####-####-####-##", t))(we || {}), Q = /* @__PURE__ */ ((t) => (t.FullDate = "YYYY/M/D HH:mm", t.SimpleDate = "YYYY/M/D", t.CompactGregorianDate = "YYYYMMDD", t.ShortJalaliDate = "YYMM", t.JustHour = "HH:mm:ss", t))(Q || {});
|
|
6
6
|
const st = [
|
|
@@ -853,7 +853,7 @@ class A {
|
|
|
853
853
|
return L(new Date(e)).subtract(1, "day").format(s);
|
|
854
854
|
}
|
|
855
855
|
}
|
|
856
|
-
var m = /* @__PURE__ */ ((t) => (t.FetchList = "fetchList", t.AutoRefresh = "autoRefresh", t.FetchItem = "fetchItem", t.FetchLastItems = "fetchLastItems", t.FetchPreviousItems = "fetchPreviousItems", t.Create = "CREATE", t.Update = "UPDATE", t.Delete = "DELETE", t.Search = "SEARCH", t.Sort = "SORT", t.Success = "SUCCESS", t.Error = "ERROR", t.Idle = "IDLE", t))(m || {}), T = /* @__PURE__ */ ((t) => (t.Width = "width", t.Height = "height", t[t.DefaultWidth = 500] = "DefaultWidth", t[t.DefaultHeight = 350] = "DefaultHeight", t[t.MinimalAvailableSize = 0] = "MinimalAvailableSize", t))(T || {}),
|
|
856
|
+
var m = /* @__PURE__ */ ((t) => (t.FetchList = "fetchList", t.AutoRefresh = "autoRefresh", t.FetchItem = "fetchItem", t.FetchLastItems = "fetchLastItems", t.FetchPreviousItems = "fetchPreviousItems", t.Create = "CREATE", t.Update = "UPDATE", t.Delete = "DELETE", t.Search = "SEARCH", t.Sort = "SORT", t.Success = "SUCCESS", t.Error = "ERROR", t.Idle = "IDLE", t))(m || {}), T = /* @__PURE__ */ ((t) => (t.Width = "width", t.Height = "height", t[t.DefaultWidth = 500] = "DefaultWidth", t[t.DefaultHeight = 350] = "DefaultHeight", t[t.MinimalAvailableSize = 0] = "MinimalAvailableSize", t))(T || {}), Y = /* @__PURE__ */ ((t) => (t.ASC = "ASC", t.DESC = "DESC", t))(Y || {}), $t = /* @__PURE__ */ ((t) => (t.ASC = "ascend", t.DESC = "descend", t))($t || {}), _e = /* @__PURE__ */ ((t) => (t.Left = "left", t.Right = "right", t.Center = "center", t))(_e || {}), Ae = /* @__PURE__ */ ((t) => (t.Text = "text", t))(Ae || {}), Me = /* @__PURE__ */ ((t) => (t.Text = "text", t.ACTION = "action", t.Tag = "tag", t.Iban = "iban", t.BankCard = "bankCard", t.Symbol = "symbol", t.TradeDetail = "tradeDetail", t.SymbolPrice = "symbolPrice", t.TradeSymbol = "tradeSymbol", t.Price = "price", t.DynamicCurrencyPrice = "dynamicCurrencyPrice", t.TradeDate = "tradeDate", t.RequestResponseIdentity = "requestResponseIdentity", t.Image = "image", t))(Me || {}), Be = /* @__PURE__ */ ((t) => (t[t.MINIMAL_LOADABLE_HEADER_COUNT = 0] = "MINIMAL_LOADABLE_HEADER_COUNT", t[t.DEFAULT_ITEM_COUNT_PER_PAGE = 20] = "DEFAULT_ITEM_COUNT_PER_PAGE", t.PAGINATION_POSITION = "bottomCenter", t))(Be || {}), Ce = /* @__PURE__ */ ((t) => (t.FontFamily = "IRANSansX", t))(Ce || {}), ee = /* @__PURE__ */ ((t) => (t.Open = "open", t.Close = "close", t))(ee || {}), Pt = /* @__PURE__ */ ((t) => (t[t.NotFound = 404] = "NotFound", t[t.Unauthorized = 401] = "Unauthorized", t[t.ServerError = 500] = "ServerError", t))(Pt || {}), de = /* @__PURE__ */ ((t) => (t[t.Invalid = 0] = "Invalid", t[t.Valid = 1] = "Valid", t))(de || {}), V = /* @__PURE__ */ ((t) => (t.Theme = "theme", t.AccessList = "accessList", t.Token = "token", t.SSO_ACCESS_LIST = "ssoAccessList", t))(V || {}), Ce = /* @__PURE__ */ ((t) => (t.Light = "light", t.Dark = "dark", t))(Ce || {}), Re = /* @__PURE__ */ ((t) => (t.Dialog = "dialog", t.Drawer = "drawer", t.Module = "module", t.Toast = "toast", t))(Re || {}), Ft = /* @__PURE__ */ ((t) => (t.USDT = "USDT", t))(Ft || {});
|
|
857
857
|
class W {
|
|
858
858
|
static getBankImageBaseOnCardInfo(e, s) {
|
|
859
859
|
return e === void 0 ? "/img/banks/shetab.png" : s === "IBAN" ? (e = A.toEnglishDigits(
|
|
@@ -912,8 +912,8 @@ class W {
|
|
|
912
912
|
""
|
|
913
913
|
);
|
|
914
914
|
}
|
|
915
|
-
static isArraySorted(e, s = (a) => a, r =
|
|
916
|
-
return e.every((a, n) => e.length - 1 === n ? !0 : r ===
|
|
915
|
+
static isArraySorted(e, s = (a) => a, r = Y.ASC) {
|
|
916
|
+
return e.every((a, n) => e.length - 1 === n ? !0 : r === Y.ASC ? s(a) <= s(e[n + 1]) : s(a) >= s(e[n + 1]));
|
|
917
917
|
}
|
|
918
918
|
}
|
|
919
919
|
const $ = class $ {
|
|
@@ -1061,7 +1061,7 @@ function os(t) {
|
|
|
1061
1061
|
function ls(t, e) {
|
|
1062
1062
|
return t - 1 === e;
|
|
1063
1063
|
}
|
|
1064
|
-
function
|
|
1064
|
+
function Yt(t) {
|
|
1065
1065
|
return String(t).length === 0 || t === null || t === void 0;
|
|
1066
1066
|
}
|
|
1067
1067
|
function cs(t) {
|
|
@@ -1072,7 +1072,7 @@ class us {
|
|
|
1072
1072
|
this.initialData = null, this.data = new Vt(), this._validators = [], this._id = Math.random(), this.data.value = s, this.data.name = e, this.shouldRunValidation() && this.runValidation(!0);
|
|
1073
1073
|
}
|
|
1074
1074
|
shouldRunValidation() {
|
|
1075
|
-
return this.data.hasCustomValidationCheck ? !1 : this.data.isRequired ? !0 : !
|
|
1075
|
+
return this.data.hasCustomValidationCheck ? !1 : this.data.isRequired ? !0 : !Yt(this.data.value);
|
|
1076
1076
|
}
|
|
1077
1077
|
async runValidation(e = !1) {
|
|
1078
1078
|
for (const s of this._validators) {
|
|
@@ -1244,12 +1244,13 @@ class fs {
|
|
|
1244
1244
|
return Array.from(this._inputControls.values());
|
|
1245
1245
|
}
|
|
1246
1246
|
async runValidation(e) {
|
|
1247
|
-
|
|
1248
|
-
|
|
1247
|
+
let s = !0;
|
|
1248
|
+
for (const r of this.getInputControlsAsArray())
|
|
1249
|
+
if (e && await r.runValidation(!0), !r.getIsValid() && (s = !1, !e)) {
|
|
1249
1250
|
this._isValid = !1;
|
|
1250
1251
|
return;
|
|
1251
1252
|
}
|
|
1252
|
-
this._isValid =
|
|
1253
|
+
this._isValid = s;
|
|
1253
1254
|
}
|
|
1254
1255
|
addInputControls(e) {
|
|
1255
1256
|
for (const s of e)
|
|
@@ -1291,7 +1292,7 @@ class fs {
|
|
|
1291
1292
|
}
|
|
1292
1293
|
}
|
|
1293
1294
|
function vs(t, e = !1) {
|
|
1294
|
-
const s =
|
|
1295
|
+
const s = Ne(t), r = M(
|
|
1295
1296
|
de.Invalid
|
|
1296
1297
|
);
|
|
1297
1298
|
return Qe(
|
|
@@ -1334,7 +1335,7 @@ const Je = "150px", Ge = 2, ms = {
|
|
|
1334
1335
|
align: _e.Center,
|
|
1335
1336
|
headerType: Ae.Text,
|
|
1336
1337
|
accessLevel: null
|
|
1337
|
-
},
|
|
1338
|
+
}, Nt = {
|
|
1338
1339
|
width: Je,
|
|
1339
1340
|
align: _e.Center,
|
|
1340
1341
|
headerType: Ae.Text,
|
|
@@ -1370,17 +1371,17 @@ class Pe {
|
|
|
1370
1371
|
}
|
|
1371
1372
|
class ps {
|
|
1372
1373
|
arrayOfObjectSort(e, s, r, a = new Pe()) {
|
|
1373
|
-
return r ===
|
|
1374
|
+
return r === Y.ASC ? a.aSort(e, s) : a.bSort(e, s);
|
|
1374
1375
|
}
|
|
1375
1376
|
arraySort(e, s, r = new Pe()) {
|
|
1376
|
-
return s ===
|
|
1377
|
+
return s === Y.ASC ? r.aSort(e) : r.bSort(e);
|
|
1377
1378
|
}
|
|
1378
1379
|
}
|
|
1379
1380
|
class jt {
|
|
1380
1381
|
constructor(e) {
|
|
1381
1382
|
this.currentPage = 1, this.currentPageSize = 20, this.currentSortDetail = new We(
|
|
1382
1383
|
"id",
|
|
1383
|
-
|
|
1384
|
+
Y.DESC
|
|
1384
1385
|
), this.loadedRows = [], this.headerSchema = [], this.service = e, this.accessService = fe.GetInstance();
|
|
1385
1386
|
}
|
|
1386
1387
|
addHeader(e) {
|
|
@@ -1525,7 +1526,7 @@ class gs extends jt {
|
|
|
1525
1526
|
}
|
|
1526
1527
|
function ys(t) {
|
|
1527
1528
|
return {
|
|
1528
|
-
...
|
|
1529
|
+
...Nt,
|
|
1529
1530
|
...t
|
|
1530
1531
|
};
|
|
1531
1532
|
}
|
|
@@ -1621,7 +1622,7 @@ function Bt() {
|
|
|
1621
1622
|
}
|
|
1622
1623
|
class Ht {
|
|
1623
1624
|
constructor() {
|
|
1624
|
-
this.pageNumber = 1, this.itemCount = 20, this.sortDetail = new We("id",
|
|
1625
|
+
this.pageNumber = 1, this.itemCount = 20, this.sortDetail = new We("id", Y.DESC), this.filters = [];
|
|
1625
1626
|
}
|
|
1626
1627
|
}
|
|
1627
1628
|
class _s {
|
|
@@ -2086,7 +2087,7 @@ const F = class F {
|
|
|
2086
2087
|
}
|
|
2087
2088
|
};
|
|
2088
2089
|
F.Instance = null;
|
|
2089
|
-
let
|
|
2090
|
+
let Ye = F;
|
|
2090
2091
|
var Jt = /* @__PURE__ */ ((t) => (t.Success = "success", t.Failure = "error", t.Info = "info", t.Warning = "warning", t))(Jt || {}), Ze = /* @__PURE__ */ ((t) => (t.BottomLeft = "bottomLeft", t.TopLeft = "topLeft", t))(Ze || {});
|
|
2091
2092
|
class Ps {
|
|
2092
2093
|
constructor(e, s, r) {
|
|
@@ -2094,7 +2095,7 @@ class Ps {
|
|
|
2094
2095
|
}
|
|
2095
2096
|
}
|
|
2096
2097
|
const Fs = je(Re.Dialog, () => {
|
|
2097
|
-
const t =
|
|
2098
|
+
const t = Ne({
|
|
2098
2099
|
dialogComponent: null,
|
|
2099
2100
|
width: T.DefaultWidth,
|
|
2100
2101
|
height: T.DefaultHeight,
|
|
@@ -2146,7 +2147,7 @@ const Fs = je(Re.Dialog, () => {
|
|
|
2146
2147
|
isDrawerOpen: e
|
|
2147
2148
|
};
|
|
2148
2149
|
});
|
|
2149
|
-
class
|
|
2150
|
+
class Ys {
|
|
2150
2151
|
constructor() {
|
|
2151
2152
|
this.observers = [];
|
|
2152
2153
|
}
|
|
@@ -2163,7 +2164,7 @@ class Ns {
|
|
|
2163
2164
|
e.update(this);
|
|
2164
2165
|
}
|
|
2165
2166
|
}
|
|
2166
|
-
class
|
|
2167
|
+
class Ns {
|
|
2167
2168
|
constructor(e) {
|
|
2168
2169
|
this.mapProcesses = /* @__PURE__ */ new Map(), this.processes = e, this.assignProcessManager();
|
|
2169
2170
|
}
|
|
@@ -2311,10 +2312,10 @@ let ve = class {
|
|
|
2311
2312
|
}
|
|
2312
2313
|
};
|
|
2313
2314
|
C([
|
|
2314
|
-
|
|
2315
|
+
N("value", String, !0)
|
|
2315
2316
|
], ve.prototype, "value", 2);
|
|
2316
2317
|
C([
|
|
2317
|
-
|
|
2318
|
+
N("symbol", String)
|
|
2318
2319
|
], ve.prototype, "symbol", 2);
|
|
2319
2320
|
ve = C([
|
|
2320
2321
|
be("Amount")
|
|
@@ -2330,7 +2331,7 @@ let me = class {
|
|
|
2330
2331
|
}
|
|
2331
2332
|
};
|
|
2332
2333
|
C([
|
|
2333
|
-
|
|
2334
|
+
N("id", Object)
|
|
2334
2335
|
], me.prototype, "id", 2);
|
|
2335
2336
|
me = C([
|
|
2336
2337
|
be("BaseModel")
|
|
@@ -2338,16 +2339,16 @@ me = C([
|
|
|
2338
2339
|
let Z = class extends me {
|
|
2339
2340
|
};
|
|
2340
2341
|
C([
|
|
2341
|
-
|
|
2342
|
+
N("symbol", String)
|
|
2342
2343
|
], Z.prototype, "symbol", 2);
|
|
2343
2344
|
C([
|
|
2344
|
-
|
|
2345
|
+
N("enName", String)
|
|
2345
2346
|
], Z.prototype, "enName", 2);
|
|
2346
2347
|
C([
|
|
2347
|
-
|
|
2348
|
+
N("faName", String)
|
|
2348
2349
|
], Z.prototype, "faName", 2);
|
|
2349
2350
|
C([
|
|
2350
|
-
|
|
2351
|
+
N("image", String)
|
|
2351
2352
|
], Z.prototype, "image", 2);
|
|
2352
2353
|
Z = C([
|
|
2353
2354
|
be("MinifiedSymbolModel")
|
|
@@ -2396,7 +2397,7 @@ class Ws {
|
|
|
2396
2397
|
}
|
|
2397
2398
|
export {
|
|
2398
2399
|
Ve as APIErrorHandlerRegistry,
|
|
2399
|
-
|
|
2400
|
+
Ys as AbstractSubject,
|
|
2400
2401
|
He as AccessControl,
|
|
2401
2402
|
fe as AccessLevel,
|
|
2402
2403
|
ws as Action,
|
|
@@ -2437,12 +2438,12 @@ export {
|
|
|
2437
2438
|
us as InputControl,
|
|
2438
2439
|
hs as InputControlBuilder,
|
|
2439
2440
|
Vt as InputControlData,
|
|
2440
|
-
|
|
2441
|
+
Ye as JsonMapper,
|
|
2441
2442
|
m as LoadingStatus,
|
|
2442
2443
|
Z as MinifiedSymbolModel,
|
|
2443
2444
|
Ht as Params,
|
|
2444
2445
|
js as Process,
|
|
2445
|
-
|
|
2446
|
+
Ns as ProcessManager,
|
|
2446
2447
|
ts as RangeValue,
|
|
2447
2448
|
Us as RouteGuard,
|
|
2448
2449
|
ze as Scheduler,
|
|
@@ -2451,7 +2452,7 @@ export {
|
|
|
2451
2452
|
as as SomeAccess,
|
|
2452
2453
|
is as SomeLevelsAuthorizationDirective,
|
|
2453
2454
|
We as SortDetail,
|
|
2454
|
-
|
|
2455
|
+
Y as SortOrder,
|
|
2455
2456
|
$t as SortOrderTableHeader,
|
|
2456
2457
|
ps as Sorter,
|
|
2457
2458
|
Pt as StatusCode,
|
|
@@ -2463,7 +2464,7 @@ export {
|
|
|
2463
2464
|
As as SyncDetail,
|
|
2464
2465
|
ms as TABLE_ACTION_COLUMN,
|
|
2465
2466
|
Ge as TABLE_COLUMN_DEFAULT_COLSPAN,
|
|
2466
|
-
|
|
2467
|
+
Nt as TABLE_COLUMN_DEFAULT_VALUES,
|
|
2467
2468
|
Je as TABLE_COLUMN_DEFAULT_WIDTH,
|
|
2468
2469
|
Ss as Table,
|
|
2469
2470
|
Be as TableConstants,
|
|
@@ -2482,7 +2483,7 @@ export {
|
|
|
2482
2483
|
st as cards,
|
|
2483
2484
|
ys as generateHeader,
|
|
2484
2485
|
rt as ibans,
|
|
2485
|
-
|
|
2486
|
+
Yt as isEmpty,
|
|
2486
2487
|
ls as isLastItem,
|
|
2487
2488
|
os as isOnlyOneItem,
|
|
2488
2489
|
Tt as setupJalaliDate,
|
package/dist/IronCore.umd.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
(function(r,_){typeof exports=="object"&&typeof module<"u"?_(exports,require("dayjs"),require("vue"),require("json2typescript"),require("pinia")):typeof define=="function"&&define.amd?define(["exports","dayjs","vue","json2typescript","pinia"],_):(r=typeof globalThis<"u"?globalThis:r||self,_(r.IronCore={},r.dayjs,r.Vue,r.json2typescript,r.pinia))})(this,function(r,_,g,M,Fe){"use strict";var ae=(t=>(t.BankCard="####-####-####-####",t.Iban="##-####-####-####-####-####-##",t))(ae||{}),H=(t=>(t.FullDate="YYYY/M/D HH:mm",t.SimpleDate="YYYY/M/D",t.CompactGregorianDate="YYYYMMDD",t.ShortJalaliDate="YYMM",t.JustHour="HH:mm:ss",t))(H||{});const Ve=[{62198619:{persian:"بلو",english:"blue"}},{603799:{persian:"بانک ملی ایران",english:"melli"}},{589210:{persian:"بانک سپه",english:"sepah"}},{627648:{persian:"بانک توسعه صادرات",english:"export-development"}},{627961:{persian:"بانک صنعت و معدن",english:"industry-mine"}},{603770:{persian:"بانک کشاورزی",english:"agriculture"}},{628023:{persian:"بانک مسکن",english:"housing"}},{627760:{persian:"پست بانک ایران",english:"post"}},{502908:{persian:"بانک توسعه تعاون",english:"development-cooperation"}},{627412:{persian:"بانک اقتصاد نوین",english:"eghtesad-novin"}},{622106:{persian:"بانک پارسیان",english:"parsian"}},{502229:{persian:"بانک پاسارگاد",english:"pasargad"}},{639599:{persian:"بانک قوامین",english:"ghavamin"}},{627488:{persian:"بانک کارآفرین",english:"karafarin"}},{621986:{persian:"بانک سامان",english:"saman"}},{639346:{persian:"بانک سینا",english:"sina"}},{639607:{persian:"بانک سرمایه",english:"sarmayeh"}},{504706:{persian:"بانک شهر",english:"shahr"}},{502806:{persian:"بانک شهر",english:"shahr"}},{502938:{persian:"بانک دی",english:"day"}},{603769:{persian:"بانک صادرات",english:"saderat"}},{610433:{persian:"بانک ملت",english:"mellat"}},{627353:{persian:"بانک تجارت",english:"tejarat"}},{585983:{persian:"بانک تجارت",english:"tejarat"}},{589463:{persian:"بانک رفاه",english:"refah"}},{627381:{persian:"بانک انصار",english:"ansar"}},{639370:{persian:"بانک مهر اقتصاد",english:"mehr-eqtesad"}},{505801:{persian:"موسسه اعتباری کوثر",english:"kosar"}},{606373:{persian:"بانک قرض الحسنه مهرایرانیان",english:"mehr"}},{186214:{persian:"بانک آینده",english:"ayandeh"}},{504172:{persian:"بانک قرض الحسنه رسالت",english:"resalat"}},{505416:{persian:"بانک گردشگری",english:"tourism"}},{505785:{persian:"بانک ایرانزمین",english:"iran-zamin"}},{505809:{persian:"بانک خاورمیانه",english:"middle-east"}},{585947:{persian:"بانک خاورمیانه",english:"middle-east"}},{604932:{persian:"بانک سپه",english:"sepah"}},{627961:{persian:"بانک صنعت و معدن",english:"industry-mine"}},{636214:{persian:"بانک آینده",english:"ayandeh"}},{636795:{persian:"بانک مرکزی",english:"markazi"}},{636949:{persian:"بانک حکمت ایرانیان",english:"hekmat-iranian"}},{639217:{persian:"بانک کشاورزی",english:"agriculture"}}],Ne=[{"010":{persian:"بانک مرکزی",english:"markazi"}},{"011":{persian:"بانک صنعت و معدن",english:"industry-mine"}},{"012":{persian:"بانک ملت",english:"mellat"}},{"013":{persian:"بانک رفاه",english:"refah"}},{"014":{persian:"بانک مسکن",english:"housing"}},{"015":{persian:"بانک سپه",english:"sepah"}},{"016":{persian:"بانک کشاورزی",english:"agriculture"}},{"017":{persian:"بانک ملّی ایران",english:"melli"}},{"018":{persian:"بانک تجارت",english:"tejarat"}},{"019":{persian:"بانک صادرات",english:"saderat"}},{"020":{persian:"بانک توسعه صادرات",english:"export-development"}},{"021":{persian:"پست بانک",english:"post"}},{"053":{persian:"بانک کارآفرین",english:"karafarin"}},{"054":{persian:"بانک پارسیان",english:"parsian"}},{"055":{persian:"بانک اقتصاد نوین",english:"eghtesad-novin"}},{"056":{persian:"بانک سامان",english:"saman"}},{"057":{persian:"بانک پاسارگاد",english:"pasargad"}},{"058":{persian:"بانک سرمایه",english:"sarmayeh"}},{"059":{persian:"بانک سینا",english:"sina"}},{"060":{persian:"بانک قرض الحسنه مهرایرانیان",english:"mehr"}},{"061":{persian:"بانک شهر",english:"shahr"}},{"062":{persian:"بانک آینده",english:"ayandeh"}},{"065":{persian:"بانک حکمت ایرانیان",english:"hekmat-iranian"}},{"066":{persian:"بانک دی",english:"day"}},{"069":{persian:"بانک ایران زمین",english:"iran-zamin"}},{"070":{persian:"بانک قرض الحسنه رسالت",english:"resalat"}},{"078":{persian:"بانک خاورمیانه",english:"middle-east"}}];var Be=(t=>(t.Normal="YYYY-MM-DD",t.ContainsHour="YYYY-MM-DD HH:mm",t.OnlyHour="HH:mm",t))(Be||{});function re(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ie={exports:{}},ct=ie.exports,Ue;function ut(){return Ue||(Ue=1,function(t,e){(function(s,a){t.exports=a()})(ct,function(){return function(s,a){a.prototype.weekday=function(i){var n=this.$locale().weekStart||0,o=this.$W,d=(o<n?o+7:o)-n;return this.$utils().u(i)?d:this.subtract(d,"day").add(i,"day")}}})}(ie)),ie.exports}var ht=ut();const dt=re(ht);var ne={exports:{}},ft=ne.exports,Ye;function mt(){return Ye||(Ye=1,function(t,e){(function(s,a){t.exports=a()})(ft,function(){var s="week",a="year";return function(i,n,o){var d=n.prototype;d.week=function(u){if(u===void 0&&(u=null),u!==null)return this.add(7*(u-this.week()),"day");var y=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var m=o(this).startOf(a).add(1,a).date(y),h=o(this).endOf(s);if(m.isBefore(h))return 1}var v=o(this).startOf(a).date(y).startOf(s).subtract(1,"millisecond"),S=this.diff(v,s,!0);return S<0?o(this).startOf("week").week():Math.ceil(S)},d.weeks=function(u){return u===void 0&&(u=null),this.week(u)}}})}(ne)),ne.exports}var vt=mt();const gt=re(vt);var oe={exports:{}},pt=oe.exports,je;function yt(){return je||(je=1,function(t,e){(function(s,a){t.exports=a()})(pt,function(){return function(s,a){a.prototype.weekYear=function(){var i=this.month(),n=this.week(),o=this.year();return n===1&&i===11?o+1:i===0&&n>=52?o-1:o}}})}(oe)),oe.exports}var St=yt();const It=re(St);var le={exports:{}},wt=le.exports,He;function Dt(){return He||(He=1,function(t,e){(function(s,a){t.exports=a(_)})(wt,function(s){function a(o){return o&&typeof o=="object"&&"default"in o?o:{default:o}}var i=a(s),n={name:"fa",weekdays:"یکشنبه_دوشنبه_سهشنبه_چهارشنبه_پنجشنبه_جمعه_شنبه".split("_"),weekdaysShort:"یکشنبه_دوشنبه_سهشنبه_چهارشنبه_پنجشنبه_جمعه_شنبه".split("_"),weekdaysMin:"ی_د_س_چ_پ_ج_ش".split("_"),weekStart:6,months:"ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر".split("_"),monthsShort:"ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر".split("_"),ordinal:function(o){return o},formats:{LT:"HH:mm",LTS:"HH:mm:ss",L:"DD/MM/YYYY",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"},relativeTime:{future:"در %s",past:"%s پیش",s:"چند ثانیه",m:"یک دقیقه",mm:"%d دقیقه",h:"یک ساعت",hh:"%d ساعت",d:"یک روز",dd:"%d روز",M:"یک ماه",MM:"%d ماه",y:"یک سال",yy:"%d سال"}};return i.default.locale(n,null,!0),n})}(le)),le.exports}var At=Dt();const bt=re(At);function ce(t,e){return _t(t)||Mt(t,e)||Ct()}function _t(t){if(Array.isArray(t))return t}function Mt(t,e){var s=[],a=!0,i=!1,n=void 0;try{for(var o=t[Symbol.iterator](),d;!(a=(d=o.next()).done)&&(s.push(d.value),!(e&&s.length===e));a=!0);}catch(u){i=!0,n=u}finally{try{!a&&o.return!=null&&o.return()}finally{if(i)throw n}}return s}function Ct(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function qe(t,e,s){e<=2&&(t-=1,e+=12);var a=Math.floor(t/100),i=2-a+Math.floor(a/4),n=Math.floor(365.25*(t+4716))+Math.floor(30.6001*(e+1))+s+i-1524.5;return n}function Rt(t){t=t+.5;var e=Math.floor(t),s=t-e,a=e;if(e>=2299161){var i=Math.floor((e-186721625e-2)/36524.25);a=e+1+i-Math.floor(i/4)}var n=a+1524,o=Math.floor((n-122.1)/365.25),d=Math.floor(365.25*o),u=Math.floor((n-d)/30.6001),y=n-d-Math.floor(30.6001*u)+s,m=u<14?u-1:u-13,h=m>2?o-4716:o-4715;return Ot(h,m,y)}function Lt(t){t=t+.5;var e=Math.floor(t),s=t-e,a=e;if(e>=2299161){var i=Math.floor((e-186721625e-2)/36524.25);a=e+1+i-Math.floor(i/4)}var n=a+1524,o=Math.floor((n-122.1)/365.25),d=Math.floor(365.25*o),u=Math.floor((n-d)/30.6001),y=n-d-Math.floor(30.6001*u)+s,m=u<14?u-1:u-13,h=m>2?o-4716:o-4715;return[Math.floor(h),Math.floor(m),Math.floor(y)]}function Tt(t,e,s){var a=[31,28,31,30,31,30,31,31,30,31,30,31],i=[31,31,31,31,31,31,30,30,30,30,30,29];function n(S,A){return Math.floor(S/A)}t-=979;for(var o=365*t+n(t,33)*8+n(t%33+3,4),d=0;d<e-1;++d)o+=i[d];o+=s-1;var u=o+79,y=1600+400*n(u,146097);u=u%146097;var m=!0;for(u>=36525&&(u--,y+=100*n(u,36524),u=u%36524,u>=365?u++:m=!1),y+=4*n(u,1461),u%=1461,u>=366&&(m=!1,u--,y+=n(u,365),u=u%365),d=0;u>=a[d]+(d==1&&m);d++)u-=a[d]+(d==1&&m);var h=d+1,v=u+1;return qe(y,h,v)}function Ot(t,e,s){var a=[31,28,31,30,31,30,31,31,30,31,30,31],i=[31,31,31,31,31,31,30,30,30,30,30,29];function n(W,x){return Math.floor(W/x)}for(var o=t-1600,d=e-1,u=s-1,y=365*o+n(o+3,4)-n(o+99,100)+n(o+399,400),m=0;m<d;++m)y+=a[m];d>1&&(t%4==0&&t%100!=0||t%400==0)&&y++,y+=u;var h=y-79,v=n(h,12053);h%=12053;var S=979+33*v+4*n(h,1461);h%=1461,h>=366&&(S+=n(h-1,365),h=(h-1)%365);for(var A=0;A<11&&h>=i[A];++A)h-=i[A];var J=A+1,G=h+1;return[S,J,G]}var ue={J:function(e,s,a){return Rt(qe(e,s,a))},G:function(e,s,a){return Lt(Tt(e,s,a))}},Et=/^(\d{4})[-/]?(\d{1,2})[-/]?(\d{0,2})(.*)?$/,kt=/\[.*?\]|jY{2,4}|jM{1,4}|jD{1,2}|Y{2,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,Ie="date",q="day",P="month",$="year",ze="week",Pt="YYYY-MM-DDTHH:mm:ssZ",$t={jmonths:"فروردین_اردیبهشت_خرداد_تیر_مرداد_شهریور_مهر_آبان_آذر_دی_بهمن_اسفند".split("_")},Ft=function(t,e,s){var a=e.prototype,i=a.$utils(),n=function(c){return c.$C==="jalali"},o=i.prettyUnit||i.p,d=i.isUndefined||i.u,u=i.padStart||i.s,y=i.monthDiff||i.m,m=i.absFloor||i.a,h=function(c){return function(){var f=c.bind(this).apply(void 0,arguments);return f.$C=this.$C,f.isJalali()&&f.InitJalali(),f}};a.startOf=h(a.startOf),a.endOf=h(a.endOf),a.add=h(a.add),a.subtract=h(a.subtract),a.set=h(a.set);var v=a.parse,S=a.init,A=a.startOf,J=a.$set,G=a.add,W=a.format,x=a.diff,ke=a.year,Pe=a.month,ge=a.date,$e=a.daysInMonth,te=a.toArray;s.$C="gregory",s.$fdow=6,s.calendar=function(l){return s.$C=l,s},a.calendar=function(l){var c=this.clone();return c.$C=l,c.isJalali()&&c.InitJalali(),c},a.isJalali=function(){return n(this)},s.en.jmonths="Farvardin_Ordibehesht_Khordaad_Tir_Mordaad_Shahrivar_Mehr_Aabaan_Aazar_Dey_Bahman_Esfand".split("_"),s.locale("fa",Object.assign({},bt,{},$t),!0);var K=function(c,f){return s(c,{locale:f.$L,utc:f.$u,calendar:f.$C})};a.init=function(){var l=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};S.bind(this)(l),this.isJalali()&&this.InitJalali()},a.parse=function(l){var c;if(this.$C=l.calendar||this.$C||s.$C,l.jalali&&typeof l.date=="string"&&/.*[^Z]$/i.test(l.date)&&(c=l.date.match(Et))){var f=ue.G(parseInt(c[1],10),parseInt(c[2],10),parseInt(c[3]||1,10)),w=ce(f,3),D=w[0],I=w[1],b=w[2];l.date="".concat(D,"-").concat(I,"-").concat(b).concat(c[4]||"")}return v.bind(this)(l)},a.InitJalali=function(){var l=ue.J(this.$y,this.$M+1,this.$D),c=ce(l,3),f=c[0],w=c[1],D=c[2];this.$jy=f,this.$jM=w-1,this.$jD=D},a.startOf=function(l,c){var f=this;if(!n(this))return A.bind(this)(l,c);var w=d(c)?!0:c,D=o(l),I=function(Z,Y){var T=arguments.length>2&&arguments[2]!==void 0?arguments[2]:f.$jy,ye=ue.G(T,Y+1,Z),j=ce(ye,3),se=j[0],Se=j[1],$s=j[2],lt=K(new Date(se,Se-1,$s),f);return(w?lt:lt.endOf(q)).$set("hour",1)},b=(this.$W+(7-s.$fdow))%7;switch(D){case $:return w?I(1,0):I(0,0,this.$jy+1);case P:return w?I(1,this.$jM):I(0,(this.$jM+1)%12,this.$jy+parseInt((this.$jM+1)/12,10));case ze:return w?I(this.$jD-b,this.$jM):I(this.$jD+(6-b),this.$jM);default:return A.bind(this)(l,c)}},a.$set=function(l,c){var f=this;if(!n(this))return J.bind(this)(l,c);var w=o(l),D=function(b,pe){var Z=arguments.length>2&&arguments[2]!==void 0?arguments[2]:f.$jy,Y=ue.G(Z,pe+1,b),T=ce(Y,3),ye=T[0],j=T[1],se=T[2];return f.$d.setFullYear(ye),f.$d.setMonth(j-1),f.$d.setDate(se),f};switch(w){case Ie:case q:D(c,this.$jM);break;case P:D(this.$jD,c);break;case $:D(this.$jD,this.$jM,c);break;default:return J.bind(this)(l,c)}return this.init(),this},a.add=function(l,c){var f=this;if(!n(this))return G.bind(this)(l,c);l=Number(l);var w=c&&(c.length===1||c==="ms")?c:o(c),D=function(j,se){var Se=f.set(Ie,1).set(j,se+l);return Se.set(Ie,Math.min(f.$jD,Se.daysInMonth()))};if(["M",P].indexOf(w)>-1){var I=this.$jM+l,b=I<0?-Math.ceil(-I/12):Math.floor(I/12),pe=this.$jD,Z=this.set(q,1).add(b,$).set(P,I-b*12);return Z.set(q,Math.min(Z.daysInMonth(),pe))}if(["y",$].indexOf(w)>-1)return D($,this.$jy);if(["d",q].indexOf(w)>-1){var Y=new Date(this.$d);return Y.setDate(Y.getDate()+l),K(Y,this)}if(["w",ze].indexOf(w)>-1){var T=new Date(this.$d);return T.setDate(T.getDate()+l*7),K(T,this)}return G.bind(this)(l,c)},a.format=function(l,c){var f=this;if(!n(this))return W.bind(this)(l,c);var w=l||Pt,D=c||this.$locale(),I=D.jmonths;return w.replace(kt,function(b){if(b.indexOf("[")>-1)return b.replace(/\[|\]/g,"");switch(b){case"YY":return String(f.$jy).slice(-2);case"YYYY":return String(f.$jy);case"M":return String(f.$jM+1);case"MM":return u(f.$jM+1,2,"0");case"MMM":return I[f.$jM].slice(0,3);case"MMMM":return I[f.$jM];case"D":return String(f.$jD);case"DD":return u(f.$jD,2,"0");default:return W.bind(f)(b,c)}})},a.diff=function(l,c,f){if(!n(this))return x.bind(this)(l,c,f);var w=o(c),D=s(l),I=y(this,D);switch(w){case $:I/=12;break;case P:break;default:return x.bind(this)(l,c,f)}return f?I:m(I)},a.$g=function(l,c,f){return d(l)?this[c]:this.set(f,l)},a.year=function(l){return n(this)?this.$g(l,"$jy",$):ke.bind(this)(l)},a.month=function(l){return n(this)?this.$g(l,"$jM",P):Pe.bind(this)(l)},a.date=function(l){return n(this)?this.$g(l,"$jD",q):ge.bind(this)(l)},a.daysInMonth=function(){return n(this)?this.endOf(P).$jD:$e.bind(this)()},te&&(a.toArray=function(){return n(this)?[this.$jy,this.$jM,this.$jD,this.$H,this.$m,this.$s,this.$ms]:te.bind(this)()}),a.clone=function(){return K(this.toDate(),this)}};const Vt={ordinal(t){},relativeTime:void 0,name:"fa",weekdays:"یکشنبه_دوشنبه_سهشنبه_چهارشنبه_پنجشنبه_جمعه_شنبه".split("_"),weekdaysShort:"ی_د_س_چ_پ_ج_ش".split("_"),weekdaysMin:"ی_د_س_چ_پ_ج_ش".split("_"),months:"فروردین_اردیبهشت_خرداد_تیر_مرداد_شهریور_مهر_آبان_آذر_دی_بهمن_اسفند".split("_"),monthsShort:"فروردین_اردیبهشت_خرداد_تیر_مرداد_شهریور_مهر_آبان_آذر_دی_بهمن_اسفند".split("_"),weekStart:6,formats:{L:"YYYY/MM/DD",LL:"D MMMM YYYY",LLL:"D MMMM YYYY HH:mm",LLLL:"dddd, D MMMM YYYY HH:mm"}};function Je(){_.extend(Ft),_.calendar("jalali"),_.extend(dt),_.extend(gt),_.extend(It),_.locale(Vt,{},!0)}class Nt{constructor(e,s){this.start=e,this.end=s}}class Bt{constructor(e,s,a){this.maxDate=e,this.minDate=s,this.disabledDates=a}}class F{static standardToUnix(e){return Math.floor(new Date(e).getTime()/1e3)}static unixToStandard(e){return new Date(e*1e3).toString()}static getUnixEndOfDayInUnix(e){return _.unix(e).endOf("day").unix()}}class X{static isDateDisabled(e,s){for(const a of e.disabledDates)if(X.areUnixesInSameDate(a,s.unix()))return!0;return!!(e.maxDate&&X.isDateGraterOrSame(e.maxDate,s.unix())||e.minDate&&X.isDateLowerOrSame(e.minDate,s.unix()))}static areUnixesInSameDate(e,s){return F.getUnixEndOfDayInUnix(e)===F.getUnixEndOfDayInUnix(s)}static isDateGraterOrSame(e,s){return F.getUnixEndOfDayInUnix(s)>=F.getUnixEndOfDayInUnix(e)}static isDateLowerOrSame(e,s){return F.getUnixEndOfDayInUnix(s)<=F.getUnixEndOfDayInUnix(e)}}Je();class C{static toCurrency(e,s){return e.toLocaleString("en-US",s)}static toCurrencyWithDotSeparator(e){return C.toCurrency(e).replaceAll(",",".")}static applyMask(e,s){let a="",i=0,n=0;for(;i<e.length;){if(e[i]==="#"){if(n>=s.length)throw new Error("Value length does not match the format.");a+=s[n],n++}else a+=e[i];i++}if(n!==s.length)throw new Error("Value length does not match the format.");return a}static applyBankCardMask(e){return C.applyMask(ae.BankCard,String(e))}static applyIbanMask(e){return C.applyMask(ae.Iban,String(e))}static toEnglishDigits(e){const s=["۱","۲","۳","۴","۵","۶","۷","۸","۹","۰"],a=["١","٢","٣","٤","٥","٦","٧","٨","٩","٠"],i=["1","2","3","4","5","6","7","8","9","0"];return e.split("").map(n=>i[s.indexOf(n)]||i[a.indexOf(n)]||n).join("")}static mapUnixToDate(e,s){return _(new Date(e)).subtract(1,"day").format(s)}}var p=(t=>(t.FetchList="fetchList",t.AutoRefresh="autoRefresh",t.FetchItem="fetchItem",t.FetchLastItems="fetchLastItems",t.FetchPreviousItems="fetchPreviousItems",t.Create="CREATE",t.Update="UPDATE",t.Delete="DELETE",t.Search="SEARCH",t.Sort="SORT",t.Success="SUCCESS",t.Error="ERROR",t.Idle="IDLE",t))(p||{}),O=(t=>(t.Width="width",t.Height="height",t[t.DefaultWidth=500]="DefaultWidth",t[t.DefaultHeight=350]="DefaultHeight",t[t.MinimalAvailableSize=0]="MinimalAvailableSize",t))(O||{}),E=(t=>(t.ASC="ASC",t.DESC="DESC",t))(E||{}),Ge=(t=>(t.ASC="ascend",t.DESC="descend",t))(Ge||{}),he=(t=>(t.Left="left",t.Right="right",t.Center="center",t))(he||{}),de=(t=>(t.Text="text",t))(de||{}),fe=(t=>(t.Text="text",t.ACTION="action",t.Tag="tag",t.Iban="iban",t.BankCard="bankCard",t.Symbol="symbol",t.TradeDetail="tradeDetail",t.SymbolPrice="symbolPrice",t.TradeSymbol="tradeSymbol",t.Price="price",t.DynamicCurrencyPrice="dynamicCurrencyPrice",t.TradeDate="tradeDate",t.RequestResponseIdentity="requestResponseIdentity",t.Image="image",t))(fe||{}),we=(t=>(t[t.MINIMAL_LOADABLE_HEADER_COUNT=0]="MINIMAL_LOADABLE_HEADER_COUNT",t[t.DEFAULT_ITEM_COUNT_PER_PAGE=20]="DEFAULT_ITEM_COUNT_PER_PAGE",t.PAGINATION_POSITION="bottomCenter",t))(we||{});r.ApplicationTheme=(t=>(t.FontFamily="IRANSansX",t))(r.ApplicationTheme||{});var z=(t=>(t.Open="open",t.Close="close",t))(z||{}),We=(t=>(t[t.NotFound=404]="NotFound",t[t.Unauthorized=401]="Unauthorized",t[t.ServerError=500]="ServerError",t))(We||{}),Q=(t=>(t[t.Invalid=0]="Invalid",t[t.Valid=1]="Valid",t))(Q||{}),k=(t=>(t.Theme="theme",t.AccessList="accessList",t.Token="token",t.SSO_ACCESS_LIST="ssoAccessList",t))(k||{});r.ApplicationTheme=(t=>(t.Light="light",t.Dark="dark",t))(r.ApplicationTheme||{});var me=(t=>(t.Dialog="dialog",t.Drawer="drawer",t.Module="module",t.Toast="toast",t))(me||{}),xe=(t=>(t.USDT="USDT",t))(xe||{});class V{static getBankImageBaseOnCardInfo(e,s){return e===void 0?"/img/banks/shetab.png":s==="IBAN"?(e=C.toEnglishDigits(e.replace(/IR/g,"").split(" ").join("")),`/img/banks/${V.iban(e).english}.png`):(e=C.toEnglishDigits(e.replace(/ /g,"")),`/img/banks/${V.card(e).english}.png`)}static card(e){const s={persian:"نامشخص",english:"shetab"};if(e==null)return s;e=e.substring(0,6);try{const a=Ve.find(i=>Object.keys(i)[0]===e);return a===void 0?s:Object.values(a)[0]}catch{return s}}static iban(e){const s={persian:"نامشخص",english:"shetab"};if(e==null)return s;e=e.substring(2,5);try{const a=Ne.find(i=>Object.keys(i)[0]===e);return a===void 0?s:Object.values(a)[0]}catch{return s}}static async copyValueToClipboard(e){await navigator.clipboard.writeText(String(e))}static downloadBlob(e,s=V.extractFileNameFromHeader(e)){const a=document.createElement("a");a.href=URL.createObjectURL(e.data),a.download=s,a.dispatchEvent(new MouseEvent("click",{bubbles:!0,cancelable:!0,composed:!0})),a.remove()}static extractFileNameFromHeader(e){var a,i,n,o;return((o=(a=e.headers["content-disposition"])==null?void 0:a.split("filename=")[1])==null?void 0:o.slice(1,((n=(i=e.headers["content-disposition"])==null?void 0:i.split("filename="))==null?void 0:n[1].length)-1))||"Saraf-File"}static removeSpacesFromString(e){return e&&typeof e.normalize=="function"&&(e=e.normalize("NFC")),e.replace(/[\s\u00A0\u1680\u180E\u2000-\u200A\u200B-\u200D\u2060\uFEFF\u2028\u2029\u202F\u205F\u3000]+/g,"")}static isArraySorted(e,s=i=>i,a=E.ASC){return e.every((i,n)=>e.length-1===n?!0:a===E.ASC?s(i)<=s(e[n+1]):s(i)>=s(e[n+1]))}}const N=class N{constructor(){this.availableAccesses=new Set}setAvailableAccesses(e){this.setAccessListToStorage(e);for(const s of e)this.availableAccesses.add(s)}setAccessListToStorage(e){localStorage.setItem(k.AccessList,JSON.stringify(e))}everyAccess(e){return e.every(s=>this.availableAccesses.has(s))}someAccess(e){return e.some(s=>this.availableAccesses.has(s))}clearAvailableAccesses(){this.availableAccesses.clear(),localStorage.removeItem(k.AccessList)}initialize(){const e=localStorage.getItem(k.AccessList);e!==null&&this.setAvailableAccesses(JSON.parse(e))}static GetInstance(){return N.Instance||(N.Instance=new N),N.Instance}};N.Instance=null;let ee=N;class De{constructor(){this.mounted=(e,s)=>{this.checkAccess(e,s.value)},this.updated=(e,s)=>{this.checkAccess(e,s.value)},this.checkAccess=(e,s)=>{this.hasAccess(s)||e.remove()},this.accessService=ee.GetInstance()}}class Ut extends De{hasAccess(e){return this.accessService.everyAccess(e)}}class Yt extends De{hasAccess(e){return this.accessService.someAccess(e)}}const B=class B{constructor(){this._accessLevels=new Map}initialize(){this.setAccessLevelFromStorage()}setAccessLevels(e){for(const s in e)this._accessLevels.set(s,new Set(e[s]));this.setAccessLevelsToStorage(e)}setAccessLevelsToStorage(e){localStorage.setItem(k.SSO_ACCESS_LIST,JSON.stringify(e))}getAccessLevelsFromStorage(){let e=localStorage.getItem(k.SSO_ACCESS_LIST);return e!==null?JSON.parse(e):e}getAccessLevelsOfScope(e){if(this._accessLevels.has(e))return this._accessLevels.get(e);throw new Error(`The scope is not exists ${e}`)}setAccessLevelFromStorage(){const e=this.getAccessLevelsFromStorage();e&&this.setAccessLevels(e)}everyAccess(e,s){const a=this.getAccessLevelsOfScope(e);return a?s.every(i=>a.has(i)):!1}someAccess(e,s){const a=this.getAccessLevelsOfScope(e);return a?s.some(i=>a.has(i)):!1}hasScope(e){return this._accessLevels.has(e)}clear(){localStorage.removeItem(k.SSO_ACCESS_LIST),this._accessLevels=new Map}static GetInstance(){return B._instance||(B._instance=new B),B._instance}};B._instance=null;let ve=B;class Ae{constructor(){this._authorizationService=ve.GetInstance(),this.mounted=this.mounted.bind(this),this.updated=this.updated.bind(this),this.hasAccess=this.hasAccess.bind(this),this.manageElement=this.manageElement.bind(this)}mounted(e,s,a){this.manageElement(e,s.arg,s.modifiers)}updated(e,s,a){this.manageElement(e,s.arg,s.modifiers)}manageElement(e,s,a){if(!this._authorizationService.hasScope(s)){e.remove();return}const i=this.getAccessLevels(s,a);this.hasAccess(s,i)||e.remove()}getAccessLevels(e,s){var i;let a=Object.keys(s);return a.length||(a=Array.from(((i=this._authorizationService.getAccessLevelsOfScope(e))==null?void 0:i.values())??[])),a}}class jt extends Ae{hasAccess(e,s){return this._authorizationService.everyAccess(e,s)}}class Ht extends Ae{hasAccess(e,s){return this._authorizationService.someAccess(e,s)}}class Ke{constructor(){this.value=null,this.initialValue=null,this.name="",this.isValid=!1,this.isBlurSensitive=!1,this.isRequired=!1,this.isIncludeInRequestBody=!0,this.isChangeSensitive=!1,this.notValidMessage="",this.isEmptySensitive=!0,this.hasCustomValidationCheck=!1,this.shouldRemoveValidationMessageOnInteract=!1}}function qt(t){return t===1}function zt(t,e){return t-1===e}function Ze(t){return String(t).length===0||t===null||t===void 0}function Jt(t){t()}class Gt{constructor(e,s){this.initialData=null,this.data=new Ke,this._validators=[],this._id=Math.random(),this.data.value=s,this.data.name=e,this.shouldRunValidation()&&this.runValidation(!0)}shouldRunValidation(){return this.data.hasCustomValidationCheck?!1:this.data.isRequired?!0:!Ze(this.data.value)}async runValidation(e=!1){for(const s of this._validators){const a=await s.validate(this.data.value);if(a){this.setFormToInvalidState(e,a);return}}this.setFormToValidState()}setFormToInvalidState(e,s){this.data.isValid=!1,(this.data.isChangeSensitive||e)&&this.setNotValidMessage(s)}setFormToValidState(){this.data.isValid=!0,this.setNotValidMessage("")}reset(){this.initialData?this.data=structuredClone(g.toRaw(this.initialData)):console.warn("The "+this.data.name+`input control has no initial data,
|
|
2
|
-
the initial data will be available after calling the [markAsInitial] method on this instance`)}markAsInitial(){this.initialData=structuredClone(g.toRaw(this.data))}setValidators(e){this._validators=e}getChangeSensitive(){return this.data.isChangeSensitive}setChangeSensitive(e){if(e&&this.data.shouldRemoveValidationMessageOnInteract)throw new Error("Input control "+this.getName()+" can not be both change sensitive and remove validation meessage on interact");this.data.isChangeSensitive=e}getIsBlurSensitive(){return this.data.isBlurSensitive}setIsBlurSensitive(e){this.data.isBlurSensitive=e}getIsRequired(){return this.data.isRequired}setIsRequired(e){this.data.isRequired=e}getIsValid(){return this.data.isValid}setIsValid(e){this.data.isValid=e}getIsIncludeInRequestBody(){return this.data.isIncludeInRequestBody}setIsIncludeInRequestBody(e){this.data.isIncludeInRequestBody=e}getNotValidMessage(){return this.data.notValidMessage}setNotValidMessage(e){this.data.notValidMessage=e}getName(){return this.data.name}setName(e){this.data.name=e}setId(e){this._id=e}getId(){return this._id}getIsEmptySensitive(){return this.data.isEmptySensitive}setIsEmptySensitive(e){this.data.isEmptySensitive=e}setHasCustomValidationCheck(e){this.data.hasCustomValidationCheck=e}setShouldRemoveValidationOnInteract(e){if(e&&this.data.isChangeSensitive)throw new Error("Input control "+this.getName()+" can not be both change sensitive and remove validation meessage on interact");this.data.shouldRemoveValidationMessageOnInteract=e}getShouldRemoveValidationOnInteract(){return this.data.shouldRemoveValidationMessageOnInteract}hasCustomValidationCheck(){return this.data.hasCustomValidationCheck}set value(e){this.data.value=e,this.shouldRunValidation()&&this.runValidation(),this.getShouldRemoveValidationOnInteract()&&this.setNotValidMessage("")}get value(){return this.data.value}}class Wt{constructor(e){this._inputControl=e}setValidators(e){return this._inputControl.setValidators(e),this}setChangeSensitive(){return this._inputControl.setChangeSensitive(!0),this}setRequired(){return this._inputControl.setIsRequired(!0),this}setValid(){return this._inputControl.setIsValid(!0),this}setBlurSensitive(){return this._inputControl.setIsBlurSensitive(!0),this}setId(e){return this._inputControl.setId(e),this}removeEmptySensitive(){return this._inputControl.setIsEmptySensitive(!1),this}setHasCustomValidationCheck(){return this._inputControl.setHasCustomValidationCheck(!0),this}removeErrorOnInteract(){return this._inputControl.setShouldRemoveValidationOnInteract(!0),this}build(){return this._inputControl}}class xt{constructor(){this.mounted=(e,s)=>{s.value&&s.value.getIsBlurSensitive()&&(e.addEventListener("click",this.handleFocus.bind(this,s.value)),e.addEventListener("blur",this.handleBlur.bind(this,s.value),!0))},this.beforeUnMount=(e,s)=>{e.removeEventListener("blur",this.handleBlur.bind(this,s.value)),e.removeEventListener("click",this.handleFocus.bind(this,s.value))}}handleBlur(e){e.runValidation(!0)}handleFocus(e){e.value||e.getIsEmptySensitive()||e.setNotValidMessage("")}}class Kt{constructor(){this._inputControls=new Map,this._isValid=!1,this._id=Math.random()}getInputControlsAsArray(){return Array.from(this._inputControls.values())}async runValidation(e){for(const s of this.getInputControlsAsArray())if(e&&await s.runValidation(!0),!s.getIsValid()){this._isValid=!1;return}this._isValid=!0}addInputControls(e){for(const s of e)this._inputControls.set(s.getName(),s)}getInputControl(e){const s=this._inputControls.get(e);if(!s)throw new Error(`The provided input name (${e}}) has no controls.`);return s}resetControls(e){for(const s of e){const a=this._inputControls.get(s);a?a.reset():console.warn(`Provided input name ${s} has no controllers in this form`)}}resetAll(){for(const e of this.getInputControlsAsArray())e.reset()}createRequestBody(){const e={};for(const s of this.getInputControlsAsArray())s.getIsIncludeInRequestBody()&&(e[s.getName()]=s.value);return e}setIsValid(e){this._isValid=e}getIsValid(){return this._isValid}setId(e){this._id=e}getId(){return this._id}}function Zt(t,e=!1){const s=g.reactive(t),a=g.ref(Q.Invalid);return g.watch(()=>s.getInputControlsAsArray(),()=>{e||(s.runValidation(),s.getIsValid()?a.value=Q.Valid:a.value=Q.Invalid)},{immediate:!0,deep:!0}),{reactiveForm:s,validationStatus:a}}class be{constructor(e){this.timerId=null,this.setupInterval=this.setupInterval.bind(this),this.schedule=e}setupInterval(e){const s=this;this.timerId=setTimeout(async function a(){await s.schedule.runAction(),s.timerId=setTimeout(()=>{a()},e)},e)}clearInterval(){this.timerId&&clearInterval(this.timerId)}}const _e="150px",Me=2,Xt={path:"id",key:"id",title:"عملیات",colspan:Me,width:_e,cellType:fe.ACTION,align:he.Center,headerType:de.Text,accessLevel:null},Xe={width:_e,align:he.Center,headerType:de.Text,cellType:fe.Text,colspan:Me};class Ce{constructor(e,s){this.key=e,this.order=s}}class Re{aSort(e,s){return e.sort((a,i)=>{const n=a[s]??a,o=i[s]??i;if(typeof n=="string"&&typeof o=="string")return n.localeCompare(o);if(typeof n=="number"&&typeof o=="number")return n-o;throw new Error("Not supported data type")})}bSort(e,s){return e.sort((a,i)=>{const n=a[s]??a,o=i[s]??i;if(typeof n=="string"&&typeof o=="string")return o.localeCompare(n);if(typeof n=="number"&&typeof o=="number")return o-n;throw new Error("Not supported data type")})}}class Qt{arrayOfObjectSort(e,s,a,i=new Re){return a===E.ASC?i.aSort(e,s):i.bSort(e,s)}arraySort(e,s,a=new Re){return s===E.ASC?a.aSort(e):a.bSort(e)}}class Qe{constructor(e){this.currentPage=1,this.currentPageSize=20,this.currentSortDetail=new Ce("id",E.DESC),this.loadedRows=[],this.headerSchema=[],this.service=e,this.accessService=ee.GetInstance()}addHeader(e){this.headerSchema.push(e)}async load(){this.headerSchema=this.filterItemsBaseOnAccessLevel(await this.loadHeader()),await this.loadRows()}filterItemsBaseOnAccessLevel(e){return e.filter(s=>s.hasAccess?s.hasAccess():!0)}async sort(e){this.shouldSendSortRequest(e)&&(this.currentSortDetail=e,this.loadedRows=(await this.handleSort(this.currentSortDetail)).items)}shouldSendSortRequest(e){return e.key!==this.currentSortDetail.key||e.order!==this.currentSortDetail.order}async paginate(e,s){this.shouldSendPaginationRequest(e,s)&&(this.currentPage=e,this.currentPageSize=s,this.loadedRows=(await this.handlePagination(this.currentPage,this.currentPageSize)).items)}shouldSendPaginationRequest(e,s){return this.currentPage!==e||this.currentPageSize!==s}async loadRows(){return this.loadedRows=(await this.service.fetchRows()).items,this.loadedRows}getData(){return this.service.getData()}async handleSort(e){return await this.service.sort(e)}async handlePagination(e,s){return await this.service.paginate(e,s)}getItemCountPerPage(){return we.DEFAULT_ITEM_COUNT_PER_PAGE}isLoading(){const e=this.getLoadingStatuses();return e.has(p.Search)||e.has(p.FetchList)||e.has(p.Sort)||e.has(p.FetchLastItems)||e.has(p.FetchPreviousItems)}getLoadingStatuses(){return this.getData().loadingStatus}hasAnyAction(){for(const e of this.loadedRows)if(this.getAccessedActions(e).length)return!0;return!1}getAccessedActions(e){return this.filterItemsBaseOnAccessLevel(this.getActions(e))}getActions(e){return[]}getScrollDetail(){return null}isExpandable(){return!1}async handleClick(e){}async handleMetaClick(e){}async handleDoubleClick(e){}async onDestroy(){}async loadHeader(){throw new Error("No header provided for the table.")}loadSummarySchema(){return{summaryTitle:"",summaryItems:[]}}}class et{constructor(e){this.observers=[],this.next(e)}attach(e){this.observers.push(e)}detach(e){this.observers=this.observers.filter(s=>s!==e)}notify(){for(const e of this.observers)typeof e=="function"?e(this._value):e.update(this._value)}next(e){typeof e=="function"?this._value=e(this._value):this._value=e,this.notify()}getValue(){return this._value}}class es extends Qe{constructor(e){super(e),this.selectedRows=new et(new Map),this.rowSelect=this.rowSelect.bind(this),this.selectAll=this.selectAll.bind(this),this.isEveryRowSelected=this.isEveryRowSelected.bind(this),this.handlePagination=this.handlePagination.bind(this),this.clearAllSelectedItems=this.clearAllSelectedItems.bind(this),this.getSelectedRows=this.getSelectedRows.bind(this),this.getSelectedRowsAsArray=this.getSelectedRowsAsArray.bind(this),this.getSelectedRowIds=this.getSelectedRowIds.bind(this)}rowSelect(e){this.getSelectedRowsValue().has(e.id)?(this.getSelectedRowsValue().delete(e.id),this.selectedRows.next(this.selectedRows.getValue())):(this.selectedRows.getValue().set(e.id,e),this.selectedRows.next(this.selectedRows.getValue()))}selectAll(){if(this.isEveryRowSelected())this.clearAllSelectedItems();else for(const e of this.loadedRows)this.selectedRows.getValue().set(e.id,e),this.selectedRows.next(this.selectedRows.getValue())}isEveryRowSelected(){return this.getSelectedRowsValue().size===this.currentPageSize||this.loadedRows.length===this.getSelectedRowsValue().size}async handlePagination(e,s){return this.clearAllSelectedItems(),await super.handlePagination(e,s)}async handleSort(e){return this.clearAllSelectedItems(),await super.handleSort(e)}clearAllSelectedItems(){this.selectedRows.getValue().clear(),this.selectedRows.next(this.selectedRows.getValue())}getSelectedRows(){return this.selectedRows}getSelectedRowsAsArray(){return Array.from(this.selectedRows.getValue().values())}getSelectedRowIds(){return Array.from(this.selectedRows.getValue().keys())}getSelectedRowsValue(){return this.selectedRows.getValue()}}function ts(t){return{...Xe,...t}}function ss(t){return function(s,a){s.constructor.prototype.headers||(s.constructor.prototype.headers=[]),s.constructor.prototype.headers.push({path:a,...t})}}function as(t){return function(s){async function a(){return s.prototype._table=this,s.prototype.headers}function i(d){const u=[],y=s.prototype.actions||[];for(const m of y){if(!m.isAvailable(d))continue;const h={handler:m.handler.bind(d),accessLevel:m.accessLevel,actionName:m.actionName};u.push(h)}return u}async function n(d){s.prototype.rowClick&&await s.prototype.rowClick.call(d)}async function o(){s.prototype.tableDestroy&&await s.prototype.tableDestroy()}t.prototype.loadHeader=a,t.prototype.getActions=i,t.prototype.handleClick=n,t.prototype.onDestroy=o}}function rs(t){return function(s,a,i){s.constructor.prototype.actions||(s.constructor.prototype.actions=[]),t.handler=i.value,s.constructor.prototype.actions.push(t)}}function is(){return function(e,s,a){e.constructor.prototype.tableDestroy=a.value}}function ns(){return function(e,s,a){e.constructor.prototype.rowClick=a.value}}function tt(){const t=g.ref(new Map),e=g.ref(0),s=g.ref(null),a=g.computed(()=>Array.from(t.value.values()));function i(v){e.value=v}function n(v){for(const S of v)o(S)}function o(v){t.value.set(v.id,v)}function d(v){return s.value=t.value.get(v)||null,s.value}function u(v){const S=d(v);return S&&t.value.delete(v),!!S}function y(){t.value.clear()}function m(v){s.value=v}function h(){s.value=null}return{itemsAsArray:a,totalCount:e,currentItem:s,setTotalCount:i,addOrReplaceItems:n,getById:d,removeById:u,clearItems:y,setCurrentItem:m,clearCurrentItem:h}}class st{constructor(){this.pageNumber=1,this.itemCount=20,this.sortDetail=new Ce("id",E.DESC),this.filters=[]}}class os{constructor(e,s){this.items=e,this.totalItems=s}}class ls{constructor(e,s){this.shouldKeepSync=e,this.intervalInMillisecond=s}}const at=new st;function rt(){const t=g.ref(structuredClone(at));function e(){t.value.pageNumber=t.value.pageNumber+1}function s(){t.value.pageNumber=t.value.pageNumber-1}function a(h){t.value.pageNumber=h}function i(h){t.value.itemCount=h}function n(h){t.value.sortDetail.key=h.key,t.value.sortDetail.order=h.order}function o(h){for(const v in h)d(v,h[v])}function d(h,v){const S=t.value.filters.findIndex(A=>A.key===h);S>-1?t.value.filters[S].value=v:t.value.filters.push({key:h,value:v})}function u(h){let v=t.value.filters;v=v.filter(S=>S.key!==h),t.value.filters=v}function y(){const h={page:t.value.pageNumber,count:t.value.itemCount};t.value.sortDetail&&(h.by=t.value.sortDetail.key,h.order=t.value.sortDetail.order);for(const v of t.value.filters)if(v.value)if(typeof v.value=="string"||typeof v.value=="number")h[v.key]=v.value;else{const S=JSON.stringify(v.value);S!=="[]"&&S!=="{}"&&(h[v.key]=S)}return h}function m(){t.value=structuredClone(at)}return{params:t,setNextPage:e,setPreventPage:s,setPageNumber:a,setItemCount:i,setSortDetail:n,setFilter:d,removeFilter:u,getRequestParams:y,clearParam:m,setFiltersBaseOnRequestBody:o}}function it(){const t=g.ref(new Set),e=g.computed(()=>t.value.has(p.FetchList)),s=g.computed(()=>t.value.has(p.FetchItem)),a=g.computed(()=>t.value.has(p.FetchLastItems)),i=g.computed(()=>t.value.has(p.FetchPreviousItems)),n=g.computed(()=>t.value.has(p.Create)),o=g.computed(()=>t.value.has(p.Update)),d=g.computed(()=>t.value.has(p.Delete)),u=g.computed(()=>t.value.has(p.Search)),y=g.computed(()=>t.value.has(p.Sort));function m(v){t.value.add(v)}function h(v){t.value.delete(v)}return{loadingStatus:t,isFetchingList:e,isFetchingItem:s,isFetchingLastItems:a,isFetchingPreviousItems:i,isCreating:n,isUpdating:o,isDeleting:d,isSearching:u,isSorting:y,setStatus:m,removeStatus:h}}function cs(t){const e=tt(),s=rt(),a=it(),i=new be({runAction:async()=>h(p.AutoRefresh)}),n=g.computed(()=>{const l=s.params.value.pageNumber,c=s.params.value.itemCount,f=l*c-c,w=l*c-1,D=[];for(let I=f;I<=w&&e.itemsAsArray.value[I];I++)D.push(e.itemsAsArray.value[I]);return D}),o=g.computed(()=>({totalItems:e.totalCount.value,currentPage:s.params.value.pageNumber,rows:e.itemsAsArray.value,loadingStatus:a.loadingStatus.value,currentPageItems:n.value})),d=g.computed(()=>({getData:y,sort:te,paginate:ge,fetchRows:h})),u=g.computed(()=>t.getSyncDetail());function y(){return o.value}async function m(l){const c=await t.fetchList(l);return e.clearItems(),e.addOrReplaceItems(c.items),e.setTotalCount(c.totalItems),c}async function h(l=p.FetchList){a.setStatus(l);const c=await m(s.getRequestParams());return a.removeStatus(l),c}async function v(){S(),await h()}function S(){if(!u.value.shouldKeepSync)throw new Error("The provided repository does not support auto refresh");i.setupInterval(u.value.intervalInMillisecond)}function A(){i.clearInterval()}async function J(l,c=!0){a.setStatus(p.FetchItem),c&&e.clearCurrentItem();const f=await t.fetchItemById(l);return e.setCurrentItem(f),a.removeStatus(p.FetchItem),f}async function G(l){a.setStatus(p.Create);const c=await t.createItem(l);return c&&e.addOrReplaceItems([c]),a.removeStatus(p.Create),c}async function W(l,c){a.setStatus(p.Update);const f=await t.updateItem(l,c);return f&&e.addOrReplaceItems([f]),a.removeStatus(p.Update),f}async function x(l){return a.setStatus(p.Delete),await t.deleteItem(l),a.removeStatus(p.Delete),e.removeById(l)}async function ke(){s.setNextPage(),a.setStatus(p.FetchLastItems);const l=await m(s.getRequestParams());return a.removeStatus(p.FetchLastItems),l}async function Pe(){s.setPreventPage(),a.setStatus(p.FetchPreviousItems);const l=await m(s.getRequestParams());return a.removeStatus(p.FetchPreviousItems),l}async function ge(l){s.setPageNumber(l),a.setStatus(p.FetchList);const c=await m(s.getRequestParams());return a.removeStatus(p.FetchList),c}async function $e(l){s.setFilter("search",l),a.setStatus(p.Search),e.clearItems();const c=await m(s.getRequestParams());return a.removeStatus(p.Search),c}async function te(l){s.setSortDetail(l),a.setStatus(p.Sort),e.clearItems();const c=await m(s.getRequestParams());return a.removeStatus(p.Sort),c}async function K(){return s.clearParam(),await h()}return g.onBeforeUnmount(()=>{A()}),{loadingStatusManager:a,dataManger:e,paramsManager:s,tableRenderingData:o,fetchList:h,fetchWithAutoRefresh:v,setupAutoRefresh:S,stopAutoRefresh:A,fetchItemById:J,createItem:G,updateItem:W,deleteItem:x,fetchLastItems:ke,fetchPreviousItems:Pe,fetchItemsByPageNumber:ge,search:$e,sort:te,clearFilters:K,tableService:d,currentPageItems:n}}function us(t){const e=g.ref(t),s=g.computed(()=>({getData(){return{totalItems:e.value.length,currentPageItems:e.value,loadingStatus:new Set,rows:e.value,currentPage:1}},async sort(a){return{totalItems:e.value.length,items:e.value}},async fetchRows(){return{totalItems:e.value.length,items:e.value}},async paginate(a,i){return{totalItems:e.value.length,items:e.value}}}));return{tableRows:e,staticTableService:s}}function hs(){const t=g.ref(new Map),e=g.ref(0),s=g.computed(()=>e.value),a=g.computed(()=>Array.from(t.value.values()));function i(m){e.value=m}function n(m){for(const h of m)o(h)}function o(m){t.value.set(String(m.id),m)}function d(m){const h=u(m);return t.value.delete(String(m)),h}function u(m){return t.value.get(String(m))||null}function y(){t.value.clear()}return{entityItemsAsArray:a,addOrReplaceItems:n,removeById:d,getItemById:u,clearItems:y,setTotalCount:i,getTotalCount:s}}class ds{constructor(e,s=500){this.timerId=null,this.debounceTimeout=s,this.action=e}runAction(){this.cancelDebounce(),this.action.runImmediate(),this.timerId=setTimeout(()=>{this.action.runDebounce()},this.debounceTimeout)}cancelDebounce(){this.timerId&&clearTimeout(this.timerId)}}function fs(t){return function(e,s,a){const i=a.value;a.value=async function(...n){try{return await i.apply(this,n)}catch(o){for(const d of t)await d.handleError(o)}}}}function ms(t){return function(e,s,a){const i=a.value;a.value=async function(...n){try{const o=await i.apply(this,n);for(const d of t)d.shouldResolveSuccess(o)&&await d.handleSuccess(o);return o}catch(o){for(const d of t)d.shouldResolveFailure(o)&&await d.handleFailure(o)}}}}class vs{constructor(e,s,a=()=>!0,i=()=>!0){this.successMessageResolver=e,this.failureMessageResolver=s,this.shouldResolveSuccess=a,this.shouldResolveFailure=i}async handleSuccess(e){}async handleFailure(e){}async handleInfo(){}async handleWarning(){}}const L=class L{constructor(){}static GetInstance(){return L.instance||(L.instance=new L),L.instance}static registerHandler(e,s){L.handlers.set(e,s)}handle(e){var i;const s=((i=e.response)==null?void 0:i.status)??0,a=L.handlers.get(s);a&&a.handleError(e)}};L.handlers=new Map,L.instance=null;let Le=L;class gs{constructor(e){this.axiosInstance=e}setBaseURL(e){return this.axiosInstance.defaults.baseURL=e,this}setTimeout(e){return this.axiosInstance.defaults.timeout=e,this}setHeaders(e){return this.axiosInstance.defaults.headers.common=e,this}attachRequestInterceptors(e){return this.axiosInstance.interceptors.request.use(s=>{for(const a of e)a.intercept(s);return s},s=>Promise.reject(s)),this}attachResponseInterceptors(e){return this.axiosInstance.interceptors.response.use(s=>s,s=>{throw e.handle(s),s}),this}build(){return this.axiosInstance}}class ps{constructor(e){this.axiosInstance=e}async get(e,s){return await this.axiosInstance.get(e,s)}async post(e,s,a){return await this.axiosInstance.post(e,s,a)}async patch(e,s,a){return await this.axiosInstance.patch(e,s,a)}async put(e,s,a){return await this.axiosInstance.put(e,s,a)}async delete(e,s){return await this.axiosInstance.delete(e,s)}}class ys{constructor(){this._initializer=[]}setupInitializers(e){this._initializer.push(...e)}initialize(){for(const e of this._initializer)e.initialize()}}const U=class U{constructor(){this.jsonConverter=new M.JsonConvert}serializeObject(e,s){return this.jsonConverter.serializeObject(e,s)}deserializeObject(e,s){return this.jsonConverter.deserializeObject(e,s)}deserializeArray(e,s){return this.jsonConverter.deserializeArray(e,s)}tryDeserialize(e,s){for(const a of s)try{return this.deserializeObject(e,a)}catch{}throw new Error("Unable to deserialize object")}static GetInstance(){return U.Instance||(U.Instance=new U),U.Instance}};U.Instance=null;let Te=U;var nt=(t=>(t.Success="success",t.Failure="error",t.Info="info",t.Warning="warning",t))(nt||{}),Oe=(t=>(t.BottomLeft="bottomLeft",t.TopLeft="topLeft",t))(Oe||{});class Ss{constructor(e,s,a){this.placement=Oe.BottomLeft,this.type=e,this.message=s,this.description=a}}const Is=Fe.defineStore(me.Dialog,()=>{const t=g.reactive({dialogComponent:null,width:O.DefaultWidth,height:O.DefaultHeight,props:null,header:""}),e=g.computed(()=>!!t.dialogComponent),s=g.computed(()=>!!t.header);function a(u){t.dialogComponent=u}function i(u){t.header=u}function n(u){if(!e.value)throw new Error("there is no dialog to set props on");t.props=u}function o(u,y){if(!e.value)throw new Error("there is no dialog to set size on");if(u<O.MinimalAvailableSize)throw new Error("negative size not supported");y===O.Width?t.width=u:t.height=u}function d(){t.props=null,t.height=O.DefaultHeight,t.width=O.DefaultWidth,t.header="",t.dialogComponent=null}return{dialogData:t,openDialog:a,clearDialog:d,setSize:o,setDialogHeader:i,setProps:n,isDialogExists:e,hasDefaultHeader:s}}),ws=Fe.defineStore(me.Drawer,()=>{const t=g.ref(z.Close),e=g.computed(()=>t.value===z.Open);function s(){t.value=z.Close}function a(){t.value=z.Open}return{closeDrawer:s,openDrawer:a,isDrawerOpen:e}});class Ds{constructor(){this.observers=[]}attach(e){this.observers.push(e)}detach(e){this.observers=this.observers.filter(s=>s!==e)}notify(){for(const e of this.observers)e.update(this)}}class As{constructor(e){this.mapProcesses=new Map,this.processes=e,this.assignProcessManager()}assignProcessManager(){this.processes.addToManager(this)}setProcessToMap(e){this.mapProcesses.set(e.name,e)}async start(){await this.processes.execute()}async startFrom(e){const s=this.mapProcesses.get(e);if(!s)throw new Error(`Process ${e} not found`);await s.execute()}}class bs{constructor(e,s){this.next=null,this.name=e,this.next=s}addToManager(e){e.setProcessToMap(this),this.next&&this.next.addToManager(e)}}class _s{constructor(){this.checkAccessibility=this.checkAccessibility.bind(this),this.isAccessible=this.isAccessible.bind(this),this.getDestinationRouteName=this.getDestinationRouteName.bind(this)}async checkAccessibility(e,s,a){if(await this.isAccessible(e,s)){a();return}if(await this.getDestinationRouteName()){a({name:await this.getDestinationRouteName()});return}if(await this.getDestinationRouteLocation(e,s)){a(await this.getDestinationRouteLocation(e,s));return}a(!1)}async getDestinationRouteName(){return""}async getDestinationRouteLocation(e,s){return null}}class Ms{constructor(e,s,a){this.scheduler=new be({runAction:async()=>{await this.fetchList()}}),this.repository=e,this.crudDataManagement=s,this.syncDetail=this.repository.getSyncDetail(),this.paramManager=a,this.syncListWithApi()}async fetchList(){const e=await this.repository.fetchList(this.paramManager.getRequestParams());return this.crudDataManagement.addOrReplaceItems(e.items),this.crudDataManagement.setTotalCount(e.totalItems),e}async fetchItemById(e){const s=await this.repository.fetchItemById(e);return s&&this.crudDataManagement.addOrReplaceItems([s]),s}async createItem(e){const s=await this.repository.createItem(e);return s&&!this.shouldRefreshListAfterCreate()&&this.crudDataManagement.addOrReplaceItems([s]),s&&this.shouldRefreshListAfterCreate()&&await this.fetchList(),s}shouldRefreshListAfterCreate(){return!0}async deleteItem(e){return await this.repository.deleteItem(e)?this.crudDataManagement.removeById(e):null}async updateItem(e,s){const a=await this.repository.updateItem(e,s);return this.shouldRefreshListAfterUpdate()&&a?(await this.fetchList(),this.crudDataManagement.getItemById(e)):a}shouldRefreshListAfterUpdate(){return!0}async removeItem(e){const s=await this.repository.deleteItem(e);return s&&this.shouldRefreshListAfterDelete()&&await this.fetchList(),s?this.crudDataManagement.removeById(e):null}shouldRefreshListAfterDelete(){return!1}syncListWithApi(){this.scheduler.clearInterval(),this.syncDetail.shouldKeepSync&&this.scheduler.setupInterval(this.syncDetail.intervalInMillisecond)}onDestroy(){this.crudDataManagement.clearItems(),this.clearInterval()}clearInterval(){this.scheduler.clearInterval()}}class ot{}class Cs extends ot{search(e,s,a){const i=[];e:for(const n of e)for(const o of a(n))if(V.removeSpacesFromString(String(o).toLowerCase()).indexOf(V.removeSpacesFromString(String(s).toLowerCase()))>-1){i.push(n);continue e}return i}}var Ee=(t=>(t.Hidden="hidden",t.Visible="visible",t))(Ee||{});class Rs{constructor(e){this._visibilityControl=e,this.mangeVisibilityEvent()}mangeVisibilityEvent(){document.addEventListener("visibilitychange",e=>{document.visibilityState===Ee.Hidden?this._visibilityControl.screenInvisible(e):this._visibilityControl.screenVisible(e)})}}var Ls=Object.defineProperty,Ts=Object.getOwnPropertyDescriptor,R=(t,e,s,a)=>{for(var i=a>1?void 0:a?Ts(e,s):e,n=t.length-1,o;n>=0;n--)(o=t[n])&&(i=(a?o(e,s,i):o(i))||i);return a&&i&&Ls(e,s,i),i};r.Amount=class{constructor(){this.value="",this.symbol=""}get tradeValueInNumber(){return Number(this.value)}get truncatedValue(){return this.tradeValueInNumber.toLocaleString("en-US",{maximumFractionDigits:8})}},R([M.JsonProperty("value",String,!0)],r.Amount.prototype,"value",2),R([M.JsonProperty("symbol",String)],r.Amount.prototype,"symbol",2),r.Amount=R([M.JsonObject("Amount")],r.Amount),r.BaseModel=class{getTable(){const e=Object.getPrototypeOf(this)._table;if(!e)throw new Error("No Table found for the model. are you sure decorated the model with @Table() ?");return e}},R([M.JsonProperty("id",Number)],r.BaseModel.prototype,"id",2),r.BaseModel=R([M.JsonObject("BaseModel")],r.BaseModel),r.MinifiedSymbolModel=class extends r.BaseModel{},R([M.JsonProperty("symbol",String)],r.MinifiedSymbolModel.prototype,"symbol",2),R([M.JsonProperty("enName",String)],r.MinifiedSymbolModel.prototype,"enName",2),R([M.JsonProperty("faName",String)],r.MinifiedSymbolModel.prototype,"faName",2),R([M.JsonProperty("image",String)],r.MinifiedSymbolModel.prototype,"image",2),r.MinifiedSymbolModel=R([M.JsonObject("MinifiedSymbolModel")],r.MinifiedSymbolModel);class Os{constructor(e,s){this.requestedDate=e,this.executedDate=s}get requestedDateInJalali(){return C.mapUnixToDate(this.requestedDate,H.SimpleDate)}get requestedTime(){return C.mapUnixToDate(this.requestedDate,H.JustHour)}get executedDateInJalali(){return C.mapUnixToDate(this.executedDate,H.SimpleDate)}get executedDateTime(){return C.mapUnixToDate(this.executedDate,H.JustHour)}}class Es{constructor(e,s){this.requestedAmount=e,this.executedAmount=s}}class ks{constructor(e,s,a,i,n){this.symbolPrice=e,this.USDTPrice=s,this.symobl=a,this.symbolImage=i,this.USDTImage=n}get truncatedSymbolPrice(){return this.symbolPrice.toLocaleString("en-US",{maximumFractionDigits:8})}get truncatedUSDTPrice(){return this.USDTPrice.toLocaleString("en-US",{maximumFractionDigits:8})}}class Ps{constructor(e,s){this.soldSymbol=e,this.buySymbol=s}}r.APIErrorHandlerRegistry=Le,r.AbstractSubject=Ds,r.AccessControl=De,r.AccessLevel=ee,r.Action=rs,r.ApiBuilder=gs,r.ApplicationDrawerStatus=z,r.ApplicationInitializer=ys,r.AuthorizationDirective=Ae,r.AuthorizationService=ve,r.BaseTable=Qe,r.BehaviorSubject=et,r.CellType=fe,r.ClientArraySearch=Cs,r.ClientSearch=ot,r.Column=ss,r.CommonMaskFormats=ae,r.CrudService=Ms,r.DateConverter=F,r.DateDisabledOptions=Bt,r.DateFormat=H,r.DateFormats=Be,r.DateTools=X,r.DebounceService=ds,r.DialogDimensions=O,r.EveryAccess=Ut,r.EveryLevelAuthorizationDirective=jt,r.Feedback=vs,r.FetchListResponse=os,r.FormManager=Kt,r.FormValidationStatus=Q,r.Formatter=C,r.HandleError=fs,r.HandleFeedback=ms,r.HeaderType=de,r.HttpClient=ps,r.InputControl=Gt,r.InputControlBuilder=Wt,r.InputControlData=Ke,r.JsonMapper=Te,r.LoadingStatus=p,r.Params=st,r.Process=bs,r.ProcessManager=As,r.RangeValue=Nt,r.RouteGuard=_s,r.Scheduler=be,r.SelectableTable=es,r.SimpleSort=Re,r.SomeAccess=Yt,r.SomeLevelsAuthorizationDirective=Ht,r.SortDetail=Ce,r.SortOrder=E,r.SortOrderTableHeader=Ge,r.Sorter=Qt,r.StatusCode=We,r.StorageKeys=k,r.StoreNames=me,r.SymbolInTrade=Ps,r.SymbolPriceInTrade=ks,r.Symbols=xe,r.SyncDetail=ls,r.TABLE_ACTION_COLUMN=Xt,r.TABLE_COLUMN_DEFAULT_COLSPAN=Me,r.TABLE_COLUMN_DEFAULT_VALUES=Xe,r.TABLE_COLUMN_DEFAULT_WIDTH=_e,r.Table=as,r.TableConstants=we,r.TableDestroy=is,r.TableHeaderAlign=he,r.TableRowClick=ns,r.ToastLocation=Oe,r.ToastMessage=Ss,r.ToastType=nt,r.TouchSensitiveControl=xt,r.TradeAmount=Es,r.TradeDate=Os,r.Util=V,r.VisibilityManager=Rs,r.VisibilityState=Ee,r.cards=Ve,r.generateHeader=ts,r.ibans=Ne,r.isEmpty=Ze,r.isLastItem=zt,r.isOnlyOneItem=qt,r.setupJalaliDate=Je,r.setupStore=Jt,r.useCrud=hs,r.useData=tt,r.useDialogService=Is,r.useDrawerService=ws,r.useForm=Zt,r.useLoadingStatus=it,r.useParams=rt,r.useRepository=cs,r.useStaticTableService=us,Object.defineProperty(r,Symbol.toStringTag,{value:"Module"})});
|
|
2
|
+
the initial data will be available after calling the [markAsInitial] method on this instance`)}markAsInitial(){this.initialData=structuredClone(g.toRaw(this.data))}setValidators(e){this._validators=e}getChangeSensitive(){return this.data.isChangeSensitive}setChangeSensitive(e){if(e&&this.data.shouldRemoveValidationMessageOnInteract)throw new Error("Input control "+this.getName()+" can not be both change sensitive and remove validation meessage on interact");this.data.isChangeSensitive=e}getIsBlurSensitive(){return this.data.isBlurSensitive}setIsBlurSensitive(e){this.data.isBlurSensitive=e}getIsRequired(){return this.data.isRequired}setIsRequired(e){this.data.isRequired=e}getIsValid(){return this.data.isValid}setIsValid(e){this.data.isValid=e}getIsIncludeInRequestBody(){return this.data.isIncludeInRequestBody}setIsIncludeInRequestBody(e){this.data.isIncludeInRequestBody=e}getNotValidMessage(){return this.data.notValidMessage}setNotValidMessage(e){this.data.notValidMessage=e}getName(){return this.data.name}setName(e){this.data.name=e}setId(e){this._id=e}getId(){return this._id}getIsEmptySensitive(){return this.data.isEmptySensitive}setIsEmptySensitive(e){this.data.isEmptySensitive=e}setHasCustomValidationCheck(e){this.data.hasCustomValidationCheck=e}setShouldRemoveValidationOnInteract(e){if(e&&this.data.isChangeSensitive)throw new Error("Input control "+this.getName()+" can not be both change sensitive and remove validation meessage on interact");this.data.shouldRemoveValidationMessageOnInteract=e}getShouldRemoveValidationOnInteract(){return this.data.shouldRemoveValidationMessageOnInteract}hasCustomValidationCheck(){return this.data.hasCustomValidationCheck}set value(e){this.data.value=e,this.shouldRunValidation()&&this.runValidation(),this.getShouldRemoveValidationOnInteract()&&this.setNotValidMessage("")}get value(){return this.data.value}}class Wt{constructor(e){this._inputControl=e}setValidators(e){return this._inputControl.setValidators(e),this}setChangeSensitive(){return this._inputControl.setChangeSensitive(!0),this}setRequired(){return this._inputControl.setIsRequired(!0),this}setValid(){return this._inputControl.setIsValid(!0),this}setBlurSensitive(){return this._inputControl.setIsBlurSensitive(!0),this}setId(e){return this._inputControl.setId(e),this}removeEmptySensitive(){return this._inputControl.setIsEmptySensitive(!1),this}setHasCustomValidationCheck(){return this._inputControl.setHasCustomValidationCheck(!0),this}removeErrorOnInteract(){return this._inputControl.setShouldRemoveValidationOnInteract(!0),this}build(){return this._inputControl}}class xt{constructor(){this.mounted=(e,s)=>{s.value&&s.value.getIsBlurSensitive()&&(e.addEventListener("click",this.handleFocus.bind(this,s.value)),e.addEventListener("blur",this.handleBlur.bind(this,s.value),!0))},this.beforeUnMount=(e,s)=>{e.removeEventListener("blur",this.handleBlur.bind(this,s.value)),e.removeEventListener("click",this.handleFocus.bind(this,s.value))}}handleBlur(e){e.runValidation(!0)}handleFocus(e){e.value||e.getIsEmptySensitive()||e.setNotValidMessage("")}}class Kt{constructor(){this._inputControls=new Map,this._isValid=!1,this._id=Math.random()}getInputControlsAsArray(){return Array.from(this._inputControls.values())}async runValidation(e){let s=!0;for(const a of this.getInputControlsAsArray())if(e&&await a.runValidation(!0),!a.getIsValid()&&(s=!1,!e)){this._isValid=!1;return}this._isValid=s}addInputControls(e){for(const s of e)this._inputControls.set(s.getName(),s)}getInputControl(e){const s=this._inputControls.get(e);if(!s)throw new Error(`The provided input name (${e}}) has no controls.`);return s}resetControls(e){for(const s of e){const a=this._inputControls.get(s);a?a.reset():console.warn(`Provided input name ${s} has no controllers in this form`)}}resetAll(){for(const e of this.getInputControlsAsArray())e.reset()}createRequestBody(){const e={};for(const s of this.getInputControlsAsArray())s.getIsIncludeInRequestBody()&&(e[s.getName()]=s.value);return e}setIsValid(e){this._isValid=e}getIsValid(){return this._isValid}setId(e){this._id=e}getId(){return this._id}}function Zt(t,e=!1){const s=g.reactive(t),a=g.ref(Q.Invalid);return g.watch(()=>s.getInputControlsAsArray(),()=>{e||(s.runValidation(),s.getIsValid()?a.value=Q.Valid:a.value=Q.Invalid)},{immediate:!0,deep:!0}),{reactiveForm:s,validationStatus:a}}class be{constructor(e){this.timerId=null,this.setupInterval=this.setupInterval.bind(this),this.schedule=e}setupInterval(e){const s=this;this.timerId=setTimeout(async function a(){await s.schedule.runAction(),s.timerId=setTimeout(()=>{a()},e)},e)}clearInterval(){this.timerId&&clearInterval(this.timerId)}}const _e="150px",Me=2,Xt={path:"id",key:"id",title:"عملیات",colspan:Me,width:_e,cellType:fe.ACTION,align:he.Center,headerType:de.Text,accessLevel:null},Xe={width:_e,align:he.Center,headerType:de.Text,cellType:fe.Text,colspan:Me};class Ce{constructor(e,s){this.key=e,this.order=s}}class Re{aSort(e,s){return e.sort((a,i)=>{const n=a[s]??a,o=i[s]??i;if(typeof n=="string"&&typeof o=="string")return n.localeCompare(o);if(typeof n=="number"&&typeof o=="number")return n-o;throw new Error("Not supported data type")})}bSort(e,s){return e.sort((a,i)=>{const n=a[s]??a,o=i[s]??i;if(typeof n=="string"&&typeof o=="string")return o.localeCompare(n);if(typeof n=="number"&&typeof o=="number")return o-n;throw new Error("Not supported data type")})}}class Qt{arrayOfObjectSort(e,s,a,i=new Re){return a===E.ASC?i.aSort(e,s):i.bSort(e,s)}arraySort(e,s,a=new Re){return s===E.ASC?a.aSort(e):a.bSort(e)}}class Qe{constructor(e){this.currentPage=1,this.currentPageSize=20,this.currentSortDetail=new Ce("id",E.DESC),this.loadedRows=[],this.headerSchema=[],this.service=e,this.accessService=ee.GetInstance()}addHeader(e){this.headerSchema.push(e)}async load(){this.headerSchema=this.filterItemsBaseOnAccessLevel(await this.loadHeader()),await this.loadRows()}filterItemsBaseOnAccessLevel(e){return e.filter(s=>s.hasAccess?s.hasAccess():!0)}async sort(e){this.shouldSendSortRequest(e)&&(this.currentSortDetail=e,this.loadedRows=(await this.handleSort(this.currentSortDetail)).items)}shouldSendSortRequest(e){return e.key!==this.currentSortDetail.key||e.order!==this.currentSortDetail.order}async paginate(e,s){this.shouldSendPaginationRequest(e,s)&&(this.currentPage=e,this.currentPageSize=s,this.loadedRows=(await this.handlePagination(this.currentPage,this.currentPageSize)).items)}shouldSendPaginationRequest(e,s){return this.currentPage!==e||this.currentPageSize!==s}async loadRows(){return this.loadedRows=(await this.service.fetchRows()).items,this.loadedRows}getData(){return this.service.getData()}async handleSort(e){return await this.service.sort(e)}async handlePagination(e,s){return await this.service.paginate(e,s)}getItemCountPerPage(){return we.DEFAULT_ITEM_COUNT_PER_PAGE}isLoading(){const e=this.getLoadingStatuses();return e.has(p.Search)||e.has(p.FetchList)||e.has(p.Sort)||e.has(p.FetchLastItems)||e.has(p.FetchPreviousItems)}getLoadingStatuses(){return this.getData().loadingStatus}hasAnyAction(){for(const e of this.loadedRows)if(this.getAccessedActions(e).length)return!0;return!1}getAccessedActions(e){return this.filterItemsBaseOnAccessLevel(this.getActions(e))}getActions(e){return[]}getScrollDetail(){return null}isExpandable(){return!1}async handleClick(e){}async handleMetaClick(e){}async handleDoubleClick(e){}async onDestroy(){}async loadHeader(){throw new Error("No header provided for the table.")}loadSummarySchema(){return{summaryTitle:"",summaryItems:[]}}}class et{constructor(e){this.observers=[],this.next(e)}attach(e){this.observers.push(e)}detach(e){this.observers=this.observers.filter(s=>s!==e)}notify(){for(const e of this.observers)typeof e=="function"?e(this._value):e.update(this._value)}next(e){typeof e=="function"?this._value=e(this._value):this._value=e,this.notify()}getValue(){return this._value}}class es extends Qe{constructor(e){super(e),this.selectedRows=new et(new Map),this.rowSelect=this.rowSelect.bind(this),this.selectAll=this.selectAll.bind(this),this.isEveryRowSelected=this.isEveryRowSelected.bind(this),this.handlePagination=this.handlePagination.bind(this),this.clearAllSelectedItems=this.clearAllSelectedItems.bind(this),this.getSelectedRows=this.getSelectedRows.bind(this),this.getSelectedRowsAsArray=this.getSelectedRowsAsArray.bind(this),this.getSelectedRowIds=this.getSelectedRowIds.bind(this)}rowSelect(e){this.getSelectedRowsValue().has(e.id)?(this.getSelectedRowsValue().delete(e.id),this.selectedRows.next(this.selectedRows.getValue())):(this.selectedRows.getValue().set(e.id,e),this.selectedRows.next(this.selectedRows.getValue()))}selectAll(){if(this.isEveryRowSelected())this.clearAllSelectedItems();else for(const e of this.loadedRows)this.selectedRows.getValue().set(e.id,e),this.selectedRows.next(this.selectedRows.getValue())}isEveryRowSelected(){return this.getSelectedRowsValue().size===this.currentPageSize||this.loadedRows.length===this.getSelectedRowsValue().size}async handlePagination(e,s){return this.clearAllSelectedItems(),await super.handlePagination(e,s)}async handleSort(e){return this.clearAllSelectedItems(),await super.handleSort(e)}clearAllSelectedItems(){this.selectedRows.getValue().clear(),this.selectedRows.next(this.selectedRows.getValue())}getSelectedRows(){return this.selectedRows}getSelectedRowsAsArray(){return Array.from(this.selectedRows.getValue().values())}getSelectedRowIds(){return Array.from(this.selectedRows.getValue().keys())}getSelectedRowsValue(){return this.selectedRows.getValue()}}function ts(t){return{...Xe,...t}}function ss(t){return function(s,a){s.constructor.prototype.headers||(s.constructor.prototype.headers=[]),s.constructor.prototype.headers.push({path:a,...t})}}function as(t){return function(s){async function a(){return s.prototype._table=this,s.prototype.headers}function i(d){const u=[],y=s.prototype.actions||[];for(const m of y){if(!m.isAvailable(d))continue;const h={handler:m.handler.bind(d),accessLevel:m.accessLevel,actionName:m.actionName};u.push(h)}return u}async function n(d){s.prototype.rowClick&&await s.prototype.rowClick.call(d)}async function o(){s.prototype.tableDestroy&&await s.prototype.tableDestroy()}t.prototype.loadHeader=a,t.prototype.getActions=i,t.prototype.handleClick=n,t.prototype.onDestroy=o}}function rs(t){return function(s,a,i){s.constructor.prototype.actions||(s.constructor.prototype.actions=[]),t.handler=i.value,s.constructor.prototype.actions.push(t)}}function is(){return function(e,s,a){e.constructor.prototype.tableDestroy=a.value}}function ns(){return function(e,s,a){e.constructor.prototype.rowClick=a.value}}function tt(){const t=g.ref(new Map),e=g.ref(0),s=g.ref(null),a=g.computed(()=>Array.from(t.value.values()));function i(v){e.value=v}function n(v){for(const S of v)o(S)}function o(v){t.value.set(v.id,v)}function d(v){return s.value=t.value.get(v)||null,s.value}function u(v){const S=d(v);return S&&t.value.delete(v),!!S}function y(){t.value.clear()}function m(v){s.value=v}function h(){s.value=null}return{itemsAsArray:a,totalCount:e,currentItem:s,setTotalCount:i,addOrReplaceItems:n,getById:d,removeById:u,clearItems:y,setCurrentItem:m,clearCurrentItem:h}}class st{constructor(){this.pageNumber=1,this.itemCount=20,this.sortDetail=new Ce("id",E.DESC),this.filters=[]}}class os{constructor(e,s){this.items=e,this.totalItems=s}}class ls{constructor(e,s){this.shouldKeepSync=e,this.intervalInMillisecond=s}}const at=new st;function rt(){const t=g.ref(structuredClone(at));function e(){t.value.pageNumber=t.value.pageNumber+1}function s(){t.value.pageNumber=t.value.pageNumber-1}function a(h){t.value.pageNumber=h}function i(h){t.value.itemCount=h}function n(h){t.value.sortDetail.key=h.key,t.value.sortDetail.order=h.order}function o(h){for(const v in h)d(v,h[v])}function d(h,v){const S=t.value.filters.findIndex(A=>A.key===h);S>-1?t.value.filters[S].value=v:t.value.filters.push({key:h,value:v})}function u(h){let v=t.value.filters;v=v.filter(S=>S.key!==h),t.value.filters=v}function y(){const h={page:t.value.pageNumber,count:t.value.itemCount};t.value.sortDetail&&(h.by=t.value.sortDetail.key,h.order=t.value.sortDetail.order);for(const v of t.value.filters)if(v.value)if(typeof v.value=="string"||typeof v.value=="number")h[v.key]=v.value;else{const S=JSON.stringify(v.value);S!=="[]"&&S!=="{}"&&(h[v.key]=S)}return h}function m(){t.value=structuredClone(at)}return{params:t,setNextPage:e,setPreventPage:s,setPageNumber:a,setItemCount:i,setSortDetail:n,setFilter:d,removeFilter:u,getRequestParams:y,clearParam:m,setFiltersBaseOnRequestBody:o}}function it(){const t=g.ref(new Set),e=g.computed(()=>t.value.has(p.FetchList)),s=g.computed(()=>t.value.has(p.FetchItem)),a=g.computed(()=>t.value.has(p.FetchLastItems)),i=g.computed(()=>t.value.has(p.FetchPreviousItems)),n=g.computed(()=>t.value.has(p.Create)),o=g.computed(()=>t.value.has(p.Update)),d=g.computed(()=>t.value.has(p.Delete)),u=g.computed(()=>t.value.has(p.Search)),y=g.computed(()=>t.value.has(p.Sort));function m(v){t.value.add(v)}function h(v){t.value.delete(v)}return{loadingStatus:t,isFetchingList:e,isFetchingItem:s,isFetchingLastItems:a,isFetchingPreviousItems:i,isCreating:n,isUpdating:o,isDeleting:d,isSearching:u,isSorting:y,setStatus:m,removeStatus:h}}function cs(t){const e=tt(),s=rt(),a=it(),i=new be({runAction:async()=>h(p.AutoRefresh)}),n=g.computed(()=>{const l=s.params.value.pageNumber,c=s.params.value.itemCount,f=l*c-c,w=l*c-1,D=[];for(let I=f;I<=w&&e.itemsAsArray.value[I];I++)D.push(e.itemsAsArray.value[I]);return D}),o=g.computed(()=>({totalItems:e.totalCount.value,currentPage:s.params.value.pageNumber,rows:e.itemsAsArray.value,loadingStatus:a.loadingStatus.value,currentPageItems:n.value})),d=g.computed(()=>({getData:y,sort:te,paginate:ge,fetchRows:h})),u=g.computed(()=>t.getSyncDetail());function y(){return o.value}async function m(l){const c=await t.fetchList(l);return e.clearItems(),e.addOrReplaceItems(c.items),e.setTotalCount(c.totalItems),c}async function h(l=p.FetchList){a.setStatus(l);const c=await m(s.getRequestParams());return a.removeStatus(l),c}async function v(){S(),await h()}function S(){if(!u.value.shouldKeepSync)throw new Error("The provided repository does not support auto refresh");i.setupInterval(u.value.intervalInMillisecond)}function A(){i.clearInterval()}async function J(l,c=!0){a.setStatus(p.FetchItem),c&&e.clearCurrentItem();const f=await t.fetchItemById(l);return e.setCurrentItem(f),a.removeStatus(p.FetchItem),f}async function G(l){a.setStatus(p.Create);const c=await t.createItem(l);return c&&e.addOrReplaceItems([c]),a.removeStatus(p.Create),c}async function W(l,c){a.setStatus(p.Update);const f=await t.updateItem(l,c);return f&&e.addOrReplaceItems([f]),a.removeStatus(p.Update),f}async function x(l){return a.setStatus(p.Delete),await t.deleteItem(l),a.removeStatus(p.Delete),e.removeById(l)}async function ke(){s.setNextPage(),a.setStatus(p.FetchLastItems);const l=await m(s.getRequestParams());return a.removeStatus(p.FetchLastItems),l}async function Pe(){s.setPreventPage(),a.setStatus(p.FetchPreviousItems);const l=await m(s.getRequestParams());return a.removeStatus(p.FetchPreviousItems),l}async function ge(l){s.setPageNumber(l),a.setStatus(p.FetchList);const c=await m(s.getRequestParams());return a.removeStatus(p.FetchList),c}async function $e(l){s.setFilter("search",l),a.setStatus(p.Search),e.clearItems();const c=await m(s.getRequestParams());return a.removeStatus(p.Search),c}async function te(l){s.setSortDetail(l),a.setStatus(p.Sort),e.clearItems();const c=await m(s.getRequestParams());return a.removeStatus(p.Sort),c}async function K(){return s.clearParam(),await h()}return g.onBeforeUnmount(()=>{A()}),{loadingStatusManager:a,dataManger:e,paramsManager:s,tableRenderingData:o,fetchList:h,fetchWithAutoRefresh:v,setupAutoRefresh:S,stopAutoRefresh:A,fetchItemById:J,createItem:G,updateItem:W,deleteItem:x,fetchLastItems:ke,fetchPreviousItems:Pe,fetchItemsByPageNumber:ge,search:$e,sort:te,clearFilters:K,tableService:d,currentPageItems:n}}function us(t){const e=g.ref(t),s=g.computed(()=>({getData(){return{totalItems:e.value.length,currentPageItems:e.value,loadingStatus:new Set,rows:e.value,currentPage:1}},async sort(a){return{totalItems:e.value.length,items:e.value}},async fetchRows(){return{totalItems:e.value.length,items:e.value}},async paginate(a,i){return{totalItems:e.value.length,items:e.value}}}));return{tableRows:e,staticTableService:s}}function hs(){const t=g.ref(new Map),e=g.ref(0),s=g.computed(()=>e.value),a=g.computed(()=>Array.from(t.value.values()));function i(m){e.value=m}function n(m){for(const h of m)o(h)}function o(m){t.value.set(String(m.id),m)}function d(m){const h=u(m);return t.value.delete(String(m)),h}function u(m){return t.value.get(String(m))||null}function y(){t.value.clear()}return{entityItemsAsArray:a,addOrReplaceItems:n,removeById:d,getItemById:u,clearItems:y,setTotalCount:i,getTotalCount:s}}class ds{constructor(e,s=500){this.timerId=null,this.debounceTimeout=s,this.action=e}runAction(){this.cancelDebounce(),this.action.runImmediate(),this.timerId=setTimeout(()=>{this.action.runDebounce()},this.debounceTimeout)}cancelDebounce(){this.timerId&&clearTimeout(this.timerId)}}function fs(t){return function(e,s,a){const i=a.value;a.value=async function(...n){try{return await i.apply(this,n)}catch(o){for(const d of t)await d.handleError(o)}}}}function ms(t){return function(e,s,a){const i=a.value;a.value=async function(...n){try{const o=await i.apply(this,n);for(const d of t)d.shouldResolveSuccess(o)&&await d.handleSuccess(o);return o}catch(o){for(const d of t)d.shouldResolveFailure(o)&&await d.handleFailure(o)}}}}class vs{constructor(e,s,a=()=>!0,i=()=>!0){this.successMessageResolver=e,this.failureMessageResolver=s,this.shouldResolveSuccess=a,this.shouldResolveFailure=i}async handleSuccess(e){}async handleFailure(e){}async handleInfo(){}async handleWarning(){}}const L=class L{constructor(){}static GetInstance(){return L.instance||(L.instance=new L),L.instance}static registerHandler(e,s){L.handlers.set(e,s)}handle(e){var i;const s=((i=e.response)==null?void 0:i.status)??0,a=L.handlers.get(s);a&&a.handleError(e)}};L.handlers=new Map,L.instance=null;let Le=L;class gs{constructor(e){this.axiosInstance=e}setBaseURL(e){return this.axiosInstance.defaults.baseURL=e,this}setTimeout(e){return this.axiosInstance.defaults.timeout=e,this}setHeaders(e){return this.axiosInstance.defaults.headers.common=e,this}attachRequestInterceptors(e){return this.axiosInstance.interceptors.request.use(s=>{for(const a of e)a.intercept(s);return s},s=>Promise.reject(s)),this}attachResponseInterceptors(e){return this.axiosInstance.interceptors.response.use(s=>s,s=>{throw e.handle(s),s}),this}build(){return this.axiosInstance}}class ps{constructor(e){this.axiosInstance=e}async get(e,s){return await this.axiosInstance.get(e,s)}async post(e,s,a){return await this.axiosInstance.post(e,s,a)}async patch(e,s,a){return await this.axiosInstance.patch(e,s,a)}async put(e,s,a){return await this.axiosInstance.put(e,s,a)}async delete(e,s){return await this.axiosInstance.delete(e,s)}}class ys{constructor(){this._initializer=[]}setupInitializers(e){this._initializer.push(...e)}initialize(){for(const e of this._initializer)e.initialize()}}const U=class U{constructor(){this.jsonConverter=new M.JsonConvert}serializeObject(e,s){return this.jsonConverter.serializeObject(e,s)}deserializeObject(e,s){return this.jsonConverter.deserializeObject(e,s)}deserializeArray(e,s){return this.jsonConverter.deserializeArray(e,s)}tryDeserialize(e,s){for(const a of s)try{return this.deserializeObject(e,a)}catch{}throw new Error("Unable to deserialize object")}static GetInstance(){return U.Instance||(U.Instance=new U),U.Instance}};U.Instance=null;let Te=U;var nt=(t=>(t.Success="success",t.Failure="error",t.Info="info",t.Warning="warning",t))(nt||{}),Oe=(t=>(t.BottomLeft="bottomLeft",t.TopLeft="topLeft",t))(Oe||{});class Ss{constructor(e,s,a){this.placement=Oe.BottomLeft,this.type=e,this.message=s,this.description=a}}const Is=Fe.defineStore(me.Dialog,()=>{const t=g.reactive({dialogComponent:null,width:O.DefaultWidth,height:O.DefaultHeight,props:null,header:""}),e=g.computed(()=>!!t.dialogComponent),s=g.computed(()=>!!t.header);function a(u){t.dialogComponent=u}function i(u){t.header=u}function n(u){if(!e.value)throw new Error("there is no dialog to set props on");t.props=u}function o(u,y){if(!e.value)throw new Error("there is no dialog to set size on");if(u<O.MinimalAvailableSize)throw new Error("negative size not supported");y===O.Width?t.width=u:t.height=u}function d(){t.props=null,t.height=O.DefaultHeight,t.width=O.DefaultWidth,t.header="",t.dialogComponent=null}return{dialogData:t,openDialog:a,clearDialog:d,setSize:o,setDialogHeader:i,setProps:n,isDialogExists:e,hasDefaultHeader:s}}),ws=Fe.defineStore(me.Drawer,()=>{const t=g.ref(z.Close),e=g.computed(()=>t.value===z.Open);function s(){t.value=z.Close}function a(){t.value=z.Open}return{closeDrawer:s,openDrawer:a,isDrawerOpen:e}});class Ds{constructor(){this.observers=[]}attach(e){this.observers.push(e)}detach(e){this.observers=this.observers.filter(s=>s!==e)}notify(){for(const e of this.observers)e.update(this)}}class As{constructor(e){this.mapProcesses=new Map,this.processes=e,this.assignProcessManager()}assignProcessManager(){this.processes.addToManager(this)}setProcessToMap(e){this.mapProcesses.set(e.name,e)}async start(){await this.processes.execute()}async startFrom(e){const s=this.mapProcesses.get(e);if(!s)throw new Error(`Process ${e} not found`);await s.execute()}}class bs{constructor(e,s){this.next=null,this.name=e,this.next=s}addToManager(e){e.setProcessToMap(this),this.next&&this.next.addToManager(e)}}class _s{constructor(){this.checkAccessibility=this.checkAccessibility.bind(this),this.isAccessible=this.isAccessible.bind(this),this.getDestinationRouteName=this.getDestinationRouteName.bind(this)}async checkAccessibility(e,s,a){if(await this.isAccessible(e,s)){a();return}if(await this.getDestinationRouteName()){a({name:await this.getDestinationRouteName()});return}if(await this.getDestinationRouteLocation(e,s)){a(await this.getDestinationRouteLocation(e,s));return}a(!1)}async getDestinationRouteName(){return""}async getDestinationRouteLocation(e,s){return null}}class Ms{constructor(e,s,a){this.scheduler=new be({runAction:async()=>{await this.fetchList()}}),this.repository=e,this.crudDataManagement=s,this.syncDetail=this.repository.getSyncDetail(),this.paramManager=a,this.syncListWithApi()}async fetchList(){const e=await this.repository.fetchList(this.paramManager.getRequestParams());return this.crudDataManagement.addOrReplaceItems(e.items),this.crudDataManagement.setTotalCount(e.totalItems),e}async fetchItemById(e){const s=await this.repository.fetchItemById(e);return s&&this.crudDataManagement.addOrReplaceItems([s]),s}async createItem(e){const s=await this.repository.createItem(e);return s&&!this.shouldRefreshListAfterCreate()&&this.crudDataManagement.addOrReplaceItems([s]),s&&this.shouldRefreshListAfterCreate()&&await this.fetchList(),s}shouldRefreshListAfterCreate(){return!0}async deleteItem(e){return await this.repository.deleteItem(e)?this.crudDataManagement.removeById(e):null}async updateItem(e,s){const a=await this.repository.updateItem(e,s);return this.shouldRefreshListAfterUpdate()&&a?(await this.fetchList(),this.crudDataManagement.getItemById(e)):a}shouldRefreshListAfterUpdate(){return!0}async removeItem(e){const s=await this.repository.deleteItem(e);return s&&this.shouldRefreshListAfterDelete()&&await this.fetchList(),s?this.crudDataManagement.removeById(e):null}shouldRefreshListAfterDelete(){return!1}syncListWithApi(){this.scheduler.clearInterval(),this.syncDetail.shouldKeepSync&&this.scheduler.setupInterval(this.syncDetail.intervalInMillisecond)}onDestroy(){this.crudDataManagement.clearItems(),this.clearInterval()}clearInterval(){this.scheduler.clearInterval()}}class ot{}class Cs extends ot{search(e,s,a){const i=[];e:for(const n of e)for(const o of a(n))if(V.removeSpacesFromString(String(o).toLowerCase()).indexOf(V.removeSpacesFromString(String(s).toLowerCase()))>-1){i.push(n);continue e}return i}}var Ee=(t=>(t.Hidden="hidden",t.Visible="visible",t))(Ee||{});class Rs{constructor(e){this._visibilityControl=e,this.mangeVisibilityEvent()}mangeVisibilityEvent(){document.addEventListener("visibilitychange",e=>{document.visibilityState===Ee.Hidden?this._visibilityControl.screenInvisible(e):this._visibilityControl.screenVisible(e)})}}var Ls=Object.defineProperty,Ts=Object.getOwnPropertyDescriptor,R=(t,e,s,a)=>{for(var i=a>1?void 0:a?Ts(e,s):e,n=t.length-1,o;n>=0;n--)(o=t[n])&&(i=(a?o(e,s,i):o(i))||i);return a&&i&&Ls(e,s,i),i};r.Amount=class{constructor(){this.value="",this.symbol=""}get tradeValueInNumber(){return Number(this.value)}get truncatedValue(){return this.tradeValueInNumber.toLocaleString("en-US",{maximumFractionDigits:8})}},R([M.JsonProperty("value",String,!0)],r.Amount.prototype,"value",2),R([M.JsonProperty("symbol",String)],r.Amount.prototype,"symbol",2),r.Amount=R([M.JsonObject("Amount")],r.Amount),r.BaseModel=class{getTable(){const e=Object.getPrototypeOf(this)._table;if(!e)throw new Error("No Table found for the model. are you sure decorated the model with @Table() ?");return e}},R([M.JsonProperty("id",Object)],r.BaseModel.prototype,"id",2),r.BaseModel=R([M.JsonObject("BaseModel")],r.BaseModel),r.MinifiedSymbolModel=class extends r.BaseModel{},R([M.JsonProperty("symbol",String)],r.MinifiedSymbolModel.prototype,"symbol",2),R([M.JsonProperty("enName",String)],r.MinifiedSymbolModel.prototype,"enName",2),R([M.JsonProperty("faName",String)],r.MinifiedSymbolModel.prototype,"faName",2),R([M.JsonProperty("image",String)],r.MinifiedSymbolModel.prototype,"image",2),r.MinifiedSymbolModel=R([M.JsonObject("MinifiedSymbolModel")],r.MinifiedSymbolModel);class Os{constructor(e,s){this.requestedDate=e,this.executedDate=s}get requestedDateInJalali(){return C.mapUnixToDate(this.requestedDate,H.SimpleDate)}get requestedTime(){return C.mapUnixToDate(this.requestedDate,H.JustHour)}get executedDateInJalali(){return C.mapUnixToDate(this.executedDate,H.SimpleDate)}get executedDateTime(){return C.mapUnixToDate(this.executedDate,H.JustHour)}}class Es{constructor(e,s){this.requestedAmount=e,this.executedAmount=s}}class ks{constructor(e,s,a,i,n){this.symbolPrice=e,this.USDTPrice=s,this.symobl=a,this.symbolImage=i,this.USDTImage=n}get truncatedSymbolPrice(){return this.symbolPrice.toLocaleString("en-US",{maximumFractionDigits:8})}get truncatedUSDTPrice(){return this.USDTPrice.toLocaleString("en-US",{maximumFractionDigits:8})}}class Ps{constructor(e,s){this.soldSymbol=e,this.buySymbol=s}}r.APIErrorHandlerRegistry=Le,r.AbstractSubject=Ds,r.AccessControl=De,r.AccessLevel=ee,r.Action=rs,r.ApiBuilder=gs,r.ApplicationDrawerStatus=z,r.ApplicationInitializer=ys,r.AuthorizationDirective=Ae,r.AuthorizationService=ve,r.BaseTable=Qe,r.BehaviorSubject=et,r.CellType=fe,r.ClientArraySearch=Cs,r.ClientSearch=ot,r.Column=ss,r.CommonMaskFormats=ae,r.CrudService=Ms,r.DateConverter=F,r.DateDisabledOptions=Bt,r.DateFormat=H,r.DateFormats=Be,r.DateTools=X,r.DebounceService=ds,r.DialogDimensions=O,r.EveryAccess=Ut,r.EveryLevelAuthorizationDirective=jt,r.Feedback=vs,r.FetchListResponse=os,r.FormManager=Kt,r.FormValidationStatus=Q,r.Formatter=C,r.HandleError=fs,r.HandleFeedback=ms,r.HeaderType=de,r.HttpClient=ps,r.InputControl=Gt,r.InputControlBuilder=Wt,r.InputControlData=Ke,r.JsonMapper=Te,r.LoadingStatus=p,r.Params=st,r.Process=bs,r.ProcessManager=As,r.RangeValue=Nt,r.RouteGuard=_s,r.Scheduler=be,r.SelectableTable=es,r.SimpleSort=Re,r.SomeAccess=Yt,r.SomeLevelsAuthorizationDirective=Ht,r.SortDetail=Ce,r.SortOrder=E,r.SortOrderTableHeader=Ge,r.Sorter=Qt,r.StatusCode=We,r.StorageKeys=k,r.StoreNames=me,r.SymbolInTrade=Ps,r.SymbolPriceInTrade=ks,r.Symbols=xe,r.SyncDetail=ls,r.TABLE_ACTION_COLUMN=Xt,r.TABLE_COLUMN_DEFAULT_COLSPAN=Me,r.TABLE_COLUMN_DEFAULT_VALUES=Xe,r.TABLE_COLUMN_DEFAULT_WIDTH=_e,r.Table=as,r.TableConstants=we,r.TableDestroy=is,r.TableHeaderAlign=he,r.TableRowClick=ns,r.ToastLocation=Oe,r.ToastMessage=Ss,r.ToastType=nt,r.TouchSensitiveControl=xt,r.TradeAmount=Es,r.TradeDate=Os,r.Util=V,r.VisibilityManager=Rs,r.VisibilityState=Ee,r.cards=Ve,r.generateHeader=ts,r.ibans=Ne,r.isEmpty=Ze,r.isLastItem=zt,r.isOnlyOneItem=qt,r.setupJalaliDate=Je,r.setupStore=Jt,r.useCrud=hs,r.useData=tt,r.useDialogService=Is,r.useDrawerService=ws,r.useForm=Zt,r.useLoadingStatus=it,r.useParams=rt,r.useRepository=cs,r.useStaticTableService=us,Object.defineProperty(r,Symbol.toStringTag,{value:"Module"})});
|
package/dist/src/BaseModel.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sarafapp/iron_core",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.35",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist"
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
"scripts": {
|
|
12
12
|
"dev": "vite",
|
|
13
13
|
"build": "vite build",
|
|
14
|
-
"preview": "vite preview"
|
|
14
|
+
"preview": "vite preview",
|
|
15
|
+
"publish": "npm run build -- --mode=prodcuction; npm publish --access=public"
|
|
15
16
|
},
|
|
16
17
|
"dependencies": {
|
|
17
18
|
"axios": "^1.6.3",
|