@sarafapp/iron_core 1.0.43 → 1.0.45
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 +1059 -1611
- package/dist/IronCore.umd.cjs +2 -17
- package/package.json +1 -1
package/dist/IronCore.umd.cjs
CHANGED
|
@@ -1,17 +1,2 @@
|
|
|
1
|
-
(function(o,_){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"],_):(o=typeof globalThis<"u"?globalThis:o||self,_(o.IronCore={},o.dayjs,o.Vue,o.json2typescript,o.pinia))})(this,function(o,_,g,C,Ke){"use strict";var oe=(t=>(t.BankCard="####-####-####-####",t.Iban="##-####-####-####-####-####-##",t))(oe||{}),J=(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))(J||{});const Ze=[{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"}}],Xe=[{"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 Qe=(t=>(t.Normal="YYYY-MM-DD",t.ContainsHour="YYYY-MM-DD HH:mm",t.OnlyHour="HH:mm",t))(Qe||{});function le(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ue={exports:{}},Ct=ue.exports,et;function Mt(){return et||(et=1,function(t,e){(function(r,s){t.exports=s()})(Ct,function(){return function(r,s){s.prototype.weekday=function(n){var i=this.$locale().weekStart||0,a=this.$W,u=(a<i?a+7:a)-i;return this.$utils().u(n)?u:this.subtract(u,"day").add(n,"day")}}})}(ue)),ue.exports}var Tt=Mt();const Et=le(Tt);var ce={exports:{}},Lt=ce.exports,tt;function Ot(){return tt||(tt=1,function(t,e){(function(r,s){t.exports=s()})(Lt,function(){var r="week",s="year";return function(n,i,a){var u=i.prototype;u.week=function(l){if(l===void 0&&(l=null),l!==null)return this.add(7*(l-this.week()),"day");var c=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var v=a(this).startOf(s).add(1,s).date(c),f=a(this).endOf(r);if(v.isBefore(f))return 1}var p=a(this).startOf(s).date(c).startOf(r).subtract(1,"millisecond"),S=this.diff(p,r,!0);return S<0?a(this).startOf("week").week():Math.ceil(S)},u.weeks=function(l){return l===void 0&&(l=null),this.week(l)}}})}(ce)),ce.exports}var Pt=Ot();const kt=le(Pt);var he={exports:{}},Vt=he.exports,rt;function $t(){return rt||(rt=1,function(t,e){(function(r,s){t.exports=s()})(Vt,function(){return function(r,s){s.prototype.weekYear=function(){var n=this.month(),i=this.week(),a=this.year();return i===1&&n===11?a+1:n===0&&i>=52?a-1:a}}})}(he)),he.exports}var Ft=$t();const Nt=le(Ft);var de={exports:{}},Bt=de.exports,st;function jt(){return st||(st=1,function(t,e){(function(r,s){t.exports=s(_)})(Bt,function(r){function s(a){return a&&typeof a=="object"&&"default"in a?a:{default:a}}var n=s(r),i={name:"fa",weekdays:"یکشنبه_دوشنبه_سهشنبه_چهارشنبه_پنجشنبه_جمعه_شنبه".split("_"),weekdaysShort:"یکشنبه_دوشنبه_سهشنبه_چهارشنبه_پنجشنبه_جمعه_شنبه".split("_"),weekdaysMin:"ی_د_س_چ_پ_ج_ش".split("_"),weekStart:6,months:"ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر".split("_"),monthsShort:"ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر".split("_"),ordinal:function(a){return a},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 n.default.locale(i,null,!0),i})}(de)),de.exports}var Ut=jt();const Yt=le(Ut);function fe(t,e){return Ht(t)||qt(t,e)||zt()}function Ht(t){if(Array.isArray(t))return t}function qt(t,e){var r=[],s=!0,n=!1,i=void 0;try{for(var a=t[Symbol.iterator](),u;!(s=(u=a.next()).done)&&(r.push(u.value),!(e&&r.length===e));s=!0);}catch(l){n=!0,i=l}finally{try{!s&&a.return!=null&&a.return()}finally{if(n)throw i}}return r}function zt(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function nt(t,e,r){e<=2&&(t-=1,e+=12);var s=Math.floor(t/100),n=2-s+Math.floor(s/4),i=Math.floor(365.25*(t+4716))+Math.floor(30.6001*(e+1))+r+n-1524.5;return i}function Jt(t){t=t+.5;var e=Math.floor(t),r=t-e,s=e;if(e>=2299161){var n=Math.floor((e-186721625e-2)/36524.25);s=e+1+n-Math.floor(n/4)}var i=s+1524,a=Math.floor((i-122.1)/365.25),u=Math.floor(365.25*a),l=Math.floor((i-u)/30.6001),c=i-u-Math.floor(30.6001*l)+r,v=l<14?l-1:l-13,f=v>2?a-4716:a-4715;return Wt(f,v,c)}function Gt(t){t=t+.5;var e=Math.floor(t),r=t-e,s=e;if(e>=2299161){var n=Math.floor((e-186721625e-2)/36524.25);s=e+1+n-Math.floor(n/4)}var i=s+1524,a=Math.floor((i-122.1)/365.25),u=Math.floor(365.25*a),l=Math.floor((i-u)/30.6001),c=i-u-Math.floor(30.6001*l)+r,v=l<14?l-1:l-13,f=v>2?a-4716:a-4715;return[Math.floor(f),Math.floor(v),Math.floor(c)]}function xt(t,e,r){var s=[31,28,31,30,31,30,31,31,30,31,30,31],n=[31,31,31,31,31,31,30,30,30,30,30,29];function i(S,A){return Math.floor(S/A)}t-=979;for(var a=365*t+i(t,33)*8+i(t%33+3,4),u=0;u<e-1;++u)a+=n[u];a+=r-1;var l=a+79,c=1600+400*i(l,146097);l=l%146097;var v=!0;for(l>=36525&&(l--,c+=100*i(l,36524),l=l%36524,l>=365?l++:v=!1),c+=4*i(l,1461),l%=1461,l>=366&&(v=!1,l--,c+=i(l,365),l=l%365),u=0;l>=s[u]+(u==1&&v);u++)l-=s[u]+(u==1&&v);var f=u+1,p=l+1;return nt(c,f,p)}function Wt(t,e,r){var s=[31,28,31,30,31,30,31,31,30,31,30,31],n=[31,31,31,31,31,31,30,30,30,30,30,29];function i(Q,ee){return Math.floor(Q/ee)}for(var a=t-1600,u=e-1,l=r-1,c=365*a+i(a+3,4)-i(a+99,100)+i(a+399,400),v=0;v<u;++v)c+=s[v];u>1&&(t%4==0&&t%100!=0||t%400==0)&&c++,c+=l;var f=c-79,p=i(f,12053);f%=12053;var S=979+33*p+4*i(f,1461);f%=1461,f>=366&&(S+=i(f-1,365),f=(f-1)%365);for(var A=0;A<11&&f>=n[A];++A)f-=n[A];var Z=A+1,X=f+1;return[S,Z,X]}var ve={J:function(e,r,s){return Jt(nt(e,r,s))},G:function(e,r,s){return Gt(xt(e,r,s))}},Kt=/^(\d{4})[-/]?(\d{1,2})[-/]?(\d{0,2})(.*)?$/,Zt=/\[.*?\]|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,Ee="date",G="day",$="month",F="year",it="week",Xt="YYYY-MM-DDTHH:mm:ssZ",Qt={jmonths:"فروردین_اردیبهشت_خرداد_تیر_مرداد_شهریور_مهر_آبان_آذر_دی_بهمن_اسفند".split("_")},er=function(t,e,r){var s=e.prototype,n=s.$utils(),i=function(d){return d.$C==="jalali"},a=n.prettyUnit||n.p,u=n.isUndefined||n.u,l=n.padStart||n.s,c=n.monthDiff||n.m,v=n.absFloor||n.a,f=function(d){return function(){var m=d.bind(this).apply(void 0,arguments);return m.$C=this.$C,m.isJalali()&&m.InitJalali(),m}};s.startOf=f(s.startOf),s.endOf=f(s.endOf),s.add=f(s.add),s.subtract=f(s.subtract),s.set=f(s.set);var p=s.parse,S=s.init,A=s.startOf,Z=s.$set,X=s.add,Q=s.format,ee=s.diff,Ge=s.year,xe=s.month,_e=s.date,We=s.daysInMonth,ie=s.toArray;r.$C="gregory",r.$fdow=6,r.calendar=function(h){return r.$C=h,r},s.calendar=function(h){var d=this.clone();return d.$C=h,d.isJalali()&&d.InitJalali(),d},s.isJalali=function(){return i(this)},r.en.jmonths="Farvardin_Ordibehesht_Khordaad_Tir_Mordaad_Shahrivar_Mehr_Aabaan_Aazar_Dey_Bahman_Esfand".split("_"),r.locale("fa",Object.assign({},Yt,{},Qt),!0);var te=function(d,m){return r(d,{locale:m.$L,utc:m.$u,calendar:m.$C})};s.init=function(){var h=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};S.bind(this)(h),this.isJalali()&&this.InitJalali()},s.parse=function(h){var d;if(this.$C=h.calendar||this.$C||r.$C,h.jalali&&typeof h.date=="string"&&/.*[^Z]$/i.test(h.date)&&(d=h.date.match(Kt))){var m=ve.G(parseInt(d[1],10),parseInt(d[2],10),parseInt(d[3]||1,10)),I=fe(m,3),b=I[0],w=I[1],R=I[2];h.date="".concat(b,"-").concat(w,"-").concat(R).concat(d[4]||"")}return p.bind(this)(h)},s.InitJalali=function(){var h=ve.J(this.$y,this.$M+1,this.$D),d=fe(h,3),m=d[0],I=d[1],b=d[2];this.$jy=m,this.$jM=I-1,this.$jD=b},s.startOf=function(h,d){var m=this;if(!i(this))return A.bind(this)(h,d);var I=u(d)?!0:d,b=a(h),w=function(re,q){var P=arguments.length>2&&arguments[2]!==void 0?arguments[2]:m.$jy,Me=ve.G(P,q+1,re),z=fe(Me,3),ae=z[0],Te=z[1],Ds=z[2],_t=te(new Date(ae,Te-1,Ds),m);return(I?_t:_t.endOf(G)).$set("hour",1)},R=(this.$W+(7-r.$fdow))%7;switch(b){case F:return I?w(1,0):w(0,0,this.$jy+1);case $:return I?w(1,this.$jM):w(0,(this.$jM+1)%12,this.$jy+parseInt((this.$jM+1)/12,10));case it:return I?w(this.$jD-R,this.$jM):w(this.$jD+(6-R),this.$jM);default:return A.bind(this)(h,d)}},s.$set=function(h,d){var m=this;if(!i(this))return Z.bind(this)(h,d);var I=a(h),b=function(R,Ce){var re=arguments.length>2&&arguments[2]!==void 0?arguments[2]:m.$jy,q=ve.G(re,Ce+1,R),P=fe(q,3),Me=P[0],z=P[1],ae=P[2];return m.$d.setFullYear(Me),m.$d.setMonth(z-1),m.$d.setDate(ae),m};switch(I){case Ee:case G:b(d,this.$jM);break;case $:b(this.$jD,d);break;case F:b(this.$jD,this.$jM,d);break;default:return Z.bind(this)(h,d)}return this.init(),this},s.add=function(h,d){var m=this;if(!i(this))return X.bind(this)(h,d);h=Number(h);var I=d&&(d.length===1||d==="ms")?d:a(d),b=function(z,ae){var Te=m.set(Ee,1).set(z,ae+h);return Te.set(Ee,Math.min(m.$jD,Te.daysInMonth()))};if(["M",$].indexOf(I)>-1){var w=this.$jM+h,R=w<0?-Math.ceil(-w/12):Math.floor(w/12),Ce=this.$jD,re=this.set(G,1).add(R,F).set($,w-R*12);return re.set(G,Math.min(re.daysInMonth(),Ce))}if(["y",F].indexOf(I)>-1)return b(F,this.$jy);if(["d",G].indexOf(I)>-1){var q=new Date(this.$d);return q.setDate(q.getDate()+h),te(q,this)}if(["w",it].indexOf(I)>-1){var P=new Date(this.$d);return P.setDate(P.getDate()+h*7),te(P,this)}return X.bind(this)(h,d)},s.format=function(h,d){var m=this;if(!i(this))return Q.bind(this)(h,d);var I=h||Xt,b=d||this.$locale(),w=b.jmonths;return I.replace(Zt,function(R){if(R.indexOf("[")>-1)return R.replace(/\[|\]/g,"");switch(R){case"YY":return String(m.$jy).slice(-2);case"YYYY":return String(m.$jy);case"M":return String(m.$jM+1);case"MM":return l(m.$jM+1,2,"0");case"MMM":return w[m.$jM].slice(0,3);case"MMMM":return w[m.$jM];case"D":return String(m.$jD);case"DD":return l(m.$jD,2,"0");default:return Q.bind(m)(R,d)}})},s.diff=function(h,d,m){if(!i(this))return ee.bind(this)(h,d,m);var I=a(d),b=r(h),w=c(this,b);switch(I){case F:w/=12;break;case $:break;default:return ee.bind(this)(h,d,m)}return m?w:v(w)},s.$g=function(h,d,m){return u(h)?this[d]:this.set(m,h)},s.year=function(h){return i(this)?this.$g(h,"$jy",F):Ge.bind(this)(h)},s.month=function(h){return i(this)?this.$g(h,"$jM",$):xe.bind(this)(h)},s.date=function(h){return i(this)?this.$g(h,"$jD",G):_e.bind(this)(h)},s.daysInMonth=function(){return i(this)?this.endOf($).$jD:We.bind(this)()},ie&&(s.toArray=function(){return i(this)?[this.$jy,this.$jM,this.$jD,this.$H,this.$m,this.$s,this.$ms]:ie.bind(this)()}),s.clone=function(){return te(this.toDate(),this)}};const tr={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 at(){_.extend(er),_.calendar("jalali"),_.extend(Et),_.extend(kt),_.extend(Nt),_.locale(tr,{},!0)}class rr{constructor(e,r){this.start=e,this.end=r}}class sr{constructor(e,r,s){this.maxDate=e,this.minDate=r,this.disabledDates=s}}class N{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 se{static isDateDisabled(e,r){for(const s of e.disabledDates)if(se.areUnixesInSameDate(s,r.unix()))return!0;return!!(e.maxDate&&se.isDateGraterOrSame(e.maxDate,r.unix())||e.minDate&&se.isDateLowerOrSame(e.minDate,r.unix()))}static areUnixesInSameDate(e,r){return N.getUnixEndOfDayInUnix(e)===N.getUnixEndOfDayInUnix(r)}static isDateGraterOrSame(e,r){return N.getUnixEndOfDayInUnix(r)>=N.getUnixEndOfDayInUnix(e)}static isDateLowerOrSame(e,r){return N.getUnixEndOfDayInUnix(r)<=N.getUnixEndOfDayInUnix(e)}}at();class M{static toCurrency(e,r){return e.toLocaleString("en-US",r)}static toCurrencyWithDotSeparator(e){return M.toCurrency(e).replaceAll(",",".")}static applyMask(e,r){let s="",n=0,i=0;for(;n<e.length;){if(e[n]==="#"){if(i>=r.length)throw new Error("Value length does not match the format.");s+=r[i],i++}else s+=e[n];n++}if(i!==r.length)throw new Error("Value length does not match the format.");return s}static applyBankCardMask(e){return M.applyMask(oe.BankCard,String(e))}static applyIbanMask(e){return M.applyMask(oe.Iban,String(e))}static toEnglishDigits(e){const r=["۱","۲","۳","۴","۵","۶","۷","۸","۹","۰"],s=["١","٢","٣","٤","٥","٦","٧","٨","٩","٠"],n=["1","2","3","4","5","6","7","8","9","0"];return e.split("").map(i=>n[r.indexOf(i)]||n[s.indexOf(i)]||i).join("")}static mapUnixToDate(e,r){return _(new Date(e)).subtract(1,"day").format(r)}}var y=(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))(y||{}),k=(t=>(t.Width="width",t.Height="height",t[t.DefaultWidth=500]="DefaultWidth",t[t.DefaultHeight=350]="DefaultHeight",t[t.MinimalAvailableSize=0]="MinimalAvailableSize",t))(k||{}),O=(t=>(t.ASC="ASC",t.DESC="DESC",t))(O||{}),ot=(t=>(t.ASC="ascend",t.DESC="descend",t))(ot||{}),me=(t=>(t.Left="left",t.Right="right",t.Center="center",t))(me||{}),pe=(t=>(t.Text="text",t))(pe||{}),ge=(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))(ge||{}),Le=(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))(Le||{});o.ApplicationTheme=(t=>(t.FontFamily="IRANSansX",t))(o.ApplicationTheme||{});var x=(t=>(t.Open="open",t.Close="close",t))(x||{}),lt=(t=>(t[t.NotFound=404]="NotFound",t[t.Unauthorized=401]="Unauthorized",t[t.ServerError=500]="ServerError",t))(lt||{}),ne=(t=>(t[t.Invalid=0]="Invalid",t[t.Valid=1]="Valid",t))(ne||{}),V=(t=>(t.Theme="theme",t.AccessList="accessList",t.Token="token",t.SSO_ACCESS_LIST="ssoAccessList",t))(V||{});o.ApplicationTheme=(t=>(t.Light="light",t.Dark="dark",t))(o.ApplicationTheme||{});var ye=(t=>(t.Dialog="dialog",t.Drawer="drawer",t.Module="module",t.Toast="toast",t))(ye||{}),ut=(t=>(t.USDT="USDT",t))(ut||{});class B{static getBankImageBaseOnCardInfo(e,r){return e===void 0?"/img/banks/shetab.png":r==="IBAN"?(e=M.toEnglishDigits(e.replace(/IR/g,"").split(" ").join("")),`/img/banks/${B.iban(e).english}.png`):(e=M.toEnglishDigits(e.replace(/ /g,"")),`/img/banks/${B.card(e).english}.png`)}static card(e){const r={persian:"نامشخص",english:"shetab"};if(e==null)return r;e=e.substring(0,6);try{const s=Ze.find(n=>Object.keys(n)[0]===e);return s===void 0?r:Object.values(s)[0]}catch{return r}}static iban(e){const r={persian:"نامشخص",english:"shetab"};if(e==null)return r;e=e.substring(2,5);try{const s=Xe.find(n=>Object.keys(n)[0]===e);return s===void 0?r:Object.values(s)[0]}catch{return r}}static async copyValueToClipboard(e){await navigator.clipboard.writeText(String(e))}static downloadBlob(e,r=B.extractFileNameFromHeader(e)){const s=document.createElement("a");s.href=URL.createObjectURL(e.data),s.download=r,s.dispatchEvent(new MouseEvent("click",{bubbles:!0,cancelable:!0,composed:!0})),s.remove()}static extractFileNameFromHeader(e){var s,n,i,a;return((a=(s=e.headers["content-disposition"])==null?void 0:s.split("filename=")[1])==null?void 0:a.slice(1,((i=(n=e.headers["content-disposition"])==null?void 0:n.split("filename="))==null?void 0:i[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,r=n=>n,s=O.ASC){return e.every((n,i)=>e.length-1===i?!0:s===O.ASC?r(n)<=r(e[i+1]):r(n)>=r(e[i+1]))}}const U=class U{constructor(){this.availableAccesses=new Set}setAvailableAccesses(e){this.setAccessListToStorage(e);for(const r of e)this.availableAccesses.add(r)}setAccessListToStorage(e){localStorage.setItem(V.AccessList,JSON.stringify(e))}everyAccess(e){return e.every(r=>this.availableAccesses.has(r))}someAccess(e){return e.some(r=>this.availableAccesses.has(r))}clearAvailableAccesses(){this.availableAccesses.clear(),localStorage.removeItem(V.AccessList)}initialize(){const e=localStorage.getItem(V.AccessList);e!==null&&this.setAvailableAccesses(JSON.parse(e))}static GetInstance(){return U.Instance||(U.Instance=new U),U.Instance}};U.Instance=null;let W=U;class Oe{constructor(){this.mounted=(e,r)=>{this.checkAccess(e,r.value)},this.updated=(e,r)=>{this.checkAccess(e,r.value)},this.checkAccess=(e,r)=>{this.hasAccess(r)||e.remove()},this.accessService=W.GetInstance()}}class nr extends Oe{hasAccess(e){return this.accessService.everyAccess(e)}}class ir extends Oe{hasAccess(e){return this.accessService.someAccess(e)}}const Y=class Y{constructor(){this._accessLevels=new Map}initialize(){this.setAccessLevelFromStorage()}setAccessLevels(e){for(const r in e)this._accessLevels.set(r,new Set(e[r]));this.setAccessLevelsToStorage(e)}setAccessLevelsToStorage(e){localStorage.setItem(V.SSO_ACCESS_LIST,JSON.stringify(e))}getAccessLevelsFromStorage(){let e=localStorage.getItem(V.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,r){const s=this.getAccessLevelsOfScope(e);return s?r.every(n=>s.has(n)):!1}someAccess(e,r){const s=this.getAccessLevelsOfScope(e);return s?r.some(n=>s.has(n)):!1}hasScope(e){return this._accessLevels.has(e)}clear(){localStorage.removeItem(V.SSO_ACCESS_LIST),this._accessLevels=new Map}static GetInstance(){return Y._instance||(Y._instance=new Y),Y._instance}};Y._instance=null;let Se=Y;class Pe{constructor(){this._authorizationService=Se.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,r,s){this.manageElement(e,r.arg,r.modifiers)}updated(e,r,s){this.manageElement(e,r.arg,r.modifiers)}manageElement(e,r,s){if(!this._authorizationService.hasScope(r)){e.remove();return}const n=this.getAccessLevels(r,s);this.hasAccess(r,n)||e.remove()}getAccessLevels(e,r){var n;let s=Object.keys(r);return s.length||(s=Array.from(((n=this._authorizationService.getAccessLevelsOfScope(e))==null?void 0:n.values())??[])),s}}class ar extends Pe{hasAccess(e,r){return this._authorizationService.everyAccess(e,r)}}class or extends Pe{hasAccess(e,r){return this._authorizationService.someAccess(e,r)}}class ct{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 lr(t){return t===1}function ur(t,e){return t-1===e}function ht(t){return String(t).length===0||t===null||t===void 0}function cr(t){t()}class hr{constructor(e,r){this.initialData=null,this.data=new ct,this._validators=[],this._id=Math.random(),this.data.value=r,this.data.name=e,this.shouldRunValidation()&&this.runValidation(!0)}shouldRunValidation(){return this.data.hasCustomValidationCheck?!1:this.data.isRequired?!0:!ht(this.data.value)}async runValidation(e=!1){for(const r of this._validators){const s=await r.validate(this.data.value);if(s){this.setFormToInvalidState(e,s);return}}this.setFormToValidState()}setFormToInvalidState(e,r){this.data.isValid=!1,(this.data.isChangeSensitive||e)&&this.setNotValidMessage(r)}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 dr{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 fr{constructor(){this.mounted=(e,r)=>{r.value&&r.value.getIsBlurSensitive()&&(e.addEventListener("click",this.handleFocus.bind(this,r.value)),e.addEventListener("blur",this.handleBlur.bind(this,r.value),!0))},this.beforeUnMount=(e,r)=>{e.removeEventListener("blur",this.handleBlur.bind(this,r.value)),e.removeEventListener("click",this.handleFocus.bind(this,r.value))}}handleBlur(e){e.runValidation(!0)}handleFocus(e){e.value||e.getIsEmptySensitive()||e.setNotValidMessage("")}}class vr{constructor(){this._inputControls=new Map,this._isValid=!1,this._id=Math.random()}getInputControlsAsArray(){return Array.from(this._inputControls.values())}async runValidation(e){let r=!0;for(const s of this.getInputControlsAsArray())if(e&&await s.runValidation(!0),!s.getIsValid()&&(r=!1,!e)){this._isValid=!1;return}this._isValid=r}addInputControls(e){for(const r of e)this._inputControls.set(r.getName(),r)}getInputControl(e){const r=this._inputControls.get(e);if(!r)throw new Error(`The provided input name (${e}}) has no controls.`);return r}resetControls(e){for(const r of e){const s=this._inputControls.get(r);s?s.reset():console.warn(`Provided input name ${r} has no controllers in this form`)}}resetAll(){for(const e of this.getInputControlsAsArray())e.reset()}createRequestBody(){const e={};for(const r of this.getInputControlsAsArray())r.getIsIncludeInRequestBody()&&(e[r.getName()]=r.value);return e}setIsValid(e){this._isValid=e}getIsValid(){return this._isValid}setId(e){this._id=e}getId(){return this._id}}function mr(t,e=!1){const r=g.reactive(t),s=g.ref(ne.Invalid);return g.watch(()=>r.getInputControlsAsArray(),()=>{e||(r.runValidation(),r.getIsValid()?s.value=ne.Valid:s.value=ne.Invalid)},{immediate:!0,deep:!0}),{reactiveForm:r,validationStatus:s}}class ke{constructor(e){this.timerId=null,this.setupInterval=this.setupInterval.bind(this),this.schedule=e}setupInterval(e){const r=this;this.timerId=setTimeout(async function s(){await r.schedule.runAction(),r.timerId=setTimeout(()=>{s()},e)},e)}clearInterval(){this.timerId&&clearInterval(this.timerId)}}const Ve="150px",$e=2,pr={path:"id",key:"id",title:"عملیات",colspan:$e,width:Ve,cellType:ge.ACTION,align:me.Center,headerType:pe.Text,accessLevel:null},dt={width:Ve,align:me.Center,headerType:pe.Text,cellType:ge.Text,colspan:$e};class we{constructor(e,r){this.key=e,this.order=r}}class Fe{aSort(e,r){return e.sort((s,n)=>{const i=s[r]??s,a=n[r]??n;if(typeof i=="string"&&typeof a=="string")return i.localeCompare(a);if(typeof i=="number"&&typeof a=="number")return i-a;throw new Error("Not supported data type")})}bSort(e,r){return e.sort((s,n)=>{const i=s[r]??s,a=n[r]??n;if(typeof i=="string"&&typeof a=="string")return a.localeCompare(i);if(typeof i=="number"&&typeof a=="number")return a-i;throw new Error("Not supported data type")})}}class gr{arrayOfObjectSort(e,r,s,n=new Fe){return s===O.ASC?n.aSort(e,r):n.bSort(e,r)}arraySort(e,r,s=new Fe){return r===O.ASC?s.aSort(e):s.bSort(e)}}class ft{constructor(e){this.currentPage=1,this.currentPageSize=20,this.currentSortDetail=new we("id",O.DESC),this.loadedRows=[],this.headerSchema=[],this.service=e,this.accessService=W.GetInstance()}addHeader(e){this.headerSchema.push(e)}async load(){this.headerSchema=this.filterItemsBaseOnAccessLevel(await this.loadHeader()),await this.loadRows()}filterItemsBaseOnAccessLevel(e){return e.filter(r=>r.hasAccess?r.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,r){this.shouldSendPaginationRequest(e,r)&&(this.currentPage=e,this.currentPageSize=r,this.loadedRows=(await this.handlePagination(this.currentPage,this.currentPageSize)).items)}shouldSendPaginationRequest(e,r){return this.currentPage!==e||this.currentPageSize!==r}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,r){return await this.service.paginate(e,r)}getItemCountPerPage(){return Le.DEFAULT_ITEM_COUNT_PER_PAGE}isLoading(){const e=this.getLoadingStatuses();return e.has(y.Search)||e.has(y.FetchList)||e.has(y.Sort)||e.has(y.FetchLastItems)||e.has(y.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 T{constructor(e){this.observers=[],this.next(e)}attach(e){this.observers.push(e),this.notifyObject(e)}detach(e){this.observers=this.observers.filter(r=>r!==e)}notify(){for(const e of this.observers)this.notifyObject(e)}notifyObject(e){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 yr extends ft{constructor(e){super(e),this.selectedRows=new T(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,r){return this.clearAllSelectedItems(),await super.handlePagination(e,r)}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 Sr(t){return{...dt,...t}}function wr(t){return function(r,s){r.constructor.prototype.headers||(r.constructor.prototype.headers=[]),r.constructor.prototype.headers.push({path:s,...t})}}function Ir(t){return function(r){async function s(){return r.prototype._table=this,r.prototype.headers}function n(u){const l=[],c=r.prototype.actions||[];for(const v of c){if(!v.isAvailable(u))continue;const f={handler:v.handler.bind(u),accessLevel:v.accessLevel,actionName:v.actionName};l.push(f)}return l}async function i(u){r.prototype.rowClick&&await r.prototype.rowClick.call(u)}async function a(){r.prototype.tableDestroy&&await r.prototype.tableDestroy()}t.prototype.loadHeader=s,t.prototype.getActions=n,t.prototype.handleClick=i,t.prototype.onDestroy=a}}function br(t){return function(r,s,n){r.constructor.prototype.actions||(r.constructor.prototype.actions=[]),t.handler=n.value,r.constructor.prototype.actions.push(t)}}function Ar(){return function(e,r,s){e.constructor.prototype.tableDestroy=s.value}}function Dr(){return function(e,r,s){e.constructor.prototype.rowClick=s.value}}class Rr{constructor(){this.observers=[]}attach(e){this.observers.push(e)}detach(e){this.observers=this.observers.filter(r=>r!==e)}notify(){for(const e of this.observers)e.update(this)}}class vt{constructor(e){this.rows=new T([]),this.headerSchema=new T([]),this.currentPage=new T(1),this.currentPageSize=new T(20),this.totalItems=new T(0),this.currentSortDetail=new T(new we("id",O.DESC)),this.scrollDetail=new T(null),this.isExpandable=new T(!1),this.tableSource=e,this.accessService=W.GetInstance()}async load(){this.rows.next(await this.tableSource.loadRows()),this.headerSchema.next(this.filterItemsBaseOnAccessLevel(await this.tableSource.loadHeaderSchema()))}async paginate(e,r){this.shouldSendPaginationRequest(e,r)&&(this.currentPage.next(e),this.currentPageSize.next(r),this.rows.next(await this.tableSource.paginate(e,r)))}shouldSendPaginationRequest(e,r){return this.currentPage.getValue()!==e||this.currentPageSize.getValue()!==r}async sort(e){this.shouldSendSortRequest(e)&&(this.currentSortDetail.next(e),this.rows.next(await this.tableSource.sort(e)))}shouldSendSortRequest(e){return e.key!==this.currentSortDetail.getValue().key||e.order!==this.currentSortDetail.getValue().order}async handleClick(e){this.tableSource.onRowClick&&await this.tableSource.onRowClick()}async handleMetaClick(e){this.tableSource.onRowMetaClick&&await this.tableSource.onRowMetaClick}async handleDoubleClick(e){this.tableSource.onRowDoubleClick&&await this.tableSource.onRowDoubleClick()}hasAnyAction(){for(const e of this.rows.getValue())if(this.getRowActions(e).length)return!0;return!1}getRowActions(e){return this.filterItemsBaseOnAccessLevel(this.tableSource.loadRowActions(e))}loadSummarySchema(){return this.tableSource.loadSummarySchema?this.tableSource.loadSummarySchema():{summaryTitle:"",summaryItems:[]}}filterItemsBaseOnAccessLevel(e){return e.filter(r=>r.hasAccess?r.hasAccess():!0)}async onDestroy(){this.tableSource.onTableDestroy()}}class _r extends vt{constructor(e){super(e),this.selectedRows=new T(new Map),this.selectRow=this.selectRow.bind(this),this.selectAll=this.selectAll.bind(this),this.isEveryRowSelected=this.isEveryRowSelected.bind(this),this.clearAllSelectedItems=this.clearAllSelectedItems.bind(this),this.getSelectedRowsAsArray=this.getSelectedRowsAsArray.bind(this),this.getSelectedRowIds=this.getSelectedRowIds.bind(this)}selectRow(e){const r=this.getSelectedRows();r.has(e.id)?(r.delete(e.id),this.selectedRows.next(this.selectedRows.getValue())):(r.set(e.id,e),this.selectedRows.next(this.selectedRows.getValue()))}selectAll(){if(this.isEveryRowSelected())this.clearAllSelectedItems();else for(const e of this.rows.getValue())this.selectedRows.getValue().set(e.id,e),this.selectedRows.next(this.selectedRows.getValue())}isEveryRowSelected(){return this.getSelectedRows().size===this.currentPageSize.getValue()||this.rows.getValue().length===this.getSelectedRows().size}clearAllSelectedItems(){this.getSelectedRows().clear(),this.selectedRows.next(this.selectedRows.getValue)}getSelectedRows(){return this.selectedRows.getValue()}getSelectedRowsAsArray(){return Array.from(this.selectedRows.getValue().values())}getSelectedRowIds(){return Array.from(this.selectedRows.getValue().keys())}}var Ne;(function(t){t[t.Transient=0]="Transient",t[t.Singleton=1]="Singleton",t[t.ResolutionScoped=2]="ResolutionScoped",t[t.ContainerScoped=3]="ContainerScoped"})(Ne||(Ne={}));const D=Ne;/*! *****************************************************************************
|
|
3
|
-
Copyright (c) Microsoft Corporation.
|
|
4
|
-
|
|
5
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
6
|
-
purpose with or without fee is hereby granted.
|
|
7
|
-
|
|
8
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
9
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
10
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
11
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
12
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
13
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
14
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
15
|
-
***************************************************************************** */var Be=function(t,e){return Be=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,s){r.__proto__=s}||function(r,s){for(var n in s)s.hasOwnProperty(n)&&(r[n]=s[n])},Be(t,e)};function je(t,e){Be(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}function Cr(t,e,r,s){function n(i){return i instanceof r?i:new r(function(a){a(i)})}return new(r||(r=Promise))(function(i,a){function u(v){try{c(s.next(v))}catch(f){a(f)}}function l(v){try{c(s.throw(v))}catch(f){a(f)}}function c(v){v.done?i(v.value):n(v.value).then(u,l)}c((s=s.apply(t,[])).next())})}function Mr(t,e){var r={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},s,n,i,a;return a={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(a[Symbol.iterator]=function(){return this}),a;function u(c){return function(v){return l([c,v])}}function l(c){if(s)throw new TypeError("Generator is already executing.");for(;r;)try{if(s=1,n&&(i=c[0]&2?n.return:c[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,c[1])).done)return i;switch(n=0,i&&(c=[c[0]&2,i.value]),c[0]){case 0:case 1:i=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,n=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(i=r.trys,!(i=i.length>0&&i[i.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]<i[3])){r.label=c[1];break}if(c[0]===6&&r.label<i[1]){r.label=i[1],i=c;break}if(i&&r.label<i[2]){r.label=i[2],r.ops.push(c);break}i[2]&&r.ops.pop(),r.trys.pop();continue}c=e.call(t,r)}catch(v){c=[6,v],n=0}finally{s=i=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function Ie(t){var e=typeof Symbol=="function"&&Symbol.iterator,r=e&&t[e],s=0;if(r)return r.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&s>=t.length&&(t=void 0),{value:t&&t[s++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function be(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var s=r.call(t),n,i=[],a;try{for(;(e===void 0||e-- >0)&&!(n=s.next()).done;)i.push(n.value)}catch(u){a={error:u}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(a)throw a.error}}return i}function j(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(be(arguments[e]));return t}var Tr="injectionTokens";function Er(t){var e=Reflect.getMetadata("design:paramtypes",t)||[],r=Reflect.getOwnMetadata(Tr,t)||{};return Object.keys(r).forEach(function(s){e[+s]=r[s]}),e}function mt(t){return!!t.useClass}function Ue(t){return!!t.useFactory}var pt=function(){function t(e){this.wrap=e,this.reflectMethods=["get","getPrototypeOf","setPrototypeOf","getOwnPropertyDescriptor","defineProperty","has","set","deleteProperty","apply","construct","ownKeys"]}return t.prototype.createProxy=function(e){var r=this,s={},n=!1,i,a=function(){return n||(i=e(r.wrap()),n=!0),i};return new Proxy(s,this.createHandler(a))},t.prototype.createHandler=function(e){var r={},s=function(n){r[n]=function(){for(var i=[],a=0;a<arguments.length;a++)i[a]=arguments[a];i[0]=e();var u=Reflect[n];return u.apply(void 0,j(i))}};return this.reflectMethods.forEach(s),r},t}();function K(t){return typeof t=="string"||typeof t=="symbol"}function Lr(t){return typeof t=="object"&&"token"in t&&"multiple"in t}function gt(t){return typeof t=="object"&&"token"in t&&"transform"in t}function Or(t){return typeof t=="function"||t instanceof pt}function Ae(t){return!!t.useToken}function De(t){return t.useValue!=null}function Pr(t){return mt(t)||De(t)||Ae(t)||Ue(t)}var Ye=function(){function t(){this._registryMap=new Map}return t.prototype.entries=function(){return this._registryMap.entries()},t.prototype.getAll=function(e){return this.ensure(e),this._registryMap.get(e)},t.prototype.get=function(e){this.ensure(e);var r=this._registryMap.get(e);return r[r.length-1]||null},t.prototype.set=function(e,r){this.ensure(e),this._registryMap.get(e).push(r)},t.prototype.setAll=function(e,r){this._registryMap.set(e,r)},t.prototype.has=function(e){return this.ensure(e),this._registryMap.get(e).length>0},t.prototype.clear=function(){this._registryMap.clear()},t.prototype.ensure=function(e){this._registryMap.has(e)||this._registryMap.set(e,[])},t}(),kr=function(t){je(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(Ye),Re=function(){function t(){this.scopedResolutions=new Map}return t}();function Vr(t,e){if(t===null)return"at position #"+e;var r=t.split(",")[e].trim();return'"'+r+'" at position #'+e}function $r(t,e,r){return r===void 0&&(r=" "),j([t],e.message.split(`
|
|
16
|
-
`).map(function(s){return r+s})).join(`
|
|
17
|
-
`)}function Fr(t,e,r){var s=be(t.toString().match(/constructor\(([\w, ]+)\)/)||[],2),n=s[1],i=n===void 0?null:n,a=Vr(i,e);return $r("Cannot inject the dependency "+a+' of "'+t.name+'" constructor. Reason:',r)}function Nr(t){if(typeof t.dispose!="function")return!1;var e=t.dispose;return!(e.length>0)}var Br=function(t){je(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(Ye),jr=function(t){je(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e}(Ye),Ur=function(){function t(){this.preResolution=new Br,this.postResolution=new jr}return t}(),yt=new Map,Yr=function(){function t(e){this.parent=e,this._registry=new kr,this.interceptors=new Ur,this.disposed=!1,this.disposables=new Set}return t.prototype.register=function(e,r,s){s===void 0&&(s={lifecycle:D.Transient}),this.ensureNotDisposed();var n;if(Pr(r)?n=r:n={useClass:r},Ae(n))for(var i=[e],a=n;a!=null;){var u=a.useToken;if(i.includes(u))throw new Error("Token registration cycle detected! "+j(i,[u]).join(" -> "));i.push(u);var l=this._registry.get(u);l&&Ae(l.provider)?a=l.provider:a=null}if((s.lifecycle===D.Singleton||s.lifecycle==D.ContainerScoped||s.lifecycle==D.ResolutionScoped)&&(De(n)||Ue(n)))throw new Error('Cannot use lifecycle "'+D[s.lifecycle]+'" with ValueProviders or FactoryProviders');return this._registry.set(e,{provider:n,options:s}),this},t.prototype.registerType=function(e,r){return this.ensureNotDisposed(),K(r)?this.register(e,{useToken:r}):this.register(e,{useClass:r})},t.prototype.registerInstance=function(e,r){return this.ensureNotDisposed(),this.register(e,{useValue:r})},t.prototype.registerSingleton=function(e,r){if(this.ensureNotDisposed(),K(e)){if(K(r))return this.register(e,{useToken:r},{lifecycle:D.Singleton});if(r)return this.register(e,{useClass:r},{lifecycle:D.Singleton});throw new Error('Cannot register a type name as a singleton without a "to" token')}var s=e;return r&&!K(r)&&(s=r),this.register(e,{useClass:s},{lifecycle:D.Singleton})},t.prototype.resolve=function(e,r,s){r===void 0&&(r=new Re),s===void 0&&(s=!1),this.ensureNotDisposed();var n=this.getRegistration(e);if(!n&&K(e)){if(s)return;throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"')}if(this.executePreResolutionInterceptor(e,"Single"),n){var i=this.resolveRegistration(n,r);return this.executePostResolutionInterceptor(e,i,"Single"),i}if(Or(e)){var i=this.construct(e,r);return this.executePostResolutionInterceptor(e,i,"Single"),i}throw new Error("Attempted to construct an undefined constructor. Could mean a circular dependency problem. Try using `delay` function.")},t.prototype.executePreResolutionInterceptor=function(e,r){var s,n;if(this.interceptors.preResolution.has(e)){var i=[];try{for(var a=Ie(this.interceptors.preResolution.getAll(e)),u=a.next();!u.done;u=a.next()){var l=u.value;l.options.frequency!="Once"&&i.push(l),l.callback(e,r)}}catch(c){s={error:c}}finally{try{u&&!u.done&&(n=a.return)&&n.call(a)}finally{if(s)throw s.error}}this.interceptors.preResolution.setAll(e,i)}},t.prototype.executePostResolutionInterceptor=function(e,r,s){var n,i;if(this.interceptors.postResolution.has(e)){var a=[];try{for(var u=Ie(this.interceptors.postResolution.getAll(e)),l=u.next();!l.done;l=u.next()){var c=l.value;c.options.frequency!="Once"&&a.push(c),c.callback(e,r,s)}}catch(v){n={error:v}}finally{try{l&&!l.done&&(i=u.return)&&i.call(u)}finally{if(n)throw n.error}}this.interceptors.postResolution.setAll(e,a)}},t.prototype.resolveRegistration=function(e,r){if(this.ensureNotDisposed(),e.options.lifecycle===D.ResolutionScoped&&r.scopedResolutions.has(e))return r.scopedResolutions.get(e);var s=e.options.lifecycle===D.Singleton,n=e.options.lifecycle===D.ContainerScoped,i=s||n,a;return De(e.provider)?a=e.provider.useValue:Ae(e.provider)?a=i?e.instance||(e.instance=this.resolve(e.provider.useToken,r)):this.resolve(e.provider.useToken,r):mt(e.provider)?a=i?e.instance||(e.instance=this.construct(e.provider.useClass,r)):this.construct(e.provider.useClass,r):Ue(e.provider)?a=e.provider.useFactory(this):a=this.construct(e.provider,r),e.options.lifecycle===D.ResolutionScoped&&r.scopedResolutions.set(e,a),a},t.prototype.resolveAll=function(e,r,s){var n=this;r===void 0&&(r=new Re),s===void 0&&(s=!1),this.ensureNotDisposed();var i=this.getAllRegistrations(e);if(!i&&K(e)){if(s)return[];throw new Error('Attempted to resolve unregistered dependency token: "'+e.toString()+'"')}if(this.executePreResolutionInterceptor(e,"All"),i){var a=i.map(function(l){return n.resolveRegistration(l,r)});return this.executePostResolutionInterceptor(e,a,"All"),a}var u=[this.construct(e,r)];return this.executePostResolutionInterceptor(e,u,"All"),u},t.prototype.isRegistered=function(e,r){return r===void 0&&(r=!1),this.ensureNotDisposed(),this._registry.has(e)||r&&(this.parent||!1)&&this.parent.isRegistered(e,!0)},t.prototype.reset=function(){this.ensureNotDisposed(),this._registry.clear(),this.interceptors.preResolution.clear(),this.interceptors.postResolution.clear()},t.prototype.clearInstances=function(){var e,r;this.ensureNotDisposed();try{for(var s=Ie(this._registry.entries()),n=s.next();!n.done;n=s.next()){var i=be(n.value,2),a=i[0],u=i[1];this._registry.setAll(a,u.filter(function(l){return!De(l.provider)}).map(function(l){return l.instance=void 0,l}))}}catch(l){e={error:l}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(e)throw e.error}}},t.prototype.createChildContainer=function(){var e,r;this.ensureNotDisposed();var s=new t(this);try{for(var n=Ie(this._registry.entries()),i=n.next();!i.done;i=n.next()){var a=be(i.value,2),u=a[0],l=a[1];l.some(function(c){var v=c.options;return v.lifecycle===D.ContainerScoped})&&s._registry.setAll(u,l.map(function(c){return c.options.lifecycle===D.ContainerScoped?{provider:c.provider,options:c.options}:c}))}}catch(c){e={error:c}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(e)throw e.error}}return s},t.prototype.beforeResolution=function(e,r,s){s===void 0&&(s={frequency:"Always"}),this.interceptors.preResolution.set(e,{callback:r,options:s})},t.prototype.afterResolution=function(e,r,s){s===void 0&&(s={frequency:"Always"}),this.interceptors.postResolution.set(e,{callback:r,options:s})},t.prototype.dispose=function(){return Cr(this,void 0,void 0,function(){var e;return Mr(this,function(r){switch(r.label){case 0:return this.disposed=!0,e=[],this.disposables.forEach(function(s){var n=s.dispose();n&&e.push(n)}),[4,Promise.all(e)];case 1:return r.sent(),[2]}})})},t.prototype.getRegistration=function(e){return this.isRegistered(e)?this._registry.get(e):this.parent?this.parent.getRegistration(e):null},t.prototype.getAllRegistrations=function(e){return this.isRegistered(e)?this._registry.getAll(e):this.parent?this.parent.getAllRegistrations(e):null},t.prototype.construct=function(e,r){var s=this;if(e instanceof pt)return e.createProxy(function(i){return s.resolve(i,r)});var n=function(){var i=yt.get(e);if(!i||i.length===0){if(e.length===0)return new e;throw new Error('TypeInfo not known for "'+e.name+'"')}var a=i.map(s.resolveParams(r,e));return new(e.bind.apply(e,j([void 0],a)))}();return Nr(n)&&this.disposables.add(n),n},t.prototype.resolveParams=function(e,r){var s=this;return function(n,i){var a,u,l;try{return Lr(n)?gt(n)?n.multiple?(a=s.resolve(n.transform)).transform.apply(a,j([s.resolveAll(n.token,new Re,n.isOptional)],n.transformArgs)):(u=s.resolve(n.transform)).transform.apply(u,j([s.resolve(n.token,e,n.isOptional)],n.transformArgs)):n.multiple?s.resolveAll(n.token,new Re,n.isOptional):s.resolve(n.token,e,n.isOptional):gt(n)?(l=s.resolve(n.transform,e)).transform.apply(l,j([s.resolve(n.token,e)],n.transformArgs)):s.resolve(n,e)}catch(c){throw new Error(Fr(r,i,c))}}},t.prototype.ensureNotDisposed=function(){if(this.disposed)throw new Error("This container has been disposed, you cannot interact with a disposed container")},t}(),Hr=new Yr;function qr(t){return function(e){yt.set(e,Er(e))}}function zr(){return function(t){qr()(t),Hr.registerSingleton(t)}}if(typeof Reflect>"u"||!Reflect.getMetadata)throw new Error(`tsyringe requires a reflect polyfill. Please add 'import "reflect-metadata"' to the top of your entry point.`);var Jr=Object.getOwnPropertyDescriptor,Gr=(t,e,r,s)=>{for(var n=s>1?void 0:s?Jr(e,r):e,i=t.length-1,a;i>=0;i--)(a=t[i])&&(n=a(n)||n);return n};o.TableConfig=class{constructor(){this.setCellComponentRegistry=this.setCellComponentRegistry.bind(this),this.getCellComponentRegistry=this.getCellComponentRegistry.bind(this)}setCellComponentRegistry(e){this.cellComponentRegistry=e}getCellComponentRegistry(){return this.cellComponentRegistry}},o.TableConfig=Gr([zr()],o.TableConfig);class xr{constructor(){this.registeredComponents=new Map}initialize(){this.registerComponents()}getRegisteredComponents(){return this.registeredComponents}}function Wr(t){return function(r,s){r.constructor.prototype.headers||(r.constructor.prototype.headers=[]),r.constructor.prototype.headers.push({path:s,...t})}}function Kr(t){return function(r){async function s(){return r.prototype.headers||[]}t.loadHeaderSchema=s}}function St(){const t=g.ref(new Map),e=g.ref(0),r=g.ref(null),s=g.computed(()=>Array.from(t.value.values()));function n(p){e.value=p}function i(p){for(const S of p)a(S)}function a(p){t.value.set(p.id,p)}function u(p){return r.value=t.value.get(p)||null,r.value}function l(p){const S=u(p);return S&&t.value.delete(p),!!S}function c(){t.value.clear()}function v(p){r.value=p}function f(){r.value=null}return{itemsAsArray:s,totalCount:e,currentItem:r,setTotalCount:n,addOrReplaceItems:i,getById:u,removeById:l,clearItems:c,setCurrentItem:v,clearCurrentItem:f}}class wt{constructor(){this.pageNumber=1,this.itemCount=20,this.sortDetail=new we("id",O.DESC),this.filters=[]}}class Zr{constructor(e,r){this.items=e,this.totalItems=r}}class Xr{constructor(e,r){this.shouldKeepSync=e,this.intervalInMillisecond=r}}const It=new wt;function bt(){const t=g.ref(structuredClone(It));function e(){t.value.pageNumber=t.value.pageNumber+1}function r(){t.value.pageNumber=t.value.pageNumber-1}function s(f){t.value.pageNumber=f}function n(f){t.value.itemCount=f}function i(f){t.value.sortDetail.key=f.key,t.value.sortDetail.order=f.order}function a(f){for(const p in f)u(p,f[p])}function u(f,p){const S=t.value.filters.findIndex(A=>A.key===f);S>-1?t.value.filters[S].value=p:t.value.filters.push({key:f,value:p})}function l(f){let p=t.value.filters;p=p.filter(S=>S.key!==f),t.value.filters=p}function c(){const f={page:t.value.pageNumber,count:t.value.itemCount};t.value.sortDetail&&(f.by=t.value.sortDetail.key,f.order=t.value.sortDetail.order);for(const p of t.value.filters)if(p.value)if(typeof p.value=="string"||typeof p.value=="number")f[p.key]=p.value;else{const S=JSON.stringify(p.value);S!=="[]"&&S!=="{}"&&(f[p.key]=S)}return f}function v(){t.value=structuredClone(It)}return{params:t,setNextPage:e,setPreventPage:r,setPageNumber:s,setItemCount:n,setSortDetail:i,setFilter:u,removeFilter:l,getRequestParams:c,clearParam:v,setFiltersBaseOnRequestBody:a}}function At(){const t=g.ref(new Set),e=g.computed(()=>t.value.has(y.FetchList)),r=g.computed(()=>t.value.has(y.FetchItem)),s=g.computed(()=>t.value.has(y.FetchLastItems)),n=g.computed(()=>t.value.has(y.FetchPreviousItems)),i=g.computed(()=>t.value.has(y.Create)),a=g.computed(()=>t.value.has(y.Update)),u=g.computed(()=>t.value.has(y.Delete)),l=g.computed(()=>t.value.has(y.Search)),c=g.computed(()=>t.value.has(y.Sort));function v(p){t.value.add(p)}function f(p){t.value.delete(p)}return{loadingStatus:t,isFetchingList:e,isFetchingItem:r,isFetchingLastItems:s,isFetchingPreviousItems:n,isCreating:i,isUpdating:a,isDeleting:u,isSearching:l,isSorting:c,setStatus:v,removeStatus:f}}function Qr(t){const e=St(),r=bt(),s=At(),n=new ke({runAction:async()=>f(y.AutoRefresh)}),i=g.computed(()=>{const h=r.params.value.pageNumber,d=r.params.value.itemCount,m=h*d-d,I=h*d-1,b=[];for(let w=m;w<=I&&e.itemsAsArray.value[w];w++)b.push(e.itemsAsArray.value[w]);return b}),a=g.computed(()=>({totalItems:e.totalCount.value,currentPage:r.params.value.pageNumber,rows:e.itemsAsArray.value,loadingStatus:s.loadingStatus.value,currentPageItems:i.value})),u=g.computed(()=>({getData:c,sort:ie,paginate:_e,fetchRows:f})),l=g.computed(()=>t.getSyncDetail());function c(){return a.value}async function v(h){const d=await t.fetchList(h);return e.clearItems(),e.addOrReplaceItems(d.items),e.setTotalCount(d.totalItems),d}async function f(h=y.FetchList){s.setStatus(h);const d=await v(r.getRequestParams());return s.removeStatus(h),d}async function p(){S(),await f()}function S(){if(!l.value.shouldKeepSync)throw new Error("The provided repository does not support auto refresh");n.setupInterval(l.value.intervalInMillisecond)}function A(){n.clearInterval()}async function Z(h,d=!0){s.setStatus(y.FetchItem),d&&e.clearCurrentItem();const m=await t.fetchItemById(h);return e.setCurrentItem(m),s.removeStatus(y.FetchItem),m}async function X(h){s.setStatus(y.Create);const d=await t.createItem(h);return d&&e.addOrReplaceItems([d]),s.removeStatus(y.Create),d}async function Q(h,d){s.setStatus(y.Update);const m=await t.updateItem(h,d);return m&&e.addOrReplaceItems([m]),s.removeStatus(y.Update),m}async function ee(h){return s.setStatus(y.Delete),await t.deleteItem(h),s.removeStatus(y.Delete),e.removeById(h)}async function Ge(){r.setNextPage(),s.setStatus(y.FetchLastItems);const h=await v(r.getRequestParams());return s.removeStatus(y.FetchLastItems),h}async function xe(){r.setPreventPage(),s.setStatus(y.FetchPreviousItems);const h=await v(r.getRequestParams());return s.removeStatus(y.FetchPreviousItems),h}async function _e(h){r.setPageNumber(h),s.setStatus(y.FetchList);const d=await v(r.getRequestParams());return s.removeStatus(y.FetchList),d}async function We(h){r.setFilter("search",h),s.setStatus(y.Search),e.clearItems();const d=await v(r.getRequestParams());return s.removeStatus(y.Search),d}async function ie(h){r.setSortDetail(h),s.setStatus(y.Sort),e.clearItems();const d=await v(r.getRequestParams());return s.removeStatus(y.Sort),d}async function te(){return r.clearParam(),await f()}return g.onBeforeUnmount(()=>{A()}),{loadingStatusManager:s,dataManger:e,paramsManager:r,tableRenderingData:a,fetchList:f,fetchWithAutoRefresh:p,setupAutoRefresh:S,stopAutoRefresh:A,fetchItemById:Z,createItem:X,updateItem:Q,deleteItem:ee,fetchLastItems:Ge,fetchPreviousItems:xe,fetchItemsByPageNumber:_e,search:We,sort:ie,clearFilters:te,tableService:u,currentPageItems:i}}function es(t){const e=g.ref(t),r=g.computed(()=>({getData(){return{totalItems:e.value.length,currentPageItems:e.value,loadingStatus:new Set,rows:e.value,currentPage:1}},async sort(s){return{totalItems:e.value.length,items:e.value}},async fetchRows(){return{totalItems:e.value.length,items:e.value}},async paginate(s,n){return{totalItems:e.value.length,items:e.value}}}));return{tableRows:e,staticTableService:r}}function ts(){const t=g.ref(new Map),e=g.ref(0),r=g.computed(()=>e.value),s=g.computed(()=>Array.from(t.value.values()));function n(v){e.value=v}function i(v){for(const f of v)a(f)}function a(v){t.value.set(String(v.id),v)}function u(v){const f=l(v);return t.value.delete(String(v)),f}function l(v){return t.value.get(String(v))||null}function c(){t.value.clear()}return{entityItemsAsArray:s,addOrReplaceItems:i,removeById:u,getItemById:l,clearItems:c,setTotalCount:n,getTotalCount:r}}class rs{constructor(e,r=500){this.timerId=null,this.debounceTimeout=r,this.action=e}runAction(){this.cancelDebounce(),this.action.runImmediate(),this.timerId=setTimeout(()=>{this.action.runDebounce()},this.debounceTimeout)}cancelDebounce(){this.timerId&&clearTimeout(this.timerId)}}function ss(t){return function(e,r,s){const n=s.value;s.value=async function(...i){try{return await n.apply(this,i)}catch(a){for(const u of t)await u.handleError(a)}}}}function ns(t){return function(e,r,s){const n=s.value;s.value=async function(...i){try{const a=await n.apply(this,i);for(const u of t)u.shouldResolveSuccess(a)&&await u.handleSuccess(a);return a}catch(a){for(const u of t)u.shouldResolveFailure(a)&&await u.handleFailure(a)}}}}class is{constructor(e,r,s=()=>!0,n=()=>!0){this.successMessageResolver=e,this.failureMessageResolver=r,this.shouldResolveSuccess=s,this.shouldResolveFailure=n}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,r){L.handlers.set(e,r)}handle(e){var n;const r=((n=e.response)==null?void 0:n.status)??0,s=L.handlers.get(r);s&&s.handleError(e)}};L.handlers=new Map,L.instance=null;let He=L;class as{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(r=>{for(const s of e)s.intercept(r);return r},r=>Promise.reject(r)),this}attachResponseInterceptors(e){return this.axiosInstance.interceptors.response.use(r=>r,r=>{throw e.handle(r),r}),this}build(){return this.axiosInstance}}class os{constructor(e){this.axiosInstance=e}async get(e,r){return await this.axiosInstance.get(e,r)}async post(e,r,s){return await this.axiosInstance.post(e,r,s)}async patch(e,r,s){return await this.axiosInstance.patch(e,r,s)}async put(e,r,s){return await this.axiosInstance.put(e,r,s)}async delete(e,r){return await this.axiosInstance.delete(e,r)}}class ls{constructor(){this._initializer=[]}setupInitializers(e){this._initializer.push(...e)}initialize(){for(const e of this._initializer)e.initialize()}}const H=class H{constructor(){this.jsonConverter=new C.JsonConvert}serializeObject(e,r){return this.jsonConverter.serializeObject(e,r)}deserializeObject(e,r){return this.jsonConverter.deserializeObject(e,r)}deserializeArray(e,r){return this.jsonConverter.deserializeArray(e,r)}tryDeserialize(e,r){for(const s of r)try{return this.deserializeObject(e,s)}catch{}throw new Error("Unable to deserialize object")}static GetInstance(){return H.Instance||(H.Instance=new H),H.Instance}};H.Instance=null;let qe=H;var Dt=(t=>(t.Success="success",t.Failure="error",t.Info="info",t.Warning="warning",t))(Dt||{}),ze=(t=>(t.BottomLeft="bottomLeft",t.TopLeft="topLeft",t))(ze||{});class us{constructor(e,r,s){this.placement=ze.BottomLeft,this.type=e,this.message=r,this.description=s}}const cs=Ke.defineStore(ye.Dialog,()=>{const t=g.reactive({dialogComponent:null,width:k.DefaultWidth,height:k.DefaultHeight,props:null,header:""}),e=g.computed(()=>!!t.dialogComponent),r=g.computed(()=>!!t.header);function s(l){t.dialogComponent=l}function n(l){t.header=l}function i(l){if(!e.value)throw new Error("there is no dialog to set props on");t.props=l}function a(l,c){if(!e.value)throw new Error("there is no dialog to set size on");if(l<k.MinimalAvailableSize)throw new Error("negative size not supported");c===k.Width?t.width=l:t.height=l}function u(){t.props=null,t.height=k.DefaultHeight,t.width=k.DefaultWidth,t.header="",t.dialogComponent=null}return{dialogData:t,openDialog:s,clearDialog:u,setSize:a,setDialogHeader:n,setProps:i,isDialogExists:e,hasDefaultHeader:r}}),hs=Ke.defineStore(ye.Drawer,()=>{const t=g.ref(x.Close),e=g.computed(()=>t.value===x.Open);function r(){t.value=x.Close}function s(){t.value=x.Open}return{closeDrawer:r,openDrawer:s,isDrawerOpen:e}});class ds{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 r=this.mapProcesses.get(e);if(!r)throw new Error(`Process ${e} not found`);await r.execute()}}class fs{constructor(e,r){this.next=null,this.name=e,this.next=r}addToManager(e){e.setProcessToMap(this),this.next&&this.next.addToManager(e)}}class vs{constructor(){this.checkAccessibility=this.checkAccessibility.bind(this),this.isAccessible=this.isAccessible.bind(this),this.getDestinationRouteName=this.getDestinationRouteName.bind(this)}async checkAccessibility(e,r,s){if(await this.isAccessible(e,r)){s();return}if(await this.getDestinationRouteName()){s({name:await this.getDestinationRouteName()});return}if(await this.getDestinationRouteLocation(e,r)){s(await this.getDestinationRouteLocation(e,r));return}s(!1)}async getDestinationRouteName(){return""}async getDestinationRouteLocation(e,r){return null}}class ms{constructor(e,r,s){this.scheduler=new ke({runAction:async()=>{await this.fetchList()}}),this.repository=e,this.crudDataManagement=r,this.syncDetail=this.repository.getSyncDetail(),this.paramManager=s,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 r=await this.repository.fetchItemById(e);return r&&this.crudDataManagement.addOrReplaceItems([r]),r}async createItem(e){const r=await this.repository.createItem(e);return r&&!this.shouldRefreshListAfterCreate()&&this.crudDataManagement.addOrReplaceItems([r]),r&&this.shouldRefreshListAfterCreate()&&await this.fetchList(),r}shouldRefreshListAfterCreate(){return!0}async deleteItem(e){return await this.repository.deleteItem(e)?this.crudDataManagement.removeById(e):null}async updateItem(e,r){const s=await this.repository.updateItem(e,r);return this.shouldRefreshListAfterUpdate()&&s?(await this.fetchList(),this.crudDataManagement.getItemById(e)):s}shouldRefreshListAfterUpdate(){return!0}async removeItem(e){const r=await this.repository.deleteItem(e);return r&&this.shouldRefreshListAfterDelete()&&await this.fetchList(),r?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 Rt{}class ps extends Rt{search(e,r,s){const n=[];e:for(const i of e)for(const a of s(i))if(B.removeSpacesFromString(String(a).toLowerCase()).indexOf(B.removeSpacesFromString(String(r).toLowerCase()))>-1){n.push(i);continue e}return n}}var Je=(t=>(t.Hidden="hidden",t.Visible="visible",t))(Je||{});class gs{constructor(e){this._visibilityControl=e,this.mangeVisibilityEvent()}mangeVisibilityEvent(){document.addEventListener("visibilitychange",e=>{document.visibilityState===Je.Hidden?this._visibilityControl.screenInvisible(e):this._visibilityControl.screenVisible(e)})}}var ys=Object.defineProperty,Ss=Object.getOwnPropertyDescriptor,E=(t,e,r,s)=>{for(var n=s>1?void 0:s?Ss(e,r):e,i=t.length-1,a;i>=0;i--)(a=t[i])&&(n=(s?a(e,r,n):a(n))||n);return s&&n&&ys(e,r,n),n};o.Amount=class{constructor(){this.value="",this.symbol=""}get tradeValueInNumber(){return Number(this.value)}get truncatedValue(){return this.tradeValueInNumber.toLocaleString("en-US",{maximumFractionDigits:8})}},E([C.JsonProperty("value",String,!0)],o.Amount.prototype,"value",2),E([C.JsonProperty("symbol",String)],o.Amount.prototype,"symbol",2),o.Amount=E([C.JsonObject("Amount")],o.Amount),o.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}},E([C.JsonProperty("id",Object)],o.BaseModel.prototype,"id",2),o.BaseModel=E([C.JsonObject("BaseModel")],o.BaseModel),o.MinifiedSymbolModel=class extends o.BaseModel{},E([C.JsonProperty("symbol",String)],o.MinifiedSymbolModel.prototype,"symbol",2),E([C.JsonProperty("enName",String)],o.MinifiedSymbolModel.prototype,"enName",2),E([C.JsonProperty("faName",String)],o.MinifiedSymbolModel.prototype,"faName",2),E([C.JsonProperty("image",String)],o.MinifiedSymbolModel.prototype,"image",2),o.MinifiedSymbolModel=E([C.JsonObject("MinifiedSymbolModel")],o.MinifiedSymbolModel);class ws{constructor(e,r){this.requestedDate=e,this.executedDate=r}get requestedDateInJalali(){return M.mapUnixToDate(this.requestedDate,J.SimpleDate)}get requestedTime(){return M.mapUnixToDate(this.requestedDate,J.JustHour)}get executedDateInJalali(){return M.mapUnixToDate(this.executedDate,J.SimpleDate)}get executedDateTime(){return M.mapUnixToDate(this.executedDate,J.JustHour)}}class Is{constructor(e,r){this.requestedAmount=e,this.executedAmount=r}}class bs{constructor(e,r,s,n,i){this.symbolPrice=e,this.USDTPrice=r,this.symobl=s,this.symbolImage=n,this.USDTImage=i}get truncatedSymbolPrice(){return this.symbolPrice.toLocaleString("en-US",{maximumFractionDigits:8})}get truncatedUSDTPrice(){return this.USDTPrice.toLocaleString("en-US",{maximumFractionDigits:8})}}class As{constructor(e,r){this.soldSymbol=e,this.buySymbol=r}}o.APIErrorHandlerRegistry=He,o.AbstractSubject=Rr,o.AccessControl=Oe,o.AccessLevel=W,o.Action=br,o.ApiBuilder=as,o.ApplicationDrawerStatus=x,o.ApplicationInitializer=ls,o.AuthorizationDirective=Pe,o.AuthorizationService=Se,o.BaseTable=ft,o.BehaviorSubject=T,o.CellType=ge,o.ClientArraySearch=ps,o.ClientSearch=Rt,o.Column=wr,o.CommonMaskFormats=oe,o.CrudService=ms,o.DateConverter=N,o.DateDisabledOptions=sr,o.DateFormat=J,o.DateFormats=Qe,o.DateTools=se,o.DebounceService=rs,o.DialogDimensions=k,o.EveryAccess=nr,o.EveryLevelAuthorizationDirective=ar,o.Feedback=is,o.FetchListResponse=Zr,o.FormManager=vr,o.FormValidationStatus=ne,o.Formatter=M,o.GColumn=Wr,o.GTable=Kr,o.HandleError=ss,o.HandleFeedback=ns,o.HeaderType=pe,o.HttpClient=os,o.InputControl=hr,o.InputControlBuilder=dr,o.InputControlData=ct,o.JsonMapper=qe,o.LoadingStatus=y,o.Params=wt,o.Process=fs,o.ProcessManager=ds,o.RangeValue=rr,o.RouteGuard=vs,o.Scheduler=ke,o.SelectableTable=yr,o.SelectableTableGenerator=_r,o.SimpleSort=Fe,o.SomeAccess=ir,o.SomeLevelsAuthorizationDirective=or,o.SortDetail=we,o.SortOrder=O,o.SortOrderTableHeader=ot,o.Sorter=gr,o.StatusCode=lt,o.StorageKeys=V,o.StoreNames=ye,o.SymbolInTrade=As,o.SymbolPriceInTrade=bs,o.Symbols=ut,o.SyncDetail=Xr,o.TABLE_ACTION_COLUMN=pr,o.TABLE_COLUMN_DEFAULT_COLSPAN=$e,o.TABLE_COLUMN_DEFAULT_VALUES=dt,o.TABLE_COLUMN_DEFAULT_WIDTH=Ve,o.Table=Ir,o.TableCellComponentRegistry=xr,o.TableConstants=Le,o.TableDestroy=Ar,o.TableGenerator=vt,o.TableHeaderAlign=me,o.TableRowClick=Dr,o.ToastLocation=ze,o.ToastMessage=us,o.ToastType=Dt,o.TouchSensitiveControl=fr,o.TradeAmount=Is,o.TradeDate=ws,o.Util=B,o.VisibilityManager=gs,o.VisibilityState=Je,o.cards=Ze,o.generateHeader=Sr,o.ibans=Xe,o.isEmpty=ht,o.isLastItem=ur,o.isOnlyOneItem=lr,o.setupJalaliDate=at,o.setupStore=cr,o.useCrud=ts,o.useData=St,o.useDialogService=cs,o.useDrawerService=hs,o.useForm=mr,o.useLoadingStatus=At,o.useParams=bt,o.useRepository=Qr,o.useStaticTableService=es,Object.defineProperty(o,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(r,M){typeof exports=="object"&&typeof module<"u"?M(exports,require("dayjs"),require("vue"),require("json2typescript"),require("pinia")):typeof define=="function"&&define.amd?define(["exports","dayjs","vue","json2typescript","pinia"],M):(r=typeof globalThis<"u"?globalThis:r||self,M(r.IronCore={},r.dayjs,r.Vue,r.json2typescript,r.pinia))})(this,function(r,M,v,_,Fe){"use strict";var re=(t=>(t.BankCard="####-####-####-####",t.Iban="##-####-####-####-####-####-##",t))(re||{}),q=(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||{});const Be=[{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 Ue=(t=>(t.Normal="YYYY-MM-DD",t.ContainsHour="YYYY-MM-DD HH:mm",t.OnlyHour="HH:mm",t))(Ue||{});function ie(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ne={exports:{}},ut=ne.exports,Ye;function ht(){return Ye||(Ye=1,function(t,e){(function(s,a){t.exports=a()})(ut,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")}}})}(ne)),ne.exports}var dt=ht();const ft=ie(dt);var oe={exports:{}},mt=oe.exports,je;function gt(){return je||(je=1,function(t,e){(function(s,a){t.exports=a()})(mt,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 p=this.$locale().yearStart||1;if(this.month()===11&&this.date()>25){var m=o(this).startOf(a).add(1,a).date(p),h=o(this).endOf(s);if(m.isBefore(h))return 1}var g=o(this).startOf(a).date(p).startOf(s).subtract(1,"millisecond"),S=this.diff(g,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)}}})}(oe)),oe.exports}var vt=gt();const yt=ie(vt);var le={exports:{}},pt=le.exports,He;function St(){return He||(He=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}}})}(le)),le.exports}var It=St();const wt=ie(It);var ce={exports:{}},bt=ce.exports,qe;function At(){return qe||(qe=1,function(t,e){(function(s,a){t.exports=a(M)})(bt,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})}(ce)),ce.exports}var Dt=At();const Mt=ie(Dt);function ue(t,e){return _t(t)||Ct(t,e)||Rt()}function _t(t){if(Array.isArray(t))return t}function Ct(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 Rt(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}function ze(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 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),p=n-d-Math.floor(30.6001*u)+s,m=u<14?u-1:u-13,h=m>2?o-4716:o-4715;return Et(h,m,p)}function Tt(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),p=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(p)]}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(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,p=1600+400*n(u,146097);u=u%146097;var m=!0;for(u>=36525&&(u--,p+=100*n(u,36524),u=u%36524,u>=365?u++:m=!1),p+=4*n(u,1461),u%=1461,u>=366&&(m=!1,u--,p+=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,g=u+1;return ze(p,h,g)}function Et(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(K,Z){return Math.floor(K/Z)}for(var o=t-1600,d=e-1,u=s-1,p=365*o+n(o+3,4)-n(o+99,100)+n(o+399,400),m=0;m<d;++m)p+=a[m];d>1&&(t%4==0&&t%100!=0||t%400==0)&&p++,p+=u;var h=p-79,g=n(h,12053);h%=12053;var S=979+33*g+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 W=A+1,x=h+1;return[S,W,x]}var he={J:function(e,s,a){return Lt(ze(e,s,a))},G:function(e,s,a){return Tt(Ot(e,s,a))}},kt=/^(\d{4})[-/]?(\d{1,2})[-/]?(\d{0,2})(.*)?$/,Pt=/\[.*?\]|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,be="date",z="day",V="month",$="year",Je="week",Vt="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,p=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 g=a.parse,S=a.init,A=a.startOf,W=a.$set,x=a.add,K=a.format,Z=a.diff,Pe=a.year,Ve=a.month,pe=a.date,$e=a.daysInMonth,se=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({},Mt,{},$t),!0);var X=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(kt))){var f=he.G(parseInt(c[1],10),parseInt(c[2],10),parseInt(c[3]||1,10)),w=ue(f,3),b=w[0],I=w[1],D=w[2];l.date="".concat(b,"-").concat(I,"-").concat(D).concat(c[4]||"")}return g.bind(this)(l)},a.InitJalali=function(){var l=he.J(this.$y,this.$M+1,this.$D),c=ue(l,3),f=c[0],w=c[1],b=c[2];this.$jy=f,this.$jM=w-1,this.$jD=b},a.startOf=function(l,c){var f=this;if(!n(this))return A.bind(this)(l,c);var w=d(c)?!0:c,b=o(l),I=function(Q,j){var E=arguments.length>2&&arguments[2]!==void 0?arguments[2]:f.$jy,Ie=he.G(E,j+1,Q),H=ue(Ie,3),ae=H[0],we=H[1],Ys=H[2],ct=X(new Date(ae,we-1,Ys),f);return(w?ct:ct.endOf(z)).$set("hour",1)},D=(this.$W+(7-s.$fdow))%7;switch(b){case $:return w?I(1,0):I(0,0,this.$jy+1);case V:return w?I(1,this.$jM):I(0,(this.$jM+1)%12,this.$jy+parseInt((this.$jM+1)/12,10));case Je:return w?I(this.$jD-D,this.$jM):I(this.$jD+(6-D),this.$jM);default:return A.bind(this)(l,c)}},a.$set=function(l,c){var f=this;if(!n(this))return W.bind(this)(l,c);var w=o(l),b=function(D,Se){var Q=arguments.length>2&&arguments[2]!==void 0?arguments[2]:f.$jy,j=he.G(Q,Se+1,D),E=ue(j,3),Ie=E[0],H=E[1],ae=E[2];return f.$d.setFullYear(Ie),f.$d.setMonth(H-1),f.$d.setDate(ae),f};switch(w){case be:case z:b(c,this.$jM);break;case V:b(this.$jD,c);break;case $:b(this.$jD,this.$jM,c);break;default:return W.bind(this)(l,c)}return this.init(),this},a.add=function(l,c){var f=this;if(!n(this))return x.bind(this)(l,c);l=Number(l);var w=c&&(c.length===1||c==="ms")?c:o(c),b=function(H,ae){var we=f.set(be,1).set(H,ae+l);return we.set(be,Math.min(f.$jD,we.daysInMonth()))};if(["M",V].indexOf(w)>-1){var I=this.$jM+l,D=I<0?-Math.ceil(-I/12):Math.floor(I/12),Se=this.$jD,Q=this.set(z,1).add(D,$).set(V,I-D*12);return Q.set(z,Math.min(Q.daysInMonth(),Se))}if(["y",$].indexOf(w)>-1)return b($,this.$jy);if(["d",z].indexOf(w)>-1){var j=new Date(this.$d);return j.setDate(j.getDate()+l),X(j,this)}if(["w",Je].indexOf(w)>-1){var E=new Date(this.$d);return E.setDate(E.getDate()+l*7),X(E,this)}return x.bind(this)(l,c)},a.format=function(l,c){var f=this;if(!n(this))return K.bind(this)(l,c);var w=l||Vt,b=c||this.$locale(),I=b.jmonths;return w.replace(Pt,function(D){if(D.indexOf("[")>-1)return D.replace(/\[|\]/g,"");switch(D){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 K.bind(f)(D,c)}})},a.diff=function(l,c,f){if(!n(this))return Z.bind(this)(l,c,f);var w=o(c),b=s(l),I=p(this,b);switch(w){case $:I/=12;break;case V:break;default:return Z.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",$):Pe.bind(this)(l)},a.month=function(l){return n(this)?this.$g(l,"$jM",V):Ve.bind(this)(l)},a.date=function(l){return n(this)?this.$g(l,"$jD",z):pe.bind(this)(l)},a.daysInMonth=function(){return n(this)?this.endOf(V).$jD:$e.bind(this)()},se&&(a.toArray=function(){return n(this)?[this.$jy,this.$jM,this.$jD,this.$H,this.$m,this.$s,this.$ms]:se.bind(this)()}),a.clone=function(){return X(this.toDate(),this)}};const Bt={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 Ge(){M.extend(Ft),M.calendar("jalali"),M.extend(ft),M.extend(yt),M.extend(wt),M.locale(Bt,{},!0)}class Nt{constructor(e,s){this.start=e,this.end=s}}class Ut{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 M.unix(e).endOf("day").unix()}}class ee{static isDateDisabled(e,s){for(const a of e.disabledDates)if(ee.areUnixesInSameDate(a,s.unix()))return!0;return!!(e.maxDate&&ee.isDateGraterOrSame(e.maxDate,s.unix())||e.minDate&&ee.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)}}Ge();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(re.BankCard,String(e))}static applyIbanMask(e){return C.applyMask(re.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 M(new Date(e)).subtract(1,"day").format(s)}}var y=(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))(y||{}),k=(t=>(t.Width="width",t.Height="height",t[t.DefaultWidth=500]="DefaultWidth",t[t.DefaultHeight=350]="DefaultHeight",t[t.MinimalAvailableSize=0]="MinimalAvailableSize",t))(k||{}),O=(t=>(t.ASC="ASC",t.DESC="DESC",t))(O||{}),We=(t=>(t.ASC="ascend",t.DESC="descend",t))(We||{}),de=(t=>(t.Left="left",t.Right="right",t.Center="center",t))(de||{}),fe=(t=>(t.Text="text",t))(fe||{}),me=(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||{}),Ae=(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))(Ae||{});r.ApplicationTheme=(t=>(t.FontFamily="IRANSansX",t))(r.ApplicationTheme||{});var J=(t=>(t.Open="open",t.Close="close",t))(J||{}),xe=(t=>(t[t.NotFound=404]="NotFound",t[t.Unauthorized=401]="Unauthorized",t[t.ServerError=500]="ServerError",t))(xe||{}),te=(t=>(t[t.Invalid=0]="Invalid",t[t.Valid=1]="Valid",t))(te||{}),P=(t=>(t.Theme="theme",t.AccessList="accessList",t.Token="token",t.SSO_ACCESS_LIST="ssoAccessList",t))(P||{});r.ApplicationTheme=(t=>(t.Light="light",t.Dark="dark",t))(r.ApplicationTheme||{});var ge=(t=>(t.Dialog="dialog",t.Drawer="drawer",t.Module="module",t.Toast="toast",t))(ge||{}),Ke=(t=>(t.USDT="USDT",t))(Ke||{});class B{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/${B.iban(e).english}.png`):(e=C.toEnglishDigits(e.replace(/ /g,"")),`/img/banks/${B.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=Be.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=B.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=O.ASC){return e.every((i,n)=>e.length-1===n?!0:a===O.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(P.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(P.AccessList)}initialize(){const e=localStorage.getItem(P.AccessList);e!==null&&this.setAvailableAccesses(JSON.parse(e))}static GetInstance(){return N.Instance||(N.Instance=new N),N.Instance}};N.Instance=null;let G=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=G.GetInstance()}}class Yt extends De{hasAccess(e){return this.accessService.everyAccess(e)}}class jt extends De{hasAccess(e){return this.accessService.someAccess(e)}}const U=class U{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(P.SSO_ACCESS_LIST,JSON.stringify(e))}getAccessLevelsFromStorage(){let e=localStorage.getItem(P.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(P.SSO_ACCESS_LIST),this._accessLevels=new Map}static GetInstance(){return U._instance||(U._instance=new U),U._instance}};U._instance=null;let ve=U;class Me{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 Ht extends Me{hasAccess(e,s){return this._authorizationService.everyAccess(e,s)}}class qt extends Me{hasAccess(e,s){return this._authorizationService.someAccess(e,s)}}class Ze{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 zt(t){return t===1}function Jt(t,e){return t-1===e}function Xe(t){return String(t).length===0||t===null||t===void 0}function Gt(t){t()}class Wt{constructor(e,s){this.initialData=null,this.data=new Ze,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:!Xe(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(v.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(v.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 xt{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 Kt{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 Zt{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 Xt(t,e=!1){const s=v.reactive(t),a=v.ref(te.Invalid);return v.watch(()=>s.getInputControlsAsArray(),()=>{e||(s.runValidation(),s.getIsValid()?a.value=te.Valid:a.value=te.Invalid)},{immediate:!0,deep:!0}),{reactiveForm:s,validationStatus:a}}class _e{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 Ce="150px",Re=2,Qt={path:"id",key:"id",title:"عملیات",colspan:Re,width:Ce,cellType:me.ACTION,align:de.Center,headerType:fe.Text,accessLevel:null},Qe={width:Ce,align:de.Center,headerType:fe.Text,cellType:me.Text,colspan:Re};class ye{constructor(e,s){this.key=e,this.order=s}}class Le{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 es{arrayOfObjectSort(e,s,a,i=new Le){return a===O.ASC?i.aSort(e,s):i.bSort(e,s)}arraySort(e,s,a=new Le){return s===O.ASC?a.aSort(e):a.bSort(e)}}class et{constructor(e){this.currentPage=1,this.currentPageSize=20,this.currentSortDetail=new ye("id",O.DESC),this.loadedRows=[],this.headerSchema=[],this.service=e,this.accessService=G.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 Ae.DEFAULT_ITEM_COUNT_PER_PAGE}isLoading(){const e=this.getLoadingStatuses();return e.has(y.Search)||e.has(y.FetchList)||e.has(y.Sort)||e.has(y.FetchLastItems)||e.has(y.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 R{constructor(e){this.observers=[],this.next(e)}attach(e){this.observers.push(e),this.notifyObject(e)}detach(e){this.observers=this.observers.filter(s=>s!==e)}notify(){for(const e of this.observers)this.notifyObject(e)}notifyObject(e){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 ts extends et{constructor(e){super(e),this.selectedRows=new R(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 ss(t){return{...Qe,...t}}function as(t){return function(s,a){s.constructor.prototype.headers||(s.constructor.prototype.headers=[]),s.constructor.prototype.headers.push({path:a,...t})}}function rs(t){return function(s){async function a(){return s.prototype._table=this,s.prototype.headers}function i(d){const u=[],p=s.prototype.actions||[];for(const m of p){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 is(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 ns(){return function(e,s,a){e.constructor.prototype.tableDestroy=a.value}}function os(){return function(e,s,a){e.constructor.prototype.rowClick=a.value}}class ls{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 tt{constructor(e){this.rows=new R([]),this.headerSchema=new R([]),this.currentPage=new R(1),this.currentPageSize=new R(20),this.totalItems=new R(0),this.currentSortDetail=new R(new ye("id",O.DESC)),this.scrollDetail=new R(null),this.isExpandable=new R(!1),this.tableSource=e,this.accessService=G.GetInstance()}async load(){this.rows.next(await this.tableSource.loadRows()),this.headerSchema.next(this.filterItemsBaseOnAccessLevel(await this.tableSource.loadHeaderSchema()))}async paginate(e,s){this.shouldSendPaginationRequest(e,s)&&(this.currentPage.next(e),this.currentPageSize.next(s),this.rows.next(await this.tableSource.paginate(e,s)))}shouldSendPaginationRequest(e,s){return this.currentPage.getValue()!==e||this.currentPageSize.getValue()!==s}async sort(e){this.shouldSendSortRequest(e)&&(this.currentSortDetail.next(e),this.rows.next(await this.tableSource.sort(e)))}shouldSendSortRequest(e){return e.key!==this.currentSortDetail.getValue().key||e.order!==this.currentSortDetail.getValue().order}async handleClick(e){this.tableSource.onRowClick&&await this.tableSource.onRowClick()}async handleMetaClick(e){this.tableSource.onRowMetaClick&&await this.tableSource.onRowMetaClick}async handleDoubleClick(e){this.tableSource.onRowDoubleClick&&await this.tableSource.onRowDoubleClick()}hasAnyAction(){for(const e of this.rows.getValue())if(this.getRowActions(e).length)return!0;return!1}getRowActions(e){return this.filterItemsBaseOnAccessLevel(this.tableSource.loadRowActions(e))}loadSummarySchema(){return this.tableSource.loadSummarySchema?this.tableSource.loadSummarySchema():{summaryTitle:"",summaryItems:[]}}filterItemsBaseOnAccessLevel(e){return e.filter(s=>s.hasAccess?s.hasAccess():!0)}async onDestroy(){this.tableSource.onTableDestroy()}}class cs extends tt{constructor(e){super(e),this.selectedRows=new R(new Map),this.selectRow=this.selectRow.bind(this),this.selectAll=this.selectAll.bind(this),this.isEveryRowSelected=this.isEveryRowSelected.bind(this),this.clearAllSelectedItems=this.clearAllSelectedItems.bind(this),this.getSelectedRowsAsArray=this.getSelectedRowsAsArray.bind(this),this.getSelectedRowIds=this.getSelectedRowIds.bind(this)}selectRow(e){const s=this.getSelectedRows();s.has(e.id)?(s.delete(e.id),this.selectedRows.next(this.selectedRows.getValue())):(s.set(e.id,e),this.selectedRows.next(this.selectedRows.getValue()))}selectAll(){if(this.isEveryRowSelected())this.clearAllSelectedItems();else for(const e of this.rows.getValue())this.selectedRows.getValue().set(e.id,e),this.selectedRows.next(this.selectedRows.getValue())}isEveryRowSelected(){return this.getSelectedRows().size===this.currentPageSize.getValue()||this.rows.getValue().length===this.getSelectedRows().size}clearAllSelectedItems(){this.getSelectedRows().clear(),this.selectedRows.next(this.selectedRows.getValue)}getSelectedRows(){return this.selectedRows.getValue()}getSelectedRowsAsArray(){return Array.from(this.selectedRows.getValue().values())}getSelectedRowIds(){return Array.from(this.selectedRows.getValue().keys())}}class us{constructor(){this.setCellComponentRegistry=this.setCellComponentRegistry.bind(this),this.getCellComponentRegistry=this.getCellComponentRegistry.bind(this)}setCellComponentRegistry(e){this.cellComponentRegistry=e}getCellComponentRegistry(){return this.cellComponentRegistry}}class hs{constructor(){this.registeredComponents=new Map}initialize(){this.registerComponents()}getRegisteredComponents(){return this.registeredComponents}}function ds(t){return function(s,a){s.constructor.prototype.headers||(s.constructor.prototype.headers=[]),s.constructor.prototype.headers.push({path:a,...t})}}function fs(t){return function(s){async function a(){return s.prototype.headers||[]}t.loadHeaderSchema=a}}function st(){const t=v.ref(new Map),e=v.ref(0),s=v.ref(null),a=v.computed(()=>Array.from(t.value.values()));function i(g){e.value=g}function n(g){for(const S of g)o(S)}function o(g){t.value.set(g.id,g)}function d(g){return s.value=t.value.get(g)||null,s.value}function u(g){const S=d(g);return S&&t.value.delete(g),!!S}function p(){t.value.clear()}function m(g){s.value=g}function h(){s.value=null}return{itemsAsArray:a,totalCount:e,currentItem:s,setTotalCount:i,addOrReplaceItems:n,getById:d,removeById:u,clearItems:p,setCurrentItem:m,clearCurrentItem:h}}class at{constructor(){this.pageNumber=1,this.itemCount=20,this.sortDetail=new ye("id",O.DESC),this.filters=[]}}class ms{constructor(e,s){this.items=e,this.totalItems=s}}class gs{constructor(e,s){this.shouldKeepSync=e,this.intervalInMillisecond=s}}const rt=new at;function it(){const t=v.ref(structuredClone(rt));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 g in h)d(g,h[g])}function d(h,g){const S=t.value.filters.findIndex(A=>A.key===h);S>-1?t.value.filters[S].value=g:t.value.filters.push({key:h,value:g})}function u(h){let g=t.value.filters;g=g.filter(S=>S.key!==h),t.value.filters=g}function p(){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 g of t.value.filters)if(g.value)if(typeof g.value=="string"||typeof g.value=="number")h[g.key]=g.value;else{const S=JSON.stringify(g.value);S!=="[]"&&S!=="{}"&&(h[g.key]=S)}return h}function m(){t.value=structuredClone(rt)}return{params:t,setNextPage:e,setPreventPage:s,setPageNumber:a,setItemCount:i,setSortDetail:n,setFilter:d,removeFilter:u,getRequestParams:p,clearParam:m,setFiltersBaseOnRequestBody:o}}function nt(){const t=v.ref(new Set),e=v.computed(()=>t.value.has(y.FetchList)),s=v.computed(()=>t.value.has(y.FetchItem)),a=v.computed(()=>t.value.has(y.FetchLastItems)),i=v.computed(()=>t.value.has(y.FetchPreviousItems)),n=v.computed(()=>t.value.has(y.Create)),o=v.computed(()=>t.value.has(y.Update)),d=v.computed(()=>t.value.has(y.Delete)),u=v.computed(()=>t.value.has(y.Search)),p=v.computed(()=>t.value.has(y.Sort));function m(g){t.value.add(g)}function h(g){t.value.delete(g)}return{loadingStatus:t,isFetchingList:e,isFetchingItem:s,isFetchingLastItems:a,isFetchingPreviousItems:i,isCreating:n,isUpdating:o,isDeleting:d,isSearching:u,isSorting:p,setStatus:m,removeStatus:h}}function vs(t){const e=st(),s=it(),a=nt(),i=new _e({runAction:async()=>h(y.AutoRefresh)}),n=v.computed(()=>{const l=s.params.value.pageNumber,c=s.params.value.itemCount,f=l*c-c,w=l*c-1,b=[];for(let I=f;I<=w&&e.itemsAsArray.value[I];I++)b.push(e.itemsAsArray.value[I]);return b}),o=v.computed(()=>({totalItems:e.totalCount.value,currentPage:s.params.value.pageNumber,rows:e.itemsAsArray.value,loadingStatus:a.loadingStatus.value,currentPageItems:n.value})),d=v.computed(()=>({getData:p,sort:se,paginate:pe,fetchRows:h})),u=v.computed(()=>t.getSyncDetail());function p(){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=y.FetchList){a.setStatus(l);const c=await m(s.getRequestParams());return a.removeStatus(l),c}async function g(){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 W(l,c=!0){a.setStatus(y.FetchItem),c&&e.clearCurrentItem();const f=await t.fetchItemById(l);return e.setCurrentItem(f),a.removeStatus(y.FetchItem),f}async function x(l){a.setStatus(y.Create);const c=await t.createItem(l);return c&&e.addOrReplaceItems([c]),a.removeStatus(y.Create),c}async function K(l,c){a.setStatus(y.Update);const f=await t.updateItem(l,c);return f&&e.addOrReplaceItems([f]),a.removeStatus(y.Update),f}async function Z(l){return a.setStatus(y.Delete),await t.deleteItem(l),a.removeStatus(y.Delete),e.removeById(l)}async function Pe(){s.setNextPage(),a.setStatus(y.FetchLastItems);const l=await m(s.getRequestParams());return a.removeStatus(y.FetchLastItems),l}async function Ve(){s.setPreventPage(),a.setStatus(y.FetchPreviousItems);const l=await m(s.getRequestParams());return a.removeStatus(y.FetchPreviousItems),l}async function pe(l){s.setPageNumber(l),a.setStatus(y.FetchList);const c=await m(s.getRequestParams());return a.removeStatus(y.FetchList),c}async function $e(l){s.setFilter("search",l),a.setStatus(y.Search),e.clearItems();const c=await m(s.getRequestParams());return a.removeStatus(y.Search),c}async function se(l){s.setSortDetail(l),a.setStatus(y.Sort),e.clearItems();const c=await m(s.getRequestParams());return a.removeStatus(y.Sort),c}async function X(){return s.clearParam(),await h()}return v.onBeforeUnmount(()=>{A()}),{loadingStatusManager:a,dataManger:e,paramsManager:s,tableRenderingData:o,fetchList:h,fetchWithAutoRefresh:g,setupAutoRefresh:S,stopAutoRefresh:A,fetchItemById:W,createItem:x,updateItem:K,deleteItem:Z,fetchLastItems:Pe,fetchPreviousItems:Ve,fetchItemsByPageNumber:pe,search:$e,sort:se,clearFilters:X,tableService:d,currentPageItems:n}}function ys(t){const e=v.ref(t),s=v.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 ps(){const t=v.ref(new Map),e=v.ref(0),s=v.computed(()=>e.value),a=v.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 p(){t.value.clear()}return{entityItemsAsArray:a,addOrReplaceItems:n,removeById:d,getItemById:u,clearItems:p,setTotalCount:i,getTotalCount:s}}class Ss{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 Is(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 ws(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 bs{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 T=class T{constructor(){}static GetInstance(){return T.instance||(T.instance=new T),T.instance}static registerHandler(e,s){T.handlers.set(e,s)}handle(e){var i;const s=((i=e.response)==null?void 0:i.status)??0,a=T.handlers.get(s);a&&a.handleError(e)}};T.handlers=new Map,T.instance=null;let Te=T;class As{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 Ds{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 Ms{constructor(){this._initializer=[]}setupInitializers(e){this._initializer.push(...e)}initialize(){for(const e of this._initializer)e.initialize()}}const Y=class Y{constructor(){this.jsonConverter=new _.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 Y.Instance||(Y.Instance=new Y),Y.Instance}};Y.Instance=null;let Oe=Y;var ot=(t=>(t.Success="success",t.Failure="error",t.Info="info",t.Warning="warning",t))(ot||{}),Ee=(t=>(t.BottomLeft="bottomLeft",t.TopLeft="topLeft",t))(Ee||{});class _s{constructor(e,s,a){this.placement=Ee.BottomLeft,this.type=e,this.message=s,this.description=a}}const Cs=Fe.defineStore(ge.Dialog,()=>{const t=v.reactive({dialogComponent:null,width:k.DefaultWidth,height:k.DefaultHeight,props:null,header:""}),e=v.computed(()=>!!t.dialogComponent),s=v.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,p){if(!e.value)throw new Error("there is no dialog to set size on");if(u<k.MinimalAvailableSize)throw new Error("negative size not supported");p===k.Width?t.width=u:t.height=u}function d(){t.props=null,t.height=k.DefaultHeight,t.width=k.DefaultWidth,t.header="",t.dialogComponent=null}return{dialogData:t,openDialog:a,clearDialog:d,setSize:o,setDialogHeader:i,setProps:n,isDialogExists:e,hasDefaultHeader:s}}),Rs=Fe.defineStore(ge.Drawer,()=>{const t=v.ref(J.Close),e=v.computed(()=>t.value===J.Open);function s(){t.value=J.Close}function a(){t.value=J.Open}return{closeDrawer:s,openDrawer:a,isDrawerOpen:e}});class Ls{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 Ts{constructor(e,s){this.next=null,this.name=e,this.next=s}addToManager(e){e.setProcessToMap(this),this.next&&this.next.addToManager(e)}}class Os{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 Es{constructor(e,s,a){this.scheduler=new _e({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 lt{}class ks extends lt{search(e,s,a){const i=[];e:for(const n of e)for(const o of a(n))if(B.removeSpacesFromString(String(o).toLowerCase()).indexOf(B.removeSpacesFromString(String(s).toLowerCase()))>-1){i.push(n);continue e}return i}}var ke=(t=>(t.Hidden="hidden",t.Visible="visible",t))(ke||{});class Ps{constructor(e){this._visibilityControl=e,this.mangeVisibilityEvent()}mangeVisibilityEvent(){document.addEventListener("visibilitychange",e=>{document.visibilityState===ke.Hidden?this._visibilityControl.screenInvisible(e):this._visibilityControl.screenVisible(e)})}}var Vs=Object.defineProperty,$s=Object.getOwnPropertyDescriptor,L=(t,e,s,a)=>{for(var i=a>1?void 0:a?$s(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&&Vs(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})}},L([_.JsonProperty("value",String,!0)],r.Amount.prototype,"value",2),L([_.JsonProperty("symbol",String)],r.Amount.prototype,"symbol",2),r.Amount=L([_.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}},L([_.JsonProperty("id",Object)],r.BaseModel.prototype,"id",2),r.BaseModel=L([_.JsonObject("BaseModel")],r.BaseModel),r.MinifiedSymbolModel=class extends r.BaseModel{},L([_.JsonProperty("symbol",String)],r.MinifiedSymbolModel.prototype,"symbol",2),L([_.JsonProperty("enName",String)],r.MinifiedSymbolModel.prototype,"enName",2),L([_.JsonProperty("faName",String)],r.MinifiedSymbolModel.prototype,"faName",2),L([_.JsonProperty("image",String)],r.MinifiedSymbolModel.prototype,"image",2),r.MinifiedSymbolModel=L([_.JsonObject("MinifiedSymbolModel")],r.MinifiedSymbolModel);class Fs{constructor(e,s){this.requestedDate=e,this.executedDate=s}get requestedDateInJalali(){return C.mapUnixToDate(this.requestedDate,q.SimpleDate)}get requestedTime(){return C.mapUnixToDate(this.requestedDate,q.JustHour)}get executedDateInJalali(){return C.mapUnixToDate(this.executedDate,q.SimpleDate)}get executedDateTime(){return C.mapUnixToDate(this.executedDate,q.JustHour)}}class Bs{constructor(e,s){this.requestedAmount=e,this.executedAmount=s}}class Ns{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 Us{constructor(e,s){this.soldSymbol=e,this.buySymbol=s}}r.APIErrorHandlerRegistry=Te,r.AbstractSubject=ls,r.AccessControl=De,r.AccessLevel=G,r.Action=is,r.ApiBuilder=As,r.ApplicationDrawerStatus=J,r.ApplicationInitializer=Ms,r.AuthorizationDirective=Me,r.AuthorizationService=ve,r.BaseTable=et,r.BehaviorSubject=R,r.CellType=me,r.ClientArraySearch=ks,r.ClientSearch=lt,r.Column=as,r.CommonMaskFormats=re,r.CrudService=Es,r.DateConverter=F,r.DateDisabledOptions=Ut,r.DateFormat=q,r.DateFormats=Ue,r.DateTools=ee,r.DebounceService=Ss,r.DialogDimensions=k,r.EveryAccess=Yt,r.EveryLevelAuthorizationDirective=Ht,r.Feedback=bs,r.FetchListResponse=ms,r.FormManager=Zt,r.FormValidationStatus=te,r.Formatter=C,r.GColumn=ds,r.GTable=fs,r.HandleError=Is,r.HandleFeedback=ws,r.HeaderType=fe,r.HttpClient=Ds,r.InputControl=Wt,r.InputControlBuilder=xt,r.InputControlData=Ze,r.JsonMapper=Oe,r.LoadingStatus=y,r.Params=at,r.Process=Ts,r.ProcessManager=Ls,r.RangeValue=Nt,r.RouteGuard=Os,r.Scheduler=_e,r.SelectableTable=ts,r.SelectableTableGenerator=cs,r.SimpleSort=Le,r.SomeAccess=jt,r.SomeLevelsAuthorizationDirective=qt,r.SortDetail=ye,r.SortOrder=O,r.SortOrderTableHeader=We,r.Sorter=es,r.StatusCode=xe,r.StorageKeys=P,r.StoreNames=ge,r.SymbolInTrade=Us,r.SymbolPriceInTrade=Ns,r.Symbols=Ke,r.SyncDetail=gs,r.TABLE_ACTION_COLUMN=Qt,r.TABLE_COLUMN_DEFAULT_COLSPAN=Re,r.TABLE_COLUMN_DEFAULT_VALUES=Qe,r.TABLE_COLUMN_DEFAULT_WIDTH=Ce,r.Table=rs,r.TableCellComponentRegistry=hs,r.TableConfig=us,r.TableConstants=Ae,r.TableDestroy=ns,r.TableGenerator=tt,r.TableHeaderAlign=de,r.TableRowClick=os,r.ToastLocation=Ee,r.ToastMessage=_s,r.ToastType=ot,r.TouchSensitiveControl=Kt,r.TradeAmount=Bs,r.TradeDate=Fs,r.Util=B,r.VisibilityManager=Ps,r.VisibilityState=ke,r.cards=Be,r.generateHeader=ss,r.ibans=Ne,r.isEmpty=Xe,r.isLastItem=Jt,r.isOnlyOneItem=zt,r.setupJalaliDate=Ge,r.setupStore=Gt,r.useCrud=ps,r.useData=st,r.useDialogService=Cs,r.useDrawerService=Rs,r.useForm=Xt,r.useLoadingStatus=nt,r.useParams=it,r.useRepository=vs,r.useStaticTableService=ys,Object.defineProperty(r,Symbol.toStringTag,{value:"Module"})});
|