jingcai-html-dist/public/seller/assets/tools.d504304c.js

2 lines
15 KiB
JavaScript

import{ay as Z,az as f,aA as C,aB as Q,aC as R,aD as P,aE as U,aq as J}from"./index.407529ee.js";const M=[-61,9,38,199,426,686,756,818,1111,1181,1210,1635,2060,2097,2192,2262,2324,2394,2456,3178];function Fe(e,t,r){return Object.prototype.toString.call(e)==="[object Date]"&&(r=e.getDate(),t=e.getMonth()+1,e=e.getFullYear()),V(x(e,t,r))}function be(e,t,r){return N(W(e,t,r))}function q(e){return G(e)===0}function B(e,t){return t<=6?31:t<=11||q(e)?30:29}function G(e){const t=M.length;let r=M[0],n,a,s,c,o;if(e<r||e>=M[t-1])throw new Error("Invalid Jalaali year "+e);for(o=1;o<t&&(n=M[o],a=n-r,!(e<n));o+=1)r=n;return c=e-r,a-c<6&&(c=c-a+d(a+4,33)*33),s=h(h(c+1,33)-1,4),s===-1&&(s=4),s}function z(e,t){const r=M.length,n=e+621;let a=-14,s=M[0],c,o,i,g,u;if(e<s||e>=M[r-1])throw new Error("Invalid Jalaali year "+e);for(u=1;u<r&&(c=M[u],o=c-s,!(e<c));u+=1)a=a+d(o,33)*8+d(h(o,33),4),s=c;g=e-s,a=a+d(g,33)*8+d(h(g,33)+3,4),h(o,33)===4&&o-g===4&&(a+=1);const l=d(n,4)-d((d(n,100)+1)*3,4)-150,y=20+a-l;return t||(o-g<6&&(g=g-o+d(o+4,33)*33),i=h(h(g+1,33)-1,4),i===-1&&(i=4)),{leap:i,gy:n,march:y}}function W(e,t,r){const n=z(e,!0);return x(n.gy,3,n.march)+(t-1)*31-d(t,7)*(t-7)+r-1}function V(e){const t=N(e).gy;let r=t-621,n,a,s;const c=z(r,!1),o=x(t,3,c.march);if(s=e-o,s>=0){if(s<=185)return a=1+d(s,31),n=h(s,31)+1,{jy:r,jm:a,jd:n};s-=186}else r-=1,s+=179,c.leap===1&&(s+=1);return a=7+d(s,30),n=h(s,30)+1,{jy:r,jm:a,jd:n}}function x(e,t,r){let n=d((e+d(t-8,6)+100100)*1461,4)+d(153*h(t+9,12)+2,5)+r-34840408;return n=n-d(d(e+100100+d(t-8,6),100)*3,4)+752,n}function N(e){let t=4*e+139361631;t=t+d(d(4*e+183187720,146097)*3,4)*4-3908;const r=d(h(t,1461),4)*5+308,n=d(h(r,153),5)+1,a=h(d(r,153),12)+1;return{gy:d(t,1461)-100100+d(8-a,6),gm:a,gd:n}}function d(e,t){return~~(e/t)}function h(e,t){return e-~~(e/t)*t}const A=864e5,K=36e5,S=6e4,_="YYYY-MM-DDTHH:mm:ss.SSSZ",ee=/\[((?:[^\]\\]|\\]|\\)*)\]|d{1,4}|M{1,4}|m{1,2}|w{1,2}|Qo|Do|D{1,4}|YY(?:YY)?|H{1,2}|h{1,2}|s{1,2}|S{1,3}|Z{1,2}|a{1,2}|[AQExX]/g,te=/(\[[^\]]*\])|d{1,4}|M{1,4}|m{1,2}|w{1,2}|Qo|Do|D{1,4}|YY(?:YY)?|H{1,2}|h{1,2}|s{1,2}|S{1,3}|Z{1,2}|a{1,2}|[AQExX]|([.*+:?^,\s${}()|\\]+)/g,w={};function ne(e,t){const r="("+t.days.join("|")+")",n=e+r;if(w[n]!==void 0)return w[n];const a="("+t.daysShort.join("|")+")",s="("+t.months.join("|")+")",c="("+t.monthsShort.join("|")+")",o={};let i=0;const g=e.replace(te,l=>{switch(i++,l){case"YY":return o.YY=i,"(-?\\d{1,2})";case"YYYY":return o.YYYY=i,"(-?\\d{1,4})";case"M":return o.M=i,"(\\d{1,2})";case"MM":return o.M=i,"(\\d{2})";case"MMM":return o.MMM=i,c;case"MMMM":return o.MMMM=i,s;case"D":return o.D=i,"(\\d{1,2})";case"Do":return o.D=i++,"(\\d{1,2}(st|nd|rd|th))";case"DD":return o.D=i,"(\\d{2})";case"H":return o.H=i,"(\\d{1,2})";case"HH":return o.H=i,"(\\d{2})";case"h":return o.h=i,"(\\d{1,2})";case"hh":return o.h=i,"(\\d{2})";case"m":return o.m=i,"(\\d{1,2})";case"mm":return o.m=i,"(\\d{2})";case"s":return o.s=i,"(\\d{1,2})";case"ss":return o.s=i,"(\\d{2})";case"S":return o.S=i,"(\\d{1})";case"SS":return o.S=i,"(\\d{2})";case"SSS":return o.S=i,"(\\d{3})";case"A":return o.A=i,"(AM|PM)";case"a":return o.a=i,"(am|pm)";case"aa":return o.aa=i,"(a\\.m\\.|p\\.m\\.)";case"ddd":return a;case"dddd":return r;case"Q":case"d":case"E":return"(\\d{1})";case"Qo":return"(1st|2nd|3rd|4th)";case"DDD":case"DDDD":return"(\\d{1,3})";case"w":return"(\\d{1,2})";case"ww":return"(\\d{2})";case"Z":return o.Z=i,"(Z|[+-]\\d{2}:\\d{2})";case"ZZ":return o.ZZ=i,"(Z|[+-]\\d{2}\\d{2})";case"X":return o.X=i,"(-?\\d+)";case"x":return o.x=i,"(-?\\d{4,})";default:return i--,l[0]==="["&&(l=l.substring(1,l.length-1)),l.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}}),u={map:o,regex:new RegExp("^"+g)};return w[n]=u,u}function j(e,t){return e!==void 0?e:t!==void 0?t.date:Q.date}function F(e,t=""){const r=e>0?"-":"+",n=Math.abs(e),a=Math.floor(n/60),s=n%60;return r+f(a)+t+f(s)}function re(e,t,r){let n=e.getFullYear(),a=e.getMonth();const s=e.getDate();return t.year!==void 0&&(n+=r*t.year,delete t.year),t.month!==void 0&&(a+=r*t.month,delete t.month),e.setDate(1),e.setMonth(2),e.setFullYear(n),e.setMonth(a),e.setDate(Math.min(s,T(e))),t.date!==void 0&&(e.setDate(e.getDate()+r*t.date),delete t.date),e}function ae(e,t,r){const n=t.year!==void 0?t.year:e[`get${r}FullYear`](),a=t.month!==void 0?t.month-1:e[`get${r}Month`](),s=new Date(n,a+1,0).getDate(),c=Math.min(s,t.date!==void 0?t.date:e[`get${r}Date`]());return e[`set${r}Date`](1),e[`set${r}Month`](2),e[`set${r}FullYear`](n),e[`set${r}Month`](a),e[`set${r}Date`](c),delete t.year,delete t.month,delete t.date,e}function I(e,t,r){const n=k(t),a=new Date(e),s=n.year!==void 0||n.month!==void 0||n.date!==void 0?re(a,n,r):a;for(const c in n){const o=R(c);s[`set${o}`](s[`get${o}`]()+r*n[c])}return s}function k(e){const t={...e};return e.years!==void 0&&(t.year=e.years,delete t.years),e.months!==void 0&&(t.month=e.months,delete t.months),e.days!==void 0&&(t.date=e.days,delete t.days),e.day!==void 0&&(t.date=e.day,delete t.day),e.hour!==void 0&&(t.hours=e.hour,delete t.hour),e.minute!==void 0&&(t.minutes=e.minute,delete t.minute),e.second!==void 0&&(t.seconds=e.second,delete t.second),e.millisecond!==void 0&&(t.milliseconds=e.millisecond,delete t.millisecond),t}function L(e,t,r){const n=k(t),a=r===!0?"UTC":"",s=new Date(e),c=n.year!==void 0||n.month!==void 0||n.date!==void 0?ae(s,n,a):s;for(const o in n){const i=o.charAt(0).toUpperCase()+o.slice(1);c[`set${a}${i}`](n[o])}return c}function se(e,t,r){const n=oe(e,t,r),a=new Date(n.year,n.month===null?null:n.month-1,n.day===null?1:n.day,n.hour,n.minute,n.second,n.millisecond),s=a.getTimezoneOffset();return n.timezoneOffset===null||n.timezoneOffset===s?a:I(a,{minutes:n.timezoneOffset-s},1)}function oe(e,t,r,n,a){const s={year:null,month:null,day:null,hour:null,minute:null,second:null,millisecond:null,timezoneOffset:null,dateHash:null,timeHash:null};if(a!==void 0&&Object.assign(s,a),e==null||e===""||typeof e!="string")return s;t===void 0&&(t=_);const c=j(r,Z.props),o=c.months,i=c.monthsShort,{regex:g,map:u}=ne(t,c),l=e.match(g);if(l===null)return s;let y="";if(u.X!==void 0||u.x!==void 0){const m=parseInt(l[u.X!==void 0?u.X:u.x],10);if(isNaN(m)===!0||m<0)return s;const p=new Date(m*(u.X!==void 0?1e3:1));s.year=p.getFullYear(),s.month=p.getMonth()+1,s.day=p.getDate(),s.hour=p.getHours(),s.minute=p.getMinutes(),s.second=p.getSeconds(),s.millisecond=p.getMilliseconds()}else{if(u.YYYY!==void 0)s.year=parseInt(l[u.YYYY],10);else if(u.YY!==void 0){const m=parseInt(l[u.YY],10);s.year=m<0?m:2e3+m}if(u.M!==void 0){if(s.month=parseInt(l[u.M],10),s.month<1||s.month>12)return s}else u.MMM!==void 0?s.month=i.indexOf(l[u.MMM])+1:u.MMMM!==void 0&&(s.month=o.indexOf(l[u.MMMM])+1);if(u.D!==void 0){if(s.day=parseInt(l[u.D],10),s.year===null||s.month===null||s.day<1)return s;const m=n!=="persian"?new Date(s.year,s.month,0).getDate():B(s.year,s.month);if(s.day>m)return s}u.H!==void 0?s.hour=parseInt(l[u.H],10)%24:u.h!==void 0&&(s.hour=parseInt(l[u.h],10)%12,(u.A&&l[u.A]==="PM"||u.a&&l[u.a]==="pm"||u.aa&&l[u.aa]==="p.m.")&&(s.hour+=12),s.hour=s.hour%24),u.m!==void 0&&(s.minute=parseInt(l[u.m],10)%60),u.s!==void 0&&(s.second=parseInt(l[u.s],10)%60),u.S!==void 0&&(s.millisecond=parseInt(l[u.S],10)*10**(3-l[u.S].length)),(u.Z!==void 0||u.ZZ!==void 0)&&(y=u.Z!==void 0?l[u.Z].replace(":",""):l[u.ZZ],s.timezoneOffset=(y[0]==="+"?-1:1)*(60*y.slice(1,3)+1*y.slice(3,5)))}return s.dateHash=f(s.year,6)+"/"+f(s.month)+"/"+f(s.day),s.timeHash=f(s.hour)+":"+f(s.minute)+":"+f(s.second)+y,s}function ue(e){return typeof e=="number"?!0:isNaN(Date.parse(e))===!1}function ie(e,t){return L(new Date,e,t)}function ce(e){const t=new Date(e).getDay();return t===0?7:t}function $(e){const t=new Date(e.getFullYear(),e.getMonth(),e.getDate());t.setDate(t.getDate()-(t.getDay()+6)%7+3);const r=new Date(t.getFullYear(),0,4);r.setDate(r.getDate()-(r.getDay()+6)%7+3);const n=t.getTimezoneOffset()-r.getTimezoneOffset();t.setHours(t.getHours()-n);const a=(t-r)/(A*7);return 1+Math.floor(a)}function le(e){return e.getFullYear()*1e4+e.getMonth()*100+e.getDate()}function v(e,t){const r=new Date(e);return t===!0?le(r):r.getTime()}function de(e,t,r,n={}){const a=v(t,n.onlyDate),s=v(r,n.onlyDate),c=v(e,n.onlyDate);return(c>a||n.inclusiveFrom===!0&&c===a)&&(c<s||n.inclusiveTo===!0&&c===s)}function fe(e,t){return I(e,t,1)}function he(e,t){return I(e,t,-1)}function D(e,t,r){const n=new Date(e),a=`set${r===!0?"UTC":""}`;switch(t){case"year":case"years":n[`${a}Month`](0);case"month":case"months":n[`${a}Date`](1);case"day":case"days":case"date":n[`${a}Hours`](0);case"hour":case"hours":n[`${a}Minutes`](0);case"minute":case"minutes":n[`${a}Seconds`](0);case"second":case"seconds":n[`${a}Milliseconds`](0)}return n}function ge(e,t,r){const n=new Date(e),a=`set${r===!0?"UTC":""}`;switch(t){case"year":case"years":n[`${a}Month`](11);case"month":case"months":n[`${a}Date`](T(n));case"day":case"days":case"date":n[`${a}Hours`](23);case"hour":case"hours":n[`${a}Minutes`](59);case"minute":case"minutes":n[`${a}Seconds`](59);case"second":case"seconds":n[`${a}Milliseconds`](999)}return n}function De(e){let t=new Date(e);return Array.prototype.slice.call(arguments,1).forEach(r=>{t=Math.max(t,new Date(r))}),t}function me(e){let t=new Date(e);return Array.prototype.slice.call(arguments,1).forEach(r=>{t=Math.min(t,new Date(r))}),t}function Y(e,t,r){return(e.getTime()-e.getTimezoneOffset()*S-(t.getTime()-t.getTimezoneOffset()*S))/r}function X(e,t,r="days"){const n=new Date(e),a=new Date(t);switch(r){case"years":case"year":return n.getFullYear()-a.getFullYear();case"months":case"month":return(n.getFullYear()-a.getFullYear())*12+n.getMonth()-a.getMonth();case"days":case"day":case"date":return Y(D(n,"day"),D(a,"day"),A);case"hours":case"hour":return Y(D(n,"hour"),D(a,"hour"),K);case"minutes":case"minute":return Y(D(n,"minute"),D(a,"minute"),S);case"seconds":case"second":return Y(D(n,"second"),D(a,"second"),1e3)}}function H(e){return X(e,D(e,"year"),"days")+1}function Me(e){return C(e)===!0?"date":typeof e=="number"?"number":"string"}function ye(e,t,r){const n=new Date(e);if(t){const a=new Date(t);if(n<a)return a}if(r){const a=new Date(r);if(n>a)return a}return n}function pe(e,t,r){const n=new Date(e),a=new Date(t);if(r===void 0)return n.getTime()===a.getTime();switch(r){case"second":case"seconds":if(n.getSeconds()!==a.getSeconds())return!1;case"minute":case"minutes":if(n.getMinutes()!==a.getMinutes())return!1;case"hour":case"hours":if(n.getHours()!==a.getHours())return!1;case"day":case"days":case"date":if(n.getDate()!==a.getDate())return!1;case"month":case"months":if(n.getMonth()!==a.getMonth())return!1;case"year":case"years":if(n.getFullYear()!==a.getFullYear())return!1;break;default:throw new Error(`date isSameDate unknown unit ${r}`)}return!0}function T(e){return new Date(e.getFullYear(),e.getMonth()+1,0).getDate()}function b(e){if(e>=11&&e<=13)return`${e}th`;switch(e%10){case 1:return`${e}st`;case 2:return`${e}nd`;case 3:return`${e}rd`}return`${e}th`}const O={YY(e,t,r){const n=this.YYYY(e,t,r)%100;return n>=0?f(n):"-"+f(Math.abs(n))},YYYY(e,t,r){return r!=null?r:e.getFullYear()},M(e){return e.getMonth()+1},MM(e){return f(e.getMonth()+1)},MMM(e,t){return t.monthsShort[e.getMonth()]},MMMM(e,t){return t.months[e.getMonth()]},Q(e){return Math.ceil((e.getMonth()+1)/3)},Qo(e){return b(this.Q(e))},D(e){return e.getDate()},Do(e){return b(e.getDate())},DD(e){return f(e.getDate())},DDD(e){return H(e)},DDDD(e){return f(H(e),3)},d(e){return e.getDay()},dd(e,t){return this.dddd(e,t).slice(0,2)},ddd(e,t){return t.daysShort[e.getDay()]},dddd(e,t){return t.days[e.getDay()]},E(e){return e.getDay()||7},w(e){return $(e)},ww(e){return f($(e))},H(e){return e.getHours()},HH(e){return f(e.getHours())},h(e){const t=e.getHours();return t===0?12:t>12?t%12:t},hh(e){return f(this.h(e))},m(e){return e.getMinutes()},mm(e){return f(e.getMinutes())},s(e){return e.getSeconds()},ss(e){return f(e.getSeconds())},S(e){return Math.floor(e.getMilliseconds()/100)},SS(e){return f(Math.floor(e.getMilliseconds()/10))},SSS(e){return f(e.getMilliseconds(),3)},A(e){return this.H(e)<12?"AM":"PM"},a(e){return this.H(e)<12?"am":"pm"},aa(e){return this.H(e)<12?"a.m.":"p.m."},Z(e,t,r,n){const a=n==null?e.getTimezoneOffset():n;return F(a,":")},ZZ(e,t,r,n){const a=n==null?e.getTimezoneOffset():n;return F(a)},X(e){return Math.floor(e.getTime()/1e3)},x(e){return e.getTime()}};function Ye(e,t,r,n,a){if(e!==0&&!e||e===1/0||e===-1/0)return;const s=new Date(e);if(isNaN(s))return;t===void 0&&(t=_);const c=j(r,Z.props);return t.replace(ee,(o,i)=>o in O?O[o](s,c,n,a):i===void 0?o:i.split("\\]").join("]"))}function we(e){return C(e)===!0?new Date(e.getTime()):e}var E={isValid:ue,extractDate:se,buildDate:ie,getDayOfWeek:ce,getWeekOfYear:$,isBetweenDates:de,addToDate:fe,subtractFromDate:he,adjustDate:L,startOfDate:D,endOfDate:ge,getMaxDate:De,getMinDate:me,getDateDiff:X,getDayOfYear:H,inferDateFormat:Me,getDateBetween:ye,isSameDate:pe,daysInMonth:T,formatDate:Ye,clone:we};function ve(e){const t=document.createElement("textarea");t.value=e,t.contentEditable="true",t.style.position="fixed";const r=()=>{};P(r),document.body.appendChild(t),t.focus(),t.select();const n=document.execCommand("copy");return t.remove(),U(r),n}function Se(e){return navigator.clipboard!==void 0?navigator.clipboard.writeText(e):new Promise((t,r)=>{const n=ve(e);n?t(!0):r(n)})}let $e=/^(([1-6][1-9]|50)\d{4}(18|19|20)\d{2}((0[1-9])|10|11|12)(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx])$/,He=/^(([1-6][1-9]|50)\d{4}\d{2}((0[1-9])|10|11|12)(([0-2][1-9])|10|20|30|31)\d{3})$/;function xe(e){return RegExp([$e.source,He.source].join("|"),"g").test(e)}function Ie(e){return/^1\d{10}$/g.test(e)}const Oe={cardNo:function(e){return xe(e)||"\u8BF7\u8F93\u5165\u6B63\u786E\u7684\u8EAB\u4EFD\u8BC1"},phone:function(e){return Ie(e)||"\u8BF7\u586B\u5199\u6B63\u786E\u7684\u624B\u673A\u53F7\u7801"},password:function(e){return(e+"").length>=6||"\u5BC6\u7801\u81F3\u5C116\u4F4D"},required:function(e){return e!==null&&e!==""||"\u5FC5\u586B\u9879"},sameAs:function(e,t){return r=>r==e||t},strLength:function(e,t){return r=>r.length==e||t},greaterThan:function(e,t){return r=>r*1>e||t||"\u9700\u8981\u5927\u4E8E"+e},lessThan:function(e,t){return r=>r*1<e||t||"\u9700\u8981\u5C0F\u4E8E"+e},lessEqualThan:function(e,t){return r=>r*1<=e||t||"\u9700\u8981\u5C0F\u4E8E\u7B49\u4E8E"+e},number:function(e,t){return r=>{let n=r*1;return typeof n!="number"?"\u5FC5\u987B\u662F\u6570\u5B57":!n&&n!==0?"\u8BF7\u586B\u5199\u6B63\u786E\u7684\u6570\u5B57":n.toFixed(e)*1==n||t||(e?`\u5C0F\u6570\u4F4D\u4E0D\u80FD\u591A\u4E8E${e}\u4F4D`:"\u5FC5\u987B\u4E3A\u6574\u6570")}}};function Ee(e){try{let t=E.extractDate(e,"YYYY-MM-DD HH:mm:ss");return t.getFullYear()=="1900"&&(t=new Date(e)),new Date().getFullYear()!=t.getFullYear()?e:E.formatDate(t.getTime(),"MM-DD HH:mm")}catch(t){return console.error(t),e}}function Ze(e=0){return e=parseFloat(e),e.toFixed(2)}function Ce(e){return Se(e).catch(t=>new Promise((r,n)=>{const a=document.createElement("textarea");a.value=e,a.contentEditable="true",a.style.position="fixed",document.body.appendChild(a),a.focus(),a.select();const s=document.execCommand("copy");a.remove(),s?r(!0):n(s)})).then(()=>{J.create({position:"center",message:"\u5DF2\u590D\u5236"})})}export{Oe as R,oe as _,be as a,Ye as b,Ee as c,E as d,Ze as f,X as g,B as j,Ce as s,Fe as t};