ai-client-sdk 3.0.7 → 3.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai-client-sdk.mjs +1 -1
- package/dist/ai-client-sdk.umd.js +1 -1
- package/dist/index.d.ts +1 -1
- package/package.json +1 -1
package/dist/ai-client-sdk.mjs
CHANGED
|
@@ -17470,7 +17470,7 @@ class Hk {
|
|
|
17470
17470
|
updateLoadingMessageReasoningContent = ot.updateLoadingMessageReasoningContent;
|
|
17471
17471
|
updateLoadingMessageContent = ot.updateLoadingMessageContent;
|
|
17472
17472
|
finishLoadingMessage = ot.finishLoadingMessage;
|
|
17473
|
-
|
|
17473
|
+
setUserInputValue = Ut.setValue;
|
|
17474
17474
|
constructor(t) {
|
|
17475
17475
|
const { container: n } = t;
|
|
17476
17476
|
if (!n)
|
|
@@ -94,4 +94,4 @@
|
|
|
94
94
|
tags: ${JSON.stringify(Array.from(this._tags).sort())},
|
|
95
95
|
knownValues: ${JSON.stringify(this.knownValues)},
|
|
96
96
|
impliedValues: ${JSON.stringify(this.impliedValues)}},
|
|
97
|
-
reference: ${JSON.stringify(this.reference)}]`}date(){const t=this.dateWithoutTimezoneAdjustment(),n=this.reference.getSystemTimezoneAdjustmentMinute(t,this.get("timezoneOffset"));return new Date(t.getTime()+n*6e4)}addTag(t){return this._tags.add(t),this}addTags(t){for(const n of t)this._tags.add(n);return this}tags(){return new Set(this._tags)}dateWithoutTimezoneAdjustment(){const t=new Date(this.get("year"),this.get("month")-1,this.get("day"),this.get("hour"),this.get("minute"),this.get("second"),this.get("millisecond"));return t.setFullYear(this.get("year")),t}}class _n{refDate;index;text;reference;start;end;constructor(t,n,r,i,s){this.reference=t,this.refDate=t.instant,this.index=n,this.text=r,this.start=i||new Te(t),this.end=s}clone(){const t=new _n(this.reference,this.index,this.text);return t.start=this.start?this.start.clone():null,t.end=this.end?this.end.clone():null,t}date(){return this.start.date()}addTag(t){return this.start.addTag(t),this.end&&this.end.addTag(t),this}addTags(t){return this.start.addTags(t),this.end&&this.end.addTags(t),this}tags(){const t=new Set(this.start.tags());if(this.end)for(const n of this.end.tags())t.add(n);return t}toString(){const t=Array.from(this.tags()).sort();return`[ParsingResult {index: ${this.index}, text: '${this.text}', tags: ${JSON.stringify(t)} ...}]`}}function qc(e,t,n="\\s{0,5},?\\s{0,5}"){const r=t.replace(/\((?!\?)/g,"(?:");return`${e}${r}(?:${n}${r}){0,10}`}function A_(e){let t;return e instanceof Array?t=[...e]:e instanceof Map?t=Array.from(e.keys()):t=Object.keys(e),t}function Et(e){return`(?:${A_(e).sort((n,r)=>r.length-n.length).join("|").replace(/\./g,"\\.")})`}function Hc(e){return e<100&&(e>50?e=e+1900:e=e+2e3),e}function yi(e,t,n){let r=new Date(e);r.setMonth(n-1),r.setDate(t);const i=Le(r,{year:1}),s=Le(r,{year:-1});return Math.abs(i.getTime()-e.getTime())<Math.abs(r.getTime()-e.getTime())?r=i:Math.abs(s.getTime()-e.getTime())<Math.abs(r.getTime()-e.getTime())&&(r=s),r.getFullYear()}const ba={sunday:0,sun:0,"sun.":0,monday:1,mon:1,"mon.":1,tuesday:2,tue:2,"tue.":2,wednesday:3,wed:3,"wed.":3,thursday:4,thurs:4,"thurs.":4,thur:4,"thur.":4,thu:4,"thu.":4,friday:5,fri:5,"fri.":5,saturday:6,sat:6,"sat.":6},Bc={january:1,february:2,march:3,april:4,may:5,june:6,july:7,august:8,september:9,october:10,november:11,december:12},Vt={...Bc,jan:1,"jan.":1,feb:2,"feb.":2,mar:3,"mar.":3,apr:4,"apr.":4,jun:6,"jun.":6,jul:7,"jul.":7,aug:8,"aug.":8,sep:9,"sep.":9,sept:9,"sept.":9,oct:10,"oct.":10,nov:11,"nov.":11,dec:12,"dec.":12},wa={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12},_a={first:1,second:2,third:3,fourth:4,fifth:5,sixth:6,seventh:7,eighth:8,ninth:9,tenth:10,eleventh:11,twelfth:12,thirteenth:13,fourteenth:14,fifteenth:15,sixteenth:16,seventeenth:17,eighteenth:18,nineteenth:19,twentieth:20,"twenty first":21,"twenty-first":21,"twenty second":22,"twenty-second":22,"twenty third":23,"twenty-third":23,"twenty fourth":24,"twenty-fourth":24,"twenty fifth":25,"twenty-fifth":25,"twenty sixth":26,"twenty-sixth":26,"twenty seventh":27,"twenty-seventh":27,"twenty eighth":28,"twenty-eighth":28,"twenty ninth":29,"twenty-ninth":29,thirtieth:30,"thirty first":31,"thirty-first":31},Vc={second:"second",seconds:"second",minute:"minute",minutes:"minute",hour:"hour",hours:"hour",day:"day",days:"day",week:"week",weeks:"week",month:"month",months:"month",quarter:"quarter",quarters:"quarter",year:"year",years:"year"},bi={s:"second",sec:"second",second:"second",seconds:"second",m:"minute",min:"minute",mins:"minute",minute:"minute",minutes:"minute",h:"hour",hr:"hour",hrs:"hour",hour:"hour",hours:"hour",d:"day",day:"day",days:"day",w:"week",week:"week",weeks:"week",mo:"month",mon:"month",mos:"month",month:"month",months:"month",qtr:"quarter",quarter:"quarter",quarters:"quarter",y:"year",yr:"year",year:"year",years:"year",...Vc},Wc=`(?:${Et(wa)}|[0-9]+|[0-9]+\\.[0-9]+|half(?:\\s{0,2}an?)?|an?\\b(?:\\s{0,2}few)?|few|several|the|a?\\s{0,2}couple\\s{0,2}(?:of)?)`;function D_(e){const t=e.toLowerCase();return wa[t]!==void 0?wa[t]:t==="a"||t==="an"||t=="the"?1:t.match(/few/)?3:t.match(/half/)?.5:t.match(/couple/)?2:t.match(/several/)?7:parseFloat(t)}const wi=`(?:${Et(_a)}|[0-9]{1,2}(?:st|nd|rd|th)?)`;function _i(e){let t=e.toLowerCase();return _a[t]!==void 0?_a[t]:(t=t.replace(/(?:st|nd|rd|th)$/i,""),parseInt(t))}const vi="(?:[1-9][0-9]{0,3}\\s{0,2}(?:BE|AD|BC|BCE|CE)|[1-2][0-9]{3}|[5-9][0-9]|2[0-5])";function Ti(e){if(/BE/i.test(e))return e=e.replace(/BE/i,""),parseInt(e)-543;if(/BCE?/i.test(e))return e=e.replace(/BCE?/i,""),-parseInt(e);if(/(AD|CE)/i.test(e))return e=e.replace(/(AD|CE)/i,""),parseInt(e);const t=parseInt(e);return Hc(t)}const Yc=`(${Wc})\\s{0,3}(${Et(bi)})`,Gc=new RegExp(Yc,"i"),$_=`(${Wc})\\s{0,3}(${Et(Vc)})`,Kc="\\s{0,5},?(?:\\s*and)?\\s{0,5}",Gn=qc("(?:(?:about|around)\\s{0,3})?",Yc,Kc),ki=qc("(?:(?:about|around)\\s{0,3})?",$_,Kc);function vn(e){const t={};let n=e,r=Gc.exec(n);for(;r;)C_(t,r),n=n.substring(r[0].length).trim(),r=Gc.exec(n);return Object.keys(t).length==0?null:t}function C_(e,t){if(t[0].match(/^[a-zA-Z]+$/))return;const n=D_(t[1]),r=bi[t[2].toLowerCase()];e[r]=n}class ke{innerPatternHasChange(t,n){return this.innerPattern(t)!==n}patternLeftBoundary(){return"(\\W|^)"}cachedInnerPattern=null;cachedPattern=null;pattern(t){return this.cachedInnerPattern&&!this.innerPatternHasChange(t,this.cachedInnerPattern)?this.cachedPattern:(this.cachedInnerPattern=this.innerPattern(t),this.cachedPattern=new RegExp(`${this.patternLeftBoundary()}${this.cachedInnerPattern.source}`,this.cachedInnerPattern.flags),this.cachedPattern)}extract(t,n){const r=n[1]??"";n.index=n.index+r.length,n[0]=n[0].substring(r.length);for(let i=2;i<n.length;i++)n[i-1]=n[i];return this.innerExtract(t,n)}}const O_=new RegExp(`(?:(?:within|in|for)\\s*)?(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${Gn})(?=\\W|$)`,"i"),R_=new RegExp(`(?:within|in|for)\\s*(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${Gn})(?=\\W|$)`,"i"),N_=new RegExp(`(?:within|in|for)\\s*(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${ki})(?=\\W|$)`,"i");class M_ extends ke{strictMode;constructor(t){super(),this.strictMode=t}innerPattern(t){return this.strictMode?N_:t.option.forwardDate?O_:R_}innerExtract(t,n){if(n[0].match(/^for\s*the\s*\w+/))return null;const r=vn(n[1]);return r?Te.createRelativeFromReference(t.reference,r):null}}const I_=new RegExp(`(?:on\\s{0,3})?(${wi})(?:\\s{0,3}(?:to|\\-|\\–|until|through|till)?\\s{0,3}(${wi}))?(?:-|/|\\s{0,3}(?:of)?\\s{0,3})(${Et(Vt)})(?:(?:-|/|,?\\s{0,3})(${vi}(?!\\w)))?(?=\\W|$)`,"i"),Zc=1,Jc=2,L_=3,Xc=4;class F_ extends ke{innerPattern(){return I_}innerExtract(t,n){const r=t.createParsingResult(n.index,n[0]),i=Vt[n[L_].toLowerCase()],s=_i(n[Zc]);if(s>31)return n.index=n.index+n[Zc].length,null;if(r.start.assign("month",i),r.start.assign("day",s),n[Xc]){const a=Ti(n[Xc]);r.start.assign("year",a)}else{const a=yi(t.refDate,s,i);r.start.imply("year",a)}if(n[Jc]){const a=_i(n[Jc]);r.end=r.start.clone(),r.end.assign("day",a)}return r}}const j_=new RegExp(`(${Et(Vt)})(?:-|/|\\s*,?\\s*)(${wi})(?!\\s*(?:am|pm))\\s*(?:(?:to|\\-)\\s*(${wi})\\s*)?(?:(?:-|/|\\s*,\\s*|\\s+)(${vi}))?(?=\\W|$)(?!\\:\\d)`,"i"),z_=1,Qc=2,va=3,Ta=4;class U_ extends ke{shouldSkipYearLikeDate;constructor(t){super(),this.shouldSkipYearLikeDate=t}innerPattern(){return j_}innerExtract(t,n){const r=Vt[n[z_].toLowerCase()],i=_i(n[Qc]);if(i>31||this.shouldSkipYearLikeDate&&!n[va]&&!n[Ta]&&n[Qc].match(/^2[0-5]$/))return null;const s=t.createParsingComponents({day:i,month:r}).addTag("parser/ENMonthNameMiddleEndianParser");if(n[Ta]){const l=Ti(n[Ta]);s.assign("year",l)}else{const l=yi(t.refDate,i,r);s.imply("year",l)}if(!n[va])return s;const a=_i(n[va]),o=t.createParsingResult(n.index,n[0]);return o.start=s,o.end=s.clone(),o.end.assign("day",a),o}}const q_=new RegExp(`((?:in)\\s*)?(${Et(Vt)})\\s*(?:(?:,|-|of)?\\s*(${vi})?)?(?=[^\\s\\w]|\\s+[^0-9]|\\s+$|$)`,"i"),H_=1,B_=2,ef=3;class V_ extends ke{innerPattern(){return q_}innerExtract(t,n){const r=n[B_].toLowerCase();if(n[0].length<=3&&!Bc[r])return null;const i=t.createParsingResult(n.index+(n[H_]||"").length,n.index+n[0].length);i.start.imply("day",1),i.start.addTag("parser/ENMonthNameParser");const s=Vt[r];if(i.start.assign("month",s),n[ef]){const a=Ti(n[ef]);i.start.assign("year",a)}else{const a=yi(t.refDate,1,s);i.start.imply("year",a)}return i}}const W_=new RegExp(`([0-9]{4})[-\\.\\/\\s](?:(${Et(Vt)})|([0-9]{1,2}))[-\\.\\/\\s]([0-9]{1,2})(?=\\W|$)`,"i"),Y_=1,G_=2,tf=3,K_=4;class Z_ extends ke{strictMonthDateOrder;constructor(t){super(),this.strictMonthDateOrder=t}innerPattern(){return W_}innerExtract(t,n){const r=parseInt(n[Y_]);let i=parseInt(n[K_]),s=n[tf]?parseInt(n[tf]):Vt[n[G_].toLowerCase()];if(s<1||s>12){if(this.strictMonthDateOrder)return null;i>=1&&i<=12&&([s,i]=[i,s])}return i<1||i>31?null:{day:i,month:s,year:r}}}const J_=new RegExp("([0-9]|0[1-9]|1[012])/([0-9]{4})","i"),X_=1,Q_=2;class ev extends ke{innerPattern(){return J_}innerExtract(t,n){const r=parseInt(n[Q_]),i=parseInt(n[X_]);return t.createParsingComponents().imply("day",1).assign("month",i).assign("year",r)}}function tv(e,t,n,r){return new RegExp(`${e}${t}(\\d{1,4})(?:(?:\\.|:|:)(\\d{1,2})(?:(?::|:)(\\d{2})(?:\\.(\\d{1,6}))?)?)?(?:\\s*(a\\.m\\.|p\\.m\\.|am?|pm?))?${n}`,r)}function nv(e,t){return new RegExp(`^(${e})(\\d{1,4})(?:(?:\\.|\\:|\\:)(\\d{1,2})(?:(?:\\.|\\:|\\:)(\\d{1,2})(?:\\.(\\d{1,6}))?)?)?(?:\\s*(a\\.m\\.|p\\.m\\.|am?|pm?))?${t}`,"i")}const ka=2,rn=3,Ei=4,Si=5,Tn=6;class rv{strictMode;constructor(t=!1){this.strictMode=t}patternFlags(){return"i"}primaryPatternLeftBoundary(){return"(^|\\s|T|\\b)"}primarySuffix(){return"(?!/)(?=\\W|$)"}followingSuffix(){return"(?!/)(?=\\W|$)"}pattern(t){return this.getPrimaryTimePatternThroughCache()}extract(t,n){const r=this.extractPrimaryTimeComponents(t,n);if(!r)return n[0].match(/^\d{4}/)?(n.index+=4,null):(n.index+=n[0].length,null);const i=n.index+n[1].length,s=n[0].substring(n[1].length),a=t.createParsingResult(i,s,r);n.index+=n[0].length;const o=t.text.substring(n.index),u=this.getFollowingTimePatternThroughCache().exec(o);return s.match(/^\d{3,4}/)&&u&&(u[0].match(/^\s*([+-])\s*\d{2,4}$/)||u[0].match(/^\s*([+-])\s*\d{2}\W\d{2}/))?null:!u||u[0].match(/^\s*([+-])\s*\d{3,4}$/)?this.checkAndReturnWithoutFollowingPattern(a):(a.end=this.extractFollowingTimeComponents(t,u,a),a.end&&(a.text+=u[0]),this.checkAndReturnWithFollowingPattern(a))}extractPrimaryTimeComponents(t,n,r=!1){const i=t.createParsingComponents();let s=0,a=null,o=parseInt(n[ka]);if(o>100){if(n[ka].length==4&&n[rn]==null&&!n[Tn]||this.strictMode||n[rn]!=null)return null;s=o%100,o=Math.floor(o/100)}if(o>24)return null;if(n[rn]!=null){if(n[rn].length==1&&!n[Tn])return null;s=parseInt(n[rn])}if(s>=60)return null;if(o>12&&(a=ye.PM),n[Tn]!=null){if(o>12)return null;const l=n[Tn][0].toLowerCase();l=="a"&&(a=ye.AM,o==12&&(o=0)),l=="p"&&(a=ye.PM,o!=12&&(o+=12))}if(i.assign("hour",o),i.assign("minute",s),a!==null?i.assign("meridiem",a):o<12?i.imply("meridiem",ye.AM):i.imply("meridiem",ye.PM),n[Si]!=null){const l=parseInt(n[Si].substring(0,3));if(l>=1e3)return null;i.assign("millisecond",l)}if(n[Ei]!=null){const l=parseInt(n[Ei]);if(l>=60)return null;i.assign("second",l)}return i}extractFollowingTimeComponents(t,n,r){const i=t.createParsingComponents();if(n[Si]!=null){const l=parseInt(n[Si].substring(0,3));if(l>=1e3)return null;i.assign("millisecond",l)}if(n[Ei]!=null){const l=parseInt(n[Ei]);if(l>=60)return null;i.assign("second",l)}let s=parseInt(n[ka]),a=0,o=-1;if(n[rn]!=null?a=parseInt(n[rn]):s>100&&(a=s%100,s=Math.floor(s/100)),a>=60||s>24)return null;if(s>=12&&(o=ye.PM),n[Tn]!=null){if(s>12)return null;const l=n[Tn][0].toLowerCase();l=="a"&&(o=ye.AM,s==12&&(s=0,i.isCertain("day")||i.imply("day",i.get("day")+1))),l=="p"&&(o=ye.PM,s!=12&&(s+=12)),r.start.isCertain("meridiem")||(o==ye.AM?(r.start.imply("meridiem",ye.AM),r.start.get("hour")==12&&r.start.assign("hour",0)):(r.start.imply("meridiem",ye.PM),r.start.get("hour")!=12&&r.start.assign("hour",r.start.get("hour")+12)))}return i.assign("hour",s),i.assign("minute",a),o>=0?i.assign("meridiem",o):r.start.isCertain("meridiem")&&r.start.get("hour")>12?r.start.get("hour")-12>s?i.imply("meridiem",ye.AM):s<=12&&(i.assign("hour",s+12),i.assign("meridiem",ye.PM)):s>12?i.imply("meridiem",ye.PM):s<=12&&i.imply("meridiem",ye.AM),i.date().getTime()<r.start.date().getTime()&&i.imply("day",i.get("day")+1),i}checkAndReturnWithoutFollowingPattern(t){if(t.text.match(/^\d$/)||t.text.match(/^\d\d\d+$/)||t.text.match(/\d[apAP]$/))return null;const n=t.text.match(/[^\d:.](\d[\d.]+)$/);if(n){const r=n[1];if(this.strictMode||r.includes(".")&&!r.match(/\d(\.\d{2})+$/)||parseInt(r)>24)return null}return t}checkAndReturnWithFollowingPattern(t){if(t.text.match(/^\d+-\d+$/))return null;const n=t.text.match(/[^\d:.](\d[\d.]+)\s*-\s*(\d[\d.]+)$/);if(n){if(this.strictMode)return null;const r=n[1],i=n[2];if(i.includes(".")&&!i.match(/\d(\.\d{2})+$/))return null;const s=parseInt(i),a=parseInt(r);if(s>24||a>24)return null}return t}cachedPrimaryPrefix=null;cachedPrimarySuffix=null;cachedPrimaryTimePattern=null;getPrimaryTimePatternThroughCache(){const t=this.primaryPrefix(),n=this.primarySuffix();return this.cachedPrimaryPrefix===t&&this.cachedPrimarySuffix===n?this.cachedPrimaryTimePattern:(this.cachedPrimaryTimePattern=tv(this.primaryPatternLeftBoundary(),t,n,this.patternFlags()),this.cachedPrimaryPrefix=t,this.cachedPrimarySuffix=n,this.cachedPrimaryTimePattern)}cachedFollowingPhase=null;cachedFollowingSuffix=null;cachedFollowingTimePatten=null;getFollowingTimePatternThroughCache(){const t=this.followingPhase(),n=this.followingSuffix();return this.cachedFollowingPhase===t&&this.cachedFollowingSuffix===n?this.cachedFollowingTimePatten:(this.cachedFollowingTimePatten=nv(t,n),this.cachedFollowingPhase=t,this.cachedFollowingSuffix=n,this.cachedFollowingTimePatten)}}class iv extends rv{constructor(t){super(t)}followingPhase(){return"\\s*(?:\\-|\\–|\\~|\\〜|to|until|through|till|\\?)\\s*"}primaryPrefix(){return"(?:(?:at|from)\\s*)??"}primarySuffix(){return"(?:\\s*(?:o\\W*clock|at\\s*night|in\\s*the\\s*(?:morning|afternoon)))?(?!/)(?=\\W|$)"}extractPrimaryTimeComponents(t,n){const r=super.extractPrimaryTimeComponents(t,n);if(!r)return r;if(n[0].endsWith("night")){const i=r.get("hour");i>=6&&i<12?(r.assign("hour",r.get("hour")+12),r.assign("meridiem",ye.PM)):i<6&&r.assign("meridiem",ye.AM)}if(n[0].endsWith("afternoon")){r.assign("meridiem",ye.PM);const i=r.get("hour");i>=0&&i<=6&&r.assign("hour",r.get("hour")+12)}return n[0].endsWith("morning")&&(r.assign("meridiem",ye.AM),r.get("hour")<12&&r.assign("hour",r.get("hour"))),r.addTag("parser/ENTimeExpressionParser")}extractFollowingTimeComponents(t,n,r){const i=super.extractFollowingTimeComponents(t,n,r);return i&&i.addTag("parser/ENTimeExpressionParser"),i}}const sv=new RegExp(`(${Gn})\\s{0,5}(?:ago|before|earlier)(?=\\W|$)`,"i"),av=new RegExp(`(${ki})\\s{0,5}(?:ago|before|earlier)(?=\\W|$)`,"i");class ov extends ke{strictMode;constructor(t){super(),this.strictMode=t}innerPattern(){return this.strictMode?av:sv}innerExtract(t,n){const r=vn(n[1]);return r?Te.createRelativeFromReference(t.reference,gi(r)):null}}const lv=new RegExp(`(${Gn})\\s{0,5}(?:later|after|from now|henceforth|forward|out)(?=(?:\\W|$))`,"i"),uv=new RegExp(`(${ki})\\s{0,5}(later|after|from now)(?=\\W|$)`,"i"),cv=1;class fv extends ke{strictMode;constructor(t){super(),this.strictMode=t}innerPattern(){return this.strictMode?uv:lv}innerExtract(t,n){const r=vn(n[cv]);return r?Te.createRelativeFromReference(t.reference,r):null}}class nf{refine(t,n){return n.filter(r=>this.isValid(t,r))}}class Kn{refine(t,n){if(n.length<2)return n;const r=[];let i=n[0],s=null;for(let a=1;a<n.length;a++){s=n[a];const o=t.text.substring(i.index+i.text.length,s.index);if(!this.shouldMergeResults(o,i,s,t))r.push(i),i=s;else{const l=i,u=s,c=this.mergeResults(o,l,u,t);t.debug(()=>{console.log(`${this.constructor.name} merged ${l} and ${u} into ${c}`)}),i=c}}return i!=null&&r.push(i),r}}class rf extends Kn{shouldMergeResults(t,n,r){return!n.end&&!r.end&&t.match(this.patternBetween())!=null}mergeResults(t,n,r){if(!n.start.isOnlyWeekdayComponent()&&!r.start.isOnlyWeekdayComponent()&&(r.start.getCertainComponents().forEach(s=>{n.start.isCertain(s)||n.start.imply(s,r.start.get(s))}),n.start.getCertainComponents().forEach(s=>{r.start.isCertain(s)||r.start.imply(s,n.start.get(s))})),n.start.date()>r.start.date()){let s=n.start.date(),a=r.start.date();r.start.isOnlyWeekdayComponent()&&Le(a,{day:7})>s?(a=Le(a,{day:7}),r.start.imply("day",a.getDate()),r.start.imply("month",a.getMonth()+1),r.start.imply("year",a.getFullYear())):n.start.isOnlyWeekdayComponent()&&Le(s,{day:-7})<a?(s=Le(s,{day:-7}),n.start.imply("day",s.getDate()),n.start.imply("month",s.getMonth()+1),n.start.imply("year",s.getFullYear())):r.start.isDateWithUnknownYear()&&Le(a,{year:1})>s?(a=Le(a,{year:1}),r.start.imply("year",a.getFullYear())):n.start.isDateWithUnknownYear()&&Le(s,{year:-1})<a?(s=Le(s,{year:-1}),n.start.imply("year",s.getFullYear())):[r,n]=[n,r]}const i=n.clone();return i.start=n.start,i.end=r.start,i.index=Math.min(n.index,r.index),n.index<r.index?i.text=n.text+t+r.text:i.text=r.text+t+n.text,i}}class dv extends rf{patternBetween(){return/^\s*(to|-|–|until|through|till)\s*$/i}}function sf(e,t){const n=e.clone(),r=e.start,i=t.start;if(n.start=af(r,i),e.end!=null||t.end!=null){const s=e.end==null?e.start:e.end,a=t.end==null?t.start:t.end,o=af(s,a);if(e.end==null&&o.date().getTime()<n.start.date().getTime()){const l=new Date(o.date().getTime());l.setDate(l.getDate()+1),o.isCertain("day")?tn(o,l):wn(o,l)}n.end=o}return n}function af(e,t){const n=e.clone();return t.isCertain("hour")?(n.assign("hour",t.get("hour")),n.assign("minute",t.get("minute")),t.isCertain("second")?(n.assign("second",t.get("second")),t.isCertain("millisecond")?n.assign("millisecond",t.get("millisecond")):n.imply("millisecond",t.get("millisecond"))):(n.imply("second",t.get("second")),n.imply("millisecond",t.get("millisecond")))):(n.imply("hour",t.get("hour")),n.imply("minute",t.get("minute")),n.imply("second",t.get("second")),n.imply("millisecond",t.get("millisecond"))),t.isCertain("timezoneOffset")&&n.assign("timezoneOffset",t.get("timezoneOffset")),t.isCertain("meridiem")?n.assign("meridiem",t.get("meridiem")):t.get("meridiem")!=null&&n.get("meridiem")==null&&n.imply("meridiem",t.get("meridiem")),n.get("meridiem")==ye.PM&&n.get("hour")<12&&(t.isCertain("hour")?n.assign("hour",n.get("hour")+12):n.imply("hour",n.get("hour")+12)),n.addTags(e.tags()),n.addTags(t.tags()),n}class of extends Kn{shouldMergeResults(t,n,r){return(n.start.isOnlyDate()&&r.start.isOnlyTime()||r.start.isOnlyDate()&&n.start.isOnlyTime())&&t.match(this.patternBetween())!=null}mergeResults(t,n,r){const i=n.start.isOnlyDate()?sf(n,r):sf(r,n);return i.index=n.index,i.text=n.text+t+r.text,i}}class lf extends of{patternBetween(){return new RegExp("^\\s*(T|at|after|before|on|of|,|-|\\.|∙|:)?\\s*$")}}const hv=new RegExp("^\\s*,?\\s*\\(?([A-Z]{2,4})\\)?(?=\\W|$)","i");class pv{timezoneOverrides;constructor(t){this.timezoneOverrides=t}refine(t,n){const r=t.option.timezones??{};return n.forEach(i=>{const s=t.text.substring(i.index+i.text.length),a=hv.exec(s);if(!a)return;const o=a[1].toUpperCase(),l=i.start.date()??i.refDate??new Date,u={...this.timezoneOverrides,...r},c=Uc(o,l,u);if(c==null)return;t.debug(()=>{console.log(`Extracting timezone: '${o}' into: ${c} for: ${i.start}`)});const f=i.start.get("timezoneOffset");f!==null&&c!=f&&(i.start.isCertain("timezoneOffset")||o!=a[1])||i.start.isOnlyDate()&&o!=a[1]||(i.text+=a[0],i.start.isCertain("timezoneOffset")||i.start.assign("timezoneOffset",c),i.end!=null&&!i.end.isCertain("timezoneOffset")&&i.end.assign("timezoneOffset",c))}),n}}const mv=new RegExp("^\\s*(?:\\(?(?:GMT|UTC)\\s?)?([+-])(\\d{1,2})(?::?(\\d{2}))?\\)?","i"),gv=1,yv=2,bv=3;class uf{refine(t,n){return n.forEach(function(r){if(r.start.isCertain("timezoneOffset"))return;const i=t.text.substring(r.index+r.text.length),s=mv.exec(i);if(!s)return;t.debug(()=>{console.log(`Extracting timezone: '${s[0]}' into : ${r}`)});const a=parseInt(s[yv]),o=parseInt(s[bv]||"0");let l=a*60+o;l>840||(s[gv]==="-"&&(l=-l),r.end!=null&&r.end.assign("timezoneOffset",l),r.start.assign("timezoneOffset",l),r.text+=s[0])}),n}}class Ea{refine(t,n){if(n.length<2)return n;const r=[];let i=n[0];for(let s=1;s<n.length;s++){const a=n[s];if(a.index>=i.index+i.text.length){r.push(i),i=a;continue}let o=null,l=null;a.text.length>i.text.length?(o=a,l=i):(o=i,l=a),t.debug(()=>{console.log(`${this.constructor.name} remove ${l} by ${o}`)}),i=o}return i!=null&&r.push(i),r}}class wv{refine(t,n){return t.option.forwardDate&&n.forEach(r=>{let i=t.reference.getDateWithAdjustedTimezone();if(r.start.isOnlyTime()&&t.reference.instant>r.start.date()){const s=t.reference.getDateWithAdjustedTimezone(),a=new Date(s);a.setDate(a.getDate()+1),wn(r.start,a),t.debug(()=>{console.log(`${this.constructor.name} adjusted ${r} time from the ref date (${s}) to the following day (${a})`)}),r.end&&r.end.isOnlyTime()&&(wn(r.end,a),r.start.date()>r.end.date()&&(a.setDate(a.getDate()+1),wn(r.end,a)))}if(r.start.isOnlyWeekdayComponent()&&i>r.start.date()){let s=r.start.get("weekday")-i.getDay();if(s<=0&&(s+=7),i=Le(i,{day:s}),wn(r.start,i),t.debug(()=>{console.log(`${this.constructor.name} adjusted ${r} weekday (${r.start})`)}),r.end&&r.end.isOnlyWeekdayComponent()){let a=r.end.get("weekday")-i.getDay();a<=0&&(a+=7),i=Le(i,{day:a}),wn(r.end,i),t.debug(()=>{console.log(`${this.constructor.name} adjusted ${r} weekday (${r.end})`)})}}if(r.start.isDateWithUnknownYear()&&i>r.start.date())for(let s=0;s<3&&i>r.start.date();s++)r.start.imply("year",r.start.get("year")+1),t.debug(()=>{console.log(`${this.constructor.name} adjusted ${r} year (${r.start})`)}),r.end&&!r.end.isCertain("year")&&(r.end.imply("year",r.end.get("year")+1),t.debug(()=>{console.log(`${this.constructor.name} adjusted ${r} month (${r.start})`)}))}),n}}class _v extends nf{strictMode;constructor(t){super(),this.strictMode=t}isValid(t,n){return n.text.replace(" ","").match(/^\d*(\.\d*)?$/)?(t.debug(()=>{console.log(`Removing unlikely result '${n.text}'`)}),!1):n.start.isValidDate()?n.end&&!n.end.isValidDate()?(t.debug(()=>{console.log(`Removing invalid result: ${n} (${n.end})`)}),!1):this.strictMode?this.isStrictModeValid(t,n):!0:(t.debug(()=>{console.log(`Removing invalid result: ${n} (${n.start})`)}),!1)}isStrictModeValid(t,n){return n.start.isOnlyWeekdayComponent()?(t.debug(()=>{console.log(`(Strict) Removing weekday only component: ${n} (${n.end})`)}),!1):!0}}const vv=new RegExp("([0-9]{4})\\-([0-9]{1,2})\\-([0-9]{1,2})(?:T([0-9]{1,2}):([0-9]{1,2})(?::([0-9]{1,2})(?:\\.(\\d{1,4}))?)?(Z|([+-]\\d{2}):?(\\d{2})?)?)?(?=\\W|$)","i"),Tv=1,kv=2,Ev=3,cf=4,Sv=5,ff=6,df=7,xv=8,hf=9,pf=10;class Pv extends ke{innerPattern(){return vv}innerExtract(t,n){const r=t.createParsingComponents({year:parseInt(n[Tv]),month:parseInt(n[kv]),day:parseInt(n[Ev])});if(n[cf]!=null&&(r.assign("hour",parseInt(n[cf])),r.assign("minute",parseInt(n[Sv])),n[ff]!=null&&r.assign("second",parseInt(n[ff])),n[df]!=null&&r.assign("millisecond",parseInt(n[df])),n[xv]!=null)){let i=0;if(n[hf]){const s=parseInt(n[hf]);let a=0;n[pf]!=null&&(a=parseInt(n[pf])),i=s*60,i<0?i-=a:i+=a}r.assign("timezoneOffset",i)}return r.addTag("parser/ISOFormatParser")}}class Av extends Kn{mergeResults(t,n,r){const i=r.clone();return i.index=n.index,i.text=n.text+t+i.text,i.start.assign("weekday",n.start.get("weekday")),i.end&&i.end.assign("weekday",n.start.get("weekday")),i}shouldMergeResults(t,n,r){return n.start.isOnlyWeekdayComponent()&&!n.start.isCertain("hour")&&r.start.isCertain("day")&&t.match(/^,?\s*$/)!=null}}function mf(e,t=!1){return e.parsers.unshift(new Pv),e.refiners.unshift(new Av),e.refiners.unshift(new uf),e.refiners.unshift(new Ea),e.refiners.push(new pv),e.refiners.push(new Ea),e.refiners.push(new wv),e.refiners.push(new _v(t)),e}function Dv(e){const t=e.getDateWithAdjustedTimezone(),n=new Te(e,{});return tn(n,t),jc(n,t),n.assign("timezoneOffset",e.getTimezoneOffset()),n.addTag("casualReference/now"),n}function $v(e){const t=e.getDateWithAdjustedTimezone(),n=new Te(e,{});return tn(n,t),ya(n,t),n.delete("meridiem"),n.addTag("casualReference/today"),n}function Cv(e){return Rv(e).addTag("casualReference/yesterday")}function Ov(e){return Sa(e,1).addTag("casualReference/tomorrow")}function Rv(e,t){return Sa(e,-1)}function Sa(e,t){const n=e.getDateWithAdjustedTimezone(),r=new Te(e,{}),i=new Date(n.getTime());return i.setDate(i.getDate()+t),tn(r,i),ya(r,i),r.delete("meridiem"),r}function Nv(e,t=22){const n=e.getDateWithAdjustedTimezone(),r=new Te(e,{});return tn(r,n),r.imply("hour",t),r.imply("meridiem",ye.PM),r.addTag("casualReference/tonight"),r}function Mv(e,t=20){const n=new Te(e,{});return n.imply("meridiem",ye.PM),n.imply("hour",t),n.addTag("casualReference/evening"),n}function Iv(e){const t=new Te(e,{});return e.getDateWithAdjustedTimezone().getHours()>2&&t.addDurationAsImplied({day:1}),t.assign("hour",0),t.imply("minute",0),t.imply("second",0),t.imply("millisecond",0),t.addTag("casualReference/midnight"),t}function Lv(e,t=6){const n=new Te(e,{});return n.imply("meridiem",ye.AM),n.imply("hour",t),n.imply("minute",0),n.imply("second",0),n.imply("millisecond",0),n.addTag("casualReference/morning"),n}function Fv(e,t=15){const n=new Te(e,{});return n.imply("meridiem",ye.PM),n.imply("hour",t),n.imply("minute",0),n.imply("second",0),n.imply("millisecond",0),n.addTag("casualReference/afternoon"),n}function jv(e){const t=new Te(e,{});return t.imply("meridiem",ye.AM),t.assign("hour",12),t.imply("minute",0),t.imply("second",0),t.imply("millisecond",0),t.addTag("casualReference/noon"),t}const zv=/(now|today|tonight|tomorrow|overmorrow|tmr|tmrw|yesterday|last\s*night)(?=\W|$)/i;class Uv extends ke{innerPattern(t){return zv}innerExtract(t,n){let r=t.refDate;const i=n[0].toLowerCase();let s=t.createParsingComponents();switch(i){case"now":s=Dv(t.reference);break;case"today":s=$v(t.reference);break;case"yesterday":s=Cv(t.reference);break;case"tomorrow":case"tmr":case"tmrw":s=Ov(t.reference);break;case"tonight":s=Nv(t.reference);break;case"overmorrow":s=Sa(t.reference,2);break;default:if(i.match(/last\s*night/)){if(r.getHours()>6){const a=new Date(r.getTime());a.setDate(a.getDate()-1),r=a}tn(s,r),s.imply("hour",0)}break}return s.addTag("parser/ENCasualDateParser"),s}}const qv=/(?:this)?\s{0,3}(morning|afternoon|evening|night|midnight|midday|noon)(?=\W|$)/i;class Hv extends ke{innerPattern(){return qv}innerExtract(t,n){let r=null;switch(n[1].toLowerCase()){case"afternoon":r=Fv(t.reference);break;case"evening":case"night":r=Mv(t.reference);break;case"midnight":r=Iv(t.reference);break;case"morning":r=Lv(t.reference);break;case"noon":case"midday":r=jv(t.reference);break}return r&&r.addTag("parser/ENCasualTimeParser"),r}}function Bv(e,t,n){const r=e.getDateWithAdjustedTimezone(),i=Vv(r,t,n);let s=new Te(e);return s=s.addDurationAsImplied({day:i}),s.assign("weekday",t),s}function Vv(e,t,n){const r=e.getDay();switch(n){case"this":return xi(e,t);case"last":return gf(e,t);case"next":return r==Ee.SUNDAY?t==Ee.SUNDAY?7:t:r==Ee.SATURDAY?t==Ee.SATURDAY?7:t==Ee.SUNDAY?8:1+t:t<r&&t!=Ee.SUNDAY?xi(e,t):xi(e,t)+7}return Wv(e,t)}function Wv(e,t){const n=gf(e,t),r=xi(e,t);return r<-n?r:n}function xi(e,t){const n=e.getDay();let r=t-n;return r<0&&(r+=7),r}function gf(e,t){const n=e.getDay();let r=t-n;return r>=0&&(r-=7),r}const Yv=new RegExp(`(?:(?:\\,|\\(|\\()\\s*)?(?:on\\s*?)?(?:(this|last|past|next)\\s*)?(${Et(ba)}|weekend|weekday)(?:\\s*(?:\\,|\\)|\\)))?(?:\\s*(this|last|past|next)\\s*week)?(?=\\W|$)`,"i"),Gv=1,Kv=2,Zv=3;class Jv extends ke{innerPattern(){return Yv}innerExtract(t,n){const r=n[Gv],i=n[Zv];let s=r||i;s=s||"",s=s.toLowerCase();let a=null;s=="last"||s=="past"?a="last":s=="next"?a="next":s=="this"&&(a="this");const o=n[Kv].toLowerCase();let l;if(ba[o]!==void 0)l=ba[o];else if(o=="weekend")l=a=="last"?Ee.SUNDAY:Ee.SATURDAY;else if(o=="weekday"){const u=t.reference.getDateWithAdjustedTimezone().getDay();u==Ee.SUNDAY||u==Ee.SATURDAY?l=a=="last"?Ee.FRIDAY:Ee.MONDAY:(l=u-1,l=a=="last"?l-1:l+1,l=l%5+1)}else return null;return Bv(t.reference,l,a)}}const Xv=new RegExp(`(this|last|past|next|after\\s*this)\\s*(${Et(bi)})(?=\\s*)(?=\\W|$)`,"i"),Qv=1,eT=2;class tT extends ke{innerPattern(){return Xv}innerExtract(t,n){const r=n[Qv].toLowerCase(),i=n[eT].toLowerCase(),s=bi[i];if(r=="next"||r.startsWith("after")){const l={};return l[s]=1,Te.createRelativeFromReference(t.reference,l)}if(r=="last"||r=="past"){const l={};return l[s]=-1,Te.createRelativeFromReference(t.reference,l)}const a=t.createParsingComponents();let o=new Date(t.reference.instant.getTime());return i.match(/week/i)?(o.setDate(o.getDate()-o.getDay()),a.imply("day",o.getDate()),a.imply("month",o.getMonth()+1),a.imply("year",o.getFullYear())):i.match(/month/i)?(o.setDate(1),a.imply("day",o.getDate()),a.assign("year",o.getFullYear()),a.assign("month",o.getMonth()+1)):i.match(/year/i)&&(o.setDate(1),o.setMonth(0),a.imply("day",o.getDate()),a.imply("month",o.getMonth()+1),a.assign("year",o.getFullYear())),a}}const nT=new RegExp("([^\\d]|^)([0-3]{0,1}[0-9]{1})[\\/\\.\\-]([0-3]{0,1}[0-9]{1})(?:[\\/\\.\\-]([0-9]{4}|[0-9]{2}))?(\\W|$)","i"),rT=1,iT=5,yf=2,bf=3,xa=4;class sT{groupNumberMonth;groupNumberDay;constructor(t){this.groupNumberMonth=t?bf:yf,this.groupNumberDay=t?yf:bf}pattern(){return nT}extract(t,n){const r=n.index+n[rT].length,i=n.index+n[0].length-n[iT].length;if(r>0&&t.text.substring(0,r).match("\\d/?$")||i<t.text.length&&t.text.substring(i).match("^/?\\d"))return;const s=t.text.substring(r,i);if(s.match(/^\d\.\d$/)||s.match(/^\d\.\d{1,2}\.\d{1,2}\s*$/)||!n[xa]&&s.indexOf("/")<0)return;const a=t.createParsingResult(r,s);let o=parseInt(n[this.groupNumberMonth]),l=parseInt(n[this.groupNumberDay]);if((o<1||o>12)&&o>12)if(l>=1&&l<=12&&o<=31)[l,o]=[o,l];else return null;if(l<1||l>31)return null;if(a.start.assign("day",l),a.start.assign("month",o),n[xa]){const u=parseInt(n[xa]),c=Hc(u);a.start.assign("year",c)}else{const u=yi(t.refDate,l,o);a.start.imply("year",u)}return a.addTag("parser/SlashDateFormatParser")}}const aT=new RegExp(`(this|last|past|next|after|\\+|-)\\s*(${Gn})(?=\\W|$)`,"i"),oT=new RegExp(`(this|last|past|next|after|\\+|-)\\s*(${ki})(?=\\W|$)`,"i");class lT extends ke{allowAbbreviations;constructor(t=!0){super(),this.allowAbbreviations=t}innerPattern(){return this.allowAbbreviations?aT:oT}innerExtract(t,n){const r=n[1].toLowerCase();let i=vn(n[2]);if(!i)return null;switch(r){case"last":case"past":case"-":i=gi(i);break}return Te.createRelativeFromReference(t.reference,i)}}function uT(e){return e.text.match(/^[+-]/i)!=null}function wf(e){return e.text.match(/^-/i)!=null}class cT extends Kn{shouldMergeResults(t,n,r){return t.match(/^\s*$/i)?uT(r)||wf(r):!1}mergeResults(t,n,r,i){let s=vn(r.text);wf(r)&&(s=gi(s));const a=Te.createRelativeFromReference(nn.fromDate(n.start.date()),s);return new _n(n.reference,n.index,`${n.text}${t}${r.text}`,a)}}function _f(e){return e.text.match(/\s+(before|from)$/i)!=null}function fT(e){return e.text.match(/\s+(after|since)$/i)!=null}class dT extends Kn{patternBetween(){return/^\s*$/i}shouldMergeResults(t,n,r){return!t.match(this.patternBetween())||!_f(n)&&!fT(n)?!1:!!r.start.get("day")&&!!r.start.get("month")&&!!r.start.get("year")}mergeResults(t,n,r){let i=vn(n.text);_f(n)&&(i=gi(i));const s=Te.createRelativeFromReference(nn.fromDate(r.start.date()),i);return new _n(r.reference,n.index,`${n.text}${t}${r.text}`,s)}}const hT=new RegExp(`^\\s*(${vi})`,"i"),pT=1;class mT{refine(t,n){return n.forEach(function(r){if(!r.start.isDateWithUnknownYear())return;const i=t.text.substring(r.index+r.text.length),s=hT.exec(i);if(!s||s[0].trim().length<=3)return;t.debug(()=>{console.log(`Extracting year: '${s[0]}' into : ${r}`)});const a=Ti(s[pT]);r.end!=null&&r.end.assign("year",a),r.start.assign("year",a),r.text+=s[0]}),n}}class gT extends nf{constructor(){super()}isValid(t,n){const r=n.text.trim();return r===t.text.trim()?!0:r.toLowerCase()==="may"&&!t.text.substring(0,n.index).trim().match(/\b(in)$/i)?(t.debug(()=>{console.log(`Removing unlikely result: ${n}`)}),!1):r.toLowerCase().endsWith("the second")?(t.text.substring(n.index+n.text.length).trim().length>0&&t.debug(()=>{console.log(`Removing unlikely result: ${n}`)}),!1):!0}}class yT{createCasualConfiguration(t=!1){const n=this.createConfiguration(!1,t);return n.parsers.push(new Uv),n.parsers.push(new Hv),n.parsers.push(new V_),n.parsers.push(new tT),n.parsers.push(new lT),n.refiners.push(new gT),n}createConfiguration(t=!0,n=!1){const r=mf({parsers:[new sT(n),new M_(t),new F_,new U_(n),new Jv,new ev,new iv(t),new ov(t),new fv(t)],refiners:[new lf]},t);return r.parsers.unshift(new Z_(t)),r.refiners.unshift(new dT),r.refiners.unshift(new cT),r.refiners.unshift(new Ea),r.refiners.push(new lf),r.refiners.push(new mT),r.refiners.push(new dv),r}}class Zn{parsers;refiners;defaultConfig=new yT;constructor(t){t=t||this.defaultConfig.createCasualConfiguration(),this.parsers=[...t.parsers],this.refiners=[...t.refiners]}clone(){return new Zn({parsers:[...this.parsers],refiners:[...this.refiners]})}parseDate(t,n,r){const i=this.parse(t,n,r);return i.length>0?i[0].start.date():null}parse(t,n,r){const i=new bT(t,n,r);let s=[];return this.parsers.forEach(a=>{const o=Zn.executeParser(i,a);s=s.concat(o)}),s.sort((a,o)=>a.index-o.index),this.refiners.forEach(function(a){s=a.refine(i,s)}),s}static executeParser(t,n){const r=[],i=n.pattern(t),s=t.text;let a=t.text,o=i.exec(a);for(;o;){const l=o.index+s.length-a.length;o.index=l;const u=n.extract(t,o);if(!u){a=s.substring(o.index+1),o=i.exec(a);continue}let c=null;u instanceof _n?c=u:u instanceof Te?(c=t.createParsingResult(o.index,o[0]),c.start=u):c=t.createParsingResult(o.index,o[0],u);const f=c.index,h=c.text;t.debug(()=>console.log(`${n.constructor.name} extracted (at index=${f}) '${h}'`)),r.push(c),a=s.substring(f+h.length),o=i.exec(a)}return r}}class bT{text;option;reference;refDate;constructor(t,n,r){this.text=t,this.option=r??{},this.reference=nn.fromInput(n,this.option.timezones),this.refDate=this.reference.instant}createParsingComponents(t){return t instanceof Te?t:new Te(this.reference,t)}createParsingResult(t,n,r,i){const s=typeof n=="string"?n:this.text.substring(t,n),a=r?this.createParsingComponents(r):null,o=i?this.createParsingComponents(i):null;return new _n(this.reference,t,s,a,o)}debug(t){this.option.debug&&(this.option.debug instanceof Function?this.option.debug(t):this.option.debug.debug(t))}}const Ke={零:0,"〇":0,一:1,二:2,两:2,三:3,四:4,五:5,六:6,七:7,八:8,九:9,十:10},Pi={天:0,日:0,一:1,二:2,三:3,四:4,五:5,六:6};function Nt(e){let t=0;for(let n=0;n<e.length;n++){const r=e[n];r==="十"?t=t===0?Ke[r]:t*Ke[r]:t+=Ke[r]}return t}function wT(e){let t="";for(let n=0;n<e.length;n++){const r=e[n];t=t+Ke[r]}return parseInt(t)}const Pa=1,vf=2,Aa=3;class _T extends ke{innerPattern(){return new RegExp("(\\d{2,4}|["+Object.keys(Ke).join("")+"]{4}|["+Object.keys(Ke).join("")+"]{2})?(?:\\s*)(?:年)?(?:[\\s|,|,]*)(\\d{1,2}|["+Object.keys(Ke).join("")+"]{1,3})(?:\\s*)(?:月)(?:\\s*)(\\d{1,2}|["+Object.keys(Ke).join("")+"]{1,3})?(?:\\s*)(?:日|号)?")}innerExtract(t,n){const r=t.createParsingResult(n.index,n[0]);let i=parseInt(n[vf]);if(isNaN(i)&&(i=Nt(n[vf])),r.start.assign("month",i),n[Aa]){let s=parseInt(n[Aa]);isNaN(s)&&(s=Nt(n[Aa])),r.start.assign("day",s)}else r.start.imply("day",t.refDate.getDate());if(n[Pa]){let s=parseInt(n[Pa]);isNaN(s)&&(s=wT(n[Pa])),r.start.assign("year",s)}else r.start.imply("year",t.refDate.getFullYear());return r}}const vT=new RegExp("(\\d+|["+Object.keys(Ke).join("")+"]+|半|几)(?:\\s*)(?:个)?(秒(?:钟)?|分钟|小时|钟|日|天|星期|礼拜|月|年)(?:(?:之|过)?后|(?:之)?内)","i"),Da=1,TT=2;class kT extends ke{innerPattern(){return vT}innerExtract(t,n){const r=t.createParsingResult(n.index,n[0]);let i=parseInt(n[Da]);if(isNaN(i)&&(i=Nt(n[Da])),isNaN(i)){const u=n[Da];if(u==="几")i=3;else if(u==="半")i=.5;else return null}const s={},o=n[TT][0];if(o.match(/[日天星礼月年]/)){o=="日"||o=="天"?s.day=i:o=="星"||o=="礼"?s.week=i:o=="月"?s.month=i:o=="年"&&(s.year=i);const u=Le(t.refDate,s);return r.start.assign("year",u.getFullYear()),r.start.assign("month",u.getMonth()+1),r.start.assign("day",u.getDate()),r}o=="秒"?s.second=i:o=="分"?s.minute=i:(o=="小"||o=="钟")&&(s.hour=i);const l=Le(t.refDate,s);return r.start.imply("year",l.getFullYear()),r.start.imply("month",l.getMonth()+1),r.start.imply("day",l.getDate()),r.start.assign("hour",l.getHours()),r.start.assign("minute",l.getMinutes()),r.start.assign("second",l.getSeconds()),r}}const ET=new RegExp("(?<prefix>上|下|这)(?:个)?(?:星期|礼拜|周)(?<weekday>"+Object.keys(Pi).join("|")+")");class ST extends ke{innerPattern(){return ET}innerExtract(t,n){const r=t.createParsingResult(n.index,n[0]),i=n.groups.weekday,s=Pi[i];if(s===void 0)return null;let a=null;const o=n.groups.prefix;o=="上"?a="last":o=="下"?a="next":o=="这"&&(a="this");const l=new Date(t.refDate.getTime());let u=!1;const c=l.getDay();if(a=="last"||a=="past")l.setDate(l.getDate()+(s-7-c)),u=!0;else if(a=="next")l.setDate(l.getDate()+(s+7-c)),u=!0;else if(a=="this")l.setDate(l.getDate()+(s-c));else{let f=s-c;Math.abs(f-7)<Math.abs(f)&&(f-=7),Math.abs(f+7)<Math.abs(f)&&(f+=7),l.setDate(l.getDate()+f)}return r.start.assign("weekday",s),u?(r.start.assign("day",l.getDate()),r.start.assign("month",l.getMonth()+1),r.start.assign("year",l.getFullYear())):(r.start.imply("day",l.getDate()),r.start.imply("month",l.getMonth()+1),r.start.imply("year",l.getFullYear())),r}}const xT=new RegExp("(?:从|自)?(?:(今|明|前|大前|后|大后|昨)(早|朝|晚)|(上(?:午)|早(?:上)|下(?:午)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨))|(今|明|前|大前|后|大后|昨)(?:日|天)(?:[\\s,,]*)(?:(上(?:午)|早(?:上)|下(?:午)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨)))?)?(?:[\\s,,]*)(?:(\\d+|["+Object.keys(Ke).join("")+"]+)(?:\\s*)(?:点|时|:|:)(?:\\s*)(\\d+|半|正|整|["+Object.keys(Ke).join("")+"]+)?(?:\\s*)(?:分|:|:)?(?:\\s*)(\\d+|["+Object.keys(Ke).join("")+"]+)?(?:\\s*)(?:秒)?)(?:\\s*(A.M.|P.M.|AM?|PM?))?","i"),PT=new RegExp("(?:^\\s*(?:到|至|\\-|\\–|\\~|\\〜)\\s*)(?:(今|明|前|大前|后|大后|昨)(早|朝|晚)|(上(?:午)|早(?:上)|下(?:午)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨))|(今|明|前|大前|后|大后|昨)(?:日|天)(?:[\\s,,]*)(?:(上(?:午)|早(?:上)|下(?:午)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨)))?)?(?:[\\s,,]*)(?:(\\d+|["+Object.keys(Ke).join("")+"]+)(?:\\s*)(?:点|时|:|:)(?:\\s*)(\\d+|半|正|整|["+Object.keys(Ke).join("")+"]+)?(?:\\s*)(?:分|:|:)?(?:\\s*)(\\d+|["+Object.keys(Ke).join("")+"]+)?(?:\\s*)(?:秒)?)(?:\\s*(A.M.|P.M.|AM?|PM?))?","i"),Ai=1,Di=2,$i=3,Ci=4,Oi=5,Ri=6,ht=7,kn=8,Ni=9;class AT extends ke{innerPattern(){return xT}innerExtract(t,n){if(n.index>0&&t.text[n.index-1].match(/\w/))return null;const r=t.createParsingResult(n.index,n[0]),i=new Date(t.refDate.getTime());if(n[Ai]){const c=n[Ai];c=="明"?t.refDate.getHours()>1&&i.setDate(i.getDate()+1):c=="昨"?i.setDate(i.getDate()-1):c=="前"?i.setDate(i.getDate()-2):c=="大前"?i.setDate(i.getDate()-3):c=="后"?i.setDate(i.getDate()+2):c=="大后"&&i.setDate(i.getDate()+3),r.start.assign("day",i.getDate()),r.start.assign("month",i.getMonth()+1),r.start.assign("year",i.getFullYear())}else if(n[Ci]){const c=n[Ci];c=="明"?i.setDate(i.getDate()+1):c=="昨"?i.setDate(i.getDate()-1):c=="前"?i.setDate(i.getDate()-2):c=="大前"?i.setDate(i.getDate()-3):c=="后"?i.setDate(i.getDate()+2):c=="大后"&&i.setDate(i.getDate()+3),r.start.assign("day",i.getDate()),r.start.assign("month",i.getMonth()+1),r.start.assign("year",i.getFullYear())}else r.start.imply("day",i.getDate()),r.start.imply("month",i.getMonth()+1),r.start.imply("year",i.getFullYear());let s=0,a=0,o=-1;if(n[kn]){let c=parseInt(n[kn]);if(isNaN(c)&&(c=Nt(n[kn])),c>=60)return null;r.start.assign("second",c)}if(s=parseInt(n[Ri]),isNaN(s)&&(s=Nt(n[Ri])),n[ht]?n[ht]=="半"?a=30:n[ht]=="正"||n[ht]=="整"?a=0:(a=parseInt(n[ht]),isNaN(a)&&(a=Nt(n[ht]))):s>100&&(a=s%100,s=Math.floor(s/100)),a>=60||s>24)return null;if(s>=12&&(o=1),n[Ni]){if(s>12)return null;const c=n[Ni][0].toLowerCase();c=="a"&&(o=0,s==12&&(s=0)),c=="p"&&(o=1,s!=12&&(s+=12))}else if(n[Di]){const f=n[Di][0];f=="早"?(o=0,s==12&&(s=0)):f=="晚"&&(o=1,s!=12&&(s+=12))}else if(n[$i]){const f=n[$i][0];f=="上"||f=="早"||f=="凌"?(o=0,s==12&&(s=0)):(f=="下"||f=="晚")&&(o=1,s!=12&&(s+=12))}else if(n[Oi]){const f=n[Oi][0];f=="上"||f=="早"||f=="凌"?(o=0,s==12&&(s=0)):(f=="下"||f=="晚")&&(o=1,s!=12&&(s+=12))}r.start.assign("hour",s),r.start.assign("minute",a),o>=0?r.start.assign("meridiem",o):s<12?r.start.imply("meridiem",0):r.start.imply("meridiem",1);const l=PT.exec(t.text.substring(r.index+r.text.length));if(!l)return r.text.match(/^\d+$/)?null:r;const u=new Date(i.getTime());if(r.end=t.createParsingComponents(),l[Ai]){const c=l[Ai];c=="明"?t.refDate.getHours()>1&&u.setDate(u.getDate()+1):c=="昨"?u.setDate(u.getDate()-1):c=="前"?u.setDate(u.getDate()-2):c=="大前"?u.setDate(u.getDate()-3):c=="后"?u.setDate(u.getDate()+2):c=="大后"&&u.setDate(u.getDate()+3),r.end.assign("day",u.getDate()),r.end.assign("month",u.getMonth()+1),r.end.assign("year",u.getFullYear())}else if(l[Ci]){const c=l[Ci];c=="明"?u.setDate(u.getDate()+1):c=="昨"?u.setDate(u.getDate()-1):c=="前"?u.setDate(u.getDate()-2):c=="大前"?u.setDate(u.getDate()-3):c=="后"?u.setDate(u.getDate()+2):c=="大后"&&u.setDate(u.getDate()+3),r.end.assign("day",u.getDate()),r.end.assign("month",u.getMonth()+1),r.end.assign("year",u.getFullYear())}else r.end.imply("day",u.getDate()),r.end.imply("month",u.getMonth()+1),r.end.imply("year",u.getFullYear());if(s=0,a=0,o=-1,l[kn]){let c=parseInt(l[kn]);if(isNaN(c)&&(c=Nt(l[kn])),c>=60)return null;r.end.assign("second",c)}if(s=parseInt(l[Ri]),isNaN(s)&&(s=Nt(l[Ri])),l[ht]?l[ht]=="半"?a=30:l[ht]=="正"||l[ht]=="整"?a=0:(a=parseInt(l[ht]),isNaN(a)&&(a=Nt(l[ht]))):s>100&&(a=s%100,s=Math.floor(s/100)),a>=60||s>24)return null;if(s>=12&&(o=1),l[Ni]){if(s>12)return null;const c=l[Ni][0].toLowerCase();c=="a"&&(o=0,s==12&&(s=0)),c=="p"&&(o=1,s!=12&&(s+=12)),r.start.isCertain("meridiem")||(o==0?(r.start.imply("meridiem",0),r.start.get("hour")==12&&r.start.assign("hour",0)):(r.start.imply("meridiem",1),r.start.get("hour")!=12&&r.start.assign("hour",r.start.get("hour")+12)))}else if(l[Di]){const f=l[Di][0];f=="早"?(o=0,s==12&&(s=0)):f=="晚"&&(o=1,s!=12&&(s+=12))}else if(l[$i]){const f=l[$i][0];f=="上"||f=="早"||f=="凌"?(o=0,s==12&&(s=0)):(f=="下"||f=="晚")&&(o=1,s!=12&&(s+=12))}else if(l[Oi]){const f=l[Oi][0];f=="上"||f=="早"||f=="凌"?(o=0,s==12&&(s=0)):(f=="下"||f=="晚")&&(o=1,s!=12&&(s+=12))}return r.text=r.text+l[0],r.end.assign("hour",s),r.end.assign("minute",a),o>=0?r.end.assign("meridiem",o):r.start.isCertain("meridiem")&&r.start.get("meridiem")==1&&r.start.get("hour")>s?r.end.imply("meridiem",0):s>12&&r.end.imply("meridiem",1),r.end.date().getTime()<r.start.date().getTime()&&r.end.imply("day",r.end.get("day")+1),r}}const DT=new RegExp("(?:星期|礼拜|周)(?<weekday>"+Object.keys(Pi).join("|")+")");class $T extends ke{innerPattern(){return DT}innerExtract(t,n){const r=t.createParsingResult(n.index,n[0]),i=n.groups.weekday,s=Pi[i];if(s===void 0)return null;const a=new Date(t.refDate.getTime()),o=a.getDay();let l=s-o;return Math.abs(l-7)<Math.abs(l)&&(l-=7),Math.abs(l+7)<Math.abs(l)&&(l+=7),a.setDate(a.getDate()+l),r.start.assign("weekday",s),r.start.imply("day",a.getDate()),r.start.imply("month",a.getMonth()+1),r.start.imply("year",a.getFullYear()),r}}const CT=1,Tf=2,OT=3,kf=4,Ef=5,RT=6;class NT extends ke{innerPattern(t){return new RegExp("(而家|立(?:刻|即)|即刻)|(今|明|前|大前|後|大後|聽|昨|尋|琴)(早|朝|晚)|(上(?:午|晝)|朝(?:早)|早(?:上)|下(?:午|晝)|晏(?:晝)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨))|(今|明|前|大前|後|大後|聽|昨|尋|琴)(?:日|天)(?:[\\s|,|,]*)(?:(上(?:午|晝)|朝(?:早)|早(?:上)|下(?:午|晝)|晏(?:晝)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨)))?","i")}innerExtract(t,n){const r=n.index,i=t.createParsingResult(r,n[0]),s=t.refDate;let a=new Date(s.getTime());if(n[CT])i.start.imply("hour",s.getHours()),i.start.imply("minute",s.getMinutes()),i.start.imply("second",s.getSeconds()),i.start.imply("millisecond",s.getMilliseconds());else if(n[Tf]){const o=n[Tf],l=n[OT];o=="明"||o=="聽"?s.getHours()>1&&a.setDate(a.getDate()+1):o=="昨"||o=="尋"||o=="琴"?a.setDate(a.getDate()-1):o=="前"?a.setDate(a.getDate()-2):o=="大前"?a.setDate(a.getDate()-3):o=="後"?a.setDate(a.getDate()+2):o=="大後"&&a.setDate(a.getDate()+3),l=="早"||l=="朝"?i.start.imply("hour",6):l=="晚"&&(i.start.imply("hour",22),i.start.imply("meridiem",1))}else if(n[kf]){const l=n[kf][0];l=="早"||l=="朝"||l=="上"?i.start.imply("hour",6):l=="下"||l=="晏"?(i.start.imply("hour",15),i.start.imply("meridiem",1)):l=="中"?(i.start.imply("hour",12),i.start.imply("meridiem",1)):l=="夜"||l=="晚"?(i.start.imply("hour",22),i.start.imply("meridiem",1)):l=="凌"&&i.start.imply("hour",0)}else if(n[Ef]){const o=n[Ef];o=="明"||o=="聽"?s.getHours()>1&&a.setDate(a.getDate()+1):o=="昨"||o=="尋"||o=="琴"?a.setDate(a.getDate()-1):o=="前"?a.setDate(a.getDate()-2):o=="大前"?a.setDate(a.getDate()-3):o=="後"?a.setDate(a.getDate()+2):o=="大後"&&a.setDate(a.getDate()+3);const l=n[RT];if(l){const u=l[0];u=="早"||u=="朝"||u=="上"?i.start.imply("hour",6):u=="下"||u=="晏"?(i.start.imply("hour",15),i.start.imply("meridiem",1)):u=="中"?(i.start.imply("hour",12),i.start.imply("meridiem",1)):u=="夜"||u=="晚"?(i.start.imply("hour",22),i.start.imply("meridiem",1)):u=="凌"&&i.start.imply("hour",0)}}return i.start.assign("day",a.getDate()),i.start.assign("month",a.getMonth()+1),i.start.assign("year",a.getFullYear()),i}}const Ze={零:0,一:1,二:2,兩:2,三:3,四:4,五:5,六:6,七:7,八:8,九:9,十:10,廿:20,卅:30},Mi={天:0,日:0,一:1,二:2,三:3,四:4,五:5,六:6};function Mt(e){let t=0;for(let n=0;n<e.length;n++){const r=e[n];r==="十"?t=t===0?Ze[r]:t*Ze[r]:t+=Ze[r]}return t}function MT(e){let t="";for(let n=0;n<e.length;n++){const r=e[n];t=t+Ze[r]}return parseInt(t)}const $a=1,Sf=2,Ca=3;class IT extends ke{innerPattern(){return new RegExp("(\\d{2,4}|["+Object.keys(Ze).join("")+"]{4}|["+Object.keys(Ze).join("")+"]{2})?(?:\\s*)(?:年)?(?:[\\s|,|,]*)(\\d{1,2}|["+Object.keys(Ze).join("")+"]{1,2})(?:\\s*)(?:月)(?:\\s*)(\\d{1,2}|["+Object.keys(Ze).join("")+"]{1,2})?(?:\\s*)(?:日|號)?")}innerExtract(t,n){const r=t.createParsingResult(n.index,n[0]);let i=parseInt(n[Sf]);if(isNaN(i)&&(i=Mt(n[Sf])),r.start.assign("month",i),n[Ca]){let s=parseInt(n[Ca]);isNaN(s)&&(s=Mt(n[Ca])),r.start.assign("day",s)}else r.start.imply("day",t.refDate.getDate());if(n[$a]){let s=parseInt(n[$a]);isNaN(s)&&(s=MT(n[$a])),r.start.assign("year",s)}else r.start.imply("year",t.refDate.getFullYear());return r}}const LT=new RegExp("(\\d+|["+Object.keys(Ze).join("")+"]+|半|幾)(?:\\s*)(?:個)?(秒(?:鐘)?|分鐘|小時|鐘|日|天|星期|禮拜|月|年)(?:(?:之|過)?後|(?:之)?內)","i"),Oa=1,FT=2;class jT extends ke{innerPattern(){return LT}innerExtract(t,n){const r=t.createParsingResult(n.index,n[0]);let i=parseInt(n[Oa]);if(isNaN(i)&&(i=Mt(n[Oa])),isNaN(i)){const u=n[Oa];if(u==="幾")i=3;else if(u==="半")i=.5;else return null}const s={},o=n[FT][0];if(o.match(/[日天星禮月年]/)){o=="日"||o=="天"?s.day=i:o=="星"||o=="禮"?s.week=i:o=="月"?s.month=i:o=="年"&&(s.year=i);const u=Le(t.refDate,s);return r.start.assign("year",u.getFullYear()),r.start.assign("month",u.getMonth()+1),r.start.assign("day",u.getDate()),r}o=="秒"?s.second=i:o=="分"?s.minute=i:(o=="小"||o=="鐘")&&(s.hour=i);const l=Le(t.refDate,s);return r.start.imply("year",l.getFullYear()),r.start.imply("month",l.getMonth()+1),r.start.imply("day",l.getDate()),r.start.assign("hour",l.getHours()),r.start.assign("minute",l.getMinutes()),r.start.assign("second",l.getSeconds()),r}}const zT=new RegExp("(?<prefix>上|今|下|這|呢)(?:個)?(?:星期|禮拜|週)(?<weekday>"+Object.keys(Mi).join("|")+")");class UT extends ke{innerPattern(){return zT}innerExtract(t,n){const r=t.createParsingResult(n.index,n[0]),i=n.groups.weekday,s=Mi[i];if(s===void 0)return null;let a=null;const o=n.groups.prefix;o=="上"?a="last":o=="下"?a="next":(o=="今"||o=="這"||o=="呢")&&(a="this");const l=new Date(t.refDate.getTime());let u=!1;const c=l.getDay();if(a=="last"||a=="past")l.setDate(l.getDate()+(s-7-c)),u=!0;else if(a=="next")l.setDate(l.getDate()+(s+7-c)),u=!0;else if(a=="this")l.setDate(l.getDate()+(s-c));else{let f=s-c;Math.abs(f-7)<Math.abs(f)&&(f-=7),Math.abs(f+7)<Math.abs(f)&&(f+=7),l.setDate(l.getDate()+f)}return r.start.assign("weekday",s),u?(r.start.assign("day",l.getDate()),r.start.assign("month",l.getMonth()+1),r.start.assign("year",l.getFullYear())):(r.start.imply("day",l.getDate()),r.start.imply("month",l.getMonth()+1),r.start.imply("year",l.getFullYear())),r}}const qT=new RegExp("(?:由|從|自)?(?:(今|明|前|大前|後|大後|聽|昨|尋|琴)(早|朝|晚)|(上(?:午|晝)|朝(?:早)|早(?:上)|下(?:午|晝)|晏(?:晝)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨))|(今|明|前|大前|後|大後|聽|昨|尋|琴)(?:日|天)(?:[\\s,,]*)(?:(上(?:午|晝)|朝(?:早)|早(?:上)|下(?:午|晝)|晏(?:晝)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨)))?)?(?:[\\s,,]*)(?:(\\d+|["+Object.keys(Ze).join("")+"]+)(?:\\s*)(?:點|時|:|:)(?:\\s*)(\\d+|半|正|整|["+Object.keys(Ze).join("")+"]+)?(?:\\s*)(?:分|:|:)?(?:\\s*)(\\d+|["+Object.keys(Ze).join("")+"]+)?(?:\\s*)(?:秒)?)(?:\\s*(A.M.|P.M.|AM?|PM?))?","i"),HT=new RegExp("(?:^\\s*(?:到|至|\\-|\\–|\\~|\\〜)\\s*)(?:(今|明|前|大前|後|大後|聽|昨|尋|琴)(早|朝|晚)|(上(?:午|晝)|朝(?:早)|早(?:上)|下(?:午|晝)|晏(?:晝)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨))|(今|明|前|大前|後|大後|聽|昨|尋|琴)(?:日|天)(?:[\\s,,]*)(?:(上(?:午|晝)|朝(?:早)|早(?:上)|下(?:午|晝)|晏(?:晝)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨)))?)?(?:[\\s,,]*)(?:(\\d+|["+Object.keys(Ze).join("")+"]+)(?:\\s*)(?:點|時|:|:)(?:\\s*)(\\d+|半|正|整|["+Object.keys(Ze).join("")+"]+)?(?:\\s*)(?:分|:|:)?(?:\\s*)(\\d+|["+Object.keys(Ze).join("")+"]+)?(?:\\s*)(?:秒)?)(?:\\s*(A.M.|P.M.|AM?|PM?))?","i"),Ii=1,Li=2,Fi=3,ji=4,zi=5,Ui=6,pt=7,En=8,qi=9;class BT extends ke{innerPattern(){return qT}innerExtract(t,n){if(n.index>0&&t.text[n.index-1].match(/\w/))return null;const r=t.createParsingResult(n.index,n[0]),i=new Date(t.refDate.getTime());if(n[Ii]){const p=n[Ii];p=="明"||p=="聽"?t.refDate.getHours()>1&&i.setDate(i.getDate()+1):p=="昨"||p=="尋"||p=="琴"?i.setDate(i.getDate()-1):p=="前"?i.setDate(i.getDate()-2):p=="大前"?i.setDate(i.getDate()-3):p=="後"?i.setDate(i.getDate()+2):p=="大後"&&i.setDate(i.getDate()+3),r.start.assign("day",i.getDate()),r.start.assign("month",i.getMonth()+1),r.start.assign("year",i.getFullYear())}else if(n[ji]){const p=n[ji];p=="明"||p=="聽"?i.setDate(i.getDate()+1):p=="昨"||p=="尋"||p=="琴"?i.setDate(i.getDate()-1):p=="前"?i.setDate(i.getDate()-2):p=="大前"?i.setDate(i.getDate()-3):p=="後"?i.setDate(i.getDate()+2):p=="大後"&&i.setDate(i.getDate()+3),r.start.assign("day",i.getDate()),r.start.assign("month",i.getMonth()+1),r.start.assign("year",i.getFullYear())}else r.start.imply("day",i.getDate()),r.start.imply("month",i.getMonth()+1),r.start.imply("year",i.getFullYear());let s=0,a=0,o=-1;if(n[En]){var l=parseInt(n[En]);if(isNaN(l)&&(l=Mt(n[En])),l>=60)return null;r.start.assign("second",l)}if(s=parseInt(n[Ui]),isNaN(s)&&(s=Mt(n[Ui])),n[pt]?n[pt]=="半"?a=30:n[pt]=="正"||n[pt]=="整"?a=0:(a=parseInt(n[pt]),isNaN(a)&&(a=Mt(n[pt]))):s>100&&(a=s%100,s=Math.floor(s/100)),a>=60||s>24)return null;if(s>=12&&(o=1),n[qi]){if(s>12)return null;var u=n[qi][0].toLowerCase();u=="a"&&(o=0,s==12&&(s=0)),u=="p"&&(o=1,s!=12&&(s+=12))}else if(n[Li]){var c=n[Li],f=c[0];f=="朝"||f=="早"?(o=0,s==12&&(s=0)):f=="晚"&&(o=1,s!=12&&(s+=12))}else if(n[Fi]){var h=n[Fi],d=h[0];d=="上"||d=="朝"||d=="早"||d=="凌"?(o=0,s==12&&(s=0)):(d=="下"||d=="晏"||d=="晚")&&(o=1,s!=12&&(s+=12))}else if(n[zi]){var g=n[zi],T=g[0];T=="上"||T=="朝"||T=="早"||T=="凌"?(o=0,s==12&&(s=0)):(T=="下"||T=="晏"||T=="晚")&&(o=1,s!=12&&(s+=12))}r.start.assign("hour",s),r.start.assign("minute",a),o>=0?r.start.assign("meridiem",o):s<12?r.start.imply("meridiem",0):r.start.imply("meridiem",1);const y=HT.exec(t.text.substring(r.index+r.text.length));if(!y)return r.text.match(/^\d+$/)?null:r;const m=new Date(i.getTime());if(r.end=t.createParsingComponents(),y[Ii]){const p=y[Ii];p=="明"||p=="聽"?t.refDate.getHours()>1&&m.setDate(m.getDate()+1):p=="昨"||p=="尋"||p=="琴"?m.setDate(m.getDate()-1):p=="前"?m.setDate(m.getDate()-2):p=="大前"?m.setDate(m.getDate()-3):p=="後"?m.setDate(m.getDate()+2):p=="大後"&&m.setDate(m.getDate()+3),r.end.assign("day",m.getDate()),r.end.assign("month",m.getMonth()+1),r.end.assign("year",m.getFullYear())}else if(y[ji]){const p=y[ji];p=="明"||p=="聽"?m.setDate(m.getDate()+1):p=="昨"||p=="尋"||p=="琴"?m.setDate(m.getDate()-1):p=="前"?m.setDate(m.getDate()-2):p=="大前"?m.setDate(m.getDate()-3):p=="後"?m.setDate(m.getDate()+2):p=="大後"&&m.setDate(m.getDate()+3),r.end.assign("day",m.getDate()),r.end.assign("month",m.getMonth()+1),r.end.assign("year",m.getFullYear())}else r.end.imply("day",m.getDate()),r.end.imply("month",m.getMonth()+1),r.end.imply("year",m.getFullYear());if(s=0,a=0,o=-1,y[En]){let p=parseInt(y[En]);if(isNaN(p)&&(p=Mt(y[En])),p>=60)return null;r.end.assign("second",p)}if(s=parseInt(y[Ui]),isNaN(s)&&(s=Mt(y[Ui])),y[pt]?y[pt]=="半"?a=30:y[pt]=="正"||y[pt]=="整"?a=0:(a=parseInt(y[pt]),isNaN(a)&&(a=Mt(y[pt]))):s>100&&(a=s%100,s=Math.floor(s/100)),a>=60||s>24)return null;if(s>=12&&(o=1),y[qi]){if(s>12)return null;var u=y[qi][0].toLowerCase();u=="a"&&(o=0,s==12&&(s=0)),u=="p"&&(o=1,s!=12&&(s+=12)),r.start.isCertain("meridiem")||(o==0?(r.start.imply("meridiem",0),r.start.get("hour")==12&&r.start.assign("hour",0)):(r.start.imply("meridiem",1),r.start.get("hour")!=12&&r.start.assign("hour",r.start.get("hour")+12)))}else if(y[Li]){var f=y[Li][0];f=="朝"||f=="早"?(o=0,s==12&&(s=0)):f=="晚"&&(o=1,s!=12&&(s+=12))}else if(y[Fi]){var d=y[Fi][0];d=="上"||d=="朝"||d=="早"||d=="凌"?(o=0,s==12&&(s=0)):(d=="下"||d=="晏"||d=="晚")&&(o=1,s!=12&&(s+=12))}else if(y[zi]){var T=y[zi][0];T=="上"||T=="朝"||T=="早"||T=="凌"?(o=0,s==12&&(s=0)):(T=="下"||T=="晏"||T=="晚")&&(o=1,s!=12&&(s+=12))}return r.text=r.text+y[0],r.end.assign("hour",s),r.end.assign("minute",a),o>=0?r.end.assign("meridiem",o):r.start.isCertain("meridiem")&&r.start.get("meridiem")==1&&r.start.get("hour")>s?r.end.imply("meridiem",0):s>12&&r.end.imply("meridiem",1),r.end.date().getTime()<r.start.date().getTime()&&r.end.imply("day",r.end.get("day")+1),r}}const VT=new RegExp("(?:星期|禮拜|週)(?<weekday>"+Object.keys(Mi).join("|")+")");class WT extends ke{innerPattern(){return VT}innerExtract(t,n){const r=t.createParsingResult(n.index,n[0]),i=n.groups.weekday,s=Mi[i];if(s===void 0)return null;const a=new Date(t.refDate.getTime()),o=a.getDay();let l=s-o;return Math.abs(l-7)<Math.abs(l)&&(l-=7),Math.abs(l+7)<Math.abs(l)&&(l+=7),a.setDate(a.getDate()+l),r.start.assign("weekday",s),r.start.imply("day",a.getDate()),r.start.imply("month",a.getMonth()+1),r.start.imply("year",a.getFullYear()),r}}class YT extends rf{patternBetween(){return/^\s*(至|到|\-|\~|~|-|ー)\s*$/i}}class GT extends of{patternBetween(){return/^\s*$/i}}const KT=new Zn(JT());new Zn(xf());function ZT(e,t,n){return KT.parseDate(e,t,n)}function JT(){const e=xf();return e.parsers.unshift(new NT),e}function xf(){const e=mf({parsers:[new IT,new _T,new UT,new ST,new WT,new $T,new BT,new AT,new jT,new kT],refiners:[new YT,new GT]});return e.refiners=e.refiners.filter(t=>!(t instanceof uf)),e}var Hi={exports:{}},XT=Hi.exports,Pf;function QT(){return Pf||(Pf=1,(function(e,t){(function(n,r){e.exports=r()})(XT,(function(){var n=1e3,r=6e4,i=36e5,s="millisecond",a="second",o="minute",l="hour",u="day",c="week",f="month",h="quarter",d="year",g="date",T="Invalid Date",y=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,m=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,p={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(H){var j=["th","st","nd","rd"],B=H%100;return"["+H+(j[(B-20)%10]||j[B]||j[0])+"]"}},b=function(H,j,B){var Z=String(H);return!Z||Z.length>=j?H:""+Array(j+1-Z.length).join(B)+H},S={s:b,z:function(H){var j=-H.utcOffset(),B=Math.abs(j),Z=Math.floor(B/60),q=B%60;return(j<=0?"+":"-")+b(Z,2,"0")+":"+b(q,2,"0")},m:function H(j,B){if(j.date()<B.date())return-H(B,j);var Z=12*(B.year()-j.year())+(B.month()-j.month()),q=j.clone().add(Z,f),ee=B-q<0,k=j.clone().add(Z+(ee?-1:1),f);return+(-(Z+(B-q)/(ee?q-k:k-q))||0)},a:function(H){return H<0?Math.ceil(H)||0:Math.floor(H)},p:function(H){return{M:f,y:d,w:c,d:u,D:g,h:l,m:o,s:a,ms:s,Q:h}[H]||String(H||"").toLowerCase().replace(/s$/,"")},u:function(H){return H===void 0}},v="en",w={};w[v]=p;var x="$isDayjsObject",N=function(H){return H instanceof U||!(!H||!H[x])},F=function H(j,B,Z){var q;if(!j)return v;if(typeof j=="string"){var ee=j.toLowerCase();w[ee]&&(q=ee),B&&(w[ee]=B,q=ee);var k=j.split("-");if(!q&&k.length>1)return H(k[0])}else{var D=j.name;w[D]=j,q=D}return!Z&&q&&(v=q),q||!Z&&v},A=function(H,j){if(N(H))return H.clone();var B=typeof j=="object"?j:{};return B.date=H,B.args=arguments,new U(B)},O=S;O.l=F,O.i=N,O.w=function(H,j){return A(H,{locale:j.$L,utc:j.$u,x:j.$x,$offset:j.$offset})};var U=(function(){function H(B){this.$L=F(B.locale,null,!0),this.parse(B),this.$x=this.$x||B.x||{},this[x]=!0}var j=H.prototype;return j.parse=function(B){this.$d=(function(Z){var q=Z.date,ee=Z.utc;if(q===null)return new Date(NaN);if(O.u(q))return new Date;if(q instanceof Date)return new Date(q);if(typeof q=="string"&&!/Z$/i.test(q)){var k=q.match(y);if(k){var D=k[2]-1||0,I=(k[7]||"0").substring(0,3);return ee?new Date(Date.UTC(k[1],D,k[3]||1,k[4]||0,k[5]||0,k[6]||0,I)):new Date(k[1],D,k[3]||1,k[4]||0,k[5]||0,k[6]||0,I)}}return new Date(q)})(B),this.init()},j.init=function(){var B=this.$d;this.$y=B.getFullYear(),this.$M=B.getMonth(),this.$D=B.getDate(),this.$W=B.getDay(),this.$H=B.getHours(),this.$m=B.getMinutes(),this.$s=B.getSeconds(),this.$ms=B.getMilliseconds()},j.$utils=function(){return O},j.isValid=function(){return this.$d.toString()!==T},j.isSame=function(B,Z){var q=A(B);return this.startOf(Z)<=q&&q<=this.endOf(Z)},j.isAfter=function(B,Z){return A(B)<this.startOf(Z)},j.isBefore=function(B,Z){return this.endOf(Z)<A(B)},j.$g=function(B,Z,q){return O.u(B)?this[Z]:this.set(q,B)},j.unix=function(){return Math.floor(this.valueOf()/1e3)},j.valueOf=function(){return this.$d.getTime()},j.startOf=function(B,Z){var q=this,ee=!!O.u(Z)||Z,k=O.p(B),D=function(ae,ne){var C=O.w(q.$u?Date.UTC(q.$y,ne,ae):new Date(q.$y,ne,ae),q);return ee?C:C.endOf(u)},I=function(ae,ne){return O.w(q.toDate()[ae].apply(q.toDate("s"),(ee?[0,0,0,0]:[23,59,59,999]).slice(ne)),q)},_=this.$W,E=this.$M,P=this.$D,M="set"+(this.$u?"UTC":"");switch(k){case d:return ee?D(1,0):D(31,11);case f:return ee?D(1,E):D(0,E+1);case c:var X=this.$locale().weekStart||0,J=(_<X?_+7:_)-X;return D(ee?P-J:P+(6-J),E);case u:case g:return I(M+"Hours",0);case l:return I(M+"Minutes",1);case o:return I(M+"Seconds",2);case a:return I(M+"Milliseconds",3);default:return this.clone()}},j.endOf=function(B){return this.startOf(B,!1)},j.$set=function(B,Z){var q,ee=O.p(B),k="set"+(this.$u?"UTC":""),D=(q={},q[u]=k+"Date",q[g]=k+"Date",q[f]=k+"Month",q[d]=k+"FullYear",q[l]=k+"Hours",q[o]=k+"Minutes",q[a]=k+"Seconds",q[s]=k+"Milliseconds",q)[ee],I=ee===u?this.$D+(Z-this.$W):Z;if(ee===f||ee===d){var _=this.clone().set(g,1);_.$d[D](I),_.init(),this.$d=_.set(g,Math.min(this.$D,_.daysInMonth())).$d}else D&&this.$d[D](I);return this.init(),this},j.set=function(B,Z){return this.clone().$set(B,Z)},j.get=function(B){return this[O.p(B)]()},j.add=function(B,Z){var q,ee=this;B=Number(B);var k=O.p(Z),D=function(E){var P=A(ee);return O.w(P.date(P.date()+Math.round(E*B)),ee)};if(k===f)return this.set(f,this.$M+B);if(k===d)return this.set(d,this.$y+B);if(k===u)return D(1);if(k===c)return D(7);var I=(q={},q[o]=r,q[l]=i,q[a]=n,q)[k]||1,_=this.$d.getTime()+B*I;return O.w(_,this)},j.subtract=function(B,Z){return this.add(-1*B,Z)},j.format=function(B){var Z=this,q=this.$locale();if(!this.isValid())return q.invalidDate||T;var ee=B||"YYYY-MM-DDTHH:mm:ssZ",k=O.z(this),D=this.$H,I=this.$m,_=this.$M,E=q.weekdays,P=q.months,M=q.meridiem,X=function(ne,C,R,z){return ne&&(ne[C]||ne(Z,ee))||R[C].slice(0,z)},J=function(ne){return O.s(D%12||12,ne,"0")},ae=M||function(ne,C,R){var z=ne<12?"AM":"PM";return R?z.toLowerCase():z};return ee.replace(m,(function(ne,C){return C||(function(R){switch(R){case"YY":return String(Z.$y).slice(-2);case"YYYY":return O.s(Z.$y,4,"0");case"M":return _+1;case"MM":return O.s(_+1,2,"0");case"MMM":return X(q.monthsShort,_,P,3);case"MMMM":return X(P,_);case"D":return Z.$D;case"DD":return O.s(Z.$D,2,"0");case"d":return String(Z.$W);case"dd":return X(q.weekdaysMin,Z.$W,E,2);case"ddd":return X(q.weekdaysShort,Z.$W,E,3);case"dddd":return E[Z.$W];case"H":return String(D);case"HH":return O.s(D,2,"0");case"h":return J(1);case"hh":return J(2);case"a":return ae(D,I,!0);case"A":return ae(D,I,!1);case"m":return String(I);case"mm":return O.s(I,2,"0");case"s":return String(Z.$s);case"ss":return O.s(Z.$s,2,"0");case"SSS":return O.s(Z.$ms,3,"0");case"Z":return k}return null})(ne)||k.replace(":","")}))},j.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},j.diff=function(B,Z,q){var ee,k=this,D=O.p(Z),I=A(B),_=(I.utcOffset()-this.utcOffset())*r,E=this-I,P=function(){return O.m(k,I)};switch(D){case d:ee=P()/12;break;case f:ee=P();break;case h:ee=P()/3;break;case c:ee=(E-_)/6048e5;break;case u:ee=(E-_)/864e5;break;case l:ee=E/i;break;case o:ee=E/r;break;case a:ee=E/n;break;default:ee=E}return q?ee:O.a(ee)},j.daysInMonth=function(){return this.endOf(f).$D},j.$locale=function(){return w[this.$L]},j.locale=function(B,Z){if(!B)return this.$L;var q=this.clone(),ee=F(B,Z,!0);return ee&&(q.$L=ee),q},j.clone=function(){return O.w(this.$d,this)},j.toDate=function(){return new Date(this.valueOf())},j.toJSON=function(){return this.isValid()?this.toISOString():null},j.toISOString=function(){return this.$d.toISOString()},j.toString=function(){return this.$d.toUTCString()},H})(),K=U.prototype;return A.prototype=K,[["$ms",s],["$s",a],["$m",o],["$H",l],["$W",u],["$M",f],["$y",d],["$D",g]].forEach((function(H){K[H[1]]=function(j){return this.$g(j,H[0],H[1])}})),A.extend=function(H,j){return H.$i||(H(j,U,A),H.$i=!0),A},A.locale=F,A.isDayjs=N,A.unix=function(H){return A(1e3*H)},A.en=w[v],A.Ls=w,A.p={},A}))})(Hi)),Hi.exports}var ek=QT();const Bi=Xn(ek);var Vi={exports:{}},tk=Vi.exports,Af;function nk(){return Af||(Af=1,(function(e,t){(function(n,r){e.exports=r()})(tk,(function(){var n="day";return function(r,i,s){var a=function(u){return u.add(4-u.isoWeekday(),n)},o=i.prototype;o.isoWeekYear=function(){return a(this).year()},o.isoWeek=function(u){if(!this.$utils().u(u))return this.add(7*(u-this.isoWeek()),n);var c,f,h,d,g=a(this),T=(c=this.isoWeekYear(),f=this.$u,h=(f?s.utc:s)().year(c).startOf("year"),d=4-h.isoWeekday(),h.isoWeekday()>4&&(d+=7),h.add(d,n));return g.diff(T,"week")+1},o.isoWeekday=function(u){return this.$utils().u(u)?this.day()||7:this.day(this.day()%7?u:u-7)};var l=o.startOf;o.startOf=function(u,c){var f=this.$utils(),h=!!f.u(c)||c;return f.p(u)==="isoweek"?h?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):l.bind(this)(u,c)}}}))})(Vi)),Vi.exports}var rk=nk();const ik=Xn(rk);Bi.extend(ik);function sk(){return Bi().startOf("isoWeek").toDate()}const Ra=/大*后天/g;function ak(e){if(!Ra.test(e))return e;const t=Bi();return Ra.lastIndex=0,e.replace(Ra,n=>{const i=2+(n.length-2);return t.add(i,"day").format("YYYY年MM月DD日")})}function ok(e){const t=ak(e),n=/(?:本|这|上|下)?(?:周|星期)/.test(t),r=ZT(t,{instant:n?sk():new Date});return r?Bi(r).format("YYYY-MM-DD HH:mm:ss"):"无法解析,请输入具体时间"}const lk={parse_relative_date:{def:{type:"function",function:{name:"parse_relative_date",description:"把相对时间转成绝对时间",parameters:{type:"object",properties:{input:{type:"string",description:"相对时间"}},required:["input"]}}},handler:e=>ok(e.input)}};class uk extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"}),this.shadowRoot&&this.shadowRoot.appendChild(Fc.content.cloneNode(!0))}connectedCallback(){this.shadowRoot&&E_(this.shadowRoot)}}customElements.define("ai-chat-panel",uk);class ck{on=ga.on;pushMessage=ot.pushMessage;pushMessages=ot.pushMessages;pushLoadingMessage=ot.pushLoadingMessage;updateLoadingMessageReasoningContent=ot.updateLoadingMessageReasoningContent;updateLoadingMessageContent=ot.updateLoadingMessageContent;finishLoadingMessage=ot.finishLoadingMessage;setInputValue=Ut.setValue;constructor(t){const{container:n}=t;if(!n)throw new Error("未提供有效的 container");const r=document.createElement("ai-chat-panel");n.appendChild(r)}}$e.AIChatPanel=ck,$e.Agent=b_,$e.tools=lk,Object.defineProperty($e,Symbol.toStringTag,{value:"Module"})}));
|
|
97
|
+
reference: ${JSON.stringify(this.reference)}]`}date(){const t=this.dateWithoutTimezoneAdjustment(),n=this.reference.getSystemTimezoneAdjustmentMinute(t,this.get("timezoneOffset"));return new Date(t.getTime()+n*6e4)}addTag(t){return this._tags.add(t),this}addTags(t){for(const n of t)this._tags.add(n);return this}tags(){return new Set(this._tags)}dateWithoutTimezoneAdjustment(){const t=new Date(this.get("year"),this.get("month")-1,this.get("day"),this.get("hour"),this.get("minute"),this.get("second"),this.get("millisecond"));return t.setFullYear(this.get("year")),t}}class _n{refDate;index;text;reference;start;end;constructor(t,n,r,i,s){this.reference=t,this.refDate=t.instant,this.index=n,this.text=r,this.start=i||new Te(t),this.end=s}clone(){const t=new _n(this.reference,this.index,this.text);return t.start=this.start?this.start.clone():null,t.end=this.end?this.end.clone():null,t}date(){return this.start.date()}addTag(t){return this.start.addTag(t),this.end&&this.end.addTag(t),this}addTags(t){return this.start.addTags(t),this.end&&this.end.addTags(t),this}tags(){const t=new Set(this.start.tags());if(this.end)for(const n of this.end.tags())t.add(n);return t}toString(){const t=Array.from(this.tags()).sort();return`[ParsingResult {index: ${this.index}, text: '${this.text}', tags: ${JSON.stringify(t)} ...}]`}}function qc(e,t,n="\\s{0,5},?\\s{0,5}"){const r=t.replace(/\((?!\?)/g,"(?:");return`${e}${r}(?:${n}${r}){0,10}`}function A_(e){let t;return e instanceof Array?t=[...e]:e instanceof Map?t=Array.from(e.keys()):t=Object.keys(e),t}function Et(e){return`(?:${A_(e).sort((n,r)=>r.length-n.length).join("|").replace(/\./g,"\\.")})`}function Hc(e){return e<100&&(e>50?e=e+1900:e=e+2e3),e}function yi(e,t,n){let r=new Date(e);r.setMonth(n-1),r.setDate(t);const i=Le(r,{year:1}),s=Le(r,{year:-1});return Math.abs(i.getTime()-e.getTime())<Math.abs(r.getTime()-e.getTime())?r=i:Math.abs(s.getTime()-e.getTime())<Math.abs(r.getTime()-e.getTime())&&(r=s),r.getFullYear()}const ba={sunday:0,sun:0,"sun.":0,monday:1,mon:1,"mon.":1,tuesday:2,tue:2,"tue.":2,wednesday:3,wed:3,"wed.":3,thursday:4,thurs:4,"thurs.":4,thur:4,"thur.":4,thu:4,"thu.":4,friday:5,fri:5,"fri.":5,saturday:6,sat:6,"sat.":6},Bc={january:1,february:2,march:3,april:4,may:5,june:6,july:7,august:8,september:9,october:10,november:11,december:12},Vt={...Bc,jan:1,"jan.":1,feb:2,"feb.":2,mar:3,"mar.":3,apr:4,"apr.":4,jun:6,"jun.":6,jul:7,"jul.":7,aug:8,"aug.":8,sep:9,"sep.":9,sept:9,"sept.":9,oct:10,"oct.":10,nov:11,"nov.":11,dec:12,"dec.":12},wa={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12},_a={first:1,second:2,third:3,fourth:4,fifth:5,sixth:6,seventh:7,eighth:8,ninth:9,tenth:10,eleventh:11,twelfth:12,thirteenth:13,fourteenth:14,fifteenth:15,sixteenth:16,seventeenth:17,eighteenth:18,nineteenth:19,twentieth:20,"twenty first":21,"twenty-first":21,"twenty second":22,"twenty-second":22,"twenty third":23,"twenty-third":23,"twenty fourth":24,"twenty-fourth":24,"twenty fifth":25,"twenty-fifth":25,"twenty sixth":26,"twenty-sixth":26,"twenty seventh":27,"twenty-seventh":27,"twenty eighth":28,"twenty-eighth":28,"twenty ninth":29,"twenty-ninth":29,thirtieth:30,"thirty first":31,"thirty-first":31},Vc={second:"second",seconds:"second",minute:"minute",minutes:"minute",hour:"hour",hours:"hour",day:"day",days:"day",week:"week",weeks:"week",month:"month",months:"month",quarter:"quarter",quarters:"quarter",year:"year",years:"year"},bi={s:"second",sec:"second",second:"second",seconds:"second",m:"minute",min:"minute",mins:"minute",minute:"minute",minutes:"minute",h:"hour",hr:"hour",hrs:"hour",hour:"hour",hours:"hour",d:"day",day:"day",days:"day",w:"week",week:"week",weeks:"week",mo:"month",mon:"month",mos:"month",month:"month",months:"month",qtr:"quarter",quarter:"quarter",quarters:"quarter",y:"year",yr:"year",year:"year",years:"year",...Vc},Wc=`(?:${Et(wa)}|[0-9]+|[0-9]+\\.[0-9]+|half(?:\\s{0,2}an?)?|an?\\b(?:\\s{0,2}few)?|few|several|the|a?\\s{0,2}couple\\s{0,2}(?:of)?)`;function D_(e){const t=e.toLowerCase();return wa[t]!==void 0?wa[t]:t==="a"||t==="an"||t=="the"?1:t.match(/few/)?3:t.match(/half/)?.5:t.match(/couple/)?2:t.match(/several/)?7:parseFloat(t)}const wi=`(?:${Et(_a)}|[0-9]{1,2}(?:st|nd|rd|th)?)`;function _i(e){let t=e.toLowerCase();return _a[t]!==void 0?_a[t]:(t=t.replace(/(?:st|nd|rd|th)$/i,""),parseInt(t))}const vi="(?:[1-9][0-9]{0,3}\\s{0,2}(?:BE|AD|BC|BCE|CE)|[1-2][0-9]{3}|[5-9][0-9]|2[0-5])";function Ti(e){if(/BE/i.test(e))return e=e.replace(/BE/i,""),parseInt(e)-543;if(/BCE?/i.test(e))return e=e.replace(/BCE?/i,""),-parseInt(e);if(/(AD|CE)/i.test(e))return e=e.replace(/(AD|CE)/i,""),parseInt(e);const t=parseInt(e);return Hc(t)}const Yc=`(${Wc})\\s{0,3}(${Et(bi)})`,Gc=new RegExp(Yc,"i"),$_=`(${Wc})\\s{0,3}(${Et(Vc)})`,Kc="\\s{0,5},?(?:\\s*and)?\\s{0,5}",Gn=qc("(?:(?:about|around)\\s{0,3})?",Yc,Kc),ki=qc("(?:(?:about|around)\\s{0,3})?",$_,Kc);function vn(e){const t={};let n=e,r=Gc.exec(n);for(;r;)C_(t,r),n=n.substring(r[0].length).trim(),r=Gc.exec(n);return Object.keys(t).length==0?null:t}function C_(e,t){if(t[0].match(/^[a-zA-Z]+$/))return;const n=D_(t[1]),r=bi[t[2].toLowerCase()];e[r]=n}class ke{innerPatternHasChange(t,n){return this.innerPattern(t)!==n}patternLeftBoundary(){return"(\\W|^)"}cachedInnerPattern=null;cachedPattern=null;pattern(t){return this.cachedInnerPattern&&!this.innerPatternHasChange(t,this.cachedInnerPattern)?this.cachedPattern:(this.cachedInnerPattern=this.innerPattern(t),this.cachedPattern=new RegExp(`${this.patternLeftBoundary()}${this.cachedInnerPattern.source}`,this.cachedInnerPattern.flags),this.cachedPattern)}extract(t,n){const r=n[1]??"";n.index=n.index+r.length,n[0]=n[0].substring(r.length);for(let i=2;i<n.length;i++)n[i-1]=n[i];return this.innerExtract(t,n)}}const O_=new RegExp(`(?:(?:within|in|for)\\s*)?(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${Gn})(?=\\W|$)`,"i"),R_=new RegExp(`(?:within|in|for)\\s*(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${Gn})(?=\\W|$)`,"i"),N_=new RegExp(`(?:within|in|for)\\s*(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${ki})(?=\\W|$)`,"i");class M_ extends ke{strictMode;constructor(t){super(),this.strictMode=t}innerPattern(t){return this.strictMode?N_:t.option.forwardDate?O_:R_}innerExtract(t,n){if(n[0].match(/^for\s*the\s*\w+/))return null;const r=vn(n[1]);return r?Te.createRelativeFromReference(t.reference,r):null}}const I_=new RegExp(`(?:on\\s{0,3})?(${wi})(?:\\s{0,3}(?:to|\\-|\\–|until|through|till)?\\s{0,3}(${wi}))?(?:-|/|\\s{0,3}(?:of)?\\s{0,3})(${Et(Vt)})(?:(?:-|/|,?\\s{0,3})(${vi}(?!\\w)))?(?=\\W|$)`,"i"),Zc=1,Jc=2,L_=3,Xc=4;class F_ extends ke{innerPattern(){return I_}innerExtract(t,n){const r=t.createParsingResult(n.index,n[0]),i=Vt[n[L_].toLowerCase()],s=_i(n[Zc]);if(s>31)return n.index=n.index+n[Zc].length,null;if(r.start.assign("month",i),r.start.assign("day",s),n[Xc]){const a=Ti(n[Xc]);r.start.assign("year",a)}else{const a=yi(t.refDate,s,i);r.start.imply("year",a)}if(n[Jc]){const a=_i(n[Jc]);r.end=r.start.clone(),r.end.assign("day",a)}return r}}const j_=new RegExp(`(${Et(Vt)})(?:-|/|\\s*,?\\s*)(${wi})(?!\\s*(?:am|pm))\\s*(?:(?:to|\\-)\\s*(${wi})\\s*)?(?:(?:-|/|\\s*,\\s*|\\s+)(${vi}))?(?=\\W|$)(?!\\:\\d)`,"i"),z_=1,Qc=2,va=3,Ta=4;class U_ extends ke{shouldSkipYearLikeDate;constructor(t){super(),this.shouldSkipYearLikeDate=t}innerPattern(){return j_}innerExtract(t,n){const r=Vt[n[z_].toLowerCase()],i=_i(n[Qc]);if(i>31||this.shouldSkipYearLikeDate&&!n[va]&&!n[Ta]&&n[Qc].match(/^2[0-5]$/))return null;const s=t.createParsingComponents({day:i,month:r}).addTag("parser/ENMonthNameMiddleEndianParser");if(n[Ta]){const l=Ti(n[Ta]);s.assign("year",l)}else{const l=yi(t.refDate,i,r);s.imply("year",l)}if(!n[va])return s;const a=_i(n[va]),o=t.createParsingResult(n.index,n[0]);return o.start=s,o.end=s.clone(),o.end.assign("day",a),o}}const q_=new RegExp(`((?:in)\\s*)?(${Et(Vt)})\\s*(?:(?:,|-|of)?\\s*(${vi})?)?(?=[^\\s\\w]|\\s+[^0-9]|\\s+$|$)`,"i"),H_=1,B_=2,ef=3;class V_ extends ke{innerPattern(){return q_}innerExtract(t,n){const r=n[B_].toLowerCase();if(n[0].length<=3&&!Bc[r])return null;const i=t.createParsingResult(n.index+(n[H_]||"").length,n.index+n[0].length);i.start.imply("day",1),i.start.addTag("parser/ENMonthNameParser");const s=Vt[r];if(i.start.assign("month",s),n[ef]){const a=Ti(n[ef]);i.start.assign("year",a)}else{const a=yi(t.refDate,1,s);i.start.imply("year",a)}return i}}const W_=new RegExp(`([0-9]{4})[-\\.\\/\\s](?:(${Et(Vt)})|([0-9]{1,2}))[-\\.\\/\\s]([0-9]{1,2})(?=\\W|$)`,"i"),Y_=1,G_=2,tf=3,K_=4;class Z_ extends ke{strictMonthDateOrder;constructor(t){super(),this.strictMonthDateOrder=t}innerPattern(){return W_}innerExtract(t,n){const r=parseInt(n[Y_]);let i=parseInt(n[K_]),s=n[tf]?parseInt(n[tf]):Vt[n[G_].toLowerCase()];if(s<1||s>12){if(this.strictMonthDateOrder)return null;i>=1&&i<=12&&([s,i]=[i,s])}return i<1||i>31?null:{day:i,month:s,year:r}}}const J_=new RegExp("([0-9]|0[1-9]|1[012])/([0-9]{4})","i"),X_=1,Q_=2;class ev extends ke{innerPattern(){return J_}innerExtract(t,n){const r=parseInt(n[Q_]),i=parseInt(n[X_]);return t.createParsingComponents().imply("day",1).assign("month",i).assign("year",r)}}function tv(e,t,n,r){return new RegExp(`${e}${t}(\\d{1,4})(?:(?:\\.|:|:)(\\d{1,2})(?:(?::|:)(\\d{2})(?:\\.(\\d{1,6}))?)?)?(?:\\s*(a\\.m\\.|p\\.m\\.|am?|pm?))?${n}`,r)}function nv(e,t){return new RegExp(`^(${e})(\\d{1,4})(?:(?:\\.|\\:|\\:)(\\d{1,2})(?:(?:\\.|\\:|\\:)(\\d{1,2})(?:\\.(\\d{1,6}))?)?)?(?:\\s*(a\\.m\\.|p\\.m\\.|am?|pm?))?${t}`,"i")}const ka=2,rn=3,Ei=4,Si=5,Tn=6;class rv{strictMode;constructor(t=!1){this.strictMode=t}patternFlags(){return"i"}primaryPatternLeftBoundary(){return"(^|\\s|T|\\b)"}primarySuffix(){return"(?!/)(?=\\W|$)"}followingSuffix(){return"(?!/)(?=\\W|$)"}pattern(t){return this.getPrimaryTimePatternThroughCache()}extract(t,n){const r=this.extractPrimaryTimeComponents(t,n);if(!r)return n[0].match(/^\d{4}/)?(n.index+=4,null):(n.index+=n[0].length,null);const i=n.index+n[1].length,s=n[0].substring(n[1].length),a=t.createParsingResult(i,s,r);n.index+=n[0].length;const o=t.text.substring(n.index),u=this.getFollowingTimePatternThroughCache().exec(o);return s.match(/^\d{3,4}/)&&u&&(u[0].match(/^\s*([+-])\s*\d{2,4}$/)||u[0].match(/^\s*([+-])\s*\d{2}\W\d{2}/))?null:!u||u[0].match(/^\s*([+-])\s*\d{3,4}$/)?this.checkAndReturnWithoutFollowingPattern(a):(a.end=this.extractFollowingTimeComponents(t,u,a),a.end&&(a.text+=u[0]),this.checkAndReturnWithFollowingPattern(a))}extractPrimaryTimeComponents(t,n,r=!1){const i=t.createParsingComponents();let s=0,a=null,o=parseInt(n[ka]);if(o>100){if(n[ka].length==4&&n[rn]==null&&!n[Tn]||this.strictMode||n[rn]!=null)return null;s=o%100,o=Math.floor(o/100)}if(o>24)return null;if(n[rn]!=null){if(n[rn].length==1&&!n[Tn])return null;s=parseInt(n[rn])}if(s>=60)return null;if(o>12&&(a=ye.PM),n[Tn]!=null){if(o>12)return null;const l=n[Tn][0].toLowerCase();l=="a"&&(a=ye.AM,o==12&&(o=0)),l=="p"&&(a=ye.PM,o!=12&&(o+=12))}if(i.assign("hour",o),i.assign("minute",s),a!==null?i.assign("meridiem",a):o<12?i.imply("meridiem",ye.AM):i.imply("meridiem",ye.PM),n[Si]!=null){const l=parseInt(n[Si].substring(0,3));if(l>=1e3)return null;i.assign("millisecond",l)}if(n[Ei]!=null){const l=parseInt(n[Ei]);if(l>=60)return null;i.assign("second",l)}return i}extractFollowingTimeComponents(t,n,r){const i=t.createParsingComponents();if(n[Si]!=null){const l=parseInt(n[Si].substring(0,3));if(l>=1e3)return null;i.assign("millisecond",l)}if(n[Ei]!=null){const l=parseInt(n[Ei]);if(l>=60)return null;i.assign("second",l)}let s=parseInt(n[ka]),a=0,o=-1;if(n[rn]!=null?a=parseInt(n[rn]):s>100&&(a=s%100,s=Math.floor(s/100)),a>=60||s>24)return null;if(s>=12&&(o=ye.PM),n[Tn]!=null){if(s>12)return null;const l=n[Tn][0].toLowerCase();l=="a"&&(o=ye.AM,s==12&&(s=0,i.isCertain("day")||i.imply("day",i.get("day")+1))),l=="p"&&(o=ye.PM,s!=12&&(s+=12)),r.start.isCertain("meridiem")||(o==ye.AM?(r.start.imply("meridiem",ye.AM),r.start.get("hour")==12&&r.start.assign("hour",0)):(r.start.imply("meridiem",ye.PM),r.start.get("hour")!=12&&r.start.assign("hour",r.start.get("hour")+12)))}return i.assign("hour",s),i.assign("minute",a),o>=0?i.assign("meridiem",o):r.start.isCertain("meridiem")&&r.start.get("hour")>12?r.start.get("hour")-12>s?i.imply("meridiem",ye.AM):s<=12&&(i.assign("hour",s+12),i.assign("meridiem",ye.PM)):s>12?i.imply("meridiem",ye.PM):s<=12&&i.imply("meridiem",ye.AM),i.date().getTime()<r.start.date().getTime()&&i.imply("day",i.get("day")+1),i}checkAndReturnWithoutFollowingPattern(t){if(t.text.match(/^\d$/)||t.text.match(/^\d\d\d+$/)||t.text.match(/\d[apAP]$/))return null;const n=t.text.match(/[^\d:.](\d[\d.]+)$/);if(n){const r=n[1];if(this.strictMode||r.includes(".")&&!r.match(/\d(\.\d{2})+$/)||parseInt(r)>24)return null}return t}checkAndReturnWithFollowingPattern(t){if(t.text.match(/^\d+-\d+$/))return null;const n=t.text.match(/[^\d:.](\d[\d.]+)\s*-\s*(\d[\d.]+)$/);if(n){if(this.strictMode)return null;const r=n[1],i=n[2];if(i.includes(".")&&!i.match(/\d(\.\d{2})+$/))return null;const s=parseInt(i),a=parseInt(r);if(s>24||a>24)return null}return t}cachedPrimaryPrefix=null;cachedPrimarySuffix=null;cachedPrimaryTimePattern=null;getPrimaryTimePatternThroughCache(){const t=this.primaryPrefix(),n=this.primarySuffix();return this.cachedPrimaryPrefix===t&&this.cachedPrimarySuffix===n?this.cachedPrimaryTimePattern:(this.cachedPrimaryTimePattern=tv(this.primaryPatternLeftBoundary(),t,n,this.patternFlags()),this.cachedPrimaryPrefix=t,this.cachedPrimarySuffix=n,this.cachedPrimaryTimePattern)}cachedFollowingPhase=null;cachedFollowingSuffix=null;cachedFollowingTimePatten=null;getFollowingTimePatternThroughCache(){const t=this.followingPhase(),n=this.followingSuffix();return this.cachedFollowingPhase===t&&this.cachedFollowingSuffix===n?this.cachedFollowingTimePatten:(this.cachedFollowingTimePatten=nv(t,n),this.cachedFollowingPhase=t,this.cachedFollowingSuffix=n,this.cachedFollowingTimePatten)}}class iv extends rv{constructor(t){super(t)}followingPhase(){return"\\s*(?:\\-|\\–|\\~|\\〜|to|until|through|till|\\?)\\s*"}primaryPrefix(){return"(?:(?:at|from)\\s*)??"}primarySuffix(){return"(?:\\s*(?:o\\W*clock|at\\s*night|in\\s*the\\s*(?:morning|afternoon)))?(?!/)(?=\\W|$)"}extractPrimaryTimeComponents(t,n){const r=super.extractPrimaryTimeComponents(t,n);if(!r)return r;if(n[0].endsWith("night")){const i=r.get("hour");i>=6&&i<12?(r.assign("hour",r.get("hour")+12),r.assign("meridiem",ye.PM)):i<6&&r.assign("meridiem",ye.AM)}if(n[0].endsWith("afternoon")){r.assign("meridiem",ye.PM);const i=r.get("hour");i>=0&&i<=6&&r.assign("hour",r.get("hour")+12)}return n[0].endsWith("morning")&&(r.assign("meridiem",ye.AM),r.get("hour")<12&&r.assign("hour",r.get("hour"))),r.addTag("parser/ENTimeExpressionParser")}extractFollowingTimeComponents(t,n,r){const i=super.extractFollowingTimeComponents(t,n,r);return i&&i.addTag("parser/ENTimeExpressionParser"),i}}const sv=new RegExp(`(${Gn})\\s{0,5}(?:ago|before|earlier)(?=\\W|$)`,"i"),av=new RegExp(`(${ki})\\s{0,5}(?:ago|before|earlier)(?=\\W|$)`,"i");class ov extends ke{strictMode;constructor(t){super(),this.strictMode=t}innerPattern(){return this.strictMode?av:sv}innerExtract(t,n){const r=vn(n[1]);return r?Te.createRelativeFromReference(t.reference,gi(r)):null}}const lv=new RegExp(`(${Gn})\\s{0,5}(?:later|after|from now|henceforth|forward|out)(?=(?:\\W|$))`,"i"),uv=new RegExp(`(${ki})\\s{0,5}(later|after|from now)(?=\\W|$)`,"i"),cv=1;class fv extends ke{strictMode;constructor(t){super(),this.strictMode=t}innerPattern(){return this.strictMode?uv:lv}innerExtract(t,n){const r=vn(n[cv]);return r?Te.createRelativeFromReference(t.reference,r):null}}class nf{refine(t,n){return n.filter(r=>this.isValid(t,r))}}class Kn{refine(t,n){if(n.length<2)return n;const r=[];let i=n[0],s=null;for(let a=1;a<n.length;a++){s=n[a];const o=t.text.substring(i.index+i.text.length,s.index);if(!this.shouldMergeResults(o,i,s,t))r.push(i),i=s;else{const l=i,u=s,c=this.mergeResults(o,l,u,t);t.debug(()=>{console.log(`${this.constructor.name} merged ${l} and ${u} into ${c}`)}),i=c}}return i!=null&&r.push(i),r}}class rf extends Kn{shouldMergeResults(t,n,r){return!n.end&&!r.end&&t.match(this.patternBetween())!=null}mergeResults(t,n,r){if(!n.start.isOnlyWeekdayComponent()&&!r.start.isOnlyWeekdayComponent()&&(r.start.getCertainComponents().forEach(s=>{n.start.isCertain(s)||n.start.imply(s,r.start.get(s))}),n.start.getCertainComponents().forEach(s=>{r.start.isCertain(s)||r.start.imply(s,n.start.get(s))})),n.start.date()>r.start.date()){let s=n.start.date(),a=r.start.date();r.start.isOnlyWeekdayComponent()&&Le(a,{day:7})>s?(a=Le(a,{day:7}),r.start.imply("day",a.getDate()),r.start.imply("month",a.getMonth()+1),r.start.imply("year",a.getFullYear())):n.start.isOnlyWeekdayComponent()&&Le(s,{day:-7})<a?(s=Le(s,{day:-7}),n.start.imply("day",s.getDate()),n.start.imply("month",s.getMonth()+1),n.start.imply("year",s.getFullYear())):r.start.isDateWithUnknownYear()&&Le(a,{year:1})>s?(a=Le(a,{year:1}),r.start.imply("year",a.getFullYear())):n.start.isDateWithUnknownYear()&&Le(s,{year:-1})<a?(s=Le(s,{year:-1}),n.start.imply("year",s.getFullYear())):[r,n]=[n,r]}const i=n.clone();return i.start=n.start,i.end=r.start,i.index=Math.min(n.index,r.index),n.index<r.index?i.text=n.text+t+r.text:i.text=r.text+t+n.text,i}}class dv extends rf{patternBetween(){return/^\s*(to|-|–|until|through|till)\s*$/i}}function sf(e,t){const n=e.clone(),r=e.start,i=t.start;if(n.start=af(r,i),e.end!=null||t.end!=null){const s=e.end==null?e.start:e.end,a=t.end==null?t.start:t.end,o=af(s,a);if(e.end==null&&o.date().getTime()<n.start.date().getTime()){const l=new Date(o.date().getTime());l.setDate(l.getDate()+1),o.isCertain("day")?tn(o,l):wn(o,l)}n.end=o}return n}function af(e,t){const n=e.clone();return t.isCertain("hour")?(n.assign("hour",t.get("hour")),n.assign("minute",t.get("minute")),t.isCertain("second")?(n.assign("second",t.get("second")),t.isCertain("millisecond")?n.assign("millisecond",t.get("millisecond")):n.imply("millisecond",t.get("millisecond"))):(n.imply("second",t.get("second")),n.imply("millisecond",t.get("millisecond")))):(n.imply("hour",t.get("hour")),n.imply("minute",t.get("minute")),n.imply("second",t.get("second")),n.imply("millisecond",t.get("millisecond"))),t.isCertain("timezoneOffset")&&n.assign("timezoneOffset",t.get("timezoneOffset")),t.isCertain("meridiem")?n.assign("meridiem",t.get("meridiem")):t.get("meridiem")!=null&&n.get("meridiem")==null&&n.imply("meridiem",t.get("meridiem")),n.get("meridiem")==ye.PM&&n.get("hour")<12&&(t.isCertain("hour")?n.assign("hour",n.get("hour")+12):n.imply("hour",n.get("hour")+12)),n.addTags(e.tags()),n.addTags(t.tags()),n}class of extends Kn{shouldMergeResults(t,n,r){return(n.start.isOnlyDate()&&r.start.isOnlyTime()||r.start.isOnlyDate()&&n.start.isOnlyTime())&&t.match(this.patternBetween())!=null}mergeResults(t,n,r){const i=n.start.isOnlyDate()?sf(n,r):sf(r,n);return i.index=n.index,i.text=n.text+t+r.text,i}}class lf extends of{patternBetween(){return new RegExp("^\\s*(T|at|after|before|on|of|,|-|\\.|∙|:)?\\s*$")}}const hv=new RegExp("^\\s*,?\\s*\\(?([A-Z]{2,4})\\)?(?=\\W|$)","i");class pv{timezoneOverrides;constructor(t){this.timezoneOverrides=t}refine(t,n){const r=t.option.timezones??{};return n.forEach(i=>{const s=t.text.substring(i.index+i.text.length),a=hv.exec(s);if(!a)return;const o=a[1].toUpperCase(),l=i.start.date()??i.refDate??new Date,u={...this.timezoneOverrides,...r},c=Uc(o,l,u);if(c==null)return;t.debug(()=>{console.log(`Extracting timezone: '${o}' into: ${c} for: ${i.start}`)});const f=i.start.get("timezoneOffset");f!==null&&c!=f&&(i.start.isCertain("timezoneOffset")||o!=a[1])||i.start.isOnlyDate()&&o!=a[1]||(i.text+=a[0],i.start.isCertain("timezoneOffset")||i.start.assign("timezoneOffset",c),i.end!=null&&!i.end.isCertain("timezoneOffset")&&i.end.assign("timezoneOffset",c))}),n}}const mv=new RegExp("^\\s*(?:\\(?(?:GMT|UTC)\\s?)?([+-])(\\d{1,2})(?::?(\\d{2}))?\\)?","i"),gv=1,yv=2,bv=3;class uf{refine(t,n){return n.forEach(function(r){if(r.start.isCertain("timezoneOffset"))return;const i=t.text.substring(r.index+r.text.length),s=mv.exec(i);if(!s)return;t.debug(()=>{console.log(`Extracting timezone: '${s[0]}' into : ${r}`)});const a=parseInt(s[yv]),o=parseInt(s[bv]||"0");let l=a*60+o;l>840||(s[gv]==="-"&&(l=-l),r.end!=null&&r.end.assign("timezoneOffset",l),r.start.assign("timezoneOffset",l),r.text+=s[0])}),n}}class Ea{refine(t,n){if(n.length<2)return n;const r=[];let i=n[0];for(let s=1;s<n.length;s++){const a=n[s];if(a.index>=i.index+i.text.length){r.push(i),i=a;continue}let o=null,l=null;a.text.length>i.text.length?(o=a,l=i):(o=i,l=a),t.debug(()=>{console.log(`${this.constructor.name} remove ${l} by ${o}`)}),i=o}return i!=null&&r.push(i),r}}class wv{refine(t,n){return t.option.forwardDate&&n.forEach(r=>{let i=t.reference.getDateWithAdjustedTimezone();if(r.start.isOnlyTime()&&t.reference.instant>r.start.date()){const s=t.reference.getDateWithAdjustedTimezone(),a=new Date(s);a.setDate(a.getDate()+1),wn(r.start,a),t.debug(()=>{console.log(`${this.constructor.name} adjusted ${r} time from the ref date (${s}) to the following day (${a})`)}),r.end&&r.end.isOnlyTime()&&(wn(r.end,a),r.start.date()>r.end.date()&&(a.setDate(a.getDate()+1),wn(r.end,a)))}if(r.start.isOnlyWeekdayComponent()&&i>r.start.date()){let s=r.start.get("weekday")-i.getDay();if(s<=0&&(s+=7),i=Le(i,{day:s}),wn(r.start,i),t.debug(()=>{console.log(`${this.constructor.name} adjusted ${r} weekday (${r.start})`)}),r.end&&r.end.isOnlyWeekdayComponent()){let a=r.end.get("weekday")-i.getDay();a<=0&&(a+=7),i=Le(i,{day:a}),wn(r.end,i),t.debug(()=>{console.log(`${this.constructor.name} adjusted ${r} weekday (${r.end})`)})}}if(r.start.isDateWithUnknownYear()&&i>r.start.date())for(let s=0;s<3&&i>r.start.date();s++)r.start.imply("year",r.start.get("year")+1),t.debug(()=>{console.log(`${this.constructor.name} adjusted ${r} year (${r.start})`)}),r.end&&!r.end.isCertain("year")&&(r.end.imply("year",r.end.get("year")+1),t.debug(()=>{console.log(`${this.constructor.name} adjusted ${r} month (${r.start})`)}))}),n}}class _v extends nf{strictMode;constructor(t){super(),this.strictMode=t}isValid(t,n){return n.text.replace(" ","").match(/^\d*(\.\d*)?$/)?(t.debug(()=>{console.log(`Removing unlikely result '${n.text}'`)}),!1):n.start.isValidDate()?n.end&&!n.end.isValidDate()?(t.debug(()=>{console.log(`Removing invalid result: ${n} (${n.end})`)}),!1):this.strictMode?this.isStrictModeValid(t,n):!0:(t.debug(()=>{console.log(`Removing invalid result: ${n} (${n.start})`)}),!1)}isStrictModeValid(t,n){return n.start.isOnlyWeekdayComponent()?(t.debug(()=>{console.log(`(Strict) Removing weekday only component: ${n} (${n.end})`)}),!1):!0}}const vv=new RegExp("([0-9]{4})\\-([0-9]{1,2})\\-([0-9]{1,2})(?:T([0-9]{1,2}):([0-9]{1,2})(?::([0-9]{1,2})(?:\\.(\\d{1,4}))?)?(Z|([+-]\\d{2}):?(\\d{2})?)?)?(?=\\W|$)","i"),Tv=1,kv=2,Ev=3,cf=4,Sv=5,ff=6,df=7,xv=8,hf=9,pf=10;class Pv extends ke{innerPattern(){return vv}innerExtract(t,n){const r=t.createParsingComponents({year:parseInt(n[Tv]),month:parseInt(n[kv]),day:parseInt(n[Ev])});if(n[cf]!=null&&(r.assign("hour",parseInt(n[cf])),r.assign("minute",parseInt(n[Sv])),n[ff]!=null&&r.assign("second",parseInt(n[ff])),n[df]!=null&&r.assign("millisecond",parseInt(n[df])),n[xv]!=null)){let i=0;if(n[hf]){const s=parseInt(n[hf]);let a=0;n[pf]!=null&&(a=parseInt(n[pf])),i=s*60,i<0?i-=a:i+=a}r.assign("timezoneOffset",i)}return r.addTag("parser/ISOFormatParser")}}class Av extends Kn{mergeResults(t,n,r){const i=r.clone();return i.index=n.index,i.text=n.text+t+i.text,i.start.assign("weekday",n.start.get("weekday")),i.end&&i.end.assign("weekday",n.start.get("weekday")),i}shouldMergeResults(t,n,r){return n.start.isOnlyWeekdayComponent()&&!n.start.isCertain("hour")&&r.start.isCertain("day")&&t.match(/^,?\s*$/)!=null}}function mf(e,t=!1){return e.parsers.unshift(new Pv),e.refiners.unshift(new Av),e.refiners.unshift(new uf),e.refiners.unshift(new Ea),e.refiners.push(new pv),e.refiners.push(new Ea),e.refiners.push(new wv),e.refiners.push(new _v(t)),e}function Dv(e){const t=e.getDateWithAdjustedTimezone(),n=new Te(e,{});return tn(n,t),jc(n,t),n.assign("timezoneOffset",e.getTimezoneOffset()),n.addTag("casualReference/now"),n}function $v(e){const t=e.getDateWithAdjustedTimezone(),n=new Te(e,{});return tn(n,t),ya(n,t),n.delete("meridiem"),n.addTag("casualReference/today"),n}function Cv(e){return Rv(e).addTag("casualReference/yesterday")}function Ov(e){return Sa(e,1).addTag("casualReference/tomorrow")}function Rv(e,t){return Sa(e,-1)}function Sa(e,t){const n=e.getDateWithAdjustedTimezone(),r=new Te(e,{}),i=new Date(n.getTime());return i.setDate(i.getDate()+t),tn(r,i),ya(r,i),r.delete("meridiem"),r}function Nv(e,t=22){const n=e.getDateWithAdjustedTimezone(),r=new Te(e,{});return tn(r,n),r.imply("hour",t),r.imply("meridiem",ye.PM),r.addTag("casualReference/tonight"),r}function Mv(e,t=20){const n=new Te(e,{});return n.imply("meridiem",ye.PM),n.imply("hour",t),n.addTag("casualReference/evening"),n}function Iv(e){const t=new Te(e,{});return e.getDateWithAdjustedTimezone().getHours()>2&&t.addDurationAsImplied({day:1}),t.assign("hour",0),t.imply("minute",0),t.imply("second",0),t.imply("millisecond",0),t.addTag("casualReference/midnight"),t}function Lv(e,t=6){const n=new Te(e,{});return n.imply("meridiem",ye.AM),n.imply("hour",t),n.imply("minute",0),n.imply("second",0),n.imply("millisecond",0),n.addTag("casualReference/morning"),n}function Fv(e,t=15){const n=new Te(e,{});return n.imply("meridiem",ye.PM),n.imply("hour",t),n.imply("minute",0),n.imply("second",0),n.imply("millisecond",0),n.addTag("casualReference/afternoon"),n}function jv(e){const t=new Te(e,{});return t.imply("meridiem",ye.AM),t.assign("hour",12),t.imply("minute",0),t.imply("second",0),t.imply("millisecond",0),t.addTag("casualReference/noon"),t}const zv=/(now|today|tonight|tomorrow|overmorrow|tmr|tmrw|yesterday|last\s*night)(?=\W|$)/i;class Uv extends ke{innerPattern(t){return zv}innerExtract(t,n){let r=t.refDate;const i=n[0].toLowerCase();let s=t.createParsingComponents();switch(i){case"now":s=Dv(t.reference);break;case"today":s=$v(t.reference);break;case"yesterday":s=Cv(t.reference);break;case"tomorrow":case"tmr":case"tmrw":s=Ov(t.reference);break;case"tonight":s=Nv(t.reference);break;case"overmorrow":s=Sa(t.reference,2);break;default:if(i.match(/last\s*night/)){if(r.getHours()>6){const a=new Date(r.getTime());a.setDate(a.getDate()-1),r=a}tn(s,r),s.imply("hour",0)}break}return s.addTag("parser/ENCasualDateParser"),s}}const qv=/(?:this)?\s{0,3}(morning|afternoon|evening|night|midnight|midday|noon)(?=\W|$)/i;class Hv extends ke{innerPattern(){return qv}innerExtract(t,n){let r=null;switch(n[1].toLowerCase()){case"afternoon":r=Fv(t.reference);break;case"evening":case"night":r=Mv(t.reference);break;case"midnight":r=Iv(t.reference);break;case"morning":r=Lv(t.reference);break;case"noon":case"midday":r=jv(t.reference);break}return r&&r.addTag("parser/ENCasualTimeParser"),r}}function Bv(e,t,n){const r=e.getDateWithAdjustedTimezone(),i=Vv(r,t,n);let s=new Te(e);return s=s.addDurationAsImplied({day:i}),s.assign("weekday",t),s}function Vv(e,t,n){const r=e.getDay();switch(n){case"this":return xi(e,t);case"last":return gf(e,t);case"next":return r==Ee.SUNDAY?t==Ee.SUNDAY?7:t:r==Ee.SATURDAY?t==Ee.SATURDAY?7:t==Ee.SUNDAY?8:1+t:t<r&&t!=Ee.SUNDAY?xi(e,t):xi(e,t)+7}return Wv(e,t)}function Wv(e,t){const n=gf(e,t),r=xi(e,t);return r<-n?r:n}function xi(e,t){const n=e.getDay();let r=t-n;return r<0&&(r+=7),r}function gf(e,t){const n=e.getDay();let r=t-n;return r>=0&&(r-=7),r}const Yv=new RegExp(`(?:(?:\\,|\\(|\\()\\s*)?(?:on\\s*?)?(?:(this|last|past|next)\\s*)?(${Et(ba)}|weekend|weekday)(?:\\s*(?:\\,|\\)|\\)))?(?:\\s*(this|last|past|next)\\s*week)?(?=\\W|$)`,"i"),Gv=1,Kv=2,Zv=3;class Jv extends ke{innerPattern(){return Yv}innerExtract(t,n){const r=n[Gv],i=n[Zv];let s=r||i;s=s||"",s=s.toLowerCase();let a=null;s=="last"||s=="past"?a="last":s=="next"?a="next":s=="this"&&(a="this");const o=n[Kv].toLowerCase();let l;if(ba[o]!==void 0)l=ba[o];else if(o=="weekend")l=a=="last"?Ee.SUNDAY:Ee.SATURDAY;else if(o=="weekday"){const u=t.reference.getDateWithAdjustedTimezone().getDay();u==Ee.SUNDAY||u==Ee.SATURDAY?l=a=="last"?Ee.FRIDAY:Ee.MONDAY:(l=u-1,l=a=="last"?l-1:l+1,l=l%5+1)}else return null;return Bv(t.reference,l,a)}}const Xv=new RegExp(`(this|last|past|next|after\\s*this)\\s*(${Et(bi)})(?=\\s*)(?=\\W|$)`,"i"),Qv=1,eT=2;class tT extends ke{innerPattern(){return Xv}innerExtract(t,n){const r=n[Qv].toLowerCase(),i=n[eT].toLowerCase(),s=bi[i];if(r=="next"||r.startsWith("after")){const l={};return l[s]=1,Te.createRelativeFromReference(t.reference,l)}if(r=="last"||r=="past"){const l={};return l[s]=-1,Te.createRelativeFromReference(t.reference,l)}const a=t.createParsingComponents();let o=new Date(t.reference.instant.getTime());return i.match(/week/i)?(o.setDate(o.getDate()-o.getDay()),a.imply("day",o.getDate()),a.imply("month",o.getMonth()+1),a.imply("year",o.getFullYear())):i.match(/month/i)?(o.setDate(1),a.imply("day",o.getDate()),a.assign("year",o.getFullYear()),a.assign("month",o.getMonth()+1)):i.match(/year/i)&&(o.setDate(1),o.setMonth(0),a.imply("day",o.getDate()),a.imply("month",o.getMonth()+1),a.assign("year",o.getFullYear())),a}}const nT=new RegExp("([^\\d]|^)([0-3]{0,1}[0-9]{1})[\\/\\.\\-]([0-3]{0,1}[0-9]{1})(?:[\\/\\.\\-]([0-9]{4}|[0-9]{2}))?(\\W|$)","i"),rT=1,iT=5,yf=2,bf=3,xa=4;class sT{groupNumberMonth;groupNumberDay;constructor(t){this.groupNumberMonth=t?bf:yf,this.groupNumberDay=t?yf:bf}pattern(){return nT}extract(t,n){const r=n.index+n[rT].length,i=n.index+n[0].length-n[iT].length;if(r>0&&t.text.substring(0,r).match("\\d/?$")||i<t.text.length&&t.text.substring(i).match("^/?\\d"))return;const s=t.text.substring(r,i);if(s.match(/^\d\.\d$/)||s.match(/^\d\.\d{1,2}\.\d{1,2}\s*$/)||!n[xa]&&s.indexOf("/")<0)return;const a=t.createParsingResult(r,s);let o=parseInt(n[this.groupNumberMonth]),l=parseInt(n[this.groupNumberDay]);if((o<1||o>12)&&o>12)if(l>=1&&l<=12&&o<=31)[l,o]=[o,l];else return null;if(l<1||l>31)return null;if(a.start.assign("day",l),a.start.assign("month",o),n[xa]){const u=parseInt(n[xa]),c=Hc(u);a.start.assign("year",c)}else{const u=yi(t.refDate,l,o);a.start.imply("year",u)}return a.addTag("parser/SlashDateFormatParser")}}const aT=new RegExp(`(this|last|past|next|after|\\+|-)\\s*(${Gn})(?=\\W|$)`,"i"),oT=new RegExp(`(this|last|past|next|after|\\+|-)\\s*(${ki})(?=\\W|$)`,"i");class lT extends ke{allowAbbreviations;constructor(t=!0){super(),this.allowAbbreviations=t}innerPattern(){return this.allowAbbreviations?aT:oT}innerExtract(t,n){const r=n[1].toLowerCase();let i=vn(n[2]);if(!i)return null;switch(r){case"last":case"past":case"-":i=gi(i);break}return Te.createRelativeFromReference(t.reference,i)}}function uT(e){return e.text.match(/^[+-]/i)!=null}function wf(e){return e.text.match(/^-/i)!=null}class cT extends Kn{shouldMergeResults(t,n,r){return t.match(/^\s*$/i)?uT(r)||wf(r):!1}mergeResults(t,n,r,i){let s=vn(r.text);wf(r)&&(s=gi(s));const a=Te.createRelativeFromReference(nn.fromDate(n.start.date()),s);return new _n(n.reference,n.index,`${n.text}${t}${r.text}`,a)}}function _f(e){return e.text.match(/\s+(before|from)$/i)!=null}function fT(e){return e.text.match(/\s+(after|since)$/i)!=null}class dT extends Kn{patternBetween(){return/^\s*$/i}shouldMergeResults(t,n,r){return!t.match(this.patternBetween())||!_f(n)&&!fT(n)?!1:!!r.start.get("day")&&!!r.start.get("month")&&!!r.start.get("year")}mergeResults(t,n,r){let i=vn(n.text);_f(n)&&(i=gi(i));const s=Te.createRelativeFromReference(nn.fromDate(r.start.date()),i);return new _n(r.reference,n.index,`${n.text}${t}${r.text}`,s)}}const hT=new RegExp(`^\\s*(${vi})`,"i"),pT=1;class mT{refine(t,n){return n.forEach(function(r){if(!r.start.isDateWithUnknownYear())return;const i=t.text.substring(r.index+r.text.length),s=hT.exec(i);if(!s||s[0].trim().length<=3)return;t.debug(()=>{console.log(`Extracting year: '${s[0]}' into : ${r}`)});const a=Ti(s[pT]);r.end!=null&&r.end.assign("year",a),r.start.assign("year",a),r.text+=s[0]}),n}}class gT extends nf{constructor(){super()}isValid(t,n){const r=n.text.trim();return r===t.text.trim()?!0:r.toLowerCase()==="may"&&!t.text.substring(0,n.index).trim().match(/\b(in)$/i)?(t.debug(()=>{console.log(`Removing unlikely result: ${n}`)}),!1):r.toLowerCase().endsWith("the second")?(t.text.substring(n.index+n.text.length).trim().length>0&&t.debug(()=>{console.log(`Removing unlikely result: ${n}`)}),!1):!0}}class yT{createCasualConfiguration(t=!1){const n=this.createConfiguration(!1,t);return n.parsers.push(new Uv),n.parsers.push(new Hv),n.parsers.push(new V_),n.parsers.push(new tT),n.parsers.push(new lT),n.refiners.push(new gT),n}createConfiguration(t=!0,n=!1){const r=mf({parsers:[new sT(n),new M_(t),new F_,new U_(n),new Jv,new ev,new iv(t),new ov(t),new fv(t)],refiners:[new lf]},t);return r.parsers.unshift(new Z_(t)),r.refiners.unshift(new dT),r.refiners.unshift(new cT),r.refiners.unshift(new Ea),r.refiners.push(new lf),r.refiners.push(new mT),r.refiners.push(new dv),r}}class Zn{parsers;refiners;defaultConfig=new yT;constructor(t){t=t||this.defaultConfig.createCasualConfiguration(),this.parsers=[...t.parsers],this.refiners=[...t.refiners]}clone(){return new Zn({parsers:[...this.parsers],refiners:[...this.refiners]})}parseDate(t,n,r){const i=this.parse(t,n,r);return i.length>0?i[0].start.date():null}parse(t,n,r){const i=new bT(t,n,r);let s=[];return this.parsers.forEach(a=>{const o=Zn.executeParser(i,a);s=s.concat(o)}),s.sort((a,o)=>a.index-o.index),this.refiners.forEach(function(a){s=a.refine(i,s)}),s}static executeParser(t,n){const r=[],i=n.pattern(t),s=t.text;let a=t.text,o=i.exec(a);for(;o;){const l=o.index+s.length-a.length;o.index=l;const u=n.extract(t,o);if(!u){a=s.substring(o.index+1),o=i.exec(a);continue}let c=null;u instanceof _n?c=u:u instanceof Te?(c=t.createParsingResult(o.index,o[0]),c.start=u):c=t.createParsingResult(o.index,o[0],u);const f=c.index,h=c.text;t.debug(()=>console.log(`${n.constructor.name} extracted (at index=${f}) '${h}'`)),r.push(c),a=s.substring(f+h.length),o=i.exec(a)}return r}}class bT{text;option;reference;refDate;constructor(t,n,r){this.text=t,this.option=r??{},this.reference=nn.fromInput(n,this.option.timezones),this.refDate=this.reference.instant}createParsingComponents(t){return t instanceof Te?t:new Te(this.reference,t)}createParsingResult(t,n,r,i){const s=typeof n=="string"?n:this.text.substring(t,n),a=r?this.createParsingComponents(r):null,o=i?this.createParsingComponents(i):null;return new _n(this.reference,t,s,a,o)}debug(t){this.option.debug&&(this.option.debug instanceof Function?this.option.debug(t):this.option.debug.debug(t))}}const Ke={零:0,"〇":0,一:1,二:2,两:2,三:3,四:4,五:5,六:6,七:7,八:8,九:9,十:10},Pi={天:0,日:0,一:1,二:2,三:3,四:4,五:5,六:6};function Nt(e){let t=0;for(let n=0;n<e.length;n++){const r=e[n];r==="十"?t=t===0?Ke[r]:t*Ke[r]:t+=Ke[r]}return t}function wT(e){let t="";for(let n=0;n<e.length;n++){const r=e[n];t=t+Ke[r]}return parseInt(t)}const Pa=1,vf=2,Aa=3;class _T extends ke{innerPattern(){return new RegExp("(\\d{2,4}|["+Object.keys(Ke).join("")+"]{4}|["+Object.keys(Ke).join("")+"]{2})?(?:\\s*)(?:年)?(?:[\\s|,|,]*)(\\d{1,2}|["+Object.keys(Ke).join("")+"]{1,3})(?:\\s*)(?:月)(?:\\s*)(\\d{1,2}|["+Object.keys(Ke).join("")+"]{1,3})?(?:\\s*)(?:日|号)?")}innerExtract(t,n){const r=t.createParsingResult(n.index,n[0]);let i=parseInt(n[vf]);if(isNaN(i)&&(i=Nt(n[vf])),r.start.assign("month",i),n[Aa]){let s=parseInt(n[Aa]);isNaN(s)&&(s=Nt(n[Aa])),r.start.assign("day",s)}else r.start.imply("day",t.refDate.getDate());if(n[Pa]){let s=parseInt(n[Pa]);isNaN(s)&&(s=wT(n[Pa])),r.start.assign("year",s)}else r.start.imply("year",t.refDate.getFullYear());return r}}const vT=new RegExp("(\\d+|["+Object.keys(Ke).join("")+"]+|半|几)(?:\\s*)(?:个)?(秒(?:钟)?|分钟|小时|钟|日|天|星期|礼拜|月|年)(?:(?:之|过)?后|(?:之)?内)","i"),Da=1,TT=2;class kT extends ke{innerPattern(){return vT}innerExtract(t,n){const r=t.createParsingResult(n.index,n[0]);let i=parseInt(n[Da]);if(isNaN(i)&&(i=Nt(n[Da])),isNaN(i)){const u=n[Da];if(u==="几")i=3;else if(u==="半")i=.5;else return null}const s={},o=n[TT][0];if(o.match(/[日天星礼月年]/)){o=="日"||o=="天"?s.day=i:o=="星"||o=="礼"?s.week=i:o=="月"?s.month=i:o=="年"&&(s.year=i);const u=Le(t.refDate,s);return r.start.assign("year",u.getFullYear()),r.start.assign("month",u.getMonth()+1),r.start.assign("day",u.getDate()),r}o=="秒"?s.second=i:o=="分"?s.minute=i:(o=="小"||o=="钟")&&(s.hour=i);const l=Le(t.refDate,s);return r.start.imply("year",l.getFullYear()),r.start.imply("month",l.getMonth()+1),r.start.imply("day",l.getDate()),r.start.assign("hour",l.getHours()),r.start.assign("minute",l.getMinutes()),r.start.assign("second",l.getSeconds()),r}}const ET=new RegExp("(?<prefix>上|下|这)(?:个)?(?:星期|礼拜|周)(?<weekday>"+Object.keys(Pi).join("|")+")");class ST extends ke{innerPattern(){return ET}innerExtract(t,n){const r=t.createParsingResult(n.index,n[0]),i=n.groups.weekday,s=Pi[i];if(s===void 0)return null;let a=null;const o=n.groups.prefix;o=="上"?a="last":o=="下"?a="next":o=="这"&&(a="this");const l=new Date(t.refDate.getTime());let u=!1;const c=l.getDay();if(a=="last"||a=="past")l.setDate(l.getDate()+(s-7-c)),u=!0;else if(a=="next")l.setDate(l.getDate()+(s+7-c)),u=!0;else if(a=="this")l.setDate(l.getDate()+(s-c));else{let f=s-c;Math.abs(f-7)<Math.abs(f)&&(f-=7),Math.abs(f+7)<Math.abs(f)&&(f+=7),l.setDate(l.getDate()+f)}return r.start.assign("weekday",s),u?(r.start.assign("day",l.getDate()),r.start.assign("month",l.getMonth()+1),r.start.assign("year",l.getFullYear())):(r.start.imply("day",l.getDate()),r.start.imply("month",l.getMonth()+1),r.start.imply("year",l.getFullYear())),r}}const xT=new RegExp("(?:从|自)?(?:(今|明|前|大前|后|大后|昨)(早|朝|晚)|(上(?:午)|早(?:上)|下(?:午)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨))|(今|明|前|大前|后|大后|昨)(?:日|天)(?:[\\s,,]*)(?:(上(?:午)|早(?:上)|下(?:午)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨)))?)?(?:[\\s,,]*)(?:(\\d+|["+Object.keys(Ke).join("")+"]+)(?:\\s*)(?:点|时|:|:)(?:\\s*)(\\d+|半|正|整|["+Object.keys(Ke).join("")+"]+)?(?:\\s*)(?:分|:|:)?(?:\\s*)(\\d+|["+Object.keys(Ke).join("")+"]+)?(?:\\s*)(?:秒)?)(?:\\s*(A.M.|P.M.|AM?|PM?))?","i"),PT=new RegExp("(?:^\\s*(?:到|至|\\-|\\–|\\~|\\〜)\\s*)(?:(今|明|前|大前|后|大后|昨)(早|朝|晚)|(上(?:午)|早(?:上)|下(?:午)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨))|(今|明|前|大前|后|大后|昨)(?:日|天)(?:[\\s,,]*)(?:(上(?:午)|早(?:上)|下(?:午)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨)))?)?(?:[\\s,,]*)(?:(\\d+|["+Object.keys(Ke).join("")+"]+)(?:\\s*)(?:点|时|:|:)(?:\\s*)(\\d+|半|正|整|["+Object.keys(Ke).join("")+"]+)?(?:\\s*)(?:分|:|:)?(?:\\s*)(\\d+|["+Object.keys(Ke).join("")+"]+)?(?:\\s*)(?:秒)?)(?:\\s*(A.M.|P.M.|AM?|PM?))?","i"),Ai=1,Di=2,$i=3,Ci=4,Oi=5,Ri=6,ht=7,kn=8,Ni=9;class AT extends ke{innerPattern(){return xT}innerExtract(t,n){if(n.index>0&&t.text[n.index-1].match(/\w/))return null;const r=t.createParsingResult(n.index,n[0]),i=new Date(t.refDate.getTime());if(n[Ai]){const c=n[Ai];c=="明"?t.refDate.getHours()>1&&i.setDate(i.getDate()+1):c=="昨"?i.setDate(i.getDate()-1):c=="前"?i.setDate(i.getDate()-2):c=="大前"?i.setDate(i.getDate()-3):c=="后"?i.setDate(i.getDate()+2):c=="大后"&&i.setDate(i.getDate()+3),r.start.assign("day",i.getDate()),r.start.assign("month",i.getMonth()+1),r.start.assign("year",i.getFullYear())}else if(n[Ci]){const c=n[Ci];c=="明"?i.setDate(i.getDate()+1):c=="昨"?i.setDate(i.getDate()-1):c=="前"?i.setDate(i.getDate()-2):c=="大前"?i.setDate(i.getDate()-3):c=="后"?i.setDate(i.getDate()+2):c=="大后"&&i.setDate(i.getDate()+3),r.start.assign("day",i.getDate()),r.start.assign("month",i.getMonth()+1),r.start.assign("year",i.getFullYear())}else r.start.imply("day",i.getDate()),r.start.imply("month",i.getMonth()+1),r.start.imply("year",i.getFullYear());let s=0,a=0,o=-1;if(n[kn]){let c=parseInt(n[kn]);if(isNaN(c)&&(c=Nt(n[kn])),c>=60)return null;r.start.assign("second",c)}if(s=parseInt(n[Ri]),isNaN(s)&&(s=Nt(n[Ri])),n[ht]?n[ht]=="半"?a=30:n[ht]=="正"||n[ht]=="整"?a=0:(a=parseInt(n[ht]),isNaN(a)&&(a=Nt(n[ht]))):s>100&&(a=s%100,s=Math.floor(s/100)),a>=60||s>24)return null;if(s>=12&&(o=1),n[Ni]){if(s>12)return null;const c=n[Ni][0].toLowerCase();c=="a"&&(o=0,s==12&&(s=0)),c=="p"&&(o=1,s!=12&&(s+=12))}else if(n[Di]){const f=n[Di][0];f=="早"?(o=0,s==12&&(s=0)):f=="晚"&&(o=1,s!=12&&(s+=12))}else if(n[$i]){const f=n[$i][0];f=="上"||f=="早"||f=="凌"?(o=0,s==12&&(s=0)):(f=="下"||f=="晚")&&(o=1,s!=12&&(s+=12))}else if(n[Oi]){const f=n[Oi][0];f=="上"||f=="早"||f=="凌"?(o=0,s==12&&(s=0)):(f=="下"||f=="晚")&&(o=1,s!=12&&(s+=12))}r.start.assign("hour",s),r.start.assign("minute",a),o>=0?r.start.assign("meridiem",o):s<12?r.start.imply("meridiem",0):r.start.imply("meridiem",1);const l=PT.exec(t.text.substring(r.index+r.text.length));if(!l)return r.text.match(/^\d+$/)?null:r;const u=new Date(i.getTime());if(r.end=t.createParsingComponents(),l[Ai]){const c=l[Ai];c=="明"?t.refDate.getHours()>1&&u.setDate(u.getDate()+1):c=="昨"?u.setDate(u.getDate()-1):c=="前"?u.setDate(u.getDate()-2):c=="大前"?u.setDate(u.getDate()-3):c=="后"?u.setDate(u.getDate()+2):c=="大后"&&u.setDate(u.getDate()+3),r.end.assign("day",u.getDate()),r.end.assign("month",u.getMonth()+1),r.end.assign("year",u.getFullYear())}else if(l[Ci]){const c=l[Ci];c=="明"?u.setDate(u.getDate()+1):c=="昨"?u.setDate(u.getDate()-1):c=="前"?u.setDate(u.getDate()-2):c=="大前"?u.setDate(u.getDate()-3):c=="后"?u.setDate(u.getDate()+2):c=="大后"&&u.setDate(u.getDate()+3),r.end.assign("day",u.getDate()),r.end.assign("month",u.getMonth()+1),r.end.assign("year",u.getFullYear())}else r.end.imply("day",u.getDate()),r.end.imply("month",u.getMonth()+1),r.end.imply("year",u.getFullYear());if(s=0,a=0,o=-1,l[kn]){let c=parseInt(l[kn]);if(isNaN(c)&&(c=Nt(l[kn])),c>=60)return null;r.end.assign("second",c)}if(s=parseInt(l[Ri]),isNaN(s)&&(s=Nt(l[Ri])),l[ht]?l[ht]=="半"?a=30:l[ht]=="正"||l[ht]=="整"?a=0:(a=parseInt(l[ht]),isNaN(a)&&(a=Nt(l[ht]))):s>100&&(a=s%100,s=Math.floor(s/100)),a>=60||s>24)return null;if(s>=12&&(o=1),l[Ni]){if(s>12)return null;const c=l[Ni][0].toLowerCase();c=="a"&&(o=0,s==12&&(s=0)),c=="p"&&(o=1,s!=12&&(s+=12)),r.start.isCertain("meridiem")||(o==0?(r.start.imply("meridiem",0),r.start.get("hour")==12&&r.start.assign("hour",0)):(r.start.imply("meridiem",1),r.start.get("hour")!=12&&r.start.assign("hour",r.start.get("hour")+12)))}else if(l[Di]){const f=l[Di][0];f=="早"?(o=0,s==12&&(s=0)):f=="晚"&&(o=1,s!=12&&(s+=12))}else if(l[$i]){const f=l[$i][0];f=="上"||f=="早"||f=="凌"?(o=0,s==12&&(s=0)):(f=="下"||f=="晚")&&(o=1,s!=12&&(s+=12))}else if(l[Oi]){const f=l[Oi][0];f=="上"||f=="早"||f=="凌"?(o=0,s==12&&(s=0)):(f=="下"||f=="晚")&&(o=1,s!=12&&(s+=12))}return r.text=r.text+l[0],r.end.assign("hour",s),r.end.assign("minute",a),o>=0?r.end.assign("meridiem",o):r.start.isCertain("meridiem")&&r.start.get("meridiem")==1&&r.start.get("hour")>s?r.end.imply("meridiem",0):s>12&&r.end.imply("meridiem",1),r.end.date().getTime()<r.start.date().getTime()&&r.end.imply("day",r.end.get("day")+1),r}}const DT=new RegExp("(?:星期|礼拜|周)(?<weekday>"+Object.keys(Pi).join("|")+")");class $T extends ke{innerPattern(){return DT}innerExtract(t,n){const r=t.createParsingResult(n.index,n[0]),i=n.groups.weekday,s=Pi[i];if(s===void 0)return null;const a=new Date(t.refDate.getTime()),o=a.getDay();let l=s-o;return Math.abs(l-7)<Math.abs(l)&&(l-=7),Math.abs(l+7)<Math.abs(l)&&(l+=7),a.setDate(a.getDate()+l),r.start.assign("weekday",s),r.start.imply("day",a.getDate()),r.start.imply("month",a.getMonth()+1),r.start.imply("year",a.getFullYear()),r}}const CT=1,Tf=2,OT=3,kf=4,Ef=5,RT=6;class NT extends ke{innerPattern(t){return new RegExp("(而家|立(?:刻|即)|即刻)|(今|明|前|大前|後|大後|聽|昨|尋|琴)(早|朝|晚)|(上(?:午|晝)|朝(?:早)|早(?:上)|下(?:午|晝)|晏(?:晝)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨))|(今|明|前|大前|後|大後|聽|昨|尋|琴)(?:日|天)(?:[\\s|,|,]*)(?:(上(?:午|晝)|朝(?:早)|早(?:上)|下(?:午|晝)|晏(?:晝)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨)))?","i")}innerExtract(t,n){const r=n.index,i=t.createParsingResult(r,n[0]),s=t.refDate;let a=new Date(s.getTime());if(n[CT])i.start.imply("hour",s.getHours()),i.start.imply("minute",s.getMinutes()),i.start.imply("second",s.getSeconds()),i.start.imply("millisecond",s.getMilliseconds());else if(n[Tf]){const o=n[Tf],l=n[OT];o=="明"||o=="聽"?s.getHours()>1&&a.setDate(a.getDate()+1):o=="昨"||o=="尋"||o=="琴"?a.setDate(a.getDate()-1):o=="前"?a.setDate(a.getDate()-2):o=="大前"?a.setDate(a.getDate()-3):o=="後"?a.setDate(a.getDate()+2):o=="大後"&&a.setDate(a.getDate()+3),l=="早"||l=="朝"?i.start.imply("hour",6):l=="晚"&&(i.start.imply("hour",22),i.start.imply("meridiem",1))}else if(n[kf]){const l=n[kf][0];l=="早"||l=="朝"||l=="上"?i.start.imply("hour",6):l=="下"||l=="晏"?(i.start.imply("hour",15),i.start.imply("meridiem",1)):l=="中"?(i.start.imply("hour",12),i.start.imply("meridiem",1)):l=="夜"||l=="晚"?(i.start.imply("hour",22),i.start.imply("meridiem",1)):l=="凌"&&i.start.imply("hour",0)}else if(n[Ef]){const o=n[Ef];o=="明"||o=="聽"?s.getHours()>1&&a.setDate(a.getDate()+1):o=="昨"||o=="尋"||o=="琴"?a.setDate(a.getDate()-1):o=="前"?a.setDate(a.getDate()-2):o=="大前"?a.setDate(a.getDate()-3):o=="後"?a.setDate(a.getDate()+2):o=="大後"&&a.setDate(a.getDate()+3);const l=n[RT];if(l){const u=l[0];u=="早"||u=="朝"||u=="上"?i.start.imply("hour",6):u=="下"||u=="晏"?(i.start.imply("hour",15),i.start.imply("meridiem",1)):u=="中"?(i.start.imply("hour",12),i.start.imply("meridiem",1)):u=="夜"||u=="晚"?(i.start.imply("hour",22),i.start.imply("meridiem",1)):u=="凌"&&i.start.imply("hour",0)}}return i.start.assign("day",a.getDate()),i.start.assign("month",a.getMonth()+1),i.start.assign("year",a.getFullYear()),i}}const Ze={零:0,一:1,二:2,兩:2,三:3,四:4,五:5,六:6,七:7,八:8,九:9,十:10,廿:20,卅:30},Mi={天:0,日:0,一:1,二:2,三:3,四:4,五:5,六:6};function Mt(e){let t=0;for(let n=0;n<e.length;n++){const r=e[n];r==="十"?t=t===0?Ze[r]:t*Ze[r]:t+=Ze[r]}return t}function MT(e){let t="";for(let n=0;n<e.length;n++){const r=e[n];t=t+Ze[r]}return parseInt(t)}const $a=1,Sf=2,Ca=3;class IT extends ke{innerPattern(){return new RegExp("(\\d{2,4}|["+Object.keys(Ze).join("")+"]{4}|["+Object.keys(Ze).join("")+"]{2})?(?:\\s*)(?:年)?(?:[\\s|,|,]*)(\\d{1,2}|["+Object.keys(Ze).join("")+"]{1,2})(?:\\s*)(?:月)(?:\\s*)(\\d{1,2}|["+Object.keys(Ze).join("")+"]{1,2})?(?:\\s*)(?:日|號)?")}innerExtract(t,n){const r=t.createParsingResult(n.index,n[0]);let i=parseInt(n[Sf]);if(isNaN(i)&&(i=Mt(n[Sf])),r.start.assign("month",i),n[Ca]){let s=parseInt(n[Ca]);isNaN(s)&&(s=Mt(n[Ca])),r.start.assign("day",s)}else r.start.imply("day",t.refDate.getDate());if(n[$a]){let s=parseInt(n[$a]);isNaN(s)&&(s=MT(n[$a])),r.start.assign("year",s)}else r.start.imply("year",t.refDate.getFullYear());return r}}const LT=new RegExp("(\\d+|["+Object.keys(Ze).join("")+"]+|半|幾)(?:\\s*)(?:個)?(秒(?:鐘)?|分鐘|小時|鐘|日|天|星期|禮拜|月|年)(?:(?:之|過)?後|(?:之)?內)","i"),Oa=1,FT=2;class jT extends ke{innerPattern(){return LT}innerExtract(t,n){const r=t.createParsingResult(n.index,n[0]);let i=parseInt(n[Oa]);if(isNaN(i)&&(i=Mt(n[Oa])),isNaN(i)){const u=n[Oa];if(u==="幾")i=3;else if(u==="半")i=.5;else return null}const s={},o=n[FT][0];if(o.match(/[日天星禮月年]/)){o=="日"||o=="天"?s.day=i:o=="星"||o=="禮"?s.week=i:o=="月"?s.month=i:o=="年"&&(s.year=i);const u=Le(t.refDate,s);return r.start.assign("year",u.getFullYear()),r.start.assign("month",u.getMonth()+1),r.start.assign("day",u.getDate()),r}o=="秒"?s.second=i:o=="分"?s.minute=i:(o=="小"||o=="鐘")&&(s.hour=i);const l=Le(t.refDate,s);return r.start.imply("year",l.getFullYear()),r.start.imply("month",l.getMonth()+1),r.start.imply("day",l.getDate()),r.start.assign("hour",l.getHours()),r.start.assign("minute",l.getMinutes()),r.start.assign("second",l.getSeconds()),r}}const zT=new RegExp("(?<prefix>上|今|下|這|呢)(?:個)?(?:星期|禮拜|週)(?<weekday>"+Object.keys(Mi).join("|")+")");class UT extends ke{innerPattern(){return zT}innerExtract(t,n){const r=t.createParsingResult(n.index,n[0]),i=n.groups.weekday,s=Mi[i];if(s===void 0)return null;let a=null;const o=n.groups.prefix;o=="上"?a="last":o=="下"?a="next":(o=="今"||o=="這"||o=="呢")&&(a="this");const l=new Date(t.refDate.getTime());let u=!1;const c=l.getDay();if(a=="last"||a=="past")l.setDate(l.getDate()+(s-7-c)),u=!0;else if(a=="next")l.setDate(l.getDate()+(s+7-c)),u=!0;else if(a=="this")l.setDate(l.getDate()+(s-c));else{let f=s-c;Math.abs(f-7)<Math.abs(f)&&(f-=7),Math.abs(f+7)<Math.abs(f)&&(f+=7),l.setDate(l.getDate()+f)}return r.start.assign("weekday",s),u?(r.start.assign("day",l.getDate()),r.start.assign("month",l.getMonth()+1),r.start.assign("year",l.getFullYear())):(r.start.imply("day",l.getDate()),r.start.imply("month",l.getMonth()+1),r.start.imply("year",l.getFullYear())),r}}const qT=new RegExp("(?:由|從|自)?(?:(今|明|前|大前|後|大後|聽|昨|尋|琴)(早|朝|晚)|(上(?:午|晝)|朝(?:早)|早(?:上)|下(?:午|晝)|晏(?:晝)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨))|(今|明|前|大前|後|大後|聽|昨|尋|琴)(?:日|天)(?:[\\s,,]*)(?:(上(?:午|晝)|朝(?:早)|早(?:上)|下(?:午|晝)|晏(?:晝)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨)))?)?(?:[\\s,,]*)(?:(\\d+|["+Object.keys(Ze).join("")+"]+)(?:\\s*)(?:點|時|:|:)(?:\\s*)(\\d+|半|正|整|["+Object.keys(Ze).join("")+"]+)?(?:\\s*)(?:分|:|:)?(?:\\s*)(\\d+|["+Object.keys(Ze).join("")+"]+)?(?:\\s*)(?:秒)?)(?:\\s*(A.M.|P.M.|AM?|PM?))?","i"),HT=new RegExp("(?:^\\s*(?:到|至|\\-|\\–|\\~|\\〜)\\s*)(?:(今|明|前|大前|後|大後|聽|昨|尋|琴)(早|朝|晚)|(上(?:午|晝)|朝(?:早)|早(?:上)|下(?:午|晝)|晏(?:晝)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨))|(今|明|前|大前|後|大後|聽|昨|尋|琴)(?:日|天)(?:[\\s,,]*)(?:(上(?:午|晝)|朝(?:早)|早(?:上)|下(?:午|晝)|晏(?:晝)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨)))?)?(?:[\\s,,]*)(?:(\\d+|["+Object.keys(Ze).join("")+"]+)(?:\\s*)(?:點|時|:|:)(?:\\s*)(\\d+|半|正|整|["+Object.keys(Ze).join("")+"]+)?(?:\\s*)(?:分|:|:)?(?:\\s*)(\\d+|["+Object.keys(Ze).join("")+"]+)?(?:\\s*)(?:秒)?)(?:\\s*(A.M.|P.M.|AM?|PM?))?","i"),Ii=1,Li=2,Fi=3,ji=4,zi=5,Ui=6,pt=7,En=8,qi=9;class BT extends ke{innerPattern(){return qT}innerExtract(t,n){if(n.index>0&&t.text[n.index-1].match(/\w/))return null;const r=t.createParsingResult(n.index,n[0]),i=new Date(t.refDate.getTime());if(n[Ii]){const p=n[Ii];p=="明"||p=="聽"?t.refDate.getHours()>1&&i.setDate(i.getDate()+1):p=="昨"||p=="尋"||p=="琴"?i.setDate(i.getDate()-1):p=="前"?i.setDate(i.getDate()-2):p=="大前"?i.setDate(i.getDate()-3):p=="後"?i.setDate(i.getDate()+2):p=="大後"&&i.setDate(i.getDate()+3),r.start.assign("day",i.getDate()),r.start.assign("month",i.getMonth()+1),r.start.assign("year",i.getFullYear())}else if(n[ji]){const p=n[ji];p=="明"||p=="聽"?i.setDate(i.getDate()+1):p=="昨"||p=="尋"||p=="琴"?i.setDate(i.getDate()-1):p=="前"?i.setDate(i.getDate()-2):p=="大前"?i.setDate(i.getDate()-3):p=="後"?i.setDate(i.getDate()+2):p=="大後"&&i.setDate(i.getDate()+3),r.start.assign("day",i.getDate()),r.start.assign("month",i.getMonth()+1),r.start.assign("year",i.getFullYear())}else r.start.imply("day",i.getDate()),r.start.imply("month",i.getMonth()+1),r.start.imply("year",i.getFullYear());let s=0,a=0,o=-1;if(n[En]){var l=parseInt(n[En]);if(isNaN(l)&&(l=Mt(n[En])),l>=60)return null;r.start.assign("second",l)}if(s=parseInt(n[Ui]),isNaN(s)&&(s=Mt(n[Ui])),n[pt]?n[pt]=="半"?a=30:n[pt]=="正"||n[pt]=="整"?a=0:(a=parseInt(n[pt]),isNaN(a)&&(a=Mt(n[pt]))):s>100&&(a=s%100,s=Math.floor(s/100)),a>=60||s>24)return null;if(s>=12&&(o=1),n[qi]){if(s>12)return null;var u=n[qi][0].toLowerCase();u=="a"&&(o=0,s==12&&(s=0)),u=="p"&&(o=1,s!=12&&(s+=12))}else if(n[Li]){var c=n[Li],f=c[0];f=="朝"||f=="早"?(o=0,s==12&&(s=0)):f=="晚"&&(o=1,s!=12&&(s+=12))}else if(n[Fi]){var h=n[Fi],d=h[0];d=="上"||d=="朝"||d=="早"||d=="凌"?(o=0,s==12&&(s=0)):(d=="下"||d=="晏"||d=="晚")&&(o=1,s!=12&&(s+=12))}else if(n[zi]){var g=n[zi],T=g[0];T=="上"||T=="朝"||T=="早"||T=="凌"?(o=0,s==12&&(s=0)):(T=="下"||T=="晏"||T=="晚")&&(o=1,s!=12&&(s+=12))}r.start.assign("hour",s),r.start.assign("minute",a),o>=0?r.start.assign("meridiem",o):s<12?r.start.imply("meridiem",0):r.start.imply("meridiem",1);const y=HT.exec(t.text.substring(r.index+r.text.length));if(!y)return r.text.match(/^\d+$/)?null:r;const m=new Date(i.getTime());if(r.end=t.createParsingComponents(),y[Ii]){const p=y[Ii];p=="明"||p=="聽"?t.refDate.getHours()>1&&m.setDate(m.getDate()+1):p=="昨"||p=="尋"||p=="琴"?m.setDate(m.getDate()-1):p=="前"?m.setDate(m.getDate()-2):p=="大前"?m.setDate(m.getDate()-3):p=="後"?m.setDate(m.getDate()+2):p=="大後"&&m.setDate(m.getDate()+3),r.end.assign("day",m.getDate()),r.end.assign("month",m.getMonth()+1),r.end.assign("year",m.getFullYear())}else if(y[ji]){const p=y[ji];p=="明"||p=="聽"?m.setDate(m.getDate()+1):p=="昨"||p=="尋"||p=="琴"?m.setDate(m.getDate()-1):p=="前"?m.setDate(m.getDate()-2):p=="大前"?m.setDate(m.getDate()-3):p=="後"?m.setDate(m.getDate()+2):p=="大後"&&m.setDate(m.getDate()+3),r.end.assign("day",m.getDate()),r.end.assign("month",m.getMonth()+1),r.end.assign("year",m.getFullYear())}else r.end.imply("day",m.getDate()),r.end.imply("month",m.getMonth()+1),r.end.imply("year",m.getFullYear());if(s=0,a=0,o=-1,y[En]){let p=parseInt(y[En]);if(isNaN(p)&&(p=Mt(y[En])),p>=60)return null;r.end.assign("second",p)}if(s=parseInt(y[Ui]),isNaN(s)&&(s=Mt(y[Ui])),y[pt]?y[pt]=="半"?a=30:y[pt]=="正"||y[pt]=="整"?a=0:(a=parseInt(y[pt]),isNaN(a)&&(a=Mt(y[pt]))):s>100&&(a=s%100,s=Math.floor(s/100)),a>=60||s>24)return null;if(s>=12&&(o=1),y[qi]){if(s>12)return null;var u=y[qi][0].toLowerCase();u=="a"&&(o=0,s==12&&(s=0)),u=="p"&&(o=1,s!=12&&(s+=12)),r.start.isCertain("meridiem")||(o==0?(r.start.imply("meridiem",0),r.start.get("hour")==12&&r.start.assign("hour",0)):(r.start.imply("meridiem",1),r.start.get("hour")!=12&&r.start.assign("hour",r.start.get("hour")+12)))}else if(y[Li]){var f=y[Li][0];f=="朝"||f=="早"?(o=0,s==12&&(s=0)):f=="晚"&&(o=1,s!=12&&(s+=12))}else if(y[Fi]){var d=y[Fi][0];d=="上"||d=="朝"||d=="早"||d=="凌"?(o=0,s==12&&(s=0)):(d=="下"||d=="晏"||d=="晚")&&(o=1,s!=12&&(s+=12))}else if(y[zi]){var T=y[zi][0];T=="上"||T=="朝"||T=="早"||T=="凌"?(o=0,s==12&&(s=0)):(T=="下"||T=="晏"||T=="晚")&&(o=1,s!=12&&(s+=12))}return r.text=r.text+y[0],r.end.assign("hour",s),r.end.assign("minute",a),o>=0?r.end.assign("meridiem",o):r.start.isCertain("meridiem")&&r.start.get("meridiem")==1&&r.start.get("hour")>s?r.end.imply("meridiem",0):s>12&&r.end.imply("meridiem",1),r.end.date().getTime()<r.start.date().getTime()&&r.end.imply("day",r.end.get("day")+1),r}}const VT=new RegExp("(?:星期|禮拜|週)(?<weekday>"+Object.keys(Mi).join("|")+")");class WT extends ke{innerPattern(){return VT}innerExtract(t,n){const r=t.createParsingResult(n.index,n[0]),i=n.groups.weekday,s=Mi[i];if(s===void 0)return null;const a=new Date(t.refDate.getTime()),o=a.getDay();let l=s-o;return Math.abs(l-7)<Math.abs(l)&&(l-=7),Math.abs(l+7)<Math.abs(l)&&(l+=7),a.setDate(a.getDate()+l),r.start.assign("weekday",s),r.start.imply("day",a.getDate()),r.start.imply("month",a.getMonth()+1),r.start.imply("year",a.getFullYear()),r}}class YT extends rf{patternBetween(){return/^\s*(至|到|\-|\~|~|-|ー)\s*$/i}}class GT extends of{patternBetween(){return/^\s*$/i}}const KT=new Zn(JT());new Zn(xf());function ZT(e,t,n){return KT.parseDate(e,t,n)}function JT(){const e=xf();return e.parsers.unshift(new NT),e}function xf(){const e=mf({parsers:[new IT,new _T,new UT,new ST,new WT,new $T,new BT,new AT,new jT,new kT],refiners:[new YT,new GT]});return e.refiners=e.refiners.filter(t=>!(t instanceof uf)),e}var Hi={exports:{}},XT=Hi.exports,Pf;function QT(){return Pf||(Pf=1,(function(e,t){(function(n,r){e.exports=r()})(XT,(function(){var n=1e3,r=6e4,i=36e5,s="millisecond",a="second",o="minute",l="hour",u="day",c="week",f="month",h="quarter",d="year",g="date",T="Invalid Date",y=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,m=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,p={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(H){var j=["th","st","nd","rd"],B=H%100;return"["+H+(j[(B-20)%10]||j[B]||j[0])+"]"}},b=function(H,j,B){var Z=String(H);return!Z||Z.length>=j?H:""+Array(j+1-Z.length).join(B)+H},S={s:b,z:function(H){var j=-H.utcOffset(),B=Math.abs(j),Z=Math.floor(B/60),q=B%60;return(j<=0?"+":"-")+b(Z,2,"0")+":"+b(q,2,"0")},m:function H(j,B){if(j.date()<B.date())return-H(B,j);var Z=12*(B.year()-j.year())+(B.month()-j.month()),q=j.clone().add(Z,f),ee=B-q<0,k=j.clone().add(Z+(ee?-1:1),f);return+(-(Z+(B-q)/(ee?q-k:k-q))||0)},a:function(H){return H<0?Math.ceil(H)||0:Math.floor(H)},p:function(H){return{M:f,y:d,w:c,d:u,D:g,h:l,m:o,s:a,ms:s,Q:h}[H]||String(H||"").toLowerCase().replace(/s$/,"")},u:function(H){return H===void 0}},v="en",w={};w[v]=p;var x="$isDayjsObject",N=function(H){return H instanceof U||!(!H||!H[x])},F=function H(j,B,Z){var q;if(!j)return v;if(typeof j=="string"){var ee=j.toLowerCase();w[ee]&&(q=ee),B&&(w[ee]=B,q=ee);var k=j.split("-");if(!q&&k.length>1)return H(k[0])}else{var D=j.name;w[D]=j,q=D}return!Z&&q&&(v=q),q||!Z&&v},A=function(H,j){if(N(H))return H.clone();var B=typeof j=="object"?j:{};return B.date=H,B.args=arguments,new U(B)},O=S;O.l=F,O.i=N,O.w=function(H,j){return A(H,{locale:j.$L,utc:j.$u,x:j.$x,$offset:j.$offset})};var U=(function(){function H(B){this.$L=F(B.locale,null,!0),this.parse(B),this.$x=this.$x||B.x||{},this[x]=!0}var j=H.prototype;return j.parse=function(B){this.$d=(function(Z){var q=Z.date,ee=Z.utc;if(q===null)return new Date(NaN);if(O.u(q))return new Date;if(q instanceof Date)return new Date(q);if(typeof q=="string"&&!/Z$/i.test(q)){var k=q.match(y);if(k){var D=k[2]-1||0,I=(k[7]||"0").substring(0,3);return ee?new Date(Date.UTC(k[1],D,k[3]||1,k[4]||0,k[5]||0,k[6]||0,I)):new Date(k[1],D,k[3]||1,k[4]||0,k[5]||0,k[6]||0,I)}}return new Date(q)})(B),this.init()},j.init=function(){var B=this.$d;this.$y=B.getFullYear(),this.$M=B.getMonth(),this.$D=B.getDate(),this.$W=B.getDay(),this.$H=B.getHours(),this.$m=B.getMinutes(),this.$s=B.getSeconds(),this.$ms=B.getMilliseconds()},j.$utils=function(){return O},j.isValid=function(){return this.$d.toString()!==T},j.isSame=function(B,Z){var q=A(B);return this.startOf(Z)<=q&&q<=this.endOf(Z)},j.isAfter=function(B,Z){return A(B)<this.startOf(Z)},j.isBefore=function(B,Z){return this.endOf(Z)<A(B)},j.$g=function(B,Z,q){return O.u(B)?this[Z]:this.set(q,B)},j.unix=function(){return Math.floor(this.valueOf()/1e3)},j.valueOf=function(){return this.$d.getTime()},j.startOf=function(B,Z){var q=this,ee=!!O.u(Z)||Z,k=O.p(B),D=function(ae,ne){var C=O.w(q.$u?Date.UTC(q.$y,ne,ae):new Date(q.$y,ne,ae),q);return ee?C:C.endOf(u)},I=function(ae,ne){return O.w(q.toDate()[ae].apply(q.toDate("s"),(ee?[0,0,0,0]:[23,59,59,999]).slice(ne)),q)},_=this.$W,E=this.$M,P=this.$D,M="set"+(this.$u?"UTC":"");switch(k){case d:return ee?D(1,0):D(31,11);case f:return ee?D(1,E):D(0,E+1);case c:var X=this.$locale().weekStart||0,J=(_<X?_+7:_)-X;return D(ee?P-J:P+(6-J),E);case u:case g:return I(M+"Hours",0);case l:return I(M+"Minutes",1);case o:return I(M+"Seconds",2);case a:return I(M+"Milliseconds",3);default:return this.clone()}},j.endOf=function(B){return this.startOf(B,!1)},j.$set=function(B,Z){var q,ee=O.p(B),k="set"+(this.$u?"UTC":""),D=(q={},q[u]=k+"Date",q[g]=k+"Date",q[f]=k+"Month",q[d]=k+"FullYear",q[l]=k+"Hours",q[o]=k+"Minutes",q[a]=k+"Seconds",q[s]=k+"Milliseconds",q)[ee],I=ee===u?this.$D+(Z-this.$W):Z;if(ee===f||ee===d){var _=this.clone().set(g,1);_.$d[D](I),_.init(),this.$d=_.set(g,Math.min(this.$D,_.daysInMonth())).$d}else D&&this.$d[D](I);return this.init(),this},j.set=function(B,Z){return this.clone().$set(B,Z)},j.get=function(B){return this[O.p(B)]()},j.add=function(B,Z){var q,ee=this;B=Number(B);var k=O.p(Z),D=function(E){var P=A(ee);return O.w(P.date(P.date()+Math.round(E*B)),ee)};if(k===f)return this.set(f,this.$M+B);if(k===d)return this.set(d,this.$y+B);if(k===u)return D(1);if(k===c)return D(7);var I=(q={},q[o]=r,q[l]=i,q[a]=n,q)[k]||1,_=this.$d.getTime()+B*I;return O.w(_,this)},j.subtract=function(B,Z){return this.add(-1*B,Z)},j.format=function(B){var Z=this,q=this.$locale();if(!this.isValid())return q.invalidDate||T;var ee=B||"YYYY-MM-DDTHH:mm:ssZ",k=O.z(this),D=this.$H,I=this.$m,_=this.$M,E=q.weekdays,P=q.months,M=q.meridiem,X=function(ne,C,R,z){return ne&&(ne[C]||ne(Z,ee))||R[C].slice(0,z)},J=function(ne){return O.s(D%12||12,ne,"0")},ae=M||function(ne,C,R){var z=ne<12?"AM":"PM";return R?z.toLowerCase():z};return ee.replace(m,(function(ne,C){return C||(function(R){switch(R){case"YY":return String(Z.$y).slice(-2);case"YYYY":return O.s(Z.$y,4,"0");case"M":return _+1;case"MM":return O.s(_+1,2,"0");case"MMM":return X(q.monthsShort,_,P,3);case"MMMM":return X(P,_);case"D":return Z.$D;case"DD":return O.s(Z.$D,2,"0");case"d":return String(Z.$W);case"dd":return X(q.weekdaysMin,Z.$W,E,2);case"ddd":return X(q.weekdaysShort,Z.$W,E,3);case"dddd":return E[Z.$W];case"H":return String(D);case"HH":return O.s(D,2,"0");case"h":return J(1);case"hh":return J(2);case"a":return ae(D,I,!0);case"A":return ae(D,I,!1);case"m":return String(I);case"mm":return O.s(I,2,"0");case"s":return String(Z.$s);case"ss":return O.s(Z.$s,2,"0");case"SSS":return O.s(Z.$ms,3,"0");case"Z":return k}return null})(ne)||k.replace(":","")}))},j.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},j.diff=function(B,Z,q){var ee,k=this,D=O.p(Z),I=A(B),_=(I.utcOffset()-this.utcOffset())*r,E=this-I,P=function(){return O.m(k,I)};switch(D){case d:ee=P()/12;break;case f:ee=P();break;case h:ee=P()/3;break;case c:ee=(E-_)/6048e5;break;case u:ee=(E-_)/864e5;break;case l:ee=E/i;break;case o:ee=E/r;break;case a:ee=E/n;break;default:ee=E}return q?ee:O.a(ee)},j.daysInMonth=function(){return this.endOf(f).$D},j.$locale=function(){return w[this.$L]},j.locale=function(B,Z){if(!B)return this.$L;var q=this.clone(),ee=F(B,Z,!0);return ee&&(q.$L=ee),q},j.clone=function(){return O.w(this.$d,this)},j.toDate=function(){return new Date(this.valueOf())},j.toJSON=function(){return this.isValid()?this.toISOString():null},j.toISOString=function(){return this.$d.toISOString()},j.toString=function(){return this.$d.toUTCString()},H})(),K=U.prototype;return A.prototype=K,[["$ms",s],["$s",a],["$m",o],["$H",l],["$W",u],["$M",f],["$y",d],["$D",g]].forEach((function(H){K[H[1]]=function(j){return this.$g(j,H[0],H[1])}})),A.extend=function(H,j){return H.$i||(H(j,U,A),H.$i=!0),A},A.locale=F,A.isDayjs=N,A.unix=function(H){return A(1e3*H)},A.en=w[v],A.Ls=w,A.p={},A}))})(Hi)),Hi.exports}var ek=QT();const Bi=Xn(ek);var Vi={exports:{}},tk=Vi.exports,Af;function nk(){return Af||(Af=1,(function(e,t){(function(n,r){e.exports=r()})(tk,(function(){var n="day";return function(r,i,s){var a=function(u){return u.add(4-u.isoWeekday(),n)},o=i.prototype;o.isoWeekYear=function(){return a(this).year()},o.isoWeek=function(u){if(!this.$utils().u(u))return this.add(7*(u-this.isoWeek()),n);var c,f,h,d,g=a(this),T=(c=this.isoWeekYear(),f=this.$u,h=(f?s.utc:s)().year(c).startOf("year"),d=4-h.isoWeekday(),h.isoWeekday()>4&&(d+=7),h.add(d,n));return g.diff(T,"week")+1},o.isoWeekday=function(u){return this.$utils().u(u)?this.day()||7:this.day(this.day()%7?u:u-7)};var l=o.startOf;o.startOf=function(u,c){var f=this.$utils(),h=!!f.u(c)||c;return f.p(u)==="isoweek"?h?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):l.bind(this)(u,c)}}}))})(Vi)),Vi.exports}var rk=nk();const ik=Xn(rk);Bi.extend(ik);function sk(){return Bi().startOf("isoWeek").toDate()}const Ra=/大*后天/g;function ak(e){if(!Ra.test(e))return e;const t=Bi();return Ra.lastIndex=0,e.replace(Ra,n=>{const i=2+(n.length-2);return t.add(i,"day").format("YYYY年MM月DD日")})}function ok(e){const t=ak(e),n=/(?:本|这|上|下)?(?:周|星期)/.test(t),r=ZT(t,{instant:n?sk():new Date});return r?Bi(r).format("YYYY-MM-DD HH:mm:ss"):"无法解析,请输入具体时间"}const lk={parse_relative_date:{def:{type:"function",function:{name:"parse_relative_date",description:"把相对时间转成绝对时间",parameters:{type:"object",properties:{input:{type:"string",description:"相对时间"}},required:["input"]}}},handler:e=>ok(e.input)}};class uk extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"}),this.shadowRoot&&this.shadowRoot.appendChild(Fc.content.cloneNode(!0))}connectedCallback(){this.shadowRoot&&E_(this.shadowRoot)}}customElements.define("ai-chat-panel",uk);class ck{on=ga.on;pushMessage=ot.pushMessage;pushMessages=ot.pushMessages;pushLoadingMessage=ot.pushLoadingMessage;updateLoadingMessageReasoningContent=ot.updateLoadingMessageReasoningContent;updateLoadingMessageContent=ot.updateLoadingMessageContent;finishLoadingMessage=ot.finishLoadingMessage;setUserInputValue=Ut.setValue;constructor(t){const{container:n}=t;if(!n)throw new Error("未提供有效的 container");const r=document.createElement("ai-chat-panel");n.appendChild(r)}}$e.AIChatPanel=ck,$e.Agent=b_,$e.tools=lk,Object.defineProperty($e,Symbol.toStringTag,{value:"Module"})}));
|
package/dist/index.d.ts
CHANGED
|
@@ -30,6 +30,6 @@ export declare class AIChatPanel {
|
|
|
30
30
|
updateLoadingMessageReasoningContent: (content: string) => void;
|
|
31
31
|
updateLoadingMessageContent: (content: string) => void;
|
|
32
32
|
finishLoadingMessage: () => void;
|
|
33
|
-
|
|
33
|
+
setUserInputValue: (value: string) => void;
|
|
34
34
|
constructor(config: Config);
|
|
35
35
|
}
|