Release v27.000 (from 0d3d8bbd)
This commit is contained in:
@@ -100,12 +100,10 @@
|
||||
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
}</style></head><body><form class="table-fill"><h1>Advanced Charts Session Parser</h1><input id="session" class="input-field" name="session" value="24x7" maxlength="500" autocomplete="off"><div id="result" class="results"></div></form><script defer="defer">(()=>{var t={521:function(t,e,r){var n;!function(o){"use strict";var s,i=1e6,a=1e6,c="[big.js] ",u=c+"Invalid ",f=u+"decimal places",l=c+"Division by zero",h={},d=void 0,g=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function p(t,e,r,n){var o=t.c;if(r===d&&(r=t.constructor.RM),0!==r&&1!==r&&2!==r&&3!==r)throw Error("[big.js] Invalid rounding mode");if(e<1)n=3===r&&(n||!!o[0])||0===e&&(1===r&&o[0]>=5||2===r&&(o[0]>5||5===o[0]&&(n||o[1]!==d))),o.length=1,n?(t.e=t.e-e+1,o[0]=1):o[0]=t.e=0;else if(e<o.length){if(n=1===r&&o[e]>=5||2===r&&(o[e]>5||5===o[e]&&(n||o[e+1]!==d||1&o[e-1]))||3===r&&(n||!!o[0]),o.length=e--,n)for(;++o[e]>9;)o[e]=0,e--||(++t.e,o.unshift(1));for(e=o.length;!o[--e];)o.pop()}return t}function m(t,e,r){var n=t.e,o=t.c.join(""),s=o.length;if(e)o=o.charAt(0)+(s>1?"."+o.slice(1):"")+(n<0?"e":"e+")+n;else if(n<0){for(;++n;)o="0"+o;o="0."+o}else if(n>0)if(++n>s)for(n-=s;n--;)o+="0";else n<s&&(o=o.slice(0,n)+"."+o.slice(n));else s>1&&(o=o.charAt(0)+"."+o.slice(1));return t.s<0&&r?"-"+o:o}h.abs=function(){var t=new this.constructor(this);return t.s=1,t},h.cmp=function(t){var e,r=this,n=r.c,o=(t=new r.constructor(t)).c,s=r.s,i=t.s,a=r.e,c=t.e;if(!n[0]||!o[0])return n[0]?s:o[0]?-i:0;if(s!=i)return s;if(e=s<0,a!=c)return a>c^e?1:-1;for(i=(a=n.length)<(c=o.length)?a:c,s=-1;++s<i;)if(n[s]!=o[s])return n[s]>o[s]^e?1:-1;return a==c?0:a>c^e?1:-1},h.div=function(t){var e=this,r=e.constructor,n=e.c,o=(t=new r(t)).c,s=e.s==t.s?1:-1,a=r.DP;if(a!==~~a||a<0||a>i)throw Error(f);if(!o[0])throw Error(l);if(!n[0])return t.s=s,t.c=[t.e=0],t;var c,u,h,g,m,y=o.slice(),_=c=o.length,E=n.length,D=n.slice(0,c),w=D.length,v=t,A=v.c=[],N=0,O=a+(v.e=e.e-t.e)+1;for(v.s=s,s=O<0?0:O,y.unshift(0);w++<c;)D.push(0);do{for(h=0;h<10;h++){if(c!=(w=D.length))g=c>w?1:-1;else for(m=-1,g=0;++m<c;)if(o[m]!=D[m]){g=o[m]>D[m]?1:-1;break}if(!(g<0))break;for(u=w==c?o:y;w;){if(D[--w]<u[w]){for(m=w;m&&!D[--m];)D[m]=9;--D[m],D[w]+=10}D[w]-=u[w]}for(;!D[0];)D.shift()}A[N++]=g?h:++h,D[0]&&g?D[w]=n[_]||0:D=[n[_]]}while((_++<E||D[0]!==d)&&s--);return A[0]||1==N||(A.shift(),v.e--,O--),N>O&&p(v,O,r.RM,D[0]!==d),v},h.eq=function(t){return 0===this.cmp(t)},h.gt=function(t){return this.cmp(t)>0},h.gte=function(t){return this.cmp(t)>-1},h.lt=function(t){return this.cmp(t)<0},h.lte=function(t){return this.cmp(t)<1},h.minus=h.sub=function(t){var e,r,n,o,s=this,i=s.constructor,a=s.s,c=(t=new i(t)).s;if(a!=c)return t.s=-c,s.plus(t);var u=s.c.slice(),f=s.e,l=t.c,h=t.e;if(!u[0]||!l[0])return l[0]?t.s=-c:u[0]?t=new i(s):t.s=1,t;if(a=f-h){for((o=a<0)?(a=-a,n=u):(h=f,n=l),n.reverse(),c=a;c--;)n.push(0);n.reverse()}else for(r=((o=u.length<l.length)?u:l).length,a=c=0;c<r;c++)if(u[c]!=l[c]){o=u[c]<l[c];break}if(o&&(n=u,u=l,l=n,t.s=-t.s),(c=(r=l.length)-(e=u.length))>0)for(;c--;)u[e++]=0;for(c=e;r>a;){if(u[--r]<l[r]){for(e=r;e&&!u[--e];)u[e]=9;--u[e],u[r]+=10}u[r]-=l[r]}for(;0===u[--c];)u.pop();for(;0===u[0];)u.shift(),--h;return u[0]||(t.s=1,u=[h=0]),t.c=u,t.e=h,t},h.mod=function(t){var e,r=this,n=r.constructor,o=r.s,s=(t=new n(t)).s;if(!t.c[0])throw Error(l);return r.s=t.s=1,
|
||||
e=1==t.cmp(r),r.s=o,t.s=s,e?new n(r):(o=n.DP,s=n.RM,n.DP=n.RM=0,r=r.div(t),n.DP=o,n.RM=s,this.minus(r.times(t)))},h.plus=h.add=function(t){var e,r,n,o=this,s=o.constructor;if(t=new s(t),o.s!=t.s)return t.s=-t.s,o.minus(t);var i=o.e,a=o.c,c=t.e,u=t.c;if(!a[0]||!u[0])return u[0]||(a[0]?t=new s(o):t.s=o.s),t;if(a=a.slice(),e=i-c){for(e>0?(c=i,n=u):(e=-e,n=a),n.reverse();e--;)n.push(0);n.reverse()}for(a.length-u.length<0&&(n=u,u=a,a=n),e=u.length,r=0;e;a[e]%=10)r=(a[--e]=a[e]+u[e]+r)/10|0;for(r&&(a.unshift(r),++c),e=a.length;0===a[--e];)a.pop();return t.c=a,t.e=c,t},h.pow=function(t){var e=this,r=new e.constructor("1"),n=r,o=t<0;if(t!==~~t||t<-1e6||t>a)throw Error(u+"exponent");for(o&&(t=-t);1&t&&(n=n.times(e)),t>>=1;)e=e.times(e);return o?r.div(n):n},h.prec=function(t,e){if(t!==~~t||t<1||t>i)throw Error(u+"precision");return p(new this.constructor(this),t,e)},h.round=function(t,e){if(t===d)t=0;else if(t!==~~t||t<-i||t>i)throw Error(f);return p(new this.constructor(this),t+this.e+1,e)},h.sqrt=function(){var t,e,r,n=this,o=n.constructor,s=n.s,i=n.e,a=new o("0.5");if(!n.c[0])return new o(n);if(s<0)throw Error(c+"No square root");0===(s=Math.sqrt(n+""))||s===1/0?((e=n.c.join("")).length+i&1||(e+="0"),i=((i+1)/2|0)-(i<0||1&i),t=new o(((s=Math.sqrt(e))==1/0?"5e":(s=s.toExponential()).slice(0,s.indexOf("e")+1))+i)):t=new o(s+""),i=t.e+(o.DP+=4);do{r=t,t=a.times(r.plus(n.div(r)))}while(r.c.slice(0,i).join("")!==t.c.slice(0,i).join(""));return p(t,(o.DP-=4)+t.e+1,o.RM)},h.times=h.mul=function(t){var e,r=this,n=r.constructor,o=r.c,s=(t=new n(t)).c,i=o.length,a=s.length,c=r.e,u=t.e;if(t.s=r.s==t.s?1:-1,!o[0]||!s[0])return t.c=[t.e=0],t;for(t.e=c+u,i<a&&(e=o,o=s,s=e,u=i,i=a,a=u),e=new Array(u=i+a);u--;)e[u]=0;for(c=a;c--;){for(a=0,u=i+c;u>c;)a=e[u]+s[c]*o[u-c-1]+a,e[u--]=a%10,a=a/10|0;e[u]=a}for(a?++t.e:e.shift(),c=e.length;!e[--c];)e.pop();return t.c=e,t},h.toExponential=function(t,e){var r=this,n=r.c[0];if(t!==d){if(t!==~~t||t<0||t>i)throw Error(f);for(r=p(new r.constructor(r),++t,e);r.c.length<t;)r.c.push(0)}return m(r,!0,!!n)},h.toFixed=function(t,e){var r=this,n=r.c[0];if(t!==d){if(t!==~~t||t<0||t>i)throw Error(f);for(t=t+(r=p(new r.constructor(r),t+r.e+1,e)).e+1;r.c.length<t;)r.c.push(0)}return m(r,!1,!!n)},h.toJSON=h.toString=function(){var t=this,e=t.constructor;return m(t,t.e<=e.NE||t.e>=e.PE,!!t.c[0])},h.toNumber=function(){var t=Number(m(this,!0,!0));if(!0===this.constructor.strict&&!this.eq(t.toString()))throw Error(c+"Imprecise conversion");return t},h.toPrecision=function(t,e){var r=this,n=r.constructor,o=r.c[0];if(t!==d){if(t!==~~t||t<1||t>i)throw Error(u+"precision");for(r=p(new n(r),t,e);r.c.length<t;)r.c.push(0)}return m(r,t<=r.e||r.e<=n.NE||r.e>=n.PE,!!o)},h.valueOf=function(){var t=this,e=t.constructor;if(!0===e.strict)throw Error(c+"valueOf disallowed");return m(t,t.e<=e.NE||t.e>=e.PE,!0)},s=function t(){function e(r){var n=this;if(!(n instanceof e))return r===d?t():new e(r);if(r instanceof e)n.s=r.s,n.e=r.e,n.c=r.c.slice();else{if("string"!=typeof r){if(!0===e.strict)throw TypeError(u+"number")
|
||||
;r=0===r&&1/r<0?"-0":String(r)}!function(t,e){var r,n,o;if(!g.test(e))throw Error(u+"number");t.s="-"==e.charAt(0)?(e=e.slice(1),-1):1,(r=e.indexOf("."))>-1&&(e=e.replace(".",""));(n=e.search(/e/i))>0?(r<0&&(r=n),r+=+e.slice(n+1),e=e.substring(0,n)):r<0&&(r=e.length);for(o=e.length,n=0;n<o&&"0"==e.charAt(n);)++n;if(n==o)t.c=[t.e=0];else{for(;o>0&&"0"==e.charAt(--o););for(t.e=r-n-1,t.c=[],r=0;n<=o;)t.c[r++]=+e.charAt(n++)}}(n,r)}n.constructor=e}return e.prototype=h,e.DP=20,e.RM=1,e.NE=-7,e.PE=21,e.strict=false,e.roundDown=0,e.roundHalfUp=1,e.roundHalfEven=2,e.roundUp=3,e}(),s.default=s.Big=s,void 0===(n=function(){return s}.call(e,r,e,t))||(t.exports=n)}()},480:(t,e,r)=>{"use strict";var n=r(917),o=r(53).tzData;let s;function i(t){this._name=t;var e=o[t];if(!e&&s&&(e=s.instance().getTimezoneData(t)),e||(e={time:[],offset:[]},this._invalid=!0),e.time.length!==e.offset.length&&(e={time:[],offset:[]},this._invalid=!0),!e.time_utc){for(var r=e.time,n=e.offset,i=r.length,a=new Array(i),c=0;c<i;c++)r[c]*=1e3,n[c]*=1e3,a[c]=r[c]-n[c];e.time_utc=a}this.tz=e}function a(t,e){var r=t.length;if(0===r)return-1;if(isNaN(e))throw Error("Key is NaN");for(var n=0,o=r-1,s=c((n+o)/2);;){if(t[s]>e){if((o=s-1)<n)return s}else if(o<(n=s+1))return s<r-1?s+1:-1;s=c((n+o)/2)}}i.prototype.offset_utc=function(t){return i._offset(this.tz.time_utc,this.tz.offset,t)},i.prototype.offset_loc=function(t){return i._offset(this.tz.time,this.tz.offset,t)},i.prototype.name=function(){return this._name},i.prototype.correction_loc=function(t){var e=this.tz.time,r=this.tz.offset,n=a(e,t);if(n<1)return 0;var o=r[n]-r[n-1];if(o>0&&t-e[n-1]<=o)return o;return 0},i.prototype.is_valid=function(){return!this._invalid},i._offset=function(t,e,r){var n=a(t,r);return-1===n?0:e[n]};var c=function(t){return 0|t},u=function(t){return 60*t*1e3},f=function(t,e){return l(t)-l(e)},l=function(t){return t<0?c(t/1e3)-(t%1e3!=0?1:0):c(t/1e3)};function h(t){return t%4==0&&(t%100!=0||t%400==0)}var d={0:0,1:31,2:59,3:90,4:120,5:151,6:181,7:212,8:243,9:273,10:304,11:334},g={...n.WeekDays,...n.Months,YEAR:1,MONTH:2,WEEK_OF_YEAR:3,DAY_OF_MONTH:5,DAY_OF_YEAR:6,DAY_OF_WEEK:7,HOUR_OF_DAY:11,MINUTE:12,SECOND:13,minutesPerDay:1440,millisecondsPerDay:u(1440),get_minutes_from_hhmm:function(t){return-1!==t.indexOf(":")&&(t=t.split(":").join("")),t%100+60*c(t/100)},get_year:function(t){return t.getUTCFullYear()},get_month:function(t){return t.getUTCMonth()},get_hours:function(t){return t.getUTCHours()},get_minutes:function(t){return t.getUTCMinutes()},get_seconds:function(t){return t.getUTCSeconds()},get_day_of_month:function(t){return t.getUTCDate()},get_day_of_week:function(t){return t.getUTCDay()+1},get_day_of_year:function(t){var e=t.getUTCMonth(),r=d[e];return e>g.JANUARY+1&&h(t.getUTCFullYear())&&(r+=1),r+t.getUTCDate()},get_week_of_year:function(t){var e=new Date(Date.UTC(t.getUTCFullYear(),0,1)).getUTCDay(),r=0===e?1:8-e,n=g.get_day_of_year(t)-r;return Math.ceil(n/7)+1},get_minutes_from_midnight:function(t){return 60*g.get_hours(t)+g.get_minutes(t)},set_hms:function(t,e,r,n,o,s){
|
||||
t.setUTCHours(e),t.setUTCMinutes(r),t.setUTCSeconds(n),t.setUTCMilliseconds(o),void 0!==s&&g.correct_time(t,s)},correct_time:function(t,e){var r=t.getTime(),n=e.correction_loc(r);t.setTime(r+n)},add_days_considering_dst:function(t,e,r){var n=t.offset_utc(e),o=this.clone(e);this.add_date(o,r);var s=t.offset_utc(o);return o.setTime(o.getTime()+n-s),o},add_years_considering_dst:function(t,e,r){let n=e;for(let e=Math.abs(r);e>0;e--)n=this.add_days_considering_dst(t,n,this.get_days_per_year(n)*Math.sign(r));return n},add_date:function(t,e){t.setTime(t.getTime()+e*g.millisecondsPerDay)},add_minutes:function(t,e){t.setTime(t.getTime()+u(e))},clone:function(t){return new Date(t.getTime())},get_days_per_year:function(t){var e=t.getUTCFullYear();return this.days_per_year(e)},days_per_year:function(t){return h(t)?366:365},get_days_in_month:function(t,e){let r;switch(t){case 0:case 2:case 4:case 6:case 7:case 9:case 11:r=31;break;case 1:r=28,h(e)&&r++;break;default:r=30}return r},get_part:function(t,e){switch(e){case g.YEAR:return g.get_year(t);case g.MONTH:return g.get_month(t);case g.DAY_OF_MONTH:return g.get_day_of_month(t);case g.WEEK_OF_YEAR:return g.get_week_of_year(t);case g.DAY_OF_WEEK:return g.get_day_of_week(t);case g.HOUR_OF_DAY:return g.get_hours(t);case g.MINUTE:return g.get_minutes(t);case g.DAY_OF_YEAR:return g.get_day_of_year(t);case g.SECOND:return g.get_seconds(t);default:return t.getTime()}},time_minutes:u,time_seconds:function(t){return 1e3*t},time_minutes_diff:function(t,e){return c(f(t,e)/60)},time_seconds_diff:f,utc_to_cal:function(t,e){return new Date(g.utc_to_cal_ts(t,e))},utc_to_cal_ts:function(t,e){return e+t.offset_utc(e)},get_cal:function(t,e,r,n,o,s,i){var a=new Date(Date.UTC(e,r,n,o||0,s||0,i||0)),c=t.offset_utc(+a);return new Date(a.valueOf()-c)},get_cal_from_unix_timestamp_ms:function(t,e){return new Date(e+t.offset_utc(e))},get_cal_utc:function(t,e,r){return new Date(Date.UTC(t,e,r))},cal_to_utc:function(t,e){var r=e.getTime();return r-t.offset_loc(r)},get_timezone:function(t){return new i(t)},shift_day:function(t,e){var r=t-1;return(r+=e)>6?r%=7:r<0&&(r=(7+r%7)%7),r+1},setCustomTimezones:function(t){s=t}};t.exports=g},643:function(t,e,r){var n;t=r.nmd(t);var o=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},s=function(t){return"object"==typeof t&&null!==t};function i(t){return"number"==typeof t&&isFinite(t)}function a(t){return null!=t&&(t.constructor===Function||"[object Function]"===Object.prototype.toString.call(t))}function c(t,e){t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}"undefined"!=typeof window?(n=window.TradingView=window.TradingView||{},window.isNumber=i,window.isFunction=a,window.inherit=c,window.isArray=o):n=this.TradingView=this.TradingView||{},n.isNaN=function(t){return!(t<=0||t>0)},n.isAbsent=function(t){return null==t},n.isExistent=function(t){return null!=t},Number.isNaN=Number.isNaN||function(t){return t!=t},n.isSameType=function(t,e){
|
||||
return Number.isNaN(t)||Number.isNaN(e)?Number.isNaN(t)===Number.isNaN(e):{}.toString.call(t)==={}.toString.call(e)},n.isInteger=function(t){return"number"==typeof t&&t%1==0},n.isString=function(t){return null!=t&&t.constructor===String},n.isInherited=function(t,e){if(null==t||null==t.prototype)throw new TypeError("isInherited: child should be a constructor function");if(null==e||null==e.prototype)throw new TypeError("isInherited: parent should be a constructor function");return t.prototype instanceof e||t.prototype===e.prototype},n.clone=function(t){if(!t||"object"!=typeof t)return t;var e,r,o;for(r in e="function"==typeof t.pop?[]:{},t)t.hasOwnProperty(r)&&(o=t[r],e[r]=o&&"object"==typeof o?n.clone(o):o);return e},n.deepEquals=function(t,e,r){if(r||(r=""),t===e)return[!0,r];if(a(t)&&(t=void 0),a(e)&&(e=void 0),void 0===t&&void 0!==e)return[!1,r];if(void 0===e&&void 0!==t)return[!1,r];if(null===t&&null!==e)return[!1,r];if(null===e&&null!==t)return[!1,r];if("object"!=typeof t&&"object"!=typeof e)return[t===e,r];if(Array.isArray(t)&&Array.isArray(e)){var s=t.length;if(s!==e.length)return[!1,r];for(var i=0;i<s;i++){if(!(u=n.deepEquals(t[i],e[i],r+"["+i+"]"))[0])return u}return[!0,r]}if(o(t)||o(e))return[!1,r];if(Object.keys(t).length!==Object.keys(e).length)return[!1,r];for(var c in t){var u;if(!(u=n.deepEquals(t[c],e[c],r+"["+c+"]"))[0])return u}return[!0,r]},n.merge=function(t,e){for(var r in e)null!==e[r]&&"object"==typeof e[r]&&t.hasOwnProperty(r)?n.merge(t[r],e[r]):t[r]=e[r];return t},t&&t.exports&&(t.exports={inherit:c,clone:n.clone,merge:n.merge,isNumber:i,isInteger:n.isInteger,isString:n.isString,isObject:s,isHashObject:function(t){return s(t)&&-1!==t.constructor.toString().indexOf("function Object")},isPromise:function(t){return s(t)&&t.then},isNaN:n.isNaN,isAbsent:n.isAbsent,isExistent:n.isExistent,isSameType:n.isSameType,isArray:o,isFunction:a,parseBool:n.parseBool,deepEquals:n.deepEquals,notNull:function(t){return null!==t},notUndefined:function(t){return void 0!==t},isEven:function(t){return t%2==0},declareClassAsPureInterface:function(t,e){for(var r in t.prototype)"function"==typeof t.prototype[r]&&t.prototype.hasOwnProperty(r)&&(t.prototype[r]=function(){throw new Error(e+"::"+r+" is an interface member declaration and must be overloaded in order to be called")})},requireFullInterfaceImplementation:function(t,e,r,n){for(var o in r.prototype)if("function"==typeof r.prototype[o]&&!t.prototype[o])throw new Error("Interface implementation assertion failed: "+e+" does not implement "+n+"::"+o+" function")}})},53:()=>{},111:t=>{t.exports={isRtl:()=>!1}},917:(t,e,r)=>{"use strict";var n,o;r.r(e),r.d(e,{Months:()=>o,WeekDays:()=>n}),function(t){t[t.SUNDAY=1]="SUNDAY",t[t.MONDAY=2]="MONDAY",t[t.TUESDAY=3]="TUESDAY",t[t.WEDNESDAY=4]="WEDNESDAY",t[t.THURSDAY=5]="THURSDAY",t[t.FRIDAY=6]="FRIDAY",t[t.SATURDAY=7]="SATURDAY"}(n||(n={})),function(t){t[t.JANUARY=0]="JANUARY",t[t.FEBRUARY=1]="FEBRUARY",t[t.MARCH=2]="MARCH",t[t.APRIL=3]="APRIL",t[t.MAY=4]="MAY",t[t.JUNE=5]="JUNE",t[t.JULY=6]="JULY",t[t.AUGUST=7]="AUGUST",
|
||||
t[t.SEPTEMBER=8]="SEPTEMBER",t[t.OCTOBER=9]="OCTOBER",t[t.NOVEMBER=10]="NOVEMBER",t[t.DECEMBER=11]="DECEMBER"}(o||(o={}))}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var s=e[n]={id:n,loaded:!1,exports:{}};return t[n].call(s.exports,s,s.exports,r),s.loaded=!0,s.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.nmd=t=>(t.paths=[],t.children||(t.children=[]),t),(()=>{const{miniCssF:t}=r;r.miniCssF=e=>self.document&&"rtl"===self.document.dir?t(e).replace(/\.css$/,".rtl.css"):t(e)})(),(()=>{"use strict";var t=r(480),e=r.n(t);class n{constructor(t,e,r){this.year=t,this.month=e,this.day=r}toString(){return`${this.year}-${this.month}-${this.day}`}compareTo(t){return this.year>t.year||this.year===t.year&&this.month>t.month||this.year===t.year&&this.month===t.month&&this.day>t.day?1:this.year===t.year&&this.month===t.month&&this.day===t.day?0:-1}before(t){return-1===this.compareTo(t)}toCalendar(e){return t.get_cal(t.get_timezone("Etc/UTC"),this.year,this.month-1,this.day)}addDays(e){const r=this.toCalendar(t.get_timezone("Etc/UTC"));return t.add_date(r,e),n.fromCalendar(r)}static fromCalendar(e){return new n(t.get_year(e),t.get_month(e)+1,t.get_day_of_month(e))}}function o(t,e){return t.compareTo(e)}class s{constructor(t,e,r){this._dayOfWeek=t,this._start=e,this._length=r}start(){return this._start+t.minutesPerDay*this.sessionStartDaysOffset()}startOffset(){return this._start}sessionStartDaysOffset(){return this._start>=0?0:this._start%t.minutesPerDay==0?-Math.ceil(this._start/t.minutesPerDay):-Math.floor(this._start/t.minutesPerDay)}sessionEndDaysOffset(){const e=this._start+this._length;return e>=0?0:e%t.minutesPerDay==0?-Math.ceil(e/t.minutesPerDay):-Math.floor(e/t.minutesPerDay)}isOvernight(){return this._start<0}dayOfWeek(){return this._dayOfWeek}sessionStartDayOfWeek(){let e=this._dayOfWeek-this.sessionStartDaysOffset();return e<t.SUNDAY&&(e+=7),e}sessionEndDayOfWeek(){let e=this.sessionStartDayOfWeek()+this.sessionEndDaysOffset();return e>t.SATURDAY&&(e=1),e}length(){return this._length}weight(){return this._dayOfWeek*t.minutesPerDay+this._start}compareTo(t){const e=this.weight(),r=e+this._length,n=t.weight(),o=n+t._length;return e<=n&&n<r||n<=e&&e<o?0:e>n?1:-1}contains(e){const r=60*t.get_hours(e)+t.get_minutes(e);let n=t.get_day_of_week(e)-this._dayOfWeek;n>0&&(n-=7);const o=n*t.minutesPerDay+r;return o>=this._start&&o<this._start+this._length}}const i="undefined"!=typeof window?window:{};let a=!1;try{localStorage.getItem(""),a=!0}catch(t){}var c;!function(t){t[t.ERROR=1]="ERROR",t[t.WARNING=2]="WARNING",t[t.INFO=3]="INFO",t[t.NORMAL=4]="NORMAL",t[t.DEBUG=5]="DEBUG"}(c||(c={}));let u=0;const f="tv.logger.loglevel",l="tv.logger.logHighRate",h=[]
|
||||
;let d=null,g=null,p=null,m=NaN,y=c.WARNING,_=!1;function E(t){t=Math.max(c.ERROR,Math.min(c.DEBUG,t)),y=t,N()}function D(t,e){let r=h.reduce(((t,e)=>t.concat(e)),[]);return r.sort(((t,e)=>t.id-e.id)),void 0!==e&&(r=r.filter((t=>t.subSystemId===e))),"number"==typeof t&&(r=r.slice(-t)),r}function w(t,e,r,n){if(e===g&&n.id===p)return;const o=new Date;if(t<=c.NORMAL&&function(t,e,r,n,o){"function"==typeof structuredClone&&(e=structuredClone(e));const s={id:u,message:e,subSystemId:n,timestamp:Number(t)};u+=1,r.push(s),void 0!==o&&r.length>o&&r.splice(0,1)}(o,e,r,n.id,n.maxCount),t<=y&&(!n.highRate||_)&&(!d||n.id.match(d))){const r=o.toISOString()+":"+n.id+":"+e;switch(t){case c.DEBUG:console.debug(r);break;case c.INFO:case c.NORMAL:n.color?console.log("%c"+r,"color: "+n.color):console.log(r);break;case c.WARNING:console.warn(r);break;case c.ERROR:console.error(r)}g=e,p=n.id,m&&clearTimeout(m),m=setTimeout((()=>{g=null,p=null,m=NaN}),1e3)}}function v(t,e={}){const r=[];h.push(r);const n=Object.assign(e,{id:t});function o(t){return e=>w(t,String(e),r,n)}return{logDebug:o(c.DEBUG),logError:o(c.ERROR),logInfo:o(c.INFO),logNormal:o(c.NORMAL),logWarn:o(c.WARNING)}}const A=v("logger");i.lon=(t,e)=>{E(c.DEBUG),A.logNormal("Debug logging enabled"),_=Boolean(t),d=e||null,N()},i.loff=()=>{E(c.INFO),A.logInfo("Debug logging disabled")};function N(){try{a&&(localStorage.setItem(l,String(_)),localStorage.setItem(f,String(y)))}catch(t){A.logWarn(`Cannot save logger state (level: ${y}, high-rate: ${_}) to localStorage: ${t.message}`)}}!function(){_=!!a&&"true"===localStorage.getItem(l);let t=parseInt(a&&localStorage.getItem(f)||"");Number.isNaN(t)&&(t=c.WARNING),E(t),A.logNormal(`Init with settings - level: ${y}, high-rate: ${_}`)}(),i.performance&&i.performance.now?A.logNormal(`Sync logger and perf times, now is ${i.performance.now()}`):A.logWarn("Perf time is not available");const O=[t.MONDAY,t.TUESDAY,t.WEDNESDAY,t.THURSDAY,t.FRIDAY],S=[t.SUNDAY,t.MONDAY,t.TUESDAY,t.WEDNESDAY,t.THURSDAY,t.FRIDAY,t.SATURDAY],T=v("Chart.Model.SessionSpec");function b(t){return t>=48&&t<=57}class R{constructor(){this.entries=[],this.firstDayOfWeek=t.MONDAY,this.weekEndsCount=-1,this.maxTradingDayLength=0}parseSessions(t,e){var r;let n=!1;this._clear(),this.timezone=t;const{hasErrors:s,spec:i}=this._parseFirstDayOfWeek(e);if("24x7"===i.toLowerCase())for(const t of S)this.entries.push(R._createSessionEntry(t,0,0,0,0));else{let t=!1;const e=new Map;for(const r of i.split("|")){const o=r.split(":");if(1!==o.length&&2!==o.length){n=!0,T.logError(`Bad session section: ${r}`);continue}const s=1===o.length;if(s){if(t){n=!0,T.logError(`Duplicated default section: ${r}`);continue}t=!0}const i=s?O:R._parseWorkingDays(o[1]);for(const t of i)s&&e.has(t)||e.set(t,o[0])}for(const t of S){const r=e.get(t);if(void 0!==r)for(const e of r.split(",")){const{hasErrors:r,sessionEntry:o}=R._parseSessionEntry(t,e);r&&(n=r),this.entries.push(o)}}}this.entries.sort(o);const a=new Map;for(const t of this.entries){const e=t.dayOfWeek()
|
||||
;a.set(e,t.length()+(null!==(r=a.get(e))&&void 0!==r?r:0))}return this.maxTradingDayLength=0,a.forEach((t=>{this.maxTradingDayLength=Math.max(this.maxTradingDayLength,t)})),this.weekEndsCount=7-a.size,n||s}static parseHolidaysAndCorrections(e,r,n){const o=new Map,i=new Map,a=t=>{const e=this._parseDay(t),r=e.toString(),n=i.get(r);return void 0!==n?n:(i.set(r,e),e)};if(""!==r){const t=[];for(const e of r.split(",")){if(8!==e.length)throw new Error(`bad holiday date: ${e}`);const r=a(e);o.set(r,t)}}if(""===n)return o;const c=t.get_timezone("Etc/UTC");for(const e of n.split(";")){const r=e.split(":");if(2!==r.length)throw new Error(`bad correction section: ${e}`);const n=[];if("dayoff"!==r[0])for(const t of r[0].split(","))n.push(this._parseSessionEntry(1,t).sessionEntry);for(const e of r[1].split(",")){if(8!==e.length)throw new Error(`bad correction date: ${e}`);const r=a(e),i=t.get_day_of_week(t.get_cal(c,r.year,r.month-1,r.day)),u=[];for(const t of n)u.push(new s(i,t.startOffset(),t.length()));o.set(r,u)}}return o}_clear(){this.entries=[],this.timezone="",this.firstDayOfWeek=t.MONDAY,this.weekEndsCount=-1}_parseFirstDayOfWeek(e){const r=e.split(";");if(r.length>2)return T.logError(`Only one \`first day\` specification expected @ session ${e}`),{hasErrors:!0,spec:e};if(1===r.length)return{hasErrors:!1,spec:e};let n=1;let o=r[0].indexOf("-")>=0?NaN:parseInt(r[0]);return isNaN(o)&&(n=0,o=parseInt(r[1])),o<t.SUNDAY||o>t.SATURDAY?(T.logError(`Unexpected day index @ session: ${e}; day index ${o}`),{hasErrors:!0,spec:e}):(this.firstDayOfWeek=o,{hasErrors:!1,spec:r[n]})}static _parseDay(t){const e=parseInt(t.substring(0,4)),r=parseInt(t.substring(4,6)),o=parseInt(t.substring(6,8));return new n(e,r,o)}static _parseSessionEntry(t,e){let r=!1,n=e.split("-");2!==n.length&&(r=!0,T.logError(`Bad sessions entry: ${e}`),n=["0000","0000"]);let o=0,s=n[0];if(s.includes("F")){const t=s.split("F");s=t[0],o=""!==t[1]?parseInt(t[1]):1}let i=0,a=n[1];if(a.includes("F")){const t=a.split("F");a=t[0],i=""!==t[1]?parseInt(t[1]):1}if(!this._isCorrectSession(s)||!this._isCorrectSession(a))throw new Error(`Incorrect entry syntax: ${e}`);const c=s,u=a;return{hasErrors:r,sessionEntry:this._createSessionEntry(t,R._minutesFromHHMM(c),R._minutesFromHHMM(u),o,i)}}static _isCorrectSession(t){return 4===t.length&&b(t.charCodeAt(0))&&b(t.charCodeAt(1))&&b(t.charCodeAt(2))&&b(t.charCodeAt(3))}static _parseWorkingDays(t){const e=[];for(let r=0;r<t.length;r++){const n=+t[r];-1===e.indexOf(n)&&e.push(n)}return e}static _minutesFromHHMM(e){return t.get_minutes_from_hhmm(e)}static _createSessionEntry(e,r,n,o,i){0===n&&(n=t.minutesPerDay),o===i&&n<=r&&(o+=1),o>0&&(r-=o*t.minutesPerDay),i>0&&(n-=i*t.minutesPerDay);return new s(e,r,n-r)}}r(521);var U=r(643);var M=r(111);v("Chart.PriceFormatter"),new Map;new Map;function Y(t,e){if(!(0,U.isNumber)(t))return"n/a";if(!(0,U.isInteger)(e))throw new TypeError("invalid length");if(e<0||e>24)throw new TypeError("invalid length");if(0===e)return t.toString();return("0000000000000000"+t.toString()).slice(-e)}function C(t){
|
||||
for(;t>e().minutesPerDay;)t-=e().minutesPerDay;const r=t%60,n=Y((t-r)/60,2)+":"+Y(r,2);return(0,M.isRtl)()?(0,M.startWithLTR)(n):n}function I(t,r,n){const{weekDays:o,closed:s}=n;return r.map((r=>{const n=t.filter((t=>t.dayOfWeek()===r)),i=`${o[r]} `;if(0===n.length)return`${i}${s}`;const a=n.map((t=>{const r=t.sessionStartDayOfWeek(),n=t.sessionStartDaysOffset(),s=function(t,r){let n=t+r;for(;n>e().SATURDAY;)n-=e().SATURDAY;return n}(r,n===t.sessionEndDaysOffset()?0:n),i=r!==t.dayOfWeek()||s!==t.dayOfWeek(),a=i?o[r]:"",c=i?o[s]:"";return`${C(t.start())}${a}-${C(t.start()+t.length())}${c}`}));return`${i}${a.join(", ")}`}))}const k=new R,F=[e().MONDAY,e().TUESDAY,e().WEDNESDAY,e().THURSDAY,e().FRIDAY,e().SATURDAY,e().SUNDAY],P=F.reduce(((t,e)=>(t[e<7?e+1:1]=new Date(2018,0,e).toLocaleString(window.navigator.language,{weekday:"short"}),t)),{}),W=document.querySelector("#result"),x=document.querySelector("#session");function $(t){if(null===W)return;try{if(k.parseSessions("Etc/UTC",t)){const[t]=D(1);return void(W.textContent=t.message)}}catch(t){W.textContent=t.message}const e=I(k.entries,F,{weekDays:P,closed:"Closed"});W.innerHTML="",W.appendChild(function(t){const e=document.createElement("table"),r=document.createElement("tbody");for(const e of t){const t=document.createElement("tr"),n=document.createElement("td");n.textContent=e,t.appendChild(n),r.appendChild(t)}return e.appendChild(r),e}(e))}null==x||x.addEventListener("input",(()=>{$(x.value)})),$((null==x?void 0:x.value)||"")})()})();</script></body></html>
|
||||
}</style></head><body><form class="table-fill"><h1>Advanced Charts Session Parser</h1><input id="session" class="input-field" name="session" value="24x7" maxlength="500" autocomplete="off"><div id="result" class="results"></div></form><script defer="defer">(()=>{var t={480:(t,e,n)=>{"use strict";var r=n(917),o=n(53).tzData;let s;function i(t){this._name=t;var e=o[t];if(!e&&s&&(e=s.instance().getTimezoneData(t)),e||(e={time:[],offset:[]},this._invalid=!0),e.time.length!==e.offset.length&&(e={time:[],offset:[]},this._invalid=!0),!e.time_utc){for(var n=e.time,r=e.offset,i=n.length,a=new Array(i),u=0;u<i;u++)n[u]*=1e3,r[u]*=1e3,a[u]=n[u]-r[u];e.time_utc=a}this.tz=e}function a(t,e){var n=t.length;if(0===n)return-1;if(isNaN(e))throw Error("Key is NaN");for(var r=0,o=n-1,s=u((r+o)/2);;){if(t[s]>e){if((o=s-1)<r)return s}else if(o<(r=s+1))return s<n-1?s+1:-1;s=u((r+o)/2)}}i.prototype.offset_utc=function(t){return i._offset(this.tz.time_utc,this.tz.offset,t)},i.prototype.offset_loc=function(t){return i._offset(this.tz.time,this.tz.offset,t)},i.prototype.name=function(){return this._name},i.prototype.correction_loc=function(t){var e=this.tz.time,n=this.tz.offset,r=a(e,t);if(r<1)return 0;var o=n[r]-n[r-1];if(o>0&&t-e[r-1]<=o)return o;return 0},i.prototype.is_valid=function(){return!this._invalid},i._offset=function(t,e,n){var r=a(t,n);return-1===r?0:e[r]};var u=function(t){return 0|t},c=function(t){return 60*t*1e3},f=function(t,e){return l(t)-l(e)},l=function(t){return t<0?u(t/1e3)-(t%1e3!=0?1:0):u(t/1e3)};function d(t){return t%4==0&&(t%100!=0||t%400==0)}var h={0:0,1:31,2:59,3:90,4:120,5:151,6:181,7:212,8:243,9:273,10:304,11:334},g={...r.WeekDays,...r.Months,YEAR:1,MONTH:2,WEEK_OF_YEAR:3,DAY_OF_MONTH:5,DAY_OF_YEAR:6,DAY_OF_WEEK:7,HOUR_OF_DAY:11,MINUTE:12,SECOND:13,minutesPerDay:1440,millisecondsPerDay:c(1440),get_minutes_from_hhmm:function(t){return-1!==t.indexOf(":")&&(t=t.split(":").join("")),t%100+60*u(t/100)},get_year:function(t){return t.getUTCFullYear()},get_month:function(t){return t.getUTCMonth()},get_hours:function(t){return t.getUTCHours()},get_minutes:function(t){return t.getUTCMinutes()},get_seconds:function(t){return t.getUTCSeconds()},get_day_of_month:function(t){return t.getUTCDate()},get_day_of_week:function(t){return t.getUTCDay()+1},get_day_of_year:function(t){var e=t.getUTCMonth(),n=h[e];return e>g.JANUARY+1&&d(t.getUTCFullYear())&&(n+=1),n+t.getUTCDate()},get_week_of_year:function(t){var e=new Date(Date.UTC(t.getUTCFullYear(),0,1)).getUTCDay(),n=0===e?1:8-e,r=g.get_day_of_year(t)-n;return Math.ceil(r/7)+1},get_minutes_from_midnight:function(t){return 60*g.get_hours(t)+g.get_minutes(t)},set_hms:function(t,e,n,r,o,s){t.setUTCHours(e),t.setUTCMinutes(n),t.setUTCSeconds(r),t.setUTCMilliseconds(o),void 0!==s&&g.correct_time(t,s)},correct_time:function(t,e){var n=t.getTime(),r=e.correction_loc(n);t.setTime(n+r)},add_days_considering_dst:function(t,e,n){var r=t.offset_utc(e),o=this.clone(e);this.add_date(o,n);var s=t.offset_utc(o);return o.setTime(o.getTime()+r-s),o},add_years_considering_dst:function(t,e,n){let r=e;for(let e=Math.abs(n);e>0;e--)r=this.add_days_considering_dst(t,r,this.get_days_per_year(r)*Math.sign(n));return r},add_date:function(t,e){t.setTime(t.getTime()+e*g.millisecondsPerDay)},add_minutes:function(t,e){t.setTime(t.getTime()+c(e))},
|
||||
clone:function(t){return new Date(t.getTime())},get_days_per_year:function(t){var e=t.getUTCFullYear();return this.days_per_year(e)},days_per_year:function(t){return d(t)?366:365},get_days_in_month:function(t,e){let n;switch(t){case 0:case 2:case 4:case 6:case 7:case 9:case 11:n=31;break;case 1:n=28,d(e)&&n++;break;default:n=30}return n},get_part:function(t,e){switch(e){case g.YEAR:return g.get_year(t);case g.MONTH:return g.get_month(t);case g.DAY_OF_MONTH:return g.get_day_of_month(t);case g.WEEK_OF_YEAR:return g.get_week_of_year(t);case g.DAY_OF_WEEK:return g.get_day_of_week(t);case g.HOUR_OF_DAY:return g.get_hours(t);case g.MINUTE:return g.get_minutes(t);case g.DAY_OF_YEAR:return g.get_day_of_year(t);case g.SECOND:return g.get_seconds(t);default:return t.getTime()}},time_minutes:c,time_seconds:function(t){return 1e3*t},time_minutes_diff:function(t,e){return u(f(t,e)/60)},time_seconds_diff:f,utc_to_cal:function(t,e){return new Date(g.utc_to_cal_ts(t,e))},utc_to_cal_ts:function(t,e){return e+t.offset_utc(e)},get_cal:function(t,e,n,r,o,s,i){var a=new Date(Date.UTC(e,n,r,o||0,s||0,i||0)),u=t.offset_utc(+a);return new Date(a.valueOf()-u)},get_cal_from_unix_timestamp_ms:function(t,e){return new Date(e+t.offset_utc(e))},get_cal_utc:function(t,e,n){return new Date(Date.UTC(t,e,n))},cal_to_utc:function(t,e){var n=e.getTime();return n-t.offset_loc(n)},get_timezone:function(t){return new i(t)},shift_day:function(t,e){var n=t-1;return(n+=e)>6?n%=7:n<0&&(n=(7+n%7)%7),n+1},setCustomTimezones:function(t){s=t}};t.exports=g},643:function(t,e,n){var r;t=n.nmd(t);var o=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},s=function(t){return"object"==typeof t&&null!==t};function i(t){return"number"==typeof t&&isFinite(t)}function a(t){return null!=t&&(t.constructor===Function||"[object Function]"===Object.prototype.toString.call(t))}function u(t,e){t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}})}"undefined"!=typeof window?(r=window.TradingView=window.TradingView||{},window.isNumber=i,window.isFunction=a,window.inherit=u,window.isArray=o):r=this.TradingView=this.TradingView||{},r.isNaN=function(t){return!(t<=0||t>0)},r.isAbsent=function(t){return null==t},r.isExistent=function(t){return null!=t},Number.isNaN=Number.isNaN||function(t){return t!=t},r.isSameType=function(t,e){return Number.isNaN(t)||Number.isNaN(e)?Number.isNaN(t)===Number.isNaN(e):{}.toString.call(t)==={}.toString.call(e)},r.isInteger=function(t){return"number"==typeof t&&t%1==0},r.isString=function(t){return null!=t&&t.constructor===String},r.isInherited=function(t,e){if(null==t||null==t.prototype)throw new TypeError("isInherited: child should be a constructor function");if(null==e||null==e.prototype)throw new TypeError("isInherited: parent should be a constructor function");return t.prototype instanceof e||t.prototype===e.prototype},r.clone=function(t){if(!t||"object"!=typeof t)return t;var e,n,o;for(n in e="function"==typeof t.pop?[]:{},t)t.hasOwnProperty(n)&&(o=t[n],
|
||||
e[n]=o&&"object"==typeof o?r.clone(o):o);return e},r.deepEquals=function(t,e,n){if(n||(n=""),t===e)return[!0,n];if(a(t)&&(t=void 0),a(e)&&(e=void 0),void 0===t&&void 0!==e)return[!1,n];if(void 0===e&&void 0!==t)return[!1,n];if(null===t&&null!==e)return[!1,n];if(null===e&&null!==t)return[!1,n];if("object"!=typeof t&&"object"!=typeof e)return[t===e,n];if(Array.isArray(t)&&Array.isArray(e)){var s=t.length;if(s!==e.length)return[!1,n];for(var i=0;i<s;i++){if(!(c=r.deepEquals(t[i],e[i],n+"["+i+"]"))[0])return c}return[!0,n]}if(o(t)||o(e))return[!1,n];if(Object.keys(t).length!==Object.keys(e).length)return[!1,n];for(var u in t){var c;if(!(c=r.deepEquals(t[u],e[u],n+"["+u+"]"))[0])return c}return[!0,n]},r.merge=function(t,e){for(var n in e)null!==e[n]&&"object"==typeof e[n]&&t.hasOwnProperty(n)?r.merge(t[n],e[n]):t[n]=e[n];return t},t&&t.exports&&(t.exports={inherit:u,clone:r.clone,merge:r.merge,isNumber:i,isInteger:r.isInteger,isString:r.isString,isObject:s,isHashObject:function(t){return s(t)&&-1!==t.constructor.toString().indexOf("function Object")},isPromise:function(t){return s(t)&&t.then},isNaN:r.isNaN,isAbsent:r.isAbsent,isExistent:r.isExistent,isSameType:r.isSameType,isArray:o,isFunction:a,parseBool:r.parseBool,deepEquals:r.deepEquals,notNull:function(t){return null!==t},notUndefined:function(t){return void 0!==t},isEven:function(t){return t%2==0},declareClassAsPureInterface:function(t,e){for(var n in t.prototype)"function"==typeof t.prototype[n]&&t.prototype.hasOwnProperty(n)&&(t.prototype[n]=function(){throw new Error(e+"::"+n+" is an interface member declaration and must be overloaded in order to be called")})},requireFullInterfaceImplementation:function(t,e,n,r){for(var o in n.prototype)if("function"==typeof n.prototype[o]&&!t.prototype[o])throw new Error("Interface implementation assertion failed: "+e+" does not implement "+r+"::"+o+" function")}})},53:()=>{},111:t=>{t.exports={isRtl:()=>!1}},917:(t,e,n)=>{"use strict";var r,o;n.r(e),n.d(e,{Months:()=>o,WeekDays:()=>r}),function(t){t[t.SUNDAY=1]="SUNDAY",t[t.MONDAY=2]="MONDAY",t[t.TUESDAY=3]="TUESDAY",t[t.WEDNESDAY=4]="WEDNESDAY",t[t.THURSDAY=5]="THURSDAY",t[t.FRIDAY=6]="FRIDAY",t[t.SATURDAY=7]="SATURDAY"}(r||(r={})),function(t){t[t.JANUARY=0]="JANUARY",t[t.FEBRUARY=1]="FEBRUARY",t[t.MARCH=2]="MARCH",t[t.APRIL=3]="APRIL",t[t.MAY=4]="MAY",t[t.JUNE=5]="JUNE",t[t.JULY=6]="JULY",t[t.AUGUST=7]="AUGUST",t[t.SEPTEMBER=8]="SEPTEMBER",t[t.OCTOBER=9]="OCTOBER",t[t.NOVEMBER=10]="NOVEMBER",t[t.DECEMBER=11]="DECEMBER"}(o||(o={}))}},e={};function n(r){var o=e[r];if(void 0!==o)return o.exports;var s=e[r]={id:r,loaded:!1,exports:{}};return t[r].call(s.exports,s,s.exports,n),s.loaded=!0,s.exports}n.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return n.d(e,{a:e}),e},n.d=(t,e)=>{for(var r in e)n.o(e,r)&&!n.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{
|
||||
value:!0})},n.nmd=t=>(t.paths=[],t.children||(t.children=[]),t),(()=>{const{miniCssF:t}=n;n.miniCssF=e=>self.document&&"rtl"===self.document.dir?t(e).replace(/\.css$/,".rtl.css"):t(e)})(),(()=>{"use strict";var t=n(480),e=n.n(t);class r{constructor(t,e,n){this.year=t,this.month=e,this.day=n}toString(){return`${this.year}-${this.month}-${this.day}`}compareTo(t){return this.year>t.year||this.year===t.year&&this.month>t.month||this.year===t.year&&this.month===t.month&&this.day>t.day?1:this.year===t.year&&this.month===t.month&&this.day===t.day?0:-1}before(t){return-1===this.compareTo(t)}toCalendar(e){return t.get_cal(t.get_timezone("Etc/UTC"),this.year,this.month-1,this.day)}addDays(e){const n=this.toCalendar(t.get_timezone("Etc/UTC"));return t.add_date(n,e),r.fromCalendar(n)}static fromCalendar(e){return new r(t.get_year(e),t.get_month(e)+1,t.get_day_of_month(e))}}function o(t,e){return t.compareTo(e)}class s{constructor(t,e,n){this._dayOfWeek=t,this._start=e,this._length=n}start(){return this._start+t.minutesPerDay*this.sessionStartDaysOffset()}startOffset(){return this._start}sessionStartDaysOffset(){return this._start>=0?0:this._start%t.minutesPerDay==0?-Math.ceil(this._start/t.minutesPerDay):-Math.floor(this._start/t.minutesPerDay)}sessionEndDaysOffset(){const e=this._start+this._length;return e>=0?0:e%t.minutesPerDay==0?-Math.ceil(e/t.minutesPerDay):-Math.floor(e/t.minutesPerDay)}isOvernight(){return this._start<0}dayOfWeek(){return this._dayOfWeek}sessionStartDayOfWeek(){let e=this._dayOfWeek-this.sessionStartDaysOffset();return e<t.SUNDAY&&(e+=7),e}sessionEndDayOfWeek(){let e=this.sessionStartDayOfWeek()+this.sessionEndDaysOffset();return e>t.SATURDAY&&(e=1),e}length(){return this._length}weight(){return this._dayOfWeek*t.minutesPerDay+this._start}compareTo(t){const e=this.weight(),n=e+this._length,r=t.weight(),o=r+t._length;return e<=r&&r<n||r<=e&&e<o?0:e>r?1:-1}contains(e){const n=60*t.get_hours(e)+t.get_minutes(e);let r=t.get_day_of_week(e)-this._dayOfWeek;r>0&&(r-=7);const o=r*t.minutesPerDay+n;return o>=this._start&&o<this._start+this._length}}const i="undefined"!=typeof window?window:{};let a=!1;try{localStorage.getItem(""),a=!0}catch(t){}var u;!function(t){t[t.ERROR=1]="ERROR",t[t.WARNING=2]="WARNING",t[t.INFO=3]="INFO",t[t.NORMAL=4]="NORMAL",t[t.DEBUG=5]="DEBUG"}(u||(u={}));let c=0;const f="tv.logger.loglevel",l="tv.logger.logHighRate",d=[];let h=null,g=null,_=null,y=NaN,m=u.WARNING,p=!1;function D(t){t=Math.max(u.ERROR,Math.min(u.DEBUG,t)),m=t,w()}function E(t,e){let n=d.reduce(((t,e)=>t.concat(e)),[]);return n.sort(((t,e)=>t.id-e.id)),void 0!==e&&(n=n.filter((t=>t.subSystemId===e))),"number"==typeof t&&(n=n.slice(-t)),n}function A(t){return new Date(t.timestamp).toISOString()+":"+t.subSystemId+":"+t.message.replace(/"/g,"'")}i.lget=(t,e)=>function(t,e){let n,r=0,o=0;for(n=t.length-1;n>=1&&(r+=8*(1+encodeURIComponent(t[n]).length),!(n-1>0&&(o=8*(1+encodeURIComponent(t[n-1]).length),r+o>e)));n--);return t.slice(n)}(E(t,e).map(A),75497472);function N(t,e,n,r){if(e===g&&r.id===_)return;const o=new Date
|
||||
;if(t<=u.NORMAL&&function(t,e,n,r,o){"function"==typeof structuredClone&&(e=structuredClone(e));const s={id:c,message:e,subSystemId:r,timestamp:Number(t)};c+=1,n.push(s),void 0!==o&&n.length>o&&n.splice(0,1)}(o,e,n,r.id,r.maxCount),t<=m&&(!r.highRate||p)&&(!h||r.id.match(h))){const n=o.toISOString()+":"+r.id+":"+e;switch(t){case u.DEBUG:console.debug(n);break;case u.INFO:case u.NORMAL:r.color?console.log("%c"+n,"color: "+r.color):console.log(n);break;case u.WARNING:console.warn(n);break;case u.ERROR:console.error(n)}g=e,_=r.id,y&&clearTimeout(y),y=setTimeout((()=>{g=null,_=null,y=NaN}),1e3)}}function O(t,e={}){const n=[];d.push(n);const r=Object.assign(e,{id:t});function o(t){return e=>N(t,String(e),n,r)}return{logDebug:o(u.DEBUG),logError:o(u.ERROR),logInfo:o(u.INFO),logNormal:o(u.NORMAL),logWarn:o(u.WARNING)}}const S=O("logger");i.lon=(t,e)=>{D(u.DEBUG),S.logNormal("Debug logging enabled"),p=Boolean(t),h=e||null,w()},i.loff=()=>{D(u.INFO),S.logInfo("Debug logging disabled")};function w(){try{a&&(localStorage.setItem(l,String(p)),localStorage.setItem(f,String(m)))}catch(t){S.logWarn(`Cannot save logger state (level: ${m}, high-rate: ${p}) to localStorage: ${t.message}`)}}!function(){p=!!a&&"true"===localStorage.getItem(l);let t=parseInt(a&&localStorage.getItem(f)||"");Number.isNaN(t)&&(t=u.WARNING),D(t),S.logNormal(`Init with settings - level: ${m}, high-rate: ${p}`)}(),i.performance&&i.performance.now?S.logNormal(`Sync logger and perf times, now is ${i.performance.now()}`):S.logWarn("Perf time is not available");const T=[t.MONDAY,t.TUESDAY,t.WEDNESDAY,t.THURSDAY,t.FRIDAY],v=[t.SUNDAY,t.MONDAY,t.TUESDAY,t.WEDNESDAY,t.THURSDAY,t.FRIDAY,t.SATURDAY],R=O("Chart.Model.SessionSpec");function b(t){return t>=48&&t<=57}class U{constructor(){this.entries=[],this.firstDayOfWeek=t.MONDAY,this.weekEndsCount=-1,this.maxTradingDayLength=0}parseSessions(t,e){var n;let r=!1;this._clear(),this.timezone=t;const{hasErrors:s,spec:i}=this._parseFirstDayOfWeek(e);if("24x7"===i.toLowerCase())for(const t of v)this.entries.push(U._createSessionEntry(t,0,0,0,0));else{let t=!1;const e=new Map;for(const n of i.split("|")){const o=n.split(":");if(1!==o.length&&2!==o.length){r=!0,R.logError(`Bad session section: ${n}`);continue}const s=1===o.length;if(s){if(t){r=!0,R.logError(`Duplicated default section: ${n}`);continue}t=!0}const i=s?T:U._parseWorkingDays(o[1]);for(const t of i)s&&e.has(t)||e.set(t,o[0])}for(const t of v){const n=e.get(t);if(void 0!==n)for(const e of n.split(",")){const{hasErrors:n,sessionEntry:o}=U._parseSessionEntry(t,e);n&&(r=n),this.entries.push(o)}}}this.entries.sort(o);const a=new Map;for(const t of this.entries){const e=t.dayOfWeek();a.set(e,t.length()+(null!==(n=a.get(e))&&void 0!==n?n:0))}return this.maxTradingDayLength=0,a.forEach((t=>{this.maxTradingDayLength=Math.max(this.maxTradingDayLength,t)})),this.weekEndsCount=7-a.size,r||s}static parseHolidaysAndCorrections(e,n,r){const o=new Map,i=new Map,a=t=>{const e=this._parseDay(t),n=e.toString(),r=i.get(n);return void 0!==r?r:(i.set(n,e),e)};if(""!==n){const t=[]
|
||||
;for(const e of n.split(",")){if(8!==e.length)throw new Error(`bad holiday date: ${e}`);const n=a(e);o.set(n,t)}}if(""===r)return o;const u=t.get_timezone("Etc/UTC");for(const e of r.split(";")){const n=e.split(":");if(2!==n.length)throw new Error(`bad correction section: ${e}`);const r=[];if("dayoff"!==n[0])for(const t of n[0].split(","))r.push(this._parseSessionEntry(1,t).sessionEntry);for(const e of n[1].split(",")){if(8!==e.length)throw new Error(`bad correction date: ${e}`);const n=a(e),i=t.get_day_of_week(t.get_cal(u,n.year,n.month-1,n.day)),c=[];for(const t of r)c.push(new s(i,t.startOffset(),t.length()));o.set(n,c)}}return o}_clear(){this.entries=[],this.timezone="",this.firstDayOfWeek=t.MONDAY,this.weekEndsCount=-1}_parseFirstDayOfWeek(e){const n=e.split(";");if(n.length>2)return R.logError(`Only one \`first day\` specification expected @ session ${e}`),{hasErrors:!0,spec:e};if(1===n.length)return{hasErrors:!1,spec:e};let r=1;let o=n[0].indexOf("-")>=0?NaN:parseInt(n[0]);return isNaN(o)&&(r=0,o=parseInt(n[1])),o<t.SUNDAY||o>t.SATURDAY?(R.logError(`Unexpected day index @ session: ${e}; day index ${o}`),{hasErrors:!0,spec:e}):(this.firstDayOfWeek=o,{hasErrors:!1,spec:n[r]})}static _parseDay(t){const e=parseInt(t.substring(0,4)),n=parseInt(t.substring(4,6)),o=parseInt(t.substring(6,8));return new r(e,n,o)}static _parseSessionEntry(t,e){let n=!1,r=e.split("-");2!==r.length&&(n=!0,R.logError(`Bad sessions entry: ${e}`),r=["0000","0000"]);let o=0,s=r[0];if(s.includes("F")){const t=s.split("F");s=t[0],o=""!==t[1]?parseInt(t[1]):1}let i=0,a=r[1];if(a.includes("F")){const t=a.split("F");a=t[0],i=""!==t[1]?parseInt(t[1]):1}if(!this._isCorrectSession(s)||!this._isCorrectSession(a))throw new Error(`Incorrect entry syntax: ${e}`);const u=s,c=a;return{hasErrors:n,sessionEntry:this._createSessionEntry(t,U._minutesFromHHMM(u),U._minutesFromHHMM(c),o,i)}}static _isCorrectSession(t){return 4===t.length&&b(t.charCodeAt(0))&&b(t.charCodeAt(1))&&b(t.charCodeAt(2))&&b(t.charCodeAt(3))}static _parseWorkingDays(t){const e=[];for(let n=0;n<t.length;n++){const r=+t[n];-1===e.indexOf(r)&&e.push(r)}return e}static _minutesFromHHMM(e){return t.get_minutes_from_hhmm(e)}static _createSessionEntry(e,n,r,o,i){0===r&&(r=t.minutesPerDay),o===i&&r<=n&&(o+=1),o>0&&(n-=o*t.minutesPerDay),i>0&&(r-=i*t.minutesPerDay);return new s(e,n,r-n)}}var Y=n(643);function C(t,e){if(!(0,Y.isNumber)(t))return"n/a";if(!(0,Y.isInteger)(e))throw new TypeError("invalid length");if(e<0||e>24)throw new TypeError("invalid length");if(0===e)return t.toString();return("0000000000000000"+t.toString()).slice(-e)}var M=n(111);function I(t){for(;t>e().minutesPerDay;)t-=e().minutesPerDay;const n=t%60,r=C((t-n)/60,2)+":"+C(n,2);return(0,M.isRtl)()?(0,M.startWithLTR)(r):r}function F(t,n,r){const{weekDays:o,closed:s}=r;return n.map((n=>{const r=t.filter((t=>t.dayOfWeek()===n)),i=`${o[n]} `;if(0===r.length)return`${i}${s}`;const a=r.map((t=>{const n=t.sessionStartDayOfWeek(),r=t.sessionStartDaysOffset(),s=function(t,n){let r=t+n;for(;r>e().SATURDAY;)r-=e().SATURDAY;return r
|
||||
}(n,r===t.sessionEndDaysOffset()?0:r),i=n!==t.dayOfWeek()||s!==t.dayOfWeek(),a=i?o[n]:"",u=i?o[s]:"";return`${I(t.start())}${a}-${I(t.start()+t.length())}${u}`}));return`${i}${a.join(", ")}`}))}const k=new U,W=[e().MONDAY,e().TUESDAY,e().WEDNESDAY,e().THURSDAY,e().FRIDAY,e().SATURDAY,e().SUNDAY],x=W.reduce(((t,e)=>(t[e<7?e+1:1]=new Date(2018,0,e).toLocaleString(window.navigator.language,{weekday:"short"}),t)),{}),P=document.querySelector("#result"),$=document.querySelector("#session");function H(t){if(null===P)return;try{if(k.parseSessions("Etc/UTC",t)){const[t]=E(1);return void(P.textContent=t.message)}}catch(t){P.textContent=t.message}const e=F(k.entries,W,{weekDays:x,closed:"Closed"});P.innerHTML="",P.appendChild(function(t){const e=document.createElement("table"),n=document.createElement("tbody");for(const e of t){const t=document.createElement("tr"),r=document.createElement("td");r.textContent=e,t.appendChild(r),n.appendChild(t)}return e.appendChild(n),e}(e))}null==$||$.addEventListener("input",(()=>{H($.value)})),H((null==$?void 0:$.value)||"")})()})();</script></body></html>
|
||||
Reference in New Issue
Block a user