@abgov/ui-components-common 2.0.0-dev.1 → 2.0.0-next.1
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/index.cjs +1 -1
- package/index.d.ts +1 -1
- package/index.js +141 -141
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var z=Object.defineProperty;var q=n=>{throw TypeError(n)};var K=(n,t,e)=>t in n?z(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var p=(n,t,e)=>K(n,typeof t!="symbol"?t+"":t,e),tt=(n,t,e)=>t.has(n)||q("Cannot "+e);var R=(n,t,e)=>t.has(n)?q("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(n):t.set(n,e);var L=(n,t,e)=>(tt(n,t,"access private method"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class et{constructor(t){p(this,"validators");this.validators=t||{}}add(t,...e){this.validators[t]=e}validate(t){const e={};return Object.entries(this.validators).forEach(([r,a])=>{const i=a.map(s=>s(t[r])).find(s=>!!s);i&&(e[r]=i)}),e}}function nt(){return[W("Day is required"),E({min:1,max:31,minMsg:"Day must be between 1 and 31",maxMsg:"Day must be between 1 and 31"})]}function rt(){return[W("Month is required"),E({min:0,max:11,minMsg:"Month must be between Jan and Dec",maxMsg:"Month must be between Jan and Dec"})]}function at(){const n=new Date().getFullYear();return[W("Year is required"),E({min:1900,max:n,minMsg:"Year must be greater than 1900",maxMsg:`Year must be less than ${n}`})]}function W(n){return t=>(n=n||"Required",typeof t=="number"&&!isNaN(t)||t?"":n)}function it(n){const t=new RegExp(/^\+?[\d-() ]{10,18}$/);return _(t,n||"Invalid phone number")}function st(n){const t=new RegExp(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/);return _(t,n||"Invalid email address")}function ot(){return n=>{if(!n)return"";const t="121212121".split("").map(a=>parseInt(a)),e=n.replace(/\D/g,"");return e.length!==9?"SIN must contain 9 numbers":e.split("").map(a=>parseInt(a)).map((a,i)=>{const s=a*t[i];return s<10?s:`${s}`.split("").map(o=>parseInt(o)).reduce((o,c)=>o+c,0)}).reduce((a,i)=>a+i,0)%10===0?"":"Invalid SIN"}}function ut(){return _(/^[ABCEGHJ-NPRSTVXY]\d[ABCEGHJ-NPRSTV-Z][ -]?\d[ABCEGHJ-NPRSTV-Z]\d$/i,"Invalid postal code")}function _(n,t){return e=>!e||e.match(n)?"":t}function ct({invalidMsg:n,minMsg:t,maxMsg:e,min:r,max:a}={}){return i=>{let s=new Date(-1);return`${i||""}`.length===0?"":(typeof i=="string"&&(s=new Date(i)),typeof i=="number"&&(s=new Date(i)),i.toDateString&&(s=i),s.getDate()===-1?n||"Invalid date":r&&s<r?t||`Must be after ${r}`:a&&s>a?e||`Must be before ${a}`:"")}}function E({invalidTypeMsg:n,minMsg:t,maxMsg:e,min:r=-Number.MAX_VALUE,max:a=Number.MAX_VALUE}={}){return i=>{let s=Number.MAX_VALUE;return`${i??""}`.length===0?"":(typeof i=="string"&&(s=parseFloat(i)),typeof i=="number"&&(s=i),isNaN(s)?n||"Must be a numeric value":s>a?e||`Must be less than or equal to ${a}`:s<r?t||`Must be greater than or equal to ${r}`:"")}}function dt({invalidTypeMsg:n,minMsg:t,maxMsg:e,min:r=-Number.MAX_VALUE,max:a=Number.MAX_VALUE}){return i=>`${i||""}`.length===0?"":typeof i!="string"?n||"Invalid type":i.length>a?e||`Must be less than ${a} characters`:i.length<r?t||`Must be greater than ${r} characters`:""}function A(n,t,e,r){if(!n){console.error("dispatch element is null");return}n.dispatchEvent(new CustomEvent(t,{composed:!0,bubbles:r==null?void 0:r.bubbles,detail:e}))}function w(n,t,e,r){if(!n){console.error("dispatch element is null");return}n.dispatchEvent(new CustomEvent("msg",{composed:!0,bubbles:r==null?void 0:r.bubbles,detail:{action:t,data:e}}))}var k,ht,G;class ft{constructor(t){R(this,k);p(this,"state");p(this,"_formData");p(this,"_formRef");p(this,"_isCompleting",!1);this.type=t}init(t){if(this._formRef){console.warn("init: form element has already been set");return}this._formRef=t.detail.el,this.state={uuid:crypto.randomUUID(),form:{},history:[],editting:"",status:"not-started"}}initList(t){this._formRef=t.detail.el,this.state=[]}initState(t,e){w(this._formRef,"external::init:state",t),typeof t=="string"?this.state=JSON.parse(t):Array.isArray(t)||(this.state=t),e&&setTimeout(e,201)}updateListState(t){const e=t.detail;Array.isArray(e.data)&&(this.state=e.data)}updateObjectState(t){var r,a;if(Array.isArray(this.state))return;const e=t.detail;e.type==="list"?this.state={...this.state,form:{...((r=this.state)==null?void 0:r.form)||{},[e.id]:e.data}}:this.state={...this.state,...e.data,form:{...((a=this.state)==null?void 0:a.form)||{},...e.data.form},history:e.data.history}}getStateList(){return this.state?Array.isArray(this.state)?this.state.length===0?[]:this.state.map(t=>Object.values(t.form).filter(e=>{var r;return((r=e==null?void 0:e.data)==null?void 0:r.type)==="details"}).map(e=>{var r;return e.data.type==="details"&&((r=e.data)==null?void 0:r.fieldsets)||{}}).reduce((e,r)=>{for(const[a,i]of Object.entries(r))e[a]=i.value;return e},{})):(console.warn("Utils:getStateList: unable to update the state of a non-multi form type",this.state),[]):[]}getStateValue(t,e){if(Array.isArray(this.state))return console.error("getStateValue: unable to update the state of a multi form type"),"";if(!this.state)return console.error("getStateValue: state has not yet been set"),"";const r=this.state.form[t].data;return r.type!=="details"?"":r.fieldsets[e].value}continueTo(t){if(!t){console.error("continueTo [name] is undefined");return}w(this._formRef,"external::continue",{next:t})}validate(t,e,r,a){var f;const{el:i,state:s,cancelled:o}=t.detail,c=(f=s==null?void 0:s[e])==null?void 0:f.value;if(window.scrollTo({top:0,behavior:"smooth"}),o)return[!0,c];for(const h of r){const g=h(c);if(L(this,k,G).call(this,i,e,g,a),g)return[!1,""]}return[!0,c]}validateGroup(t,e,r){let a=0;const i={};for(const s of e){const[o]=this.validate(t,s,r,{grouped:!0});o&&(i[s]=!0,a++)}return[a,i]}edit(t){w(this._formRef,"external::alter:state",{index:t,operation:"edit"})}remove(t){w(this._formRef,"external::alter:state",{index:t,operation:"remove"})}complete(){if(!this._formRef){console.error("complete: form ref is not set");return}if(this._isCompleting){console.warn("complete: completion already in progress");return}this._isCompleting=!0,w(this._formRef,"fieldset::submit",null,{bubbles:!0}),this._isCompleting=!1}completeSubform(){if(!this._formRef){console.error("completeSubform: form ref is not set");return}if(this._isCompleting){console.warn("completeSubform: completion already in progress");return}const t=this._formRef;this._isCompleting=!0;const e=r=>{t.removeEventListener("_stateChange",e),A(t,"_complete",{},{bubbles:!0}),this._isCompleting=!1};t.addEventListener("_stateChange",e),A(t,"_continue",null,{bubbles:!0})}clean(t){return t.history.reduce((e,r)=>(e[r]=t.form[r],e),{})}}k=new WeakSet,ht=function(t){var e;Array.isArray(t.data)&&(Array.isArray(this.state)||(this.state={...this.state,form:{...((e=this.state)==null?void 0:e.form)||{},[t.id]:t.data}}))},G=function(t,e,r,a){t.dispatchEvent(new CustomEvent("msg",{composed:!0,detail:{action:"external::set:error",data:{name:e,msg:r,grouped:a==null?void 0:a.grouped}}}))};const lt=["basic","success","failure"];function mt(n,t){const e=crypto.randomUUID();return t={uuid:e,type:"basic",...t||{}},!t.duration&&t.type&<.includes(t.type)&&(t.duration="short"),w(document.body,"goa:temp-notification",{message:n,...t},{bubbles:!0}),e}function gt(n){w(document.body,"goa:temp-notification:dismiss",n,{bubbles:!0})}function yt(n,t){w(document.body,"goa:temp-notification:progress",{uuid:n,progress:t},{bubbles:!0})}const bt={show:mt,dismiss:gt,setProgress:yt};function d(n){const t=Object.prototype.toString.call(n);return n instanceof Date||typeof n=="object"&&t==="[object Date]"?new n.constructor(+n):typeof n=="number"||t==="[object Number]"||typeof n=="string"||t==="[object String]"?new Date(n):new Date(NaN)}function y(n,t){return n instanceof Date?new n.constructor(t):new Date(t)}function wt(n,t){const e=d(n);return isNaN(t)?y(n,NaN):(t&&e.setDate(e.getDate()+t),e)}function pt(n,t){const e=d(n);if(isNaN(t))return y(n,NaN);if(!t)return e;const r=e.getDate(),a=y(n,e.getTime());a.setMonth(e.getMonth()+t+1,0);const i=a.getDate();return r>=i?a:(e.setFullYear(a.getFullYear(),a.getMonth(),r),e)}const Q=6048e5,Mt=864e5;let Dt={};function F(){return Dt}function N(n,t){var o,c,f,h;const e=F(),r=(t==null?void 0:t.weekStartsOn)??((c=(o=t==null?void 0:t.locale)==null?void 0:o.options)==null?void 0:c.weekStartsOn)??e.weekStartsOn??((h=(f=e.locale)==null?void 0:f.options)==null?void 0:h.weekStartsOn)??0,a=d(n),i=a.getDay(),s=(i<r?7:0)+i-r;return a.setDate(a.getDate()-s),a.setHours(0,0,0,0),a}function Y(n){return N(n,{weekStartsOn:1})}function B(n){const t=d(n),e=t.getFullYear(),r=y(n,0);r.setFullYear(e+1,0,4),r.setHours(0,0,0,0);const a=Y(r),i=y(n,0);i.setFullYear(e,0,4),i.setHours(0,0,0,0);const s=Y(i);return t.getTime()>=a.getTime()?e+1:t.getTime()>=s.getTime()?e:e-1}function T(n){const t=d(n);return t.setHours(0,0,0,0),t}function H(n){const t=d(n),e=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return e.setUTCFullYear(t.getFullYear()),+n-+e}function Ot(n,t){const e=T(n),r=T(t),a=+e-H(e),i=+r-H(r);return Math.round((a-i)/Mt)}function St(n){const t=B(n),e=y(n,0);return e.setFullYear(t,0,4),e.setHours(0,0,0,0),Y(e)}function Pt(n,t){const e=T(n),r=T(t);return+e==+r}function vt(n){return n instanceof Date||typeof n=="object"&&Object.prototype.toString.call(n)==="[object Date]"}function xt(n){if(!vt(n)&&typeof n!="number")return!1;const t=d(n);return!isNaN(Number(t))}function Nt(n){const t=d(n),e=y(n,0);return e.setFullYear(t.getFullYear(),0,1),e.setHours(0,0,0,0),e}const kt={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Yt=(n,t,e)=>{let r;const a=kt[n];return typeof a=="string"?r=a:t===1?r=a.one:r=a.other.replace("{{count}}",t.toString()),e!=null&&e.addSuffix?e.comparison&&e.comparison>0?"in "+r:r+" ago":r};function V(n){return(t={})=>{const e=t.width?String(t.width):n.defaultWidth;return n.formats[e]||n.formats[n.defaultWidth]}}const Tt={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},Wt={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},_t={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Et={date:V({formats:Tt,defaultWidth:"full"}),time:V({formats:Wt,defaultWidth:"full"}),dateTime:V({formats:_t,defaultWidth:"full"})},Ft={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Ct=(n,t,e,r)=>Ft[n];function v(n){return(t,e)=>{const r=e!=null&&e.context?String(e.context):"standalone";let a;if(r==="formatting"&&n.formattingValues){const s=n.defaultFormattingWidth||n.defaultWidth,o=e!=null&&e.width?String(e.width):s;a=n.formattingValues[o]||n.formattingValues[s]}else{const s=n.defaultWidth,o=e!=null&&e.width?String(e.width):n.defaultWidth;a=n.values[o]||n.values[s]}const i=n.argumentCallback?n.argumentCallback(t):t;return a[i]}}const Vt={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},At={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},qt={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Rt={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Lt={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},Ht={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},It=(n,t)=>{const e=Number(n),r=e%100;if(r>20||r<10)switch(r%10){case 1:return e+"st";case 2:return e+"nd";case 3:return e+"rd"}return e+"th"},jt={ordinalNumber:It,era:v({values:Vt,defaultWidth:"wide"}),quarter:v({values:At,defaultWidth:"wide",argumentCallback:n=>n-1}),month:v({values:qt,defaultWidth:"wide"}),day:v({values:Rt,defaultWidth:"wide"}),dayPeriod:v({values:Lt,defaultWidth:"wide",formattingValues:Ht,defaultFormattingWidth:"wide"})};function x(n){return(t,e={})=>{const r=e.width,a=r&&n.matchPatterns[r]||n.matchPatterns[n.defaultMatchWidth],i=t.match(a);if(!i)return null;const s=i[0],o=r&&n.parsePatterns[r]||n.parsePatterns[n.defaultParseWidth],c=Array.isArray(o)?$t(o,g=>g.test(s)):Xt(o,g=>g.test(s));let f;f=n.valueCallback?n.valueCallback(c):c,f=e.valueCallback?e.valueCallback(f):f;const h=t.slice(s.length);return{value:f,rest:h}}}function Xt(n,t){for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)&&t(n[e]))return e}function $t(n,t){for(let e=0;e<n.length;e++)if(t(n[e]))return e}function Gt(n){return(t,e={})=>{const r=t.match(n.matchPattern);if(!r)return null;const a=r[0],i=t.match(n.parsePattern);if(!i)return null;let s=n.valueCallback?n.valueCallback(i[0]):i[0];s=e.valueCallback?e.valueCallback(s):s;const o=t.slice(a.length);return{value:s,rest:o}}}const Qt=/^(\d+)(th|st|nd|rd)?/i,Bt=/\d+/i,Jt={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Ut={any:[/^b/i,/^(a|c)/i]},Zt={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},zt={any:[/1/i,/2/i,/3/i,/4/i]},Kt={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},te={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},ee={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},ne={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},re={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},ae={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},ie={ordinalNumber:Gt({matchPattern:Qt,parsePattern:Bt,valueCallback:n=>parseInt(n,10)}),era:x({matchPatterns:Jt,defaultMatchWidth:"wide",parsePatterns:Ut,defaultParseWidth:"any"}),quarter:x({matchPatterns:Zt,defaultMatchWidth:"wide",parsePatterns:zt,defaultParseWidth:"any",valueCallback:n=>n+1}),month:x({matchPatterns:Kt,defaultMatchWidth:"wide",parsePatterns:te,defaultParseWidth:"any"}),day:x({matchPatterns:ee,defaultMatchWidth:"wide",parsePatterns:ne,defaultParseWidth:"any"}),dayPeriod:x({matchPatterns:re,defaultMatchWidth:"any",parsePatterns:ae,defaultParseWidth:"any"})},se={code:"en-US",formatDistance:Yt,formatLong:Et,formatRelative:Ct,localize:jt,match:ie,options:{weekStartsOn:0,firstWeekContainsDate:1}};function oe(n){const t=d(n);return Ot(t,Nt(t))+1}function ue(n){const t=d(n),e=+Y(t)-+St(t);return Math.round(e/Q)+1}function J(n,t){var h,g,S,P;const e=d(n),r=e.getFullYear(),a=F(),i=(t==null?void 0:t.firstWeekContainsDate)??((g=(h=t==null?void 0:t.locale)==null?void 0:h.options)==null?void 0:g.firstWeekContainsDate)??a.firstWeekContainsDate??((P=(S=a.locale)==null?void 0:S.options)==null?void 0:P.firstWeekContainsDate)??1,s=y(n,0);s.setFullYear(r+1,0,i),s.setHours(0,0,0,0);const o=N(s,t),c=y(n,0);c.setFullYear(r,0,i),c.setHours(0,0,0,0);const f=N(c,t);return e.getTime()>=o.getTime()?r+1:e.getTime()>=f.getTime()?r:r-1}function ce(n,t){var o,c,f,h;const e=F(),r=(t==null?void 0:t.firstWeekContainsDate)??((c=(o=t==null?void 0:t.locale)==null?void 0:o.options)==null?void 0:c.firstWeekContainsDate)??e.firstWeekContainsDate??((h=(f=e.locale)==null?void 0:f.options)==null?void 0:h.firstWeekContainsDate)??1,a=J(n,t),i=y(n,0);return i.setFullYear(a,0,r),i.setHours(0,0,0,0),N(i,t)}function de(n,t){const e=d(n),r=+N(e,t)-+ce(e,t);return Math.round(r/Q)+1}function u(n,t){const e=n<0?"-":"",r=Math.abs(n).toString().padStart(t,"0");return e+r}const M={y(n,t){const e=n.getFullYear(),r=e>0?e:1-e;return u(t==="yy"?r%100:r,t.length)},M(n,t){const e=n.getMonth();return t==="M"?String(e+1):u(e+1,2)},d(n,t){return u(n.getDate(),t.length)},a(n,t){const e=n.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return e.toUpperCase();case"aaa":return e;case"aaaaa":return e[0];case"aaaa":default:return e==="am"?"a.m.":"p.m."}},h(n,t){return u(n.getHours()%12||12,t.length)},H(n,t){return u(n.getHours(),t.length)},m(n,t){return u(n.getMinutes(),t.length)},s(n,t){return u(n.getSeconds(),t.length)},S(n,t){const e=t.length,r=n.getMilliseconds(),a=Math.trunc(r*Math.pow(10,e-3));return u(a,t.length)}},O={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},I={G:function(n,t,e){const r=n.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return e.era(r,{width:"abbreviated"});case"GGGGG":return e.era(r,{width:"narrow"});case"GGGG":default:return e.era(r,{width:"wide"})}},y:function(n,t,e){if(t==="yo"){const r=n.getFullYear(),a=r>0?r:1-r;return e.ordinalNumber(a,{unit:"year"})}return M.y(n,t)},Y:function(n,t,e,r){const a=J(n,r),i=a>0?a:1-a;if(t==="YY"){const s=i%100;return u(s,2)}return t==="Yo"?e.ordinalNumber(i,{unit:"year"}):u(i,t.length)},R:function(n,t){const e=B(n);return u(e,t.length)},u:function(n,t){const e=n.getFullYear();return u(e,t.length)},Q:function(n,t,e){const r=Math.ceil((n.getMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return u(r,2);case"Qo":return e.ordinalNumber(r,{unit:"quarter"});case"QQQ":return e.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return e.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return e.quarter(r,{width:"wide",context:"formatting"})}},q:function(n,t,e){const r=Math.ceil((n.getMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return u(r,2);case"qo":return e.ordinalNumber(r,{unit:"quarter"});case"qqq":return e.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return e.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return e.quarter(r,{width:"wide",context:"standalone"})}},M:function(n,t,e){const r=n.getMonth();switch(t){case"M":case"MM":return M.M(n,t);case"Mo":return e.ordinalNumber(r+1,{unit:"month"});case"MMM":return e.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return e.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return e.month(r,{width:"wide",context:"formatting"})}},L:function(n,t,e){const r=n.getMonth();switch(t){case"L":return String(r+1);case"LL":return u(r+1,2);case"Lo":return e.ordinalNumber(r+1,{unit:"month"});case"LLL":return e.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return e.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return e.month(r,{width:"wide",context:"standalone"})}},w:function(n,t,e,r){const a=de(n,r);return t==="wo"?e.ordinalNumber(a,{unit:"week"}):u(a,t.length)},I:function(n,t,e){const r=ue(n);return t==="Io"?e.ordinalNumber(r,{unit:"week"}):u(r,t.length)},d:function(n,t,e){return t==="do"?e.ordinalNumber(n.getDate(),{unit:"date"}):M.d(n,t)},D:function(n,t,e){const r=oe(n);return t==="Do"?e.ordinalNumber(r,{unit:"dayOfYear"}):u(r,t.length)},E:function(n,t,e){const r=n.getDay();switch(t){case"E":case"EE":case"EEE":return e.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return e.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return e.day(r,{width:"short",context:"formatting"});case"EEEE":default:return e.day(r,{width:"wide",context:"formatting"})}},e:function(n,t,e,r){const a=n.getDay(),i=(a-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(i);case"ee":return u(i,2);case"eo":return e.ordinalNumber(i,{unit:"day"});case"eee":return e.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return e.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return e.day(a,{width:"short",context:"formatting"});case"eeee":default:return e.day(a,{width:"wide",context:"formatting"})}},c:function(n,t,e,r){const a=n.getDay(),i=(a-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(i);case"cc":return u(i,t.length);case"co":return e.ordinalNumber(i,{unit:"day"});case"ccc":return e.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return e.day(a,{width:"narrow",context:"standalone"});case"cccccc":return e.day(a,{width:"short",context:"standalone"});case"cccc":default:return e.day(a,{width:"wide",context:"standalone"})}},i:function(n,t,e){const r=n.getDay(),a=r===0?7:r;switch(t){case"i":return String(a);case"ii":return u(a,t.length);case"io":return e.ordinalNumber(a,{unit:"day"});case"iii":return e.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return e.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return e.day(r,{width:"short",context:"formatting"});case"iiii":default:return e.day(r,{width:"wide",context:"formatting"})}},a:function(n,t,e){const a=n.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return e.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return e.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return e.dayPeriod(a,{width:"narrow",context:"formatting"});case"aaaa":default:return e.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(n,t,e){const r=n.getHours();let a;switch(r===12?a=O.noon:r===0?a=O.midnight:a=r/12>=1?"pm":"am",t){case"b":case"bb":return e.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return e.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return e.dayPeriod(a,{width:"narrow",context:"formatting"});case"bbbb":default:return e.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(n,t,e){const r=n.getHours();let a;switch(r>=17?a=O.evening:r>=12?a=O.afternoon:r>=4?a=O.morning:a=O.night,t){case"B":case"BB":case"BBB":return e.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return e.dayPeriod(a,{width:"narrow",context:"formatting"});case"BBBB":default:return e.dayPeriod(a,{width:"wide",context:"formatting"})}},h:function(n,t,e){if(t==="ho"){let r=n.getHours()%12;return r===0&&(r=12),e.ordinalNumber(r,{unit:"hour"})}return M.h(n,t)},H:function(n,t,e){return t==="Ho"?e.ordinalNumber(n.getHours(),{unit:"hour"}):M.H(n,t)},K:function(n,t,e){const r=n.getHours()%12;return t==="Ko"?e.ordinalNumber(r,{unit:"hour"}):u(r,t.length)},k:function(n,t,e){let r=n.getHours();return r===0&&(r=24),t==="ko"?e.ordinalNumber(r,{unit:"hour"}):u(r,t.length)},m:function(n,t,e){return t==="mo"?e.ordinalNumber(n.getMinutes(),{unit:"minute"}):M.m(n,t)},s:function(n,t,e){return t==="so"?e.ordinalNumber(n.getSeconds(),{unit:"second"}):M.s(n,t)},S:function(n,t){return M.S(n,t)},X:function(n,t,e){const r=n.getTimezoneOffset();if(r===0)return"Z";switch(t){case"X":return X(r);case"XXXX":case"XX":return D(r);case"XXXXX":case"XXX":default:return D(r,":")}},x:function(n,t,e){const r=n.getTimezoneOffset();switch(t){case"x":return X(r);case"xxxx":case"xx":return D(r);case"xxxxx":case"xxx":default:return D(r,":")}},O:function(n,t,e){const r=n.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+j(r,":");case"OOOO":default:return"GMT"+D(r,":")}},z:function(n,t,e){const r=n.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+j(r,":");case"zzzz":default:return"GMT"+D(r,":")}},t:function(n,t,e){const r=Math.trunc(n.getTime()/1e3);return u(r,t.length)},T:function(n,t,e){const r=n.getTime();return u(r,t.length)}};function j(n,t=""){const e=n>0?"-":"+",r=Math.abs(n),a=Math.trunc(r/60),i=r%60;return i===0?e+String(a):e+String(a)+t+u(i,2)}function X(n,t){return n%60===0?(n>0?"-":"+")+u(Math.abs(n)/60,2):D(n,t)}function D(n,t=""){const e=n>0?"-":"+",r=Math.abs(n),a=u(Math.trunc(r/60),2),i=u(r%60,2);return e+a+t+i}const $=(n,t)=>{switch(n){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},U=(n,t)=>{switch(n){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},fe=(n,t)=>{const e=n.match(/(P+)(p+)?/)||[],r=e[1],a=e[2];if(!a)return $(n,t);let i;switch(r){case"P":i=t.dateTime({width:"short"});break;case"PP":i=t.dateTime({width:"medium"});break;case"PPP":i=t.dateTime({width:"long"});break;case"PPPP":default:i=t.dateTime({width:"full"});break}return i.replace("{{date}}",$(r,t)).replace("{{time}}",U(a,t))},he={p:U,P:fe},le=/^D+$/,me=/^Y+$/,ge=["D","DD","YY","YYYY"];function ye(n){return le.test(n)}function be(n){return me.test(n)}function we(n,t,e){const r=pe(n,t,e);if(console.warn(r),ge.includes(n))throw new RangeError(r)}function pe(n,t,e){const r=n[0]==="Y"?"years":"days of the month";return`Use \`${n.toLowerCase()}\` instead of \`${n}\` (in \`${t}\`) for formatting ${r} to the input \`${e}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const Me=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,De=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Oe=/^'([^]*?)'?$/,Se=/''/g,Pe=/[a-zA-Z]/;function ve(n,t,e){var h,g,S,P;const r=F(),a=r.locale??se,i=r.firstWeekContainsDate??((g=(h=r.locale)==null?void 0:h.options)==null?void 0:g.firstWeekContainsDate)??1,s=r.weekStartsOn??((P=(S=r.locale)==null?void 0:S.options)==null?void 0:P.weekStartsOn)??0,o=d(n);if(!xt(o))throw new RangeError("Invalid time value");let c=t.match(De).map(m=>{const l=m[0];if(l==="p"||l==="P"){const C=he[l];return C(m,a.formatLong)}return m}).join("").match(Me).map(m=>{if(m==="''")return{isToken:!1,value:"'"};const l=m[0];if(l==="'")return{isToken:!1,value:xe(m)};if(I[l])return{isToken:!0,value:m};if(l.match(Pe))throw new RangeError("Format string contains an unescaped latin alphabet character `"+l+"`");return{isToken:!1,value:m}});a.localize.preprocessor&&(c=a.localize.preprocessor(o,c));const f={firstWeekContainsDate:i,weekStartsOn:s,locale:a};return c.map(m=>{if(!m.isToken)return m.value;const l=m.value;(be(l)||ye(l))&&we(l,t,String(n));const C=I[l[0]];return C(o,l,a.localize,f)}).join("")}function xe(n){const t=n.match(Oe);return t?t[1].replace(Se,"'"):n}function Ne(n){const t=d(n),e=t.getFullYear(),r=t.getMonth(),a=y(n,0);return a.setFullYear(e,r+1,0),a.setHours(0,0,0,0),a.getDate()}function ke(n){const t=d(n),e=t.getMonth();return t.setFullYear(t.getFullYear(),e+1,0),t.setHours(0,0,0,0),t}function Ye(n,t){const e=d(n),r=d(t);return e.getTime()>r.getTime()}function Te(n,t){const e=d(n),r=d(t);return+e<+r}function We(n,t){const e=d(n),r=d(t);return e.getFullYear()===r.getFullYear()&&e.getMonth()===r.getMonth()}class b{constructor(t){p(this,"_dateNums");t||t===0?this._dateNums=b.parse(t):this._dateNums=b.parse(new Date)}static parse(t){return typeof t=="string"?(t=t.split("T")[0],t.split("-").map(e=>+e)):t instanceof Date?[t.getFullYear(),t.getMonth()+1,t.getDate()]:t===0?[0,0,0]:[t.year,t.month,t.day]}static init(){return new b(0)}get date(){return new Date(this._dateNums[0],this._dateNums[1]-1,this._dateNums[2])}get year(){return this._dateNums[0]}get month(){return this._dateNums[1]}get day(){return this._dateNums[2]}get dayOfWeek(){return this.date.getDay()}get daysInMonth(){return Ne(this.date)}get firstDayOfMonth(){return new b({year:this.year,month:this.month,day:1})}get lastDayOfMonth(){return new b(ke(this.date))}get previousDay(){return this.clone().addDays(-1)}get nextDay(){return this.clone().addDays(1)}get previousWeek(){return this.clone().addDays(-7)}get nextWeek(){return this.clone().addDays(7)}get previousMonth(){return this.clone().addMonths(-1)}get nextMonth(){return this.clone().addMonths(1)}clone(){return new b(this.toString())}setYear(t){this._dateNums[0]=t}setMonth(t){this._dateNums[1]=t}setDay(t){return this._dateNums[2]=t,this}addYears(t){return this._dateNums[0]+=t,this}addMonths(t){return this._dateNums=b.parse(pt(this.date,t)),this}addDays(t){return this._dateNums=b.parse(wt(this.date,t)),this}isSameDay(t){return Pt(this.date,t.date)}isSameMonth(t){return We(this.date,t.date)}isBefore(t){return Te(this.date,t.date)}isAfter(t){return Ye(this.date,t.date)}isZero(){return this._dateNums[0]===0&&this._dateNums[1]===0&&this._dateNums[2]===0}isValid(){const t=new Date(this.toString());return!(isNaN(t.getTime())||this.toString()!==t.toISOString().split("T")[0])}format(t){return this.isZero()?"":ve(this.date,t)}toString(){return this.isZero()?"":this._dateNums.map(t=>`${t}`.length<2?`0${t}`:`${t}`).join("-")}}class Z{constructor(){p(this,"done");this.done=new Set}when(t){return t?this:new _e}do(t,e){this.done.has(t)||(this.done.add(t),e())}}class _e extends Z{do(t,e){}}exports.CalendarDate=b;exports.FormValidator=et;exports.Once=Z;exports.PublicFormController=ft;exports.SINValidator=ot;exports.TemporaryNotification=bt;exports.birthDayValidator=nt;exports.birthMonthValidator=rt;exports.birthYearValidator=at;exports.dateValidator=ct;exports.dispatch=A;exports.emailValidator=st;exports.lengthValidator=dt;exports.numericValidator=E;exports.phoneNumberValidator=it;exports.postalCodeValidator=ut;exports.regexValidator=_;exports.relay=w;exports.requiredValidator=W;
|
|
1
|
+
"use strict";var z=Object.defineProperty;var q=n=>{throw TypeError(n)};var K=(n,t,e)=>t in n?z(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var p=(n,t,e)=>K(n,typeof t!="symbol"?t+"":t,e),tt=(n,t,e)=>t.has(n)||q("Cannot "+e);var R=(n,t,e)=>t.has(n)?q("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(n):t.set(n,e);var L=(n,t,e)=>(tt(n,t,"access private method"),e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class et{constructor(t){p(this,"validators");this.validators=t||{}}add(t,...e){this.validators[t]=e}validate(t){const e={};return Object.entries(this.validators).forEach(([r,a])=>{const i=a.map(s=>s(t[r])).find(s=>!!s);i&&(e[r]=i)}),e}}function nt(){return[W("Day is required"),E({min:1,max:31,minMsg:"Day must be between 1 and 31",maxMsg:"Day must be between 1 and 31"})]}function rt(){return[W("Month is required"),E({min:0,max:11,minMsg:"Month must be between Jan and Dec",maxMsg:"Month must be between Jan and Dec"})]}function at(){const n=new Date().getFullYear();return[W("Year is required"),E({min:1900,max:n,minMsg:"Year must be greater than 1900",maxMsg:`Year must be less than ${n}`})]}function W(n){return t=>(n=n||"Required",typeof t=="number"&&!isNaN(t)||t?"":n)}function it(n){const t=new RegExp(/^\+?[\d-() ]{10,18}$/);return _(t,n||"Invalid phone number")}function st(n){const t=new RegExp(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/);return _(t,n||"Invalid email address")}function ot(){return n=>{if(!n)return"";const t="121212121".split("").map(a=>parseInt(a)),e=n.replace(/\D/g,"");return e.length!==9?"SIN must contain 9 numbers":e.split("").map(a=>parseInt(a)).map((a,i)=>{const s=a*t[i];return s<10?s:`${s}`.split("").map(o=>parseInt(o)).reduce((o,c)=>o+c,0)}).reduce((a,i)=>a+i,0)%10===0?"":"Invalid SIN"}}function ut(){return _(/^[ABCEGHJ-NPRSTVXY]\d[ABCEGHJ-NPRSTV-Z][ -]?\d[ABCEGHJ-NPRSTV-Z]\d$/i,"Invalid postal code")}function _(n,t){return e=>!e||e.match(n)?"":t}function ct({invalidMsg:n,minMsg:t,maxMsg:e,min:r,max:a}={}){return i=>{let s=new Date(-1);return`${i||""}`.length===0?"":(typeof i=="string"&&(s=new Date(i)),typeof i=="number"&&(s=new Date(i)),i.toDateString&&(s=i),s.getDate()===-1?n||"Invalid date":r&&s<r?t||`Must be after ${r}`:a&&s>a?e||`Must be before ${a}`:"")}}function E({invalidTypeMsg:n,minMsg:t,maxMsg:e,min:r=-Number.MAX_VALUE,max:a=Number.MAX_VALUE}={}){return i=>{let s=Number.MAX_VALUE;return`${i??""}`.length===0?"":(typeof i=="string"&&(s=parseFloat(i)),typeof i=="number"&&(s=i),isNaN(s)?n||"Must be a numeric value":s>a?e||`Must be less than or equal to ${a}`:s<r?t||`Must be greater than or equal to ${r}`:"")}}function dt({invalidTypeMsg:n,minMsg:t,maxMsg:e,min:r=-Number.MAX_VALUE,max:a=Number.MAX_VALUE}){return i=>`${i||""}`.length===0?"":typeof i!="string"?n||"Invalid type":i.length>a?e||`Must be less than ${a} characters`:i.length<r?t||`Must be greater than ${r} characters`:""}function A(n,t,e,r){if(!n){console.error("dispatch element is null");return}n.dispatchEvent(new CustomEvent(t,{composed:!0,bubbles:r==null?void 0:r.bubbles,detail:e}))}function w(n,t,e,r){if(!n){console.error("dispatch element is null");return}n.dispatchEvent(new CustomEvent("msg",{composed:!0,bubbles:r==null?void 0:r.bubbles,detail:{action:t,data:e}}))}var k,ht,G;class ft{constructor(t){R(this,k);p(this,"state");p(this,"_formData");p(this,"_formRef");p(this,"_isCompleting",!1);this.type=t}init(t){if(this._formRef){console.warn("init: form element has already been set");return}this._formRef=t.detail.el,this.state={uuid:crypto.randomUUID(),form:{},history:[],editting:"",status:"not-started"}}initList(t){this._formRef=t.detail.el,this.state=[]}initState(t,e){w(this._formRef,"external::init:state",t),typeof t=="string"?this.state=JSON.parse(t):Array.isArray(t)||(this.state=t),e&&setTimeout(e,201)}updateListState(t){const e=t.detail;Array.isArray(e.data)&&(this.state=e.data)}updateObjectState(t){var r,a;if(Array.isArray(this.state))return;const e=t.detail;e.type==="list"?this.state={...this.state,form:{...((r=this.state)==null?void 0:r.form)||{},[e.id]:e.data}}:this.state={...this.state,...e.data,form:{...((a=this.state)==null?void 0:a.form)||{},...e.data.form},history:e.data.history}}getStateList(){return this.state?Array.isArray(this.state)?this.state.length===0?[]:this.state.map(t=>Object.values(t.form).filter(e=>{var r;return((r=e==null?void 0:e.data)==null?void 0:r.type)==="details"}).map(e=>{var r;return e.data.type==="details"&&((r=e.data)==null?void 0:r.fieldsets)||{}}).reduce((e,r)=>{for(const[a,i]of Object.entries(r))e[a]=i.value;return e},{})):(console.warn("Utils:getStateList: unable to update the state of a non-multi form type",this.state),[]):[]}getStateValue(t,e){if(Array.isArray(this.state))return console.error("getStateValue: unable to update the state of a multi form type"),"";if(!this.state)return console.error("getStateValue: state has not yet been set"),"";const r=this.state.form[t].data;return r.type!=="details"?"":r.fieldsets[e].value}continueTo(t){if(!t){console.error("continueTo [name] is undefined");return}w(this._formRef,"external::continue",{next:t})}validate(t,e,r,a){var f;const{el:i,state:s,cancelled:o}=t.detail,c=(f=s==null?void 0:s[e])==null?void 0:f.value;if(window.scrollTo({top:0,behavior:"smooth"}),o)return[!0,c];for(const h of r){const g=h(c);if(L(this,k,G).call(this,i,e,g,a),g)return[!1,""]}return[!0,c]}validateGroup(t,e,r){let a=0;const i={};for(const s of e){const[o]=this.validate(t,s,r,{grouped:!0});o&&(i[s]=!0,a++)}return[a,i]}edit(t){w(this._formRef,"external::alter:state",{index:t,operation:"edit"})}remove(t){w(this._formRef,"external::alter:state",{index:t,operation:"remove"})}complete(){if(!this._formRef){console.error("complete: form ref is not set");return}if(this._isCompleting){console.warn("complete: completion already in progress");return}this._isCompleting=!0,w(this._formRef,"fieldset::submit",null,{bubbles:!0}),this._isCompleting=!1}completeSubform(){if(!this._formRef){console.error("completeSubform: form ref is not set");return}if(this._isCompleting){console.warn("completeSubform: completion already in progress");return}const t=this._formRef;this._isCompleting=!0;const e=r=>{t.removeEventListener("_stateChange",e),A(t,"_complete",{},{bubbles:!0}),this._isCompleting=!1};t.addEventListener("_stateChange",e),A(t,"_continue",null,{bubbles:!0})}clean(t){return t.history.reduce((e,r)=>(e[r]=t.form[r],e),{})}}k=new WeakSet,ht=function(t){var e;Array.isArray(t.data)&&(Array.isArray(this.state)||(this.state={...this.state,form:{...((e=this.state)==null?void 0:e.form)||{},[t.id]:t.data}}))},G=function(t,e,r,a){t.dispatchEvent(new CustomEvent("msg",{composed:!0,detail:{action:"external::set:error",data:{name:e,msg:r,grouped:a==null?void 0:a.grouped}}}))};const lt=["basic","success","failure"];function mt(n,t){const e=crypto.randomUUID();return t={uuid:e,type:"basic",...t||{}},!t.duration&&t.type&<.includes(t.type)&&(t.duration="short"),w(document.body,"goa:temp-notification",{message:n,...t},{bubbles:!0}),e}function gt(n){w(document.body,"goa:temp-notification:dismiss",n,{bubbles:!0})}function yt(n,t){w(document.body,"goa:temp-notification:progress",{uuid:n,progress:t},{bubbles:!0})}const bt={show:mt,dismiss:gt,setProgress:yt};class Q{constructor(){p(this,"done");this.done=new Set}when(t){return t?this:new wt}do(t,e){this.done.has(t)||(this.done.add(t),e())}}class wt extends Q{do(t,e){}}function d(n){const t=Object.prototype.toString.call(n);return n instanceof Date||typeof n=="object"&&t==="[object Date]"?new n.constructor(+n):typeof n=="number"||t==="[object Number]"||typeof n=="string"||t==="[object String]"?new Date(n):new Date(NaN)}function y(n,t){return n instanceof Date?new n.constructor(t):new Date(t)}function pt(n,t){const e=d(n);return isNaN(t)?y(n,NaN):(t&&e.setDate(e.getDate()+t),e)}function Mt(n,t){const e=d(n);if(isNaN(t))return y(n,NaN);if(!t)return e;const r=e.getDate(),a=y(n,e.getTime());a.setMonth(e.getMonth()+t+1,0);const i=a.getDate();return r>=i?a:(e.setFullYear(a.getFullYear(),a.getMonth(),r),e)}const B=6048e5,Dt=864e5;let Ot={};function F(){return Ot}function N(n,t){var o,c,f,h;const e=F(),r=(t==null?void 0:t.weekStartsOn)??((c=(o=t==null?void 0:t.locale)==null?void 0:o.options)==null?void 0:c.weekStartsOn)??e.weekStartsOn??((h=(f=e.locale)==null?void 0:f.options)==null?void 0:h.weekStartsOn)??0,a=d(n),i=a.getDay(),s=(i<r?7:0)+i-r;return a.setDate(a.getDate()-s),a.setHours(0,0,0,0),a}function Y(n){return N(n,{weekStartsOn:1})}function J(n){const t=d(n),e=t.getFullYear(),r=y(n,0);r.setFullYear(e+1,0,4),r.setHours(0,0,0,0);const a=Y(r),i=y(n,0);i.setFullYear(e,0,4),i.setHours(0,0,0,0);const s=Y(i);return t.getTime()>=a.getTime()?e+1:t.getTime()>=s.getTime()?e:e-1}function T(n){const t=d(n);return t.setHours(0,0,0,0),t}function H(n){const t=d(n),e=new Date(Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()));return e.setUTCFullYear(t.getFullYear()),+n-+e}function St(n,t){const e=T(n),r=T(t),a=+e-H(e),i=+r-H(r);return Math.round((a-i)/Dt)}function Pt(n){const t=J(n),e=y(n,0);return e.setFullYear(t,0,4),e.setHours(0,0,0,0),Y(e)}function vt(n,t){const e=T(n),r=T(t);return+e==+r}function xt(n){return n instanceof Date||typeof n=="object"&&Object.prototype.toString.call(n)==="[object Date]"}function Nt(n){if(!xt(n)&&typeof n!="number")return!1;const t=d(n);return!isNaN(Number(t))}function kt(n){const t=d(n),e=y(n,0);return e.setFullYear(t.getFullYear(),0,1),e.setHours(0,0,0,0),e}const Yt={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},Tt=(n,t,e)=>{let r;const a=Yt[n];return typeof a=="string"?r=a:t===1?r=a.one:r=a.other.replace("{{count}}",t.toString()),e!=null&&e.addSuffix?e.comparison&&e.comparison>0?"in "+r:r+" ago":r};function V(n){return(t={})=>{const e=t.width?String(t.width):n.defaultWidth;return n.formats[e]||n.formats[n.defaultWidth]}}const Wt={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},_t={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},Et={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},Ft={date:V({formats:Wt,defaultWidth:"full"}),time:V({formats:_t,defaultWidth:"full"}),dateTime:V({formats:Et,defaultWidth:"full"})},Ct={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},Vt=(n,t,e,r)=>Ct[n];function v(n){return(t,e)=>{const r=e!=null&&e.context?String(e.context):"standalone";let a;if(r==="formatting"&&n.formattingValues){const s=n.defaultFormattingWidth||n.defaultWidth,o=e!=null&&e.width?String(e.width):s;a=n.formattingValues[o]||n.formattingValues[s]}else{const s=n.defaultWidth,o=e!=null&&e.width?String(e.width):n.defaultWidth;a=n.values[o]||n.values[s]}const i=n.argumentCallback?n.argumentCallback(t):t;return a[i]}}const At={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},qt={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},Rt={narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],wide:["January","February","March","April","May","June","July","August","September","October","November","December"]},Lt={narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]},Ht={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},It={narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},jt=(n,t)=>{const e=Number(n),r=e%100;if(r>20||r<10)switch(r%10){case 1:return e+"st";case 2:return e+"nd";case 3:return e+"rd"}return e+"th"},Xt={ordinalNumber:jt,era:v({values:At,defaultWidth:"wide"}),quarter:v({values:qt,defaultWidth:"wide",argumentCallback:n=>n-1}),month:v({values:Rt,defaultWidth:"wide"}),day:v({values:Lt,defaultWidth:"wide"}),dayPeriod:v({values:Ht,defaultWidth:"wide",formattingValues:It,defaultFormattingWidth:"wide"})};function x(n){return(t,e={})=>{const r=e.width,a=r&&n.matchPatterns[r]||n.matchPatterns[n.defaultMatchWidth],i=t.match(a);if(!i)return null;const s=i[0],o=r&&n.parsePatterns[r]||n.parsePatterns[n.defaultParseWidth],c=Array.isArray(o)?Gt(o,g=>g.test(s)):$t(o,g=>g.test(s));let f;f=n.valueCallback?n.valueCallback(c):c,f=e.valueCallback?e.valueCallback(f):f;const h=t.slice(s.length);return{value:f,rest:h}}}function $t(n,t){for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)&&t(n[e]))return e}function Gt(n,t){for(let e=0;e<n.length;e++)if(t(n[e]))return e}function Qt(n){return(t,e={})=>{const r=t.match(n.matchPattern);if(!r)return null;const a=r[0],i=t.match(n.parsePattern);if(!i)return null;let s=n.valueCallback?n.valueCallback(i[0]):i[0];s=e.valueCallback?e.valueCallback(s):s;const o=t.slice(a.length);return{value:s,rest:o}}}const Bt=/^(\d+)(th|st|nd|rd)?/i,Jt=/\d+/i,Ut={narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},Zt={any:[/^b/i,/^(a|c)/i]},zt={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Kt={any:[/1/i,/2/i,/3/i,/4/i]},te={narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},ee={narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i]},ne={narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},re={narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},ae={narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},ie={any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},se={ordinalNumber:Qt({matchPattern:Bt,parsePattern:Jt,valueCallback:n=>parseInt(n,10)}),era:x({matchPatterns:Ut,defaultMatchWidth:"wide",parsePatterns:Zt,defaultParseWidth:"any"}),quarter:x({matchPatterns:zt,defaultMatchWidth:"wide",parsePatterns:Kt,defaultParseWidth:"any",valueCallback:n=>n+1}),month:x({matchPatterns:te,defaultMatchWidth:"wide",parsePatterns:ee,defaultParseWidth:"any"}),day:x({matchPatterns:ne,defaultMatchWidth:"wide",parsePatterns:re,defaultParseWidth:"any"}),dayPeriod:x({matchPatterns:ae,defaultMatchWidth:"any",parsePatterns:ie,defaultParseWidth:"any"})},oe={code:"en-US",formatDistance:Tt,formatLong:Ft,formatRelative:Vt,localize:Xt,match:se,options:{weekStartsOn:0,firstWeekContainsDate:1}};function ue(n){const t=d(n);return St(t,kt(t))+1}function ce(n){const t=d(n),e=+Y(t)-+Pt(t);return Math.round(e/B)+1}function U(n,t){var h,g,S,P;const e=d(n),r=e.getFullYear(),a=F(),i=(t==null?void 0:t.firstWeekContainsDate)??((g=(h=t==null?void 0:t.locale)==null?void 0:h.options)==null?void 0:g.firstWeekContainsDate)??a.firstWeekContainsDate??((P=(S=a.locale)==null?void 0:S.options)==null?void 0:P.firstWeekContainsDate)??1,s=y(n,0);s.setFullYear(r+1,0,i),s.setHours(0,0,0,0);const o=N(s,t),c=y(n,0);c.setFullYear(r,0,i),c.setHours(0,0,0,0);const f=N(c,t);return e.getTime()>=o.getTime()?r+1:e.getTime()>=f.getTime()?r:r-1}function de(n,t){var o,c,f,h;const e=F(),r=(t==null?void 0:t.firstWeekContainsDate)??((c=(o=t==null?void 0:t.locale)==null?void 0:o.options)==null?void 0:c.firstWeekContainsDate)??e.firstWeekContainsDate??((h=(f=e.locale)==null?void 0:f.options)==null?void 0:h.firstWeekContainsDate)??1,a=U(n,t),i=y(n,0);return i.setFullYear(a,0,r),i.setHours(0,0,0,0),N(i,t)}function fe(n,t){const e=d(n),r=+N(e,t)-+de(e,t);return Math.round(r/B)+1}function u(n,t){const e=n<0?"-":"",r=Math.abs(n).toString().padStart(t,"0");return e+r}const M={y(n,t){const e=n.getFullYear(),r=e>0?e:1-e;return u(t==="yy"?r%100:r,t.length)},M(n,t){const e=n.getMonth();return t==="M"?String(e+1):u(e+1,2)},d(n,t){return u(n.getDate(),t.length)},a(n,t){const e=n.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return e.toUpperCase();case"aaa":return e;case"aaaaa":return e[0];case"aaaa":default:return e==="am"?"a.m.":"p.m."}},h(n,t){return u(n.getHours()%12||12,t.length)},H(n,t){return u(n.getHours(),t.length)},m(n,t){return u(n.getMinutes(),t.length)},s(n,t){return u(n.getSeconds(),t.length)},S(n,t){const e=t.length,r=n.getMilliseconds(),a=Math.trunc(r*Math.pow(10,e-3));return u(a,t.length)}},O={midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},I={G:function(n,t,e){const r=n.getFullYear()>0?1:0;switch(t){case"G":case"GG":case"GGG":return e.era(r,{width:"abbreviated"});case"GGGGG":return e.era(r,{width:"narrow"});case"GGGG":default:return e.era(r,{width:"wide"})}},y:function(n,t,e){if(t==="yo"){const r=n.getFullYear(),a=r>0?r:1-r;return e.ordinalNumber(a,{unit:"year"})}return M.y(n,t)},Y:function(n,t,e,r){const a=U(n,r),i=a>0?a:1-a;if(t==="YY"){const s=i%100;return u(s,2)}return t==="Yo"?e.ordinalNumber(i,{unit:"year"}):u(i,t.length)},R:function(n,t){const e=J(n);return u(e,t.length)},u:function(n,t){const e=n.getFullYear();return u(e,t.length)},Q:function(n,t,e){const r=Math.ceil((n.getMonth()+1)/3);switch(t){case"Q":return String(r);case"QQ":return u(r,2);case"Qo":return e.ordinalNumber(r,{unit:"quarter"});case"QQQ":return e.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return e.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return e.quarter(r,{width:"wide",context:"formatting"})}},q:function(n,t,e){const r=Math.ceil((n.getMonth()+1)/3);switch(t){case"q":return String(r);case"qq":return u(r,2);case"qo":return e.ordinalNumber(r,{unit:"quarter"});case"qqq":return e.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return e.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return e.quarter(r,{width:"wide",context:"standalone"})}},M:function(n,t,e){const r=n.getMonth();switch(t){case"M":case"MM":return M.M(n,t);case"Mo":return e.ordinalNumber(r+1,{unit:"month"});case"MMM":return e.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return e.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return e.month(r,{width:"wide",context:"formatting"})}},L:function(n,t,e){const r=n.getMonth();switch(t){case"L":return String(r+1);case"LL":return u(r+1,2);case"Lo":return e.ordinalNumber(r+1,{unit:"month"});case"LLL":return e.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return e.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return e.month(r,{width:"wide",context:"standalone"})}},w:function(n,t,e,r){const a=fe(n,r);return t==="wo"?e.ordinalNumber(a,{unit:"week"}):u(a,t.length)},I:function(n,t,e){const r=ce(n);return t==="Io"?e.ordinalNumber(r,{unit:"week"}):u(r,t.length)},d:function(n,t,e){return t==="do"?e.ordinalNumber(n.getDate(),{unit:"date"}):M.d(n,t)},D:function(n,t,e){const r=ue(n);return t==="Do"?e.ordinalNumber(r,{unit:"dayOfYear"}):u(r,t.length)},E:function(n,t,e){const r=n.getDay();switch(t){case"E":case"EE":case"EEE":return e.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return e.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return e.day(r,{width:"short",context:"formatting"});case"EEEE":default:return e.day(r,{width:"wide",context:"formatting"})}},e:function(n,t,e,r){const a=n.getDay(),i=(a-r.weekStartsOn+8)%7||7;switch(t){case"e":return String(i);case"ee":return u(i,2);case"eo":return e.ordinalNumber(i,{unit:"day"});case"eee":return e.day(a,{width:"abbreviated",context:"formatting"});case"eeeee":return e.day(a,{width:"narrow",context:"formatting"});case"eeeeee":return e.day(a,{width:"short",context:"formatting"});case"eeee":default:return e.day(a,{width:"wide",context:"formatting"})}},c:function(n,t,e,r){const a=n.getDay(),i=(a-r.weekStartsOn+8)%7||7;switch(t){case"c":return String(i);case"cc":return u(i,t.length);case"co":return e.ordinalNumber(i,{unit:"day"});case"ccc":return e.day(a,{width:"abbreviated",context:"standalone"});case"ccccc":return e.day(a,{width:"narrow",context:"standalone"});case"cccccc":return e.day(a,{width:"short",context:"standalone"});case"cccc":default:return e.day(a,{width:"wide",context:"standalone"})}},i:function(n,t,e){const r=n.getDay(),a=r===0?7:r;switch(t){case"i":return String(a);case"ii":return u(a,t.length);case"io":return e.ordinalNumber(a,{unit:"day"});case"iii":return e.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return e.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return e.day(r,{width:"short",context:"formatting"});case"iiii":default:return e.day(r,{width:"wide",context:"formatting"})}},a:function(n,t,e){const a=n.getHours()/12>=1?"pm":"am";switch(t){case"a":case"aa":return e.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"aaa":return e.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return e.dayPeriod(a,{width:"narrow",context:"formatting"});case"aaaa":default:return e.dayPeriod(a,{width:"wide",context:"formatting"})}},b:function(n,t,e){const r=n.getHours();let a;switch(r===12?a=O.noon:r===0?a=O.midnight:a=r/12>=1?"pm":"am",t){case"b":case"bb":return e.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"bbb":return e.dayPeriod(a,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return e.dayPeriod(a,{width:"narrow",context:"formatting"});case"bbbb":default:return e.dayPeriod(a,{width:"wide",context:"formatting"})}},B:function(n,t,e){const r=n.getHours();let a;switch(r>=17?a=O.evening:r>=12?a=O.afternoon:r>=4?a=O.morning:a=O.night,t){case"B":case"BB":case"BBB":return e.dayPeriod(a,{width:"abbreviated",context:"formatting"});case"BBBBB":return e.dayPeriod(a,{width:"narrow",context:"formatting"});case"BBBB":default:return e.dayPeriod(a,{width:"wide",context:"formatting"})}},h:function(n,t,e){if(t==="ho"){let r=n.getHours()%12;return r===0&&(r=12),e.ordinalNumber(r,{unit:"hour"})}return M.h(n,t)},H:function(n,t,e){return t==="Ho"?e.ordinalNumber(n.getHours(),{unit:"hour"}):M.H(n,t)},K:function(n,t,e){const r=n.getHours()%12;return t==="Ko"?e.ordinalNumber(r,{unit:"hour"}):u(r,t.length)},k:function(n,t,e){let r=n.getHours();return r===0&&(r=24),t==="ko"?e.ordinalNumber(r,{unit:"hour"}):u(r,t.length)},m:function(n,t,e){return t==="mo"?e.ordinalNumber(n.getMinutes(),{unit:"minute"}):M.m(n,t)},s:function(n,t,e){return t==="so"?e.ordinalNumber(n.getSeconds(),{unit:"second"}):M.s(n,t)},S:function(n,t){return M.S(n,t)},X:function(n,t,e){const r=n.getTimezoneOffset();if(r===0)return"Z";switch(t){case"X":return X(r);case"XXXX":case"XX":return D(r);case"XXXXX":case"XXX":default:return D(r,":")}},x:function(n,t,e){const r=n.getTimezoneOffset();switch(t){case"x":return X(r);case"xxxx":case"xx":return D(r);case"xxxxx":case"xxx":default:return D(r,":")}},O:function(n,t,e){const r=n.getTimezoneOffset();switch(t){case"O":case"OO":case"OOO":return"GMT"+j(r,":");case"OOOO":default:return"GMT"+D(r,":")}},z:function(n,t,e){const r=n.getTimezoneOffset();switch(t){case"z":case"zz":case"zzz":return"GMT"+j(r,":");case"zzzz":default:return"GMT"+D(r,":")}},t:function(n,t,e){const r=Math.trunc(n.getTime()/1e3);return u(r,t.length)},T:function(n,t,e){const r=n.getTime();return u(r,t.length)}};function j(n,t=""){const e=n>0?"-":"+",r=Math.abs(n),a=Math.trunc(r/60),i=r%60;return i===0?e+String(a):e+String(a)+t+u(i,2)}function X(n,t){return n%60===0?(n>0?"-":"+")+u(Math.abs(n)/60,2):D(n,t)}function D(n,t=""){const e=n>0?"-":"+",r=Math.abs(n),a=u(Math.trunc(r/60),2),i=u(r%60,2);return e+a+t+i}const $=(n,t)=>{switch(n){case"P":return t.date({width:"short"});case"PP":return t.date({width:"medium"});case"PPP":return t.date({width:"long"});case"PPPP":default:return t.date({width:"full"})}},Z=(n,t)=>{switch(n){case"p":return t.time({width:"short"});case"pp":return t.time({width:"medium"});case"ppp":return t.time({width:"long"});case"pppp":default:return t.time({width:"full"})}},he=(n,t)=>{const e=n.match(/(P+)(p+)?/)||[],r=e[1],a=e[2];if(!a)return $(n,t);let i;switch(r){case"P":i=t.dateTime({width:"short"});break;case"PP":i=t.dateTime({width:"medium"});break;case"PPP":i=t.dateTime({width:"long"});break;case"PPPP":default:i=t.dateTime({width:"full"});break}return i.replace("{{date}}",$(r,t)).replace("{{time}}",Z(a,t))},le={p:Z,P:he},me=/^D+$/,ge=/^Y+$/,ye=["D","DD","YY","YYYY"];function be(n){return me.test(n)}function we(n){return ge.test(n)}function pe(n,t,e){const r=Me(n,t,e);if(console.warn(r),ye.includes(n))throw new RangeError(r)}function Me(n,t,e){const r=n[0]==="Y"?"years":"days of the month";return`Use \`${n.toLowerCase()}\` instead of \`${n}\` (in \`${t}\`) for formatting ${r} to the input \`${e}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const De=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Oe=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Se=/^'([^]*?)'?$/,Pe=/''/g,ve=/[a-zA-Z]/;function xe(n,t,e){var h,g,S,P;const r=F(),a=r.locale??oe,i=r.firstWeekContainsDate??((g=(h=r.locale)==null?void 0:h.options)==null?void 0:g.firstWeekContainsDate)??1,s=r.weekStartsOn??((P=(S=r.locale)==null?void 0:S.options)==null?void 0:P.weekStartsOn)??0,o=d(n);if(!Nt(o))throw new RangeError("Invalid time value");let c=t.match(Oe).map(m=>{const l=m[0];if(l==="p"||l==="P"){const C=le[l];return C(m,a.formatLong)}return m}).join("").match(De).map(m=>{if(m==="''")return{isToken:!1,value:"'"};const l=m[0];if(l==="'")return{isToken:!1,value:Ne(m)};if(I[l])return{isToken:!0,value:m};if(l.match(ve))throw new RangeError("Format string contains an unescaped latin alphabet character `"+l+"`");return{isToken:!1,value:m}});a.localize.preprocessor&&(c=a.localize.preprocessor(o,c));const f={firstWeekContainsDate:i,weekStartsOn:s,locale:a};return c.map(m=>{if(!m.isToken)return m.value;const l=m.value;(we(l)||be(l))&&pe(l,t,String(n));const C=I[l[0]];return C(o,l,a.localize,f)}).join("")}function Ne(n){const t=n.match(Se);return t?t[1].replace(Pe,"'"):n}function ke(n){const t=d(n),e=t.getFullYear(),r=t.getMonth(),a=y(n,0);return a.setFullYear(e,r+1,0),a.setHours(0,0,0,0),a.getDate()}function Ye(n){const t=d(n),e=t.getMonth();return t.setFullYear(t.getFullYear(),e+1,0),t.setHours(0,0,0,0),t}function Te(n,t){const e=d(n),r=d(t);return e.getTime()>r.getTime()}function We(n,t){const e=d(n),r=d(t);return+e<+r}function _e(n,t){const e=d(n),r=d(t);return e.getFullYear()===r.getFullYear()&&e.getMonth()===r.getMonth()}class b{constructor(t){p(this,"_dateNums");t||t===0?this._dateNums=b.parse(t):this._dateNums=b.parse(new Date)}static parse(t){return typeof t=="string"?(t=t.split("T")[0],t.split("-").map(e=>+e)):t instanceof Date?[t.getFullYear(),t.getMonth()+1,t.getDate()]:t===0?[0,0,0]:[t.year,t.month,t.day]}static init(){return new b(0)}get date(){return new Date(this._dateNums[0],this._dateNums[1]-1,this._dateNums[2])}get year(){return this._dateNums[0]}get month(){return this._dateNums[1]}get day(){return this._dateNums[2]}get dayOfWeek(){return this.date.getDay()}get daysInMonth(){return ke(this.date)}get firstDayOfMonth(){return new b({year:this.year,month:this.month,day:1})}get lastDayOfMonth(){return new b(Ye(this.date))}get previousDay(){return this.clone().addDays(-1)}get nextDay(){return this.clone().addDays(1)}get previousWeek(){return this.clone().addDays(-7)}get nextWeek(){return this.clone().addDays(7)}get previousMonth(){return this.clone().addMonths(-1)}get nextMonth(){return this.clone().addMonths(1)}clone(){return new b(this.toString())}setYear(t){this._dateNums[0]=t}setMonth(t){this._dateNums[1]=t}setDay(t){return this._dateNums[2]=t,this}addYears(t){return this._dateNums[0]+=t,this}addMonths(t){return this._dateNums=b.parse(Mt(this.date,t)),this}addDays(t){return this._dateNums=b.parse(pt(this.date,t)),this}isSameDay(t){return vt(this.date,t.date)}isSameMonth(t){return _e(this.date,t.date)}isBefore(t){return We(this.date,t.date)}isAfter(t){return Te(this.date,t.date)}isZero(){return this._dateNums[0]===0&&this._dateNums[1]===0&&this._dateNums[2]===0}isValid(){const t=new Date(this.toString());return!(isNaN(t.getTime())||this.toString()!==t.toISOString().split("T")[0])}format(t){return this.isZero()?"":xe(this.date,t)}toString(){return this.isZero()?"":this._dateNums.map(t=>`${t}`.length<2?`0${t}`:`${t}`).join("-")}}exports.CalendarDate=b;exports.FormValidator=et;exports.Once=Q;exports.PublicFormController=ft;exports.SINValidator=ot;exports.TemporaryNotification=bt;exports.birthDayValidator=nt;exports.birthMonthValidator=rt;exports.birthYearValidator=at;exports.dateValidator=ct;exports.dispatch=A;exports.emailValidator=st;exports.lengthValidator=dt;exports.numericValidator=E;exports.phoneNumberValidator=it;exports.postalCodeValidator=ut;exports.regexValidator=_;exports.relay=w;exports.requiredValidator=W;
|
package/index.d.ts
CHANGED
|
@@ -3,5 +3,5 @@ export * from './lib/validators';
|
|
|
3
3
|
export * from './lib/public-form-controller';
|
|
4
4
|
export * from './lib/temporary-notification-controller/temporary-notification-controller';
|
|
5
5
|
export * from './lib/messaging/messaging';
|
|
6
|
-
export { CalendarDate } from './lib/calendar-date';
|
|
7
6
|
export { Once } from './lib/once';
|
|
7
|
+
export { CalendarDate } from './lib/calendar-date';
|
package/index.js
CHANGED
|
@@ -415,6 +415,22 @@ const Ee = {
|
|
|
415
415
|
dismiss: rt,
|
|
416
416
|
setProgress: at
|
|
417
417
|
};
|
|
418
|
+
class it {
|
|
419
|
+
constructor() {
|
|
420
|
+
w(this, "done");
|
|
421
|
+
this.done = /* @__PURE__ */ new Set();
|
|
422
|
+
}
|
|
423
|
+
when(t) {
|
|
424
|
+
return t ? this : new st();
|
|
425
|
+
}
|
|
426
|
+
do(t, e) {
|
|
427
|
+
this.done.has(t) || (this.done.add(t), e());
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
class st extends it {
|
|
431
|
+
do(t, e) {
|
|
432
|
+
}
|
|
433
|
+
}
|
|
418
434
|
function d(n) {
|
|
419
435
|
const t = Object.prototype.toString.call(n);
|
|
420
436
|
return n instanceof Date || typeof n == "object" && t === "[object Date]" ? new n.constructor(+n) : typeof n == "number" || t === "[object Number]" || typeof n == "string" || t === "[object String]" ? new Date(n) : /* @__PURE__ */ new Date(NaN);
|
|
@@ -422,11 +438,11 @@ function d(n) {
|
|
|
422
438
|
function y(n, t) {
|
|
423
439
|
return n instanceof Date ? new n.constructor(t) : new Date(t);
|
|
424
440
|
}
|
|
425
|
-
function
|
|
441
|
+
function ot(n, t) {
|
|
426
442
|
const e = d(n);
|
|
427
443
|
return isNaN(t) ? y(n, NaN) : (t && e.setDate(e.getDate() + t), e);
|
|
428
444
|
}
|
|
429
|
-
function
|
|
445
|
+
function ut(n, t) {
|
|
430
446
|
const e = d(n);
|
|
431
447
|
if (isNaN(t)) return y(n, NaN);
|
|
432
448
|
if (!t)
|
|
@@ -440,10 +456,10 @@ function st(n, t) {
|
|
|
440
456
|
r
|
|
441
457
|
), e);
|
|
442
458
|
}
|
|
443
|
-
const Q = 6048e5,
|
|
444
|
-
let
|
|
459
|
+
const Q = 6048e5, ct = 864e5;
|
|
460
|
+
let dt = {};
|
|
445
461
|
function W() {
|
|
446
|
-
return
|
|
462
|
+
return dt;
|
|
447
463
|
}
|
|
448
464
|
function k(n, t) {
|
|
449
465
|
var o, c, f, h;
|
|
@@ -479,32 +495,32 @@ function H(n) {
|
|
|
479
495
|
);
|
|
480
496
|
return e.setUTCFullYear(t.getFullYear()), +n - +e;
|
|
481
497
|
}
|
|
482
|
-
function
|
|
498
|
+
function ft(n, t) {
|
|
483
499
|
const e = T(n), r = T(t), a = +e - H(e), i = +r - H(r);
|
|
484
|
-
return Math.round((a - i) /
|
|
500
|
+
return Math.round((a - i) / ct);
|
|
485
501
|
}
|
|
486
|
-
function
|
|
502
|
+
function ht(n) {
|
|
487
503
|
const t = B(n), e = y(n, 0);
|
|
488
504
|
return e.setFullYear(t, 0, 4), e.setHours(0, 0, 0, 0), Y(e);
|
|
489
505
|
}
|
|
490
|
-
function
|
|
506
|
+
function lt(n, t) {
|
|
491
507
|
const e = T(n), r = T(t);
|
|
492
508
|
return +e == +r;
|
|
493
509
|
}
|
|
494
|
-
function
|
|
510
|
+
function mt(n) {
|
|
495
511
|
return n instanceof Date || typeof n == "object" && Object.prototype.toString.call(n) === "[object Date]";
|
|
496
512
|
}
|
|
497
|
-
function
|
|
498
|
-
if (!
|
|
513
|
+
function gt(n) {
|
|
514
|
+
if (!mt(n) && typeof n != "number")
|
|
499
515
|
return !1;
|
|
500
516
|
const t = d(n);
|
|
501
517
|
return !isNaN(Number(t));
|
|
502
518
|
}
|
|
503
|
-
function
|
|
519
|
+
function yt(n) {
|
|
504
520
|
const t = d(n), e = y(n, 0);
|
|
505
521
|
return e.setFullYear(t.getFullYear(), 0, 1), e.setHours(0, 0, 0, 0), e;
|
|
506
522
|
}
|
|
507
|
-
const
|
|
523
|
+
const bt = {
|
|
508
524
|
lessThanXSeconds: {
|
|
509
525
|
one: "less than a second",
|
|
510
526
|
other: "less than {{count}} seconds"
|
|
@@ -566,9 +582,9 @@ const gt = {
|
|
|
566
582
|
one: "almost 1 year",
|
|
567
583
|
other: "almost {{count}} years"
|
|
568
584
|
}
|
|
569
|
-
},
|
|
585
|
+
}, wt = (n, t, e) => {
|
|
570
586
|
let r;
|
|
571
|
-
const a =
|
|
587
|
+
const a = bt[n];
|
|
572
588
|
return typeof a == "string" ? r = a : t === 1 ? r = a.one : r = a.other.replace("{{count}}", t.toString()), e != null && e.addSuffix ? e.comparison && e.comparison > 0 ? "in " + r : r + " ago" : r;
|
|
573
589
|
};
|
|
574
590
|
function E(n) {
|
|
@@ -577,42 +593,42 @@ function E(n) {
|
|
|
577
593
|
return n.formats[e] || n.formats[n.defaultWidth];
|
|
578
594
|
};
|
|
579
595
|
}
|
|
580
|
-
const
|
|
596
|
+
const pt = {
|
|
581
597
|
full: "EEEE, MMMM do, y",
|
|
582
598
|
long: "MMMM do, y",
|
|
583
599
|
medium: "MMM d, y",
|
|
584
600
|
short: "MM/dd/yyyy"
|
|
585
|
-
},
|
|
601
|
+
}, Mt = {
|
|
586
602
|
full: "h:mm:ss a zzzz",
|
|
587
603
|
long: "h:mm:ss a z",
|
|
588
604
|
medium: "h:mm:ss a",
|
|
589
605
|
short: "h:mm a"
|
|
590
|
-
},
|
|
606
|
+
}, Dt = {
|
|
591
607
|
full: "{{date}} 'at' {{time}}",
|
|
592
608
|
long: "{{date}} 'at' {{time}}",
|
|
593
609
|
medium: "{{date}}, {{time}}",
|
|
594
610
|
short: "{{date}}, {{time}}"
|
|
595
|
-
},
|
|
611
|
+
}, Ot = {
|
|
596
612
|
date: E({
|
|
597
|
-
formats:
|
|
613
|
+
formats: pt,
|
|
598
614
|
defaultWidth: "full"
|
|
599
615
|
}),
|
|
600
616
|
time: E({
|
|
601
|
-
formats:
|
|
617
|
+
formats: Mt,
|
|
602
618
|
defaultWidth: "full"
|
|
603
619
|
}),
|
|
604
620
|
dateTime: E({
|
|
605
|
-
formats:
|
|
621
|
+
formats: Dt,
|
|
606
622
|
defaultWidth: "full"
|
|
607
623
|
})
|
|
608
|
-
},
|
|
624
|
+
}, Pt = {
|
|
609
625
|
lastWeek: "'last' eeee 'at' p",
|
|
610
626
|
yesterday: "'yesterday at' p",
|
|
611
627
|
today: "'today at' p",
|
|
612
628
|
tomorrow: "'tomorrow at' p",
|
|
613
629
|
nextWeek: "eeee 'at' p",
|
|
614
630
|
other: "P"
|
|
615
|
-
},
|
|
631
|
+
}, St = (n, t, e, r) => Pt[n];
|
|
616
632
|
function v(n) {
|
|
617
633
|
return (t, e) => {
|
|
618
634
|
const r = e != null && e.context ? String(e.context) : "standalone";
|
|
@@ -628,15 +644,15 @@ function v(n) {
|
|
|
628
644
|
return a[i];
|
|
629
645
|
};
|
|
630
646
|
}
|
|
631
|
-
const
|
|
647
|
+
const vt = {
|
|
632
648
|
narrow: ["B", "A"],
|
|
633
649
|
abbreviated: ["BC", "AD"],
|
|
634
650
|
wide: ["Before Christ", "Anno Domini"]
|
|
635
|
-
},
|
|
651
|
+
}, xt = {
|
|
636
652
|
narrow: ["1", "2", "3", "4"],
|
|
637
653
|
abbreviated: ["Q1", "Q2", "Q3", "Q4"],
|
|
638
654
|
wide: ["1st quarter", "2nd quarter", "3rd quarter", "4th quarter"]
|
|
639
|
-
},
|
|
655
|
+
}, kt = {
|
|
640
656
|
narrow: ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"],
|
|
641
657
|
abbreviated: [
|
|
642
658
|
"Jan",
|
|
@@ -666,7 +682,7 @@ const Pt = {
|
|
|
666
682
|
"November",
|
|
667
683
|
"December"
|
|
668
684
|
]
|
|
669
|
-
},
|
|
685
|
+
}, Nt = {
|
|
670
686
|
narrow: ["S", "M", "T", "W", "T", "F", "S"],
|
|
671
687
|
short: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
|
|
672
688
|
abbreviated: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
|
|
@@ -679,7 +695,7 @@ const Pt = {
|
|
|
679
695
|
"Friday",
|
|
680
696
|
"Saturday"
|
|
681
697
|
]
|
|
682
|
-
},
|
|
698
|
+
}, Yt = {
|
|
683
699
|
narrow: {
|
|
684
700
|
am: "a",
|
|
685
701
|
pm: "p",
|
|
@@ -710,7 +726,7 @@ const Pt = {
|
|
|
710
726
|
evening: "evening",
|
|
711
727
|
night: "night"
|
|
712
728
|
}
|
|
713
|
-
},
|
|
729
|
+
}, Tt = {
|
|
714
730
|
narrow: {
|
|
715
731
|
am: "a",
|
|
716
732
|
pm: "p",
|
|
@@ -741,7 +757,7 @@ const Pt = {
|
|
|
741
757
|
evening: "in the evening",
|
|
742
758
|
night: "at night"
|
|
743
759
|
}
|
|
744
|
-
},
|
|
760
|
+
}, Wt = (n, t) => {
|
|
745
761
|
const e = Number(n), r = e % 100;
|
|
746
762
|
if (r > 20 || r < 10)
|
|
747
763
|
switch (r % 10) {
|
|
@@ -753,29 +769,29 @@ const Pt = {
|
|
|
753
769
|
return e + "rd";
|
|
754
770
|
}
|
|
755
771
|
return e + "th";
|
|
756
|
-
},
|
|
757
|
-
ordinalNumber:
|
|
772
|
+
}, _t = {
|
|
773
|
+
ordinalNumber: Wt,
|
|
758
774
|
era: v({
|
|
759
|
-
values:
|
|
775
|
+
values: vt,
|
|
760
776
|
defaultWidth: "wide"
|
|
761
777
|
}),
|
|
762
778
|
quarter: v({
|
|
763
|
-
values:
|
|
779
|
+
values: xt,
|
|
764
780
|
defaultWidth: "wide",
|
|
765
781
|
argumentCallback: (n) => n - 1
|
|
766
782
|
}),
|
|
767
783
|
month: v({
|
|
768
|
-
values:
|
|
784
|
+
values: kt,
|
|
769
785
|
defaultWidth: "wide"
|
|
770
786
|
}),
|
|
771
787
|
day: v({
|
|
772
|
-
values:
|
|
788
|
+
values: Nt,
|
|
773
789
|
defaultWidth: "wide"
|
|
774
790
|
}),
|
|
775
791
|
dayPeriod: v({
|
|
776
|
-
values:
|
|
792
|
+
values: Yt,
|
|
777
793
|
defaultWidth: "wide",
|
|
778
|
-
formattingValues:
|
|
794
|
+
formattingValues: Tt,
|
|
779
795
|
defaultFormattingWidth: "wide"
|
|
780
796
|
})
|
|
781
797
|
};
|
|
@@ -784,9 +800,9 @@ function x(n) {
|
|
|
784
800
|
const r = e.width, a = r && n.matchPatterns[r] || n.matchPatterns[n.defaultMatchWidth], i = t.match(a);
|
|
785
801
|
if (!i)
|
|
786
802
|
return null;
|
|
787
|
-
const s = i[0], o = r && n.parsePatterns[r] || n.parsePatterns[n.defaultParseWidth], c = Array.isArray(o) ?
|
|
803
|
+
const s = i[0], o = r && n.parsePatterns[r] || n.parsePatterns[n.defaultParseWidth], c = Array.isArray(o) ? Ft(o, (g) => g.test(s)) : (
|
|
788
804
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- I challange you to fix the type
|
|
789
|
-
|
|
805
|
+
Et(o, (g) => g.test(s))
|
|
790
806
|
);
|
|
791
807
|
let f;
|
|
792
808
|
f = n.valueCallback ? n.valueCallback(c) : c, f = e.valueCallback ? (
|
|
@@ -797,17 +813,17 @@ function x(n) {
|
|
|
797
813
|
return { value: f, rest: h };
|
|
798
814
|
};
|
|
799
815
|
}
|
|
800
|
-
function
|
|
816
|
+
function Et(n, t) {
|
|
801
817
|
for (const e in n)
|
|
802
818
|
if (Object.prototype.hasOwnProperty.call(n, e) && t(n[e]))
|
|
803
819
|
return e;
|
|
804
820
|
}
|
|
805
|
-
function
|
|
821
|
+
function Ft(n, t) {
|
|
806
822
|
for (let e = 0; e < n.length; e++)
|
|
807
823
|
if (t(n[e]))
|
|
808
824
|
return e;
|
|
809
825
|
}
|
|
810
|
-
function
|
|
826
|
+
function Ct(n) {
|
|
811
827
|
return (t, e = {}) => {
|
|
812
828
|
const r = t.match(n.matchPattern);
|
|
813
829
|
if (!r) return null;
|
|
@@ -819,23 +835,23 @@ function Et(n) {
|
|
|
819
835
|
return { value: s, rest: o };
|
|
820
836
|
};
|
|
821
837
|
}
|
|
822
|
-
const
|
|
838
|
+
const At = /^(\d+)(th|st|nd|rd)?/i, qt = /\d+/i, Rt = {
|
|
823
839
|
narrow: /^(b|a)/i,
|
|
824
840
|
abbreviated: /^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,
|
|
825
841
|
wide: /^(before christ|before common era|anno domini|common era)/i
|
|
826
|
-
},
|
|
842
|
+
}, Vt = {
|
|
827
843
|
any: [/^b/i, /^(a|c)/i]
|
|
828
|
-
},
|
|
844
|
+
}, Lt = {
|
|
829
845
|
narrow: /^[1234]/i,
|
|
830
846
|
abbreviated: /^q[1234]/i,
|
|
831
847
|
wide: /^[1234](th|st|nd|rd)? quarter/i
|
|
832
|
-
},
|
|
848
|
+
}, Ht = {
|
|
833
849
|
any: [/1/i, /2/i, /3/i, /4/i]
|
|
834
|
-
},
|
|
850
|
+
}, It = {
|
|
835
851
|
narrow: /^[jfmasond]/i,
|
|
836
852
|
abbreviated: /^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
|
|
837
853
|
wide: /^(january|february|march|april|may|june|july|august|september|october|november|december)/i
|
|
838
|
-
},
|
|
854
|
+
}, Xt = {
|
|
839
855
|
narrow: [
|
|
840
856
|
/^j/i,
|
|
841
857
|
/^f/i,
|
|
@@ -864,18 +880,18 @@ const Ft = /^(\d+)(th|st|nd|rd)?/i, Ct = /\d+/i, At = {
|
|
|
864
880
|
/^n/i,
|
|
865
881
|
/^d/i
|
|
866
882
|
]
|
|
867
|
-
},
|
|
883
|
+
}, jt = {
|
|
868
884
|
narrow: /^[smtwf]/i,
|
|
869
885
|
short: /^(su|mo|tu|we|th|fr|sa)/i,
|
|
870
886
|
abbreviated: /^(sun|mon|tue|wed|thu|fri|sat)/i,
|
|
871
887
|
wide: /^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i
|
|
872
|
-
},
|
|
888
|
+
}, $t = {
|
|
873
889
|
narrow: [/^s/i, /^m/i, /^t/i, /^w/i, /^t/i, /^f/i, /^s/i],
|
|
874
890
|
any: [/^su/i, /^m/i, /^tu/i, /^w/i, /^th/i, /^f/i, /^sa/i]
|
|
875
|
-
},
|
|
891
|
+
}, Gt = {
|
|
876
892
|
narrow: /^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,
|
|
877
893
|
any: /^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i
|
|
878
|
-
},
|
|
894
|
+
}, Qt = {
|
|
879
895
|
any: {
|
|
880
896
|
am: /^a/i,
|
|
881
897
|
pm: /^p/i,
|
|
@@ -886,61 +902,61 @@ const Ft = /^(\d+)(th|st|nd|rd)?/i, Ct = /\d+/i, At = {
|
|
|
886
902
|
evening: /evening/i,
|
|
887
903
|
night: /night/i
|
|
888
904
|
}
|
|
889
|
-
},
|
|
890
|
-
ordinalNumber:
|
|
891
|
-
matchPattern:
|
|
892
|
-
parsePattern:
|
|
905
|
+
}, Bt = {
|
|
906
|
+
ordinalNumber: Ct({
|
|
907
|
+
matchPattern: At,
|
|
908
|
+
parsePattern: qt,
|
|
893
909
|
valueCallback: (n) => parseInt(n, 10)
|
|
894
910
|
}),
|
|
895
911
|
era: x({
|
|
896
|
-
matchPatterns:
|
|
912
|
+
matchPatterns: Rt,
|
|
897
913
|
defaultMatchWidth: "wide",
|
|
898
|
-
parsePatterns:
|
|
914
|
+
parsePatterns: Vt,
|
|
899
915
|
defaultParseWidth: "any"
|
|
900
916
|
}),
|
|
901
917
|
quarter: x({
|
|
902
|
-
matchPatterns:
|
|
918
|
+
matchPatterns: Lt,
|
|
903
919
|
defaultMatchWidth: "wide",
|
|
904
|
-
parsePatterns:
|
|
920
|
+
parsePatterns: Ht,
|
|
905
921
|
defaultParseWidth: "any",
|
|
906
922
|
valueCallback: (n) => n + 1
|
|
907
923
|
}),
|
|
908
924
|
month: x({
|
|
909
|
-
matchPatterns:
|
|
925
|
+
matchPatterns: It,
|
|
910
926
|
defaultMatchWidth: "wide",
|
|
911
|
-
parsePatterns:
|
|
927
|
+
parsePatterns: Xt,
|
|
912
928
|
defaultParseWidth: "any"
|
|
913
929
|
}),
|
|
914
930
|
day: x({
|
|
915
|
-
matchPatterns:
|
|
931
|
+
matchPatterns: jt,
|
|
916
932
|
defaultMatchWidth: "wide",
|
|
917
|
-
parsePatterns:
|
|
933
|
+
parsePatterns: $t,
|
|
918
934
|
defaultParseWidth: "any"
|
|
919
935
|
}),
|
|
920
936
|
dayPeriod: x({
|
|
921
|
-
matchPatterns:
|
|
937
|
+
matchPatterns: Gt,
|
|
922
938
|
defaultMatchWidth: "any",
|
|
923
|
-
parsePatterns:
|
|
939
|
+
parsePatterns: Qt,
|
|
924
940
|
defaultParseWidth: "any"
|
|
925
941
|
})
|
|
926
|
-
},
|
|
942
|
+
}, Jt = {
|
|
927
943
|
code: "en-US",
|
|
928
|
-
formatDistance:
|
|
929
|
-
formatLong:
|
|
930
|
-
formatRelative:
|
|
931
|
-
localize:
|
|
932
|
-
match:
|
|
944
|
+
formatDistance: wt,
|
|
945
|
+
formatLong: Ot,
|
|
946
|
+
formatRelative: St,
|
|
947
|
+
localize: _t,
|
|
948
|
+
match: Bt,
|
|
933
949
|
options: {
|
|
934
950
|
weekStartsOn: 0,
|
|
935
951
|
firstWeekContainsDate: 1
|
|
936
952
|
}
|
|
937
953
|
};
|
|
938
|
-
function
|
|
954
|
+
function Ut(n) {
|
|
939
955
|
const t = d(n);
|
|
940
|
-
return
|
|
956
|
+
return ft(t, yt(t)) + 1;
|
|
941
957
|
}
|
|
942
|
-
function
|
|
943
|
-
const t = d(n), e = +Y(t) - +
|
|
958
|
+
function Zt(n) {
|
|
959
|
+
const t = d(n), e = +Y(t) - +ht(t);
|
|
944
960
|
return Math.round(e / Q) + 1;
|
|
945
961
|
}
|
|
946
962
|
function J(n, t) {
|
|
@@ -952,13 +968,13 @@ function J(n, t) {
|
|
|
952
968
|
const f = k(c, t);
|
|
953
969
|
return e.getTime() >= o.getTime() ? r + 1 : e.getTime() >= f.getTime() ? r : r - 1;
|
|
954
970
|
}
|
|
955
|
-
function
|
|
971
|
+
function zt(n, t) {
|
|
956
972
|
var o, c, f, h;
|
|
957
973
|
const e = W(), r = (t == null ? void 0 : t.firstWeekContainsDate) ?? ((c = (o = t == null ? void 0 : t.locale) == null ? void 0 : o.options) == null ? void 0 : c.firstWeekContainsDate) ?? e.firstWeekContainsDate ?? ((h = (f = e.locale) == null ? void 0 : f.options) == null ? void 0 : h.firstWeekContainsDate) ?? 1, a = J(n, t), i = y(n, 0);
|
|
958
974
|
return i.setFullYear(a, 0, r), i.setHours(0, 0, 0, 0), k(i, t);
|
|
959
975
|
}
|
|
960
|
-
function
|
|
961
|
-
const e = d(n), r = +k(e, t) - +
|
|
976
|
+
function Kt(n, t) {
|
|
977
|
+
const e = d(n), r = +k(e, t) - +zt(e, t);
|
|
962
978
|
return Math.round(r / Q) + 1;
|
|
963
979
|
}
|
|
964
980
|
function u(n, t) {
|
|
@@ -1209,12 +1225,12 @@ const p = {
|
|
|
1209
1225
|
},
|
|
1210
1226
|
// Local week of year
|
|
1211
1227
|
w: function(n, t, e, r) {
|
|
1212
|
-
const a =
|
|
1228
|
+
const a = Kt(n, r);
|
|
1213
1229
|
return t === "wo" ? e.ordinalNumber(a, { unit: "week" }) : u(a, t.length);
|
|
1214
1230
|
},
|
|
1215
1231
|
// ISO week of year
|
|
1216
1232
|
I: function(n, t, e) {
|
|
1217
|
-
const r =
|
|
1233
|
+
const r = Zt(n);
|
|
1218
1234
|
return t === "Io" ? e.ordinalNumber(r, { unit: "week" }) : u(r, t.length);
|
|
1219
1235
|
},
|
|
1220
1236
|
// Day of the month
|
|
@@ -1223,7 +1239,7 @@ const p = {
|
|
|
1223
1239
|
},
|
|
1224
1240
|
// Day of year
|
|
1225
1241
|
D: function(n, t, e) {
|
|
1226
|
-
const r =
|
|
1242
|
+
const r = Ut(n);
|
|
1227
1243
|
return t === "Do" ? e.ordinalNumber(r, { unit: "dayOfYear" }) : u(r, t.length);
|
|
1228
1244
|
},
|
|
1229
1245
|
// Day of week
|
|
@@ -1617,7 +1633,7 @@ const $ = (n, t) => {
|
|
|
1617
1633
|
default:
|
|
1618
1634
|
return t.time({ width: "full" });
|
|
1619
1635
|
}
|
|
1620
|
-
},
|
|
1636
|
+
}, te = (n, t) => {
|
|
1621
1637
|
const e = n.match(/(P+)(p+)?/) || [], r = e[1], a = e[2];
|
|
1622
1638
|
if (!a)
|
|
1623
1639
|
return $(n, t);
|
|
@@ -1638,46 +1654,46 @@ const $ = (n, t) => {
|
|
|
1638
1654
|
break;
|
|
1639
1655
|
}
|
|
1640
1656
|
return i.replace("{{date}}", $(r, t)).replace("{{time}}", U(a, t));
|
|
1641
|
-
},
|
|
1657
|
+
}, ee = {
|
|
1642
1658
|
p: U,
|
|
1643
|
-
P:
|
|
1644
|
-
},
|
|
1645
|
-
function
|
|
1646
|
-
return
|
|
1659
|
+
P: te
|
|
1660
|
+
}, ne = /^D+$/, re = /^Y+$/, ae = ["D", "DD", "YY", "YYYY"];
|
|
1661
|
+
function ie(n) {
|
|
1662
|
+
return ne.test(n);
|
|
1647
1663
|
}
|
|
1648
|
-
function
|
|
1649
|
-
return
|
|
1664
|
+
function se(n) {
|
|
1665
|
+
return re.test(n);
|
|
1650
1666
|
}
|
|
1651
|
-
function
|
|
1652
|
-
const r =
|
|
1653
|
-
if (console.warn(r),
|
|
1667
|
+
function oe(n, t, e) {
|
|
1668
|
+
const r = ue(n, t, e);
|
|
1669
|
+
if (console.warn(r), ae.includes(n)) throw new RangeError(r);
|
|
1654
1670
|
}
|
|
1655
|
-
function
|
|
1671
|
+
function ue(n, t, e) {
|
|
1656
1672
|
const r = n[0] === "Y" ? "years" : "days of the month";
|
|
1657
1673
|
return `Use \`${n.toLowerCase()}\` instead of \`${n}\` (in \`${t}\`) for formatting ${r} to the input \`${e}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`;
|
|
1658
1674
|
}
|
|
1659
|
-
const
|
|
1660
|
-
function
|
|
1675
|
+
const ce = /[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g, de = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g, fe = /^'([^]*?)'?$/, he = /''/g, le = /[a-zA-Z]/;
|
|
1676
|
+
function me(n, t, e) {
|
|
1661
1677
|
var h, g, P, S;
|
|
1662
|
-
const r = W(), a = r.locale ??
|
|
1663
|
-
if (!
|
|
1678
|
+
const r = W(), a = r.locale ?? Jt, i = r.firstWeekContainsDate ?? ((g = (h = r.locale) == null ? void 0 : h.options) == null ? void 0 : g.firstWeekContainsDate) ?? 1, s = r.weekStartsOn ?? ((S = (P = r.locale) == null ? void 0 : P.options) == null ? void 0 : S.weekStartsOn) ?? 0, o = d(n);
|
|
1679
|
+
if (!gt(o))
|
|
1664
1680
|
throw new RangeError("Invalid time value");
|
|
1665
|
-
let c = t.match(
|
|
1681
|
+
let c = t.match(de).map((m) => {
|
|
1666
1682
|
const l = m[0];
|
|
1667
1683
|
if (l === "p" || l === "P") {
|
|
1668
|
-
const _ =
|
|
1684
|
+
const _ = ee[l];
|
|
1669
1685
|
return _(m, a.formatLong);
|
|
1670
1686
|
}
|
|
1671
1687
|
return m;
|
|
1672
|
-
}).join("").match(
|
|
1688
|
+
}).join("").match(ce).map((m) => {
|
|
1673
1689
|
if (m === "''")
|
|
1674
1690
|
return { isToken: !1, value: "'" };
|
|
1675
1691
|
const l = m[0];
|
|
1676
1692
|
if (l === "'")
|
|
1677
|
-
return { isToken: !1, value:
|
|
1693
|
+
return { isToken: !1, value: ge(m) };
|
|
1678
1694
|
if (I[l])
|
|
1679
1695
|
return { isToken: !0, value: m };
|
|
1680
|
-
if (l.match(
|
|
1696
|
+
if (l.match(le))
|
|
1681
1697
|
throw new RangeError(
|
|
1682
1698
|
"Format string contains an unescaped latin alphabet character `" + l + "`"
|
|
1683
1699
|
);
|
|
@@ -1692,32 +1708,32 @@ function he(n, t, e) {
|
|
|
1692
1708
|
return c.map((m) => {
|
|
1693
1709
|
if (!m.isToken) return m.value;
|
|
1694
1710
|
const l = m.value;
|
|
1695
|
-
(
|
|
1711
|
+
(se(l) || ie(l)) && oe(l, t, String(n));
|
|
1696
1712
|
const _ = I[l[0]];
|
|
1697
1713
|
return _(o, l, a.localize, f);
|
|
1698
1714
|
}).join("");
|
|
1699
1715
|
}
|
|
1700
|
-
function
|
|
1701
|
-
const t = n.match(
|
|
1702
|
-
return t ? t[1].replace(
|
|
1716
|
+
function ge(n) {
|
|
1717
|
+
const t = n.match(fe);
|
|
1718
|
+
return t ? t[1].replace(he, "'") : n;
|
|
1703
1719
|
}
|
|
1704
|
-
function
|
|
1720
|
+
function ye(n) {
|
|
1705
1721
|
const t = d(n), e = t.getFullYear(), r = t.getMonth(), a = y(n, 0);
|
|
1706
1722
|
return a.setFullYear(e, r + 1, 0), a.setHours(0, 0, 0, 0), a.getDate();
|
|
1707
1723
|
}
|
|
1708
|
-
function
|
|
1724
|
+
function be(n) {
|
|
1709
1725
|
const t = d(n), e = t.getMonth();
|
|
1710
1726
|
return t.setFullYear(t.getFullYear(), e + 1, 0), t.setHours(0, 0, 0, 0), t;
|
|
1711
1727
|
}
|
|
1712
|
-
function
|
|
1728
|
+
function we(n, t) {
|
|
1713
1729
|
const e = d(n), r = d(t);
|
|
1714
1730
|
return e.getTime() > r.getTime();
|
|
1715
1731
|
}
|
|
1716
|
-
function
|
|
1732
|
+
function pe(n, t) {
|
|
1717
1733
|
const e = d(n), r = d(t);
|
|
1718
1734
|
return +e < +r;
|
|
1719
1735
|
}
|
|
1720
|
-
function
|
|
1736
|
+
function Me(n, t) {
|
|
1721
1737
|
const e = d(n), r = d(t);
|
|
1722
1738
|
return e.getFullYear() === r.getFullYear() && e.getMonth() === r.getMonth();
|
|
1723
1739
|
}
|
|
@@ -1753,13 +1769,13 @@ class b {
|
|
|
1753
1769
|
return this.date.getDay();
|
|
1754
1770
|
}
|
|
1755
1771
|
get daysInMonth() {
|
|
1756
|
-
return
|
|
1772
|
+
return ye(this.date);
|
|
1757
1773
|
}
|
|
1758
1774
|
get firstDayOfMonth() {
|
|
1759
1775
|
return new b({ year: this.year, month: this.month, day: 1 });
|
|
1760
1776
|
}
|
|
1761
1777
|
get lastDayOfMonth() {
|
|
1762
|
-
return new b(
|
|
1778
|
+
return new b(be(this.date));
|
|
1763
1779
|
}
|
|
1764
1780
|
get previousDay() {
|
|
1765
1781
|
return this.clone().addDays(-1);
|
|
@@ -1795,22 +1811,22 @@ class b {
|
|
|
1795
1811
|
return this._dateNums[0] += t, this;
|
|
1796
1812
|
}
|
|
1797
1813
|
addMonths(t) {
|
|
1798
|
-
return this._dateNums = b.parse(
|
|
1814
|
+
return this._dateNums = b.parse(ut(this.date, t)), this;
|
|
1799
1815
|
}
|
|
1800
1816
|
addDays(t) {
|
|
1801
|
-
return this._dateNums = b.parse(
|
|
1817
|
+
return this._dateNums = b.parse(ot(this.date, t)), this;
|
|
1802
1818
|
}
|
|
1803
1819
|
isSameDay(t) {
|
|
1804
|
-
return
|
|
1820
|
+
return lt(this.date, t.date);
|
|
1805
1821
|
}
|
|
1806
1822
|
isSameMonth(t) {
|
|
1807
|
-
return
|
|
1823
|
+
return Me(this.date, t.date);
|
|
1808
1824
|
}
|
|
1809
1825
|
isBefore(t) {
|
|
1810
|
-
return
|
|
1826
|
+
return pe(this.date, t.date);
|
|
1811
1827
|
}
|
|
1812
1828
|
isAfter(t) {
|
|
1813
|
-
return
|
|
1829
|
+
return we(this.date, t.date);
|
|
1814
1830
|
}
|
|
1815
1831
|
isZero() {
|
|
1816
1832
|
return this._dateNums[0] === 0 && this._dateNums[1] === 0 && this._dateNums[2] === 0;
|
|
@@ -1820,32 +1836,16 @@ class b {
|
|
|
1820
1836
|
return !(isNaN(t.getTime()) || this.toString() !== t.toISOString().split("T")[0]);
|
|
1821
1837
|
}
|
|
1822
1838
|
format(t) {
|
|
1823
|
-
return this.isZero() ? "" :
|
|
1839
|
+
return this.isZero() ? "" : me(this.date, t);
|
|
1824
1840
|
}
|
|
1825
1841
|
toString() {
|
|
1826
1842
|
return this.isZero() ? "" : this._dateNums.map((t) => `${t}`.length < 2 ? `0${t}` : `${t}`).join("-");
|
|
1827
1843
|
}
|
|
1828
1844
|
}
|
|
1829
|
-
class pe {
|
|
1830
|
-
constructor() {
|
|
1831
|
-
w(this, "done");
|
|
1832
|
-
this.done = /* @__PURE__ */ new Set();
|
|
1833
|
-
}
|
|
1834
|
-
when(t) {
|
|
1835
|
-
return t ? this : new Me();
|
|
1836
|
-
}
|
|
1837
|
-
do(t, e) {
|
|
1838
|
-
this.done.has(t) || (this.done.add(t), e());
|
|
1839
|
-
}
|
|
1840
|
-
}
|
|
1841
|
-
class Me extends pe {
|
|
1842
|
-
do(t, e) {
|
|
1843
|
-
}
|
|
1844
|
-
}
|
|
1845
1845
|
export {
|
|
1846
1846
|
b as CalendarDate,
|
|
1847
1847
|
Oe as FormValidator,
|
|
1848
|
-
|
|
1848
|
+
it as Once,
|
|
1849
1849
|
_e as PublicFormController,
|
|
1850
1850
|
Ne as SINValidator,
|
|
1851
1851
|
Ee as TemporaryNotification,
|