ai-client-sdk 4.0.1 → 4.0.2
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 +141 -115
- package/dist/ai-client-sdk.umd.js +2 -2
- package/dist/index.d.ts +2 -0
- package/dist/view/App.d.ts +1 -0
- package/package.json +1 -1
package/dist/ai-client-sdk.mjs
CHANGED
|
@@ -44650,34 +44650,24 @@ var Xj = Yj(), Zj = /* @__PURE__ */ s(((e) => {
|
|
|
44650
44650
|
]
|
|
44651
44651
|
});
|
|
44652
44652
|
}), tM = (0, H.forwardRef)(({ onReady: e }, t) => {
|
|
44653
|
-
let [n, r] = (0, H.useState)([]), [i, a] = (0, H.useState)(""), [o, s] = (0, H.useState)(!1), [c, l] =
|
|
44653
|
+
let [n, r] = (0, H.useState)([]), [i, a] = (0, H.useState)(""), [o, s] = (0, H.useState)(!1), [c, l] = (0, H.useState)(""), [u, d] = vb.useNotification(), p = (0, H.useRef)(null), m = (0, H.useRef)(null), h = (0, H.useRef)(null);
|
|
44654
44654
|
(0, H.useEffect)(() => {
|
|
44655
|
-
|
|
44656
|
-
for (let r of e) {
|
|
44657
|
-
let { height: e } = r.contentRect;
|
|
44658
|
-
e !== t && (t = e, n !== null && cancelAnimationFrame(n), n = requestAnimationFrame(() => {
|
|
44659
|
-
p.current && (p.current.style.paddingBottom = `${t - 12 - 142 - 24}px`), n = null;
|
|
44660
|
-
}));
|
|
44661
|
-
}
|
|
44662
|
-
});
|
|
44663
|
-
return m.current && r.observe(m.current), e(), () => {
|
|
44664
|
-
r.disconnect(), n !== null && cancelAnimationFrame(n);
|
|
44665
|
-
};
|
|
44655
|
+
e();
|
|
44666
44656
|
}, [e]), (0, H.useEffect)(() => {
|
|
44667
44657
|
let e = n.at(-1);
|
|
44668
|
-
if (
|
|
44669
|
-
let e =
|
|
44658
|
+
if (m.current && e?.role === "user") {
|
|
44659
|
+
let e = h.current;
|
|
44670
44660
|
e && e.scrollTo({
|
|
44671
|
-
top:
|
|
44661
|
+
top: m.current.offsetTop - 12,
|
|
44672
44662
|
behavior: "smooth"
|
|
44673
44663
|
});
|
|
44674
44664
|
}
|
|
44675
44665
|
}, [n]);
|
|
44676
|
-
let
|
|
44666
|
+
let g = (e) => {
|
|
44677
44667
|
e && (e.id ||= crypto.randomUUID(), r((t) => [...t, e]));
|
|
44678
|
-
},
|
|
44679
|
-
if (e.length) for (let t of e)
|
|
44680
|
-
},
|
|
44668
|
+
}, _ = (e) => {
|
|
44669
|
+
if (e.length) for (let t of e) g(t);
|
|
44670
|
+
}, v = () => {
|
|
44681
44671
|
let e = {
|
|
44682
44672
|
id: crypto.randomUUID(),
|
|
44683
44673
|
role: "assistant",
|
|
@@ -44685,7 +44675,7 @@ var Xj = Yj(), Zj = /* @__PURE__ */ s(((e) => {
|
|
|
44685
44675
|
content: ""
|
|
44686
44676
|
};
|
|
44687
44677
|
r((t) => [...t, e]);
|
|
44688
|
-
},
|
|
44678
|
+
}, y = (e) => {
|
|
44689
44679
|
r((t) => {
|
|
44690
44680
|
let n = [...t];
|
|
44691
44681
|
if (n.length > 0) {
|
|
@@ -44697,7 +44687,7 @@ var Xj = Yj(), Zj = /* @__PURE__ */ s(((e) => {
|
|
|
44697
44687
|
}
|
|
44698
44688
|
return n;
|
|
44699
44689
|
});
|
|
44700
|
-
},
|
|
44690
|
+
}, b = (e) => {
|
|
44701
44691
|
r((t) => {
|
|
44702
44692
|
let n = [...t];
|
|
44703
44693
|
if (n.length > 0) {
|
|
@@ -44709,143 +44699,173 @@ var Xj = Yj(), Zj = /* @__PURE__ */ s(((e) => {
|
|
|
44709
44699
|
}
|
|
44710
44700
|
return n;
|
|
44711
44701
|
});
|
|
44702
|
+
}, x = (e) => {
|
|
44703
|
+
l(e);
|
|
44704
|
+
}, S = () => {
|
|
44705
|
+
l("");
|
|
44712
44706
|
};
|
|
44713
44707
|
(0, H.useImperativeHandle)(t, () => ({
|
|
44714
|
-
pushMessage:
|
|
44715
|
-
pushMessages:
|
|
44716
|
-
pushLoadingMessage:
|
|
44717
|
-
updateLoadingMessageReasoningContent:
|
|
44718
|
-
updateLoadingMessageContent:
|
|
44708
|
+
pushMessage: g,
|
|
44709
|
+
pushMessages: _,
|
|
44710
|
+
pushLoadingMessage: v,
|
|
44711
|
+
updateLoadingMessageReasoningContent: y,
|
|
44712
|
+
updateLoadingMessageContent: b,
|
|
44713
|
+
updateContext: x
|
|
44719
44714
|
}));
|
|
44720
|
-
let
|
|
44715
|
+
let C = (e) => {
|
|
44721
44716
|
let t = document.createElement("div");
|
|
44722
44717
|
return t.textContent = e, t.innerHTML;
|
|
44723
|
-
},
|
|
44718
|
+
}, w = async () => {
|
|
44724
44719
|
if (i.trim()) try {
|
|
44725
44720
|
s(!0);
|
|
44726
|
-
let e =
|
|
44721
|
+
let e = C(i.trim());
|
|
44727
44722
|
a("");
|
|
44728
|
-
let t = {
|
|
44723
|
+
let t = c ? `${c}\n\n${e}` : e, n = {
|
|
44729
44724
|
id: crypto.randomUUID(),
|
|
44730
44725
|
role: "user",
|
|
44731
|
-
content:
|
|
44726
|
+
content: t
|
|
44732
44727
|
};
|
|
44733
|
-
r((e) => [...e,
|
|
44728
|
+
r((e) => [...e, n]), await f.emit("send", n);
|
|
44734
44729
|
} finally {
|
|
44735
|
-
s(!1),
|
|
44730
|
+
s(!1), p.current?.focus();
|
|
44736
44731
|
}
|
|
44737
44732
|
};
|
|
44738
44733
|
return /* @__PURE__ */ (0, $j.jsxs)("div", {
|
|
44739
44734
|
className: "app-container",
|
|
44740
|
-
ref: m,
|
|
44741
44735
|
children: [
|
|
44742
|
-
|
|
44736
|
+
d,
|
|
44743
44737
|
/* @__PURE__ */ (0, $j.jsx)("div", {
|
|
44744
44738
|
className: "messages-container",
|
|
44745
|
-
ref:
|
|
44739
|
+
ref: h,
|
|
44746
44740
|
children: n.map((e, t) => /* @__PURE__ */ (0, $j.jsx)(eM, {
|
|
44747
|
-
ref: t === n.length - 1 ?
|
|
44741
|
+
ref: t === n.length - 1 ? m : null,
|
|
44748
44742
|
message: e
|
|
44749
44743
|
}, e.id))
|
|
44750
44744
|
}),
|
|
44751
44745
|
/* @__PURE__ */ (0, $j.jsxs)("div", {
|
|
44752
44746
|
className: "bottom-container",
|
|
44753
|
-
children: [
|
|
44754
|
-
|
|
44755
|
-
|
|
44756
|
-
|
|
44757
|
-
|
|
44758
|
-
|
|
44759
|
-
className: "icon square plain",
|
|
44760
|
-
type: "button",
|
|
44761
|
-
"aria-label": "新对话",
|
|
44762
|
-
onClick: async () => {
|
|
44763
|
-
r([]), u.current?.focus(), await f.emit("create"), c.success({
|
|
44764
|
-
title: "已创建",
|
|
44765
|
-
description: "新对话已创建",
|
|
44766
|
-
placement: "top",
|
|
44767
|
-
closable: !1
|
|
44768
|
-
});
|
|
44769
|
-
},
|
|
44770
|
-
children: /* @__PURE__ */ (0, $j.jsx)("svg", {
|
|
44771
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
44772
|
-
width: "18",
|
|
44773
|
-
height: "18",
|
|
44774
|
-
viewBox: "0 0 1024 1024",
|
|
44775
|
-
children: /* @__PURE__ */ (0, $j.jsx)("path", { d: "M597.333 128v85.333H170.667v571.094l75.221-59.094h607.445V426.667h85.334V768A42.667 42.667 0 0 1 896 810.667H275.413L85.333 960V170.667A42.667 42.667 0 0 1 128 128h469.333zm213.334 0V0H896v128h128v85.333H896v128h-85.333v-128h-128V128h128z" })
|
|
44776
|
-
})
|
|
44777
|
-
})
|
|
44778
|
-
})
|
|
44779
|
-
}), /* @__PURE__ */ (0, $j.jsxs)("div", {
|
|
44780
|
-
className: "user-input-container",
|
|
44781
|
-
children: [/* @__PURE__ */ (0, $j.jsx)("textarea", {
|
|
44782
|
-
className: "user-input",
|
|
44783
|
-
placeholder: "发消息...",
|
|
44784
|
-
value: i,
|
|
44785
|
-
onChange: (e) => a(e.target.value),
|
|
44786
|
-
onKeyDown: (e) => {
|
|
44787
|
-
e.key === "Enter" && !e.shiftKey && (e.preventDefault(), x());
|
|
44788
|
-
},
|
|
44789
|
-
ref: u
|
|
44790
|
-
}), /* @__PURE__ */ (0, $j.jsxs)("div", {
|
|
44791
|
-
className: "button-wrap",
|
|
44792
|
-
children: [/* @__PURE__ */ (0, $j.jsx)(rb, {
|
|
44793
|
-
title: "发送 (↵)",
|
|
44794
|
-
placement: "topLeft",
|
|
44747
|
+
children: [
|
|
44748
|
+
/* @__PURE__ */ (0, $j.jsx)("div", {
|
|
44749
|
+
className: "action-bar",
|
|
44750
|
+
children: /* @__PURE__ */ (0, $j.jsx)(rb, {
|
|
44751
|
+
title: "新对话",
|
|
44752
|
+
placement: "bottomRight",
|
|
44795
44753
|
children: /* @__PURE__ */ (0, $j.jsx)("button", {
|
|
44796
44754
|
className: "icon square plain",
|
|
44797
44755
|
type: "button",
|
|
44798
|
-
"aria-label": "
|
|
44799
|
-
onClick:
|
|
44800
|
-
|
|
44801
|
-
|
|
44802
|
-
|
|
44803
|
-
|
|
44804
|
-
|
|
44805
|
-
|
|
44806
|
-
|
|
44807
|
-
|
|
44808
|
-
|
|
44809
|
-
|
|
44756
|
+
"aria-label": "新对话",
|
|
44757
|
+
onClick: async () => {
|
|
44758
|
+
r([]), p.current?.focus(), await f.emit("create"), u.success({
|
|
44759
|
+
title: "已创建",
|
|
44760
|
+
description: "新对话已创建",
|
|
44761
|
+
placement: "top",
|
|
44762
|
+
closable: !1
|
|
44763
|
+
});
|
|
44764
|
+
},
|
|
44765
|
+
children: /* @__PURE__ */ (0, $j.jsx)("svg", {
|
|
44766
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
44767
|
+
width: "18",
|
|
44768
|
+
height: "18",
|
|
44769
|
+
viewBox: "0 0 1024 1024",
|
|
44770
|
+
children: /* @__PURE__ */ (0, $j.jsx)("path", { d: "M597.333 128v85.333H170.667v571.094l75.221-59.094h607.445V426.667h85.334V768A42.667 42.667 0 0 1 896 810.667H275.413L85.333 960V170.667A42.667 42.667 0 0 1 128 128h469.333zm213.334 0V0H896v128h128v85.333H896v128h-85.333v-128h-128V128h128z" })
|
|
44810
44771
|
})
|
|
44811
44772
|
})
|
|
44773
|
+
})
|
|
44774
|
+
}),
|
|
44775
|
+
c && /* @__PURE__ */ (0, $j.jsxs)("div", {
|
|
44776
|
+
className: "context-container",
|
|
44777
|
+
children: [/* @__PURE__ */ (0, $j.jsx)("span", {
|
|
44778
|
+
className: "context-text",
|
|
44779
|
+
children: c
|
|
44812
44780
|
}), /* @__PURE__ */ (0, $j.jsx)(rb, {
|
|
44813
|
-
title: "
|
|
44781
|
+
title: "删除上下文",
|
|
44814
44782
|
placement: "topLeft",
|
|
44815
44783
|
children: /* @__PURE__ */ (0, $j.jsx)("button", {
|
|
44816
|
-
className: "
|
|
44784
|
+
className: "context-delete",
|
|
44817
44785
|
type: "button",
|
|
44818
|
-
"aria-label": "
|
|
44819
|
-
onClick:
|
|
44820
|
-
|
|
44821
|
-
|
|
44822
|
-
|
|
44823
|
-
|
|
44824
|
-
|
|
44825
|
-
})
|
|
44826
|
-
},
|
|
44827
|
-
style: { display: o ? "flex" : "none" },
|
|
44828
|
-
children: /* @__PURE__ */ (0, $j.jsx)("div", {
|
|
44829
|
-
className: "stop-icon",
|
|
44830
|
-
children: /* @__PURE__ */ (0, $j.jsx)("svg", {
|
|
44831
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
44832
|
-
width: "20",
|
|
44833
|
-
height: "20",
|
|
44834
|
-
fill: "currentColor",
|
|
44835
|
-
children: /* @__PURE__ */ (0, $j.jsx)("path", { d: "M4.5 5.75c0-.69.56-1.25 1.25-1.25h8.5c.69 0 1.25.56 1.25 1.25v8.5c0 .69-.56 1.25-1.25 1.25h-8.5c-.69 0-1.25-.56-1.25-1.25v-8.5Z" })
|
|
44836
|
-
})
|
|
44786
|
+
"aria-label": "删除上下文",
|
|
44787
|
+
onClick: S,
|
|
44788
|
+
children: /* @__PURE__ */ (0, $j.jsx)("svg", {
|
|
44789
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
44790
|
+
width: "14",
|
|
44791
|
+
height: "14",
|
|
44792
|
+
fill: "currentColor",
|
|
44793
|
+
children: /* @__PURE__ */ (0, $j.jsx)("path", { d: "M7 8.414L3.293 12.121a1 1 0 0 1-1.414-1.414L5.586 7 1.879 3.293a1 1 0 0 1 1.414-1.414L7 5.586l3.707-3.707a1 1 0 1 1 1.414 1.414L8.414 7l3.707 3.707a1 1 0 0 1-1.414 1.414L7 8.414z" })
|
|
44837
44794
|
})
|
|
44838
44795
|
})
|
|
44839
44796
|
})]
|
|
44840
|
-
})
|
|
44841
|
-
|
|
44797
|
+
}),
|
|
44798
|
+
/* @__PURE__ */ (0, $j.jsxs)("div", {
|
|
44799
|
+
className: "user-input-container",
|
|
44800
|
+
children: [/* @__PURE__ */ (0, $j.jsx)("textarea", {
|
|
44801
|
+
className: "user-input",
|
|
44802
|
+
placeholder: "发消息...",
|
|
44803
|
+
value: i,
|
|
44804
|
+
onChange: (e) => a(e.target.value),
|
|
44805
|
+
onKeyDown: (e) => {
|
|
44806
|
+
e.key === "Enter" && !e.shiftKey && (e.preventDefault(), w());
|
|
44807
|
+
},
|
|
44808
|
+
ref: p
|
|
44809
|
+
}), /* @__PURE__ */ (0, $j.jsxs)("div", {
|
|
44810
|
+
className: "button-wrap",
|
|
44811
|
+
children: [/* @__PURE__ */ (0, $j.jsx)(rb, {
|
|
44812
|
+
title: "发送 (↵)",
|
|
44813
|
+
placement: "topLeft",
|
|
44814
|
+
children: /* @__PURE__ */ (0, $j.jsx)("button", {
|
|
44815
|
+
className: "icon square plain",
|
|
44816
|
+
type: "button",
|
|
44817
|
+
"aria-label": "发送",
|
|
44818
|
+
onClick: w,
|
|
44819
|
+
style: { display: o ? "none" : "flex" },
|
|
44820
|
+
children: /* @__PURE__ */ (0, $j.jsx)("div", {
|
|
44821
|
+
className: "submit-icon",
|
|
44822
|
+
children: /* @__PURE__ */ (0, $j.jsx)("svg", {
|
|
44823
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
44824
|
+
width: "20",
|
|
44825
|
+
height: "20",
|
|
44826
|
+
fill: "currentColor",
|
|
44827
|
+
children: /* @__PURE__ */ (0, $j.jsx)("path", { d: "M9 16V6.414L5.707 9.707a1 1 0 1 1-1.414-1.414l5-5 .076-.068a1 1 0 0 1 1.338.068l5 5 .068.076a1 1 0 0 1-1.406 1.406l-.076-.068L11 6.414V16a1 1 0 1 1-2 0Z" })
|
|
44828
|
+
})
|
|
44829
|
+
})
|
|
44830
|
+
})
|
|
44831
|
+
}), /* @__PURE__ */ (0, $j.jsx)(rb, {
|
|
44832
|
+
title: "停止",
|
|
44833
|
+
placement: "topLeft",
|
|
44834
|
+
children: /* @__PURE__ */ (0, $j.jsx)("button", {
|
|
44835
|
+
className: "icon square plain",
|
|
44836
|
+
type: "button",
|
|
44837
|
+
"aria-label": "停止",
|
|
44838
|
+
onClick: () => {
|
|
44839
|
+
Fi(), s(!1), p.current?.focus(), u.info({
|
|
44840
|
+
title: "已停止",
|
|
44841
|
+
description: "对话已停止",
|
|
44842
|
+
placement: "top",
|
|
44843
|
+
closable: !1
|
|
44844
|
+
});
|
|
44845
|
+
},
|
|
44846
|
+
style: { display: o ? "flex" : "none" },
|
|
44847
|
+
children: /* @__PURE__ */ (0, $j.jsx)("div", {
|
|
44848
|
+
className: "stop-icon",
|
|
44849
|
+
children: /* @__PURE__ */ (0, $j.jsx)("svg", {
|
|
44850
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
44851
|
+
width: "20",
|
|
44852
|
+
height: "20",
|
|
44853
|
+
fill: "currentColor",
|
|
44854
|
+
children: /* @__PURE__ */ (0, $j.jsx)("path", { d: "M4.5 5.75c0-.69.56-1.25 1.25-1.25h8.5c.69 0 1.25.56 1.25 1.25v8.5c0 .69-.56 1.25-1.25 1.25h-8.5c-.69 0-1.25-.56-1.25-1.25v-8.5Z" })
|
|
44855
|
+
})
|
|
44856
|
+
})
|
|
44857
|
+
})
|
|
44858
|
+
})]
|
|
44859
|
+
})]
|
|
44860
|
+
})
|
|
44861
|
+
]
|
|
44842
44862
|
})
|
|
44843
44863
|
]
|
|
44844
44864
|
});
|
|
44845
44865
|
}), nM = [
|
|
44846
44866
|
"button{cursor:pointer;border:0;outline:0;justify-content:center;align-items:center;display:flex}button.icon{padding:4px}button.text{height:28px;padding:0 12px}button.square{border-radius:6px}button.circle{border-radius:50%}button.primary{background-color:#0000000a}button.plain{background-color:#0000}button.error{color:#fff;background-color:#ff4d4f}button.primary:hover{background-color:#0000000f}button.plain:hover{background-color:#0000000a}button.error:hover{background-color:#ff7875}",
|
|
44847
44867
|
".loading-dots{margin-left:3px;font-weight:700}.loading-dots:after{content:\"\";animation:1.5s infinite typing}@keyframes typing{0%{content:\".\"}33%{content:\"..\"}66%{content:\"...\"}to{content:\".\"}}",
|
|
44848
|
-
".app-container{background:#fff;
|
|
44868
|
+
".app-container{background:#fff;height:100%}.bottom-container{background:#fff;padding:12px;position:fixed;bottom:0;left:0;right:0}.action-bar{align-items:center;gap:12px;margin-bottom:12px;display:flex}.user-input-container{border:1px solid #72768b29;border-radius:16px;flex-direction:column;padding:12px;display:flex;box-shadow:0 10px 30px #0003}.user-input{resize:none;border:0;width:100%;font-size:14px;line-height:1.5}.button-wrap{justify-content:flex-end;align-items:center;gap:12px;display:flex}.messages-container{height:100%;padding:12px 12px calc(100vh - 12px);overflow:hidden auto}.message{max-width:80%;margin-bottom:12px;font-size:14px;line-height:1.5}.body-container{color:#000;border-radius:8px;padding:0 14px;overflow-x:auto}.message.user{margin-left:auto}.message.user .body-container{background:#e3f2fd}.message.assistant{margin-right:auto}.message.assistant .body-container{background:#f1f1f1}.button-container{margin-top:4px;display:flex}.button-container button{align-items:center;height:26px;display:flex}.message.user .button-container{justify-content:flex-end}.message.assistant .button-container{justify-content:flex-start}.submit-icon,.stop-icon{color:#fff;background-color:#000;border-radius:50%;justify-content:center;align-items:center;width:28px;height:28px;display:flex}.content-container{word-wrap:break-word}.message.assistant table{border-collapse:collapse;margin-block:1em}.message.assistant table th,.message.assistant table td{border:1px solid #ccc;padding:8px}.message.assistant table th{background-color:#e0e0e0}.message.assistant .reasoning-container{color:#6b7280;background-color:#f9fafb;border-radius:8px;margin-bottom:8px;padding:0 14px;font-size:12px;overflow-x:auto}.message.assistant .reasoning-container .reasoning-header{cursor:pointer;align-items:center;gap:4px;margin-bottom:8px;padding-top:8px;display:flex}.message.assistant .reasoning-container .reasoning-header svg{transition:transform .3s;transform:rotate(90deg)}.message.assistant .reasoning-container.collapsed .reasoning-header svg{transition:transform .3s;transform:rotate(0)}.message.assistant .reasoning-container.collapsed .reasoning-content{height:0;overflow:hidden}.context-container{background:#f3f4f6;border-radius:8px;align-items:center;gap:8px;margin-bottom:12px;padding:8px 12px;display:flex}.context-text{color:#374151;white-space:nowrap;text-overflow:ellipsis;flex:1;font-size:13px;overflow:hidden}.context-delete{color:#6b7280;cursor:pointer;background:0 0;border:none;border-radius:4px;flex-shrink:0;justify-content:center;align-items:center;padding:4px;transition:background-color .2s;display:flex}.context-delete:hover{color:#374151;background-color:#e5e7eb}",
|
|
44849
44869
|
"*{box-sizing:border-box}textarea{padding:0}textarea:focus-visible,select:focus-visible{outline:0}.flex{display:flex}:host{position:relative}"
|
|
44850
44870
|
].join("\n"), rM = ({ domNode: e, onReady: t }) => {
|
|
44851
44871
|
let n = document.createElement("style");
|
|
@@ -46971,6 +46991,9 @@ var BI = { parse_relative_date: {
|
|
|
46971
46991
|
async updateLoadingMessageContent(e) {
|
|
46972
46992
|
await this.promise, this.appRef?.current?.updateLoadingMessageContent(e);
|
|
46973
46993
|
}
|
|
46994
|
+
async updateContext(e) {
|
|
46995
|
+
await this.promise, this.appRef?.current?.updateContext(e);
|
|
46996
|
+
}
|
|
46974
46997
|
};
|
|
46975
46998
|
customElements.define("ai-chat-panel", VI);
|
|
46976
46999
|
var HI = class {
|
|
@@ -46999,6 +47022,9 @@ var HI = class {
|
|
|
46999
47022
|
updateLoadingMessageContent(e) {
|
|
47000
47023
|
return this.panelElement.updateLoadingMessageContent(e);
|
|
47001
47024
|
}
|
|
47025
|
+
updateContext(e) {
|
|
47026
|
+
return this.panelElement.updateContext(e);
|
|
47027
|
+
}
|
|
47002
47028
|
};
|
|
47003
47029
|
//#endregion
|
|
47004
47030
|
export { HI as AIChatPanel, Li as Agent, BI as tools };
|
|
@@ -418,9 +418,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
418
418
|
<%s {...props} />
|
|
419
419
|
React keys must be passed directly to JSX without using spread:
|
|
420
420
|
let props = %s;
|
|
421
|
-
<%s key={someKey} {...props} />`,o,p,m,p),ne[p+o]=!0)}if(p=null,i!==void 0&&(r(i),p=``+i),s(n)&&(r(n.key),p=``+n.key),`key`in n)for(var h in i={},n)h!==`key`&&(i[h]=n[h]);else i=n;return p&&c(i,typeof e==`function`?e.displayName||e.name||`Unknown`:e),u(e,p,i,a(),l,d)}function f(e){p(e)?e._store&&(e._store.validated=1):typeof e==`object`&&e&&e.$$typeof===D&&(e._payload.status===`fulfilled`?p(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function p(e){return typeof e==`object`&&!!e&&e.$$typeof===h}var m=g(),h=Symbol.for(`react.transitional.element`),_=Symbol.for(`react.portal`),v=Symbol.for(`react.fragment`),y=Symbol.for(`react.strict_mode`),b=Symbol.for(`react.profiler`),x=Symbol.for(`react.consumer`),S=Symbol.for(`react.context`),C=Symbol.for(`react.forward_ref`),w=Symbol.for(`react.suspense`),T=Symbol.for(`react.suspense_list`),E=Symbol.for(`react.memo`),D=Symbol.for(`react.lazy`),O=Symbol.for(`react.activity`),k=Symbol.for(`react.client.reference`),A=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,j=Object.prototype.hasOwnProperty,M=Array.isArray,N=console.createTask?console.createTask:function(){return null};m={react_stack_bottom_frame:function(e){return e()}};var ee,te={},P=m.react_stack_bottom_frame.bind(m,o)(),F=N(i(o)),ne={};e.Fragment=v,e.jsx=function(e,t,n){var r=1e4>A.recentlyCreatedOwnerStacks++;return d(e,t,n,!1,r?Error(`react-stack-top-frame`):P,r?N(i(e)):F)},e.jsxs=function(e,t,n){var r=1e4>A.recentlyCreatedOwnerStacks++;return d(e,t,n,!0,r?Error(`react-stack-top-frame`):P,r?N(i(e)):F)}})()})),eM=c(((e,t)=>{process.env.NODE_ENV===`production`?t.exports=Qj():t.exports=$j()}))(),tM=(0,U.forwardRef)(({message:e},t)=>{let[n,r]=(0,U.useState)(!1),[i,a]=(0,U.useState)(``),[o,s]=(0,U.useState)(``),[c,l]=(0,U.useState)(!0),u=(0,U.useRef)(null),d=async e=>{let t=await $b().use(cw).use(SD).use(kO,{allowDangerousHtml:!0}).use(NA,{allowDangerousHtml:!0}).process(e),n=String(t);return Zj.sanitize(n)},f=e=>e.role===`assistant`;(0,U.useEffect)(()=>{e.content?d(e.content).then(s):s(``);let t=f(e)?e.reasoning_content:void 0;t?d(t).then(a):a(``)},[e.content,f(e)?e.reasoning_content:void 0]),(0,U.useEffect)(()=>()=>{u.current&&clearTimeout(u.current)},[]);let p=()=>{l(!c)},m=t=>{t.stopPropagation();let n=e.content;navigator.clipboard.writeText(n).catch(e=>{console.error(`Failed to copy text: `,e)}).finally(()=>{u.current&&clearTimeout(u.current),r(!0),u.current=setTimeout(()=>{r(!1)},1500)})},h=!e.content;return(0,eM.jsxs)(`div`,{ref:t,className:`message ${e.role} ${h?`loading`:``}`,children:[f(e)&&i&&(0,eM.jsxs)(`div`,{className:`reasoning-container ${c?`collapsed`:``}`,children:[(0,eM.jsxs)(`div`,{className:`reasoning-header`,onClick:p,children:[(0,eM.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`14`,height:`14`,viewBox:`0 0 1024 1024`,children:(0,eM.jsx)(`path`,{d:`M724.48 521.728c-1.8432 7.7824-5.7344 14.848-11.3664 20.48l-341.9136 342.016c-16.6912 16.6912-43.7248 16.6912-60.3136 0s-16.6912-43.7248 0-60.3136L622.6944 512 310.8864 200.0896c-16.6912-16.6912-16.6912-43.7248 0-60.3136 16.6912-16.6912 43.7248-16.6912 60.3136 0l341.9136 341.9136c10.8544 10.8544 14.6432 26.112 11.3664 40.0384z`,fill:`currentColor`})}),`思考过程`]}),(0,eM.jsx)(`div`,{className:`reasoning-content`,dangerouslySetInnerHTML:{__html:i}})]}),(0,eM.jsx)(`div`,{className:`body-container`,children:h?(0,eM.jsx)(`p`,{className:`loading-dots`}):(0,eM.jsx)(`div`,{className:`content-container`,dangerouslySetInnerHTML:{__html:o}})}),(0,eM.jsx)(`div`,{className:`button-container`,children:(0,eM.jsx)(ab,{title:`复制`,placement:e.role===`user`?`bottomLeft`:`bottomRight`,children:(0,eM.jsx)(`button`,{className:`icon square plain`,type:`button`,"aria-label":`复制`,onClick:m,children:n?(0,eM.jsx)(`span`,{children:`Copied`}):(0,eM.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`18`,height:`18`,viewBox:`0 0 1024 1024`,children:(0,eM.jsx)(`path`,{d:`M298.667 256V128a42.667 42.667 0 0 1 42.666-42.667h512A42.667 42.667 0 0 1 896 128v597.333A42.667 42.667 0 0 1 853.333 768h-128v128c0 23.552-19.2 42.667-42.965 42.667H170.965A42.71 42.71 0 0 1 128 896l.128-597.333c0-23.552 19.2-42.667 42.923-42.667h127.616zm-85.248 85.333-.086 512H640v-512H213.419zM384 256h341.333v426.667h85.334v-512H384V256z`})})})})})]})}),nM=(0,U.forwardRef)(({onReady:e},t)=>{let[n,r]=(0,U.useState)([]),[i,a]=(0,U.useState)(``),[o,s]=(0,U.useState)(!1),[c,l]=bb.useNotification(),u=(0,U.useRef)(null),d=(0,U.useRef)(null),f=(0,U.useRef)(null),m=(0,U.useRef)(null);(0,U.useEffect)(()=>{let t=0,n=null,r=new ResizeObserver(e=>{for(let r of e){let{height:e}=r.contentRect;e!==t&&(t=e,n!==null&&cancelAnimationFrame(n),n=requestAnimationFrame(()=>{f.current&&(f.current.style.paddingBottom=`${t-12-142-24}px`),n=null}))}});return m.current&&r.observe(m.current),e(),()=>{r.disconnect(),n!==null&&cancelAnimationFrame(n)}},[e]),(0,U.useEffect)(()=>{let e=n.at(-1);if(d.current&&e?.role===`user`){let e=f.current;e&&e.scrollTo({top:d.current.offsetTop-12,behavior:`smooth`})}},[n]);let h=e=>{e&&(e.id||=crypto.randomUUID(),r(t=>[...t,e]))},g=e=>{if(e.length)for(let t of e)h(t)},_=()=>{let e={id:crypto.randomUUID(),role:`assistant`,reasoning_content:``,content:``};r(t=>[...t,e])},v=e=>{r(t=>{let n=[...t];if(n.length>0){let t=n.at(-1);t?.role===`assistant`&&(n[n.length-1]={...t,reasoning_content:e})}return n})},y=e=>{r(t=>{let n=[...t];if(n.length>0){let t=n.at(-1);t?.role===`assistant`&&(n[n.length-1]={...t,content:e})}return n})};(0,U.useImperativeHandle)(t,()=>({pushMessage:h,pushMessages:g,pushLoadingMessage:_,updateLoadingMessageReasoningContent:v,updateLoadingMessageContent:y}));let b=e=>{let t=document.createElement(`div`);return t.textContent=e,t.innerHTML},x=async()=>{if(i.trim())try{s(!0);let e=b(i.trim());a(``);let t={id:crypto.randomUUID(),role:`user`,content:e};r(e=>[...e,t]),await p.emit(`send`,t)}finally{s(!1),u.current?.focus()}};return(0,eM.jsxs)(`div`,{className:`app-container`,ref:m,children:[l,(0,eM.jsx)(`div`,{className:`messages-container`,ref:f,children:n.map((e,t)=>(0,eM.jsx)(tM,{ref:t===n.length-1?d:null,message:e},e.id))}),(0,eM.jsxs)(`div`,{className:`bottom-container`,children:[(0,eM.jsx)(`div`,{className:`action-bar`,children:(0,eM.jsx)(ab,{title:`新对话`,placement:`bottomRight`,children:(0,eM.jsx)(`button`,{className:`icon square plain`,type:`button`,"aria-label":`新对话`,onClick:async()=>{r([]),u.current?.focus(),await p.emit(`create`),c.success({title:`已创建`,description:`新对话已创建`,placement:`top`,closable:!1})},children:(0,eM.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`18`,height:`18`,viewBox:`0 0 1024 1024`,children:(0,eM.jsx)(`path`,{d:`M597.333 128v85.333H170.667v571.094l75.221-59.094h607.445V426.667h85.334V768A42.667 42.667 0 0 1 896 810.667H275.413L85.333 960V170.667A42.667 42.667 0 0 1 128 128h469.333zm213.334 0V0H896v128h128v85.333H896v128h-85.333v-128h-128V128h128z`})})})})}),(0,eM.jsxs)(`div`,{className:`user-input-container`,children:[(0,eM.jsx)(`textarea`,{className:`user-input`,placeholder:`发消息...`,value:i,onChange:e=>a(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),x())},ref:u}),(0,eM.jsxs)(`div`,{className:`button-wrap`,children:[(0,eM.jsx)(ab,{title:`发送 (↵)`,placement:`topLeft`,children:(0,eM.jsx)(`button`,{className:`icon square plain`,type:`button`,"aria-label":`发送`,onClick:x,style:{display:o?`none`:`flex`},children:(0,eM.jsx)(`div`,{className:`submit-icon`,children:(0,eM.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`20`,height:`20`,fill:`currentColor`,children:(0,eM.jsx)(`path`,{d:`M9 16V6.414L5.707 9.707a1 1 0 1 1-1.414-1.414l5-5 .076-.068a1 1 0 0 1 1.338.068l5 5 .068.076a1 1 0 0 1-1.406 1.406l-.076-.068L11 6.414V16a1 1 0 1 1-2 0Z`})})})})}),(0,eM.jsx)(ab,{title:`停止`,placement:`topLeft`,children:(0,eM.jsx)(`button`,{className:`icon square plain`,type:`button`,"aria-label":`停止`,onClick:()=>{Fi(),s(!1),u.current?.focus(),c.info({title:`已停止`,description:`对话已停止`,placement:`top`,closable:!1})},style:{display:o?`flex`:`none`},children:(0,eM.jsx)(`div`,{className:`stop-icon`,children:(0,eM.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`20`,height:`20`,fill:`currentColor`,children:(0,eM.jsx)(`path`,{d:`M4.5 5.75c0-.69.56-1.25 1.25-1.25h8.5c.69 0 1.25.56 1.25 1.25v8.5c0 .69-.56 1.25-1.25 1.25h-8.5c-.69 0-1.25-.56-1.25-1.25v-8.5Z`})})})})})]})]})]})]})}),rM=[`button{cursor:pointer;border:0;outline:0;justify-content:center;align-items:center;display:flex}button.icon{padding:4px}button.text{height:28px;padding:0 12px}button.square{border-radius:6px}button.circle{border-radius:50%}button.primary{background-color:#0000000a}button.plain{background-color:#0000}button.error{color:#fff;background-color:#ff4d4f}button.primary:hover{background-color:#0000000f}button.plain:hover{background-color:#0000000a}button.error:hover{background-color:#ff7875}`,`.loading-dots{margin-left:3px;font-weight:700}.loading-dots:after{content:"";animation:1.5s infinite typing}@keyframes typing{0%{content:"."}33%{content:".."}66%{content:"..."}to{content:"."}}`,`.app-container{background:#fff;flex-direction:column;height:100%;display:flex}.bottom-container{margin:12px}.action-bar{align-items:center;gap:12px;margin-bottom:12px;display:flex}.user-input-container{border:1px solid #72768b29;border-radius:16px;flex-direction:column;padding:12px;display:flex;box-shadow:0 10px 30px #0003}.user-input{resize:none;border:0;width:100%;font-size:14px;line-height:1.5}.button-wrap{justify-content:flex-end;align-items:center;gap:12px;display:flex}.messages-container{flex:1;padding-top:12px;padding-left:12px;padding-right:12px;overflow:hidden auto}.message{max-width:80%;margin-bottom:12px;font-size:14px;line-height:1.5}.body-container{color:#000;border-radius:8px;padding:0 14px;overflow-x:auto}.message.user{margin-left:auto}.message.user .body-container{background:#e3f2fd}.message.assistant{margin-right:auto}.message.assistant .body-container{background:#f1f1f1}.button-container{margin-top:4px;display:flex}.button-container button{align-items:center;height:26px;display:flex}.message.user .button-container{justify-content:flex-end}.message.assistant .button-container{justify-content:flex-start}.submit-icon,.stop-icon{color:#fff;background-color:#000;border-radius:50%;justify-content:center;align-items:center;width:28px;height:28px;display:flex}.content-container{word-wrap:break-word}.message.assistant table{border-collapse:collapse;margin-block:1em}.message.assistant table th,.message.assistant table td{border:1px solid #ccc;padding:8px}.message.assistant table th{background-color:#e0e0e0}.message.assistant .reasoning-container{color:#6b7280;background-color:#f9fafb;border-radius:8px;margin-bottom:8px;padding:0 14px;font-size:12px;overflow-x:auto}.message.assistant .reasoning-container .reasoning-header{cursor:pointer;align-items:center;gap:4px;margin-bottom:8px;padding-top:8px;display:flex}.message.assistant .reasoning-container .reasoning-header svg{transition:transform .3s;transform:rotate(90deg)}.message.assistant .reasoning-container.collapsed .reasoning-header svg{transition:transform .3s;transform:rotate(0)}.message.assistant .reasoning-container.collapsed .reasoning-content{height:0;overflow:hidden}`,`*{box-sizing:border-box}textarea{padding:0}textarea:focus-visible,select:focus-visible{outline:0}.flex{display:flex}:host{position:relative}`].join(`
|
|
421
|
+
<%s key={someKey} {...props} />`,o,p,m,p),ne[p+o]=!0)}if(p=null,i!==void 0&&(r(i),p=``+i),s(n)&&(r(n.key),p=``+n.key),`key`in n)for(var h in i={},n)h!==`key`&&(i[h]=n[h]);else i=n;return p&&c(i,typeof e==`function`?e.displayName||e.name||`Unknown`:e),u(e,p,i,a(),l,d)}function f(e){p(e)?e._store&&(e._store.validated=1):typeof e==`object`&&e&&e.$$typeof===D&&(e._payload.status===`fulfilled`?p(e._payload.value)&&e._payload.value._store&&(e._payload.value._store.validated=1):e._store&&(e._store.validated=1))}function p(e){return typeof e==`object`&&!!e&&e.$$typeof===h}var m=g(),h=Symbol.for(`react.transitional.element`),_=Symbol.for(`react.portal`),v=Symbol.for(`react.fragment`),y=Symbol.for(`react.strict_mode`),b=Symbol.for(`react.profiler`),x=Symbol.for(`react.consumer`),S=Symbol.for(`react.context`),C=Symbol.for(`react.forward_ref`),w=Symbol.for(`react.suspense`),T=Symbol.for(`react.suspense_list`),E=Symbol.for(`react.memo`),D=Symbol.for(`react.lazy`),O=Symbol.for(`react.activity`),k=Symbol.for(`react.client.reference`),A=m.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,j=Object.prototype.hasOwnProperty,M=Array.isArray,N=console.createTask?console.createTask:function(){return null};m={react_stack_bottom_frame:function(e){return e()}};var ee,te={},P=m.react_stack_bottom_frame.bind(m,o)(),F=N(i(o)),ne={};e.Fragment=v,e.jsx=function(e,t,n){var r=1e4>A.recentlyCreatedOwnerStacks++;return d(e,t,n,!1,r?Error(`react-stack-top-frame`):P,r?N(i(e)):F)},e.jsxs=function(e,t,n){var r=1e4>A.recentlyCreatedOwnerStacks++;return d(e,t,n,!0,r?Error(`react-stack-top-frame`):P,r?N(i(e)):F)}})()})),eM=c(((e,t)=>{process.env.NODE_ENV===`production`?t.exports=Qj():t.exports=$j()}))(),tM=(0,U.forwardRef)(({message:e},t)=>{let[n,r]=(0,U.useState)(!1),[i,a]=(0,U.useState)(``),[o,s]=(0,U.useState)(``),[c,l]=(0,U.useState)(!0),u=(0,U.useRef)(null),d=async e=>{let t=await $b().use(cw).use(SD).use(kO,{allowDangerousHtml:!0}).use(NA,{allowDangerousHtml:!0}).process(e),n=String(t);return Zj.sanitize(n)},f=e=>e.role===`assistant`;(0,U.useEffect)(()=>{e.content?d(e.content).then(s):s(``);let t=f(e)?e.reasoning_content:void 0;t?d(t).then(a):a(``)},[e.content,f(e)?e.reasoning_content:void 0]),(0,U.useEffect)(()=>()=>{u.current&&clearTimeout(u.current)},[]);let p=()=>{l(!c)},m=t=>{t.stopPropagation();let n=e.content;navigator.clipboard.writeText(n).catch(e=>{console.error(`Failed to copy text: `,e)}).finally(()=>{u.current&&clearTimeout(u.current),r(!0),u.current=setTimeout(()=>{r(!1)},1500)})},h=!e.content;return(0,eM.jsxs)(`div`,{ref:t,className:`message ${e.role} ${h?`loading`:``}`,children:[f(e)&&i&&(0,eM.jsxs)(`div`,{className:`reasoning-container ${c?`collapsed`:``}`,children:[(0,eM.jsxs)(`div`,{className:`reasoning-header`,onClick:p,children:[(0,eM.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`14`,height:`14`,viewBox:`0 0 1024 1024`,children:(0,eM.jsx)(`path`,{d:`M724.48 521.728c-1.8432 7.7824-5.7344 14.848-11.3664 20.48l-341.9136 342.016c-16.6912 16.6912-43.7248 16.6912-60.3136 0s-16.6912-43.7248 0-60.3136L622.6944 512 310.8864 200.0896c-16.6912-16.6912-16.6912-43.7248 0-60.3136 16.6912-16.6912 43.7248-16.6912 60.3136 0l341.9136 341.9136c10.8544 10.8544 14.6432 26.112 11.3664 40.0384z`,fill:`currentColor`})}),`思考过程`]}),(0,eM.jsx)(`div`,{className:`reasoning-content`,dangerouslySetInnerHTML:{__html:i}})]}),(0,eM.jsx)(`div`,{className:`body-container`,children:h?(0,eM.jsx)(`p`,{className:`loading-dots`}):(0,eM.jsx)(`div`,{className:`content-container`,dangerouslySetInnerHTML:{__html:o}})}),(0,eM.jsx)(`div`,{className:`button-container`,children:(0,eM.jsx)(ab,{title:`复制`,placement:e.role===`user`?`bottomLeft`:`bottomRight`,children:(0,eM.jsx)(`button`,{className:`icon square plain`,type:`button`,"aria-label":`复制`,onClick:m,children:n?(0,eM.jsx)(`span`,{children:`Copied`}):(0,eM.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`18`,height:`18`,viewBox:`0 0 1024 1024`,children:(0,eM.jsx)(`path`,{d:`M298.667 256V128a42.667 42.667 0 0 1 42.666-42.667h512A42.667 42.667 0 0 1 896 128v597.333A42.667 42.667 0 0 1 853.333 768h-128v128c0 23.552-19.2 42.667-42.965 42.667H170.965A42.71 42.71 0 0 1 128 896l.128-597.333c0-23.552 19.2-42.667 42.923-42.667h127.616zm-85.248 85.333-.086 512H640v-512H213.419zM384 256h341.333v426.667h85.334v-512H384V256z`})})})})})]})}),nM=(0,U.forwardRef)(({onReady:e},t)=>{let[n,r]=(0,U.useState)([]),[i,a]=(0,U.useState)(``),[o,s]=(0,U.useState)(!1),[c,l]=(0,U.useState)(``),[u,d]=bb.useNotification(),f=(0,U.useRef)(null),m=(0,U.useRef)(null),h=(0,U.useRef)(null);(0,U.useEffect)(()=>{e()},[e]),(0,U.useEffect)(()=>{let e=n.at(-1);if(m.current&&e?.role===`user`){let e=h.current;e&&e.scrollTo({top:m.current.offsetTop-12,behavior:`smooth`})}},[n]);let g=e=>{e&&(e.id||=crypto.randomUUID(),r(t=>[...t,e]))},_=e=>{if(e.length)for(let t of e)g(t)},v=()=>{let e={id:crypto.randomUUID(),role:`assistant`,reasoning_content:``,content:``};r(t=>[...t,e])},y=e=>{r(t=>{let n=[...t];if(n.length>0){let t=n.at(-1);t?.role===`assistant`&&(n[n.length-1]={...t,reasoning_content:e})}return n})},b=e=>{r(t=>{let n=[...t];if(n.length>0){let t=n.at(-1);t?.role===`assistant`&&(n[n.length-1]={...t,content:e})}return n})},x=e=>{l(e)},S=()=>{l(``)};(0,U.useImperativeHandle)(t,()=>({pushMessage:g,pushMessages:_,pushLoadingMessage:v,updateLoadingMessageReasoningContent:y,updateLoadingMessageContent:b,updateContext:x}));let C=e=>{let t=document.createElement(`div`);return t.textContent=e,t.innerHTML},w=async()=>{if(i.trim())try{s(!0);let e=C(i.trim());a(``);let t=c?`${c}\n\n${e}`:e,n={id:crypto.randomUUID(),role:`user`,content:t};r(e=>[...e,n]),await p.emit(`send`,n)}finally{s(!1),f.current?.focus()}};return(0,eM.jsxs)(`div`,{className:`app-container`,children:[d,(0,eM.jsx)(`div`,{className:`messages-container`,ref:h,children:n.map((e,t)=>(0,eM.jsx)(tM,{ref:t===n.length-1?m:null,message:e},e.id))}),(0,eM.jsxs)(`div`,{className:`bottom-container`,children:[(0,eM.jsx)(`div`,{className:`action-bar`,children:(0,eM.jsx)(ab,{title:`新对话`,placement:`bottomRight`,children:(0,eM.jsx)(`button`,{className:`icon square plain`,type:`button`,"aria-label":`新对话`,onClick:async()=>{r([]),f.current?.focus(),await p.emit(`create`),u.success({title:`已创建`,description:`新对话已创建`,placement:`top`,closable:!1})},children:(0,eM.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`18`,height:`18`,viewBox:`0 0 1024 1024`,children:(0,eM.jsx)(`path`,{d:`M597.333 128v85.333H170.667v571.094l75.221-59.094h607.445V426.667h85.334V768A42.667 42.667 0 0 1 896 810.667H275.413L85.333 960V170.667A42.667 42.667 0 0 1 128 128h469.333zm213.334 0V0H896v128h128v85.333H896v128h-85.333v-128h-128V128h128z`})})})})}),c&&(0,eM.jsxs)(`div`,{className:`context-container`,children:[(0,eM.jsx)(`span`,{className:`context-text`,children:c}),(0,eM.jsx)(ab,{title:`删除上下文`,placement:`topLeft`,children:(0,eM.jsx)(`button`,{className:`context-delete`,type:`button`,"aria-label":`删除上下文`,onClick:S,children:(0,eM.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`14`,height:`14`,fill:`currentColor`,children:(0,eM.jsx)(`path`,{d:`M7 8.414L3.293 12.121a1 1 0 0 1-1.414-1.414L5.586 7 1.879 3.293a1 1 0 0 1 1.414-1.414L7 5.586l3.707-3.707a1 1 0 1 1 1.414 1.414L8.414 7l3.707 3.707a1 1 0 0 1-1.414 1.414L7 8.414z`})})})})]}),(0,eM.jsxs)(`div`,{className:`user-input-container`,children:[(0,eM.jsx)(`textarea`,{className:`user-input`,placeholder:`发消息...`,value:i,onChange:e=>a(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),w())},ref:f}),(0,eM.jsxs)(`div`,{className:`button-wrap`,children:[(0,eM.jsx)(ab,{title:`发送 (↵)`,placement:`topLeft`,children:(0,eM.jsx)(`button`,{className:`icon square plain`,type:`button`,"aria-label":`发送`,onClick:w,style:{display:o?`none`:`flex`},children:(0,eM.jsx)(`div`,{className:`submit-icon`,children:(0,eM.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`20`,height:`20`,fill:`currentColor`,children:(0,eM.jsx)(`path`,{d:`M9 16V6.414L5.707 9.707a1 1 0 1 1-1.414-1.414l5-5 .076-.068a1 1 0 0 1 1.338.068l5 5 .068.076a1 1 0 0 1-1.406 1.406l-.076-.068L11 6.414V16a1 1 0 1 1-2 0Z`})})})})}),(0,eM.jsx)(ab,{title:`停止`,placement:`topLeft`,children:(0,eM.jsx)(`button`,{className:`icon square plain`,type:`button`,"aria-label":`停止`,onClick:()=>{Fi(),s(!1),f.current?.focus(),u.info({title:`已停止`,description:`对话已停止`,placement:`top`,closable:!1})},style:{display:o?`flex`:`none`},children:(0,eM.jsx)(`div`,{className:`stop-icon`,children:(0,eM.jsx)(`svg`,{xmlns:`http://www.w3.org/2000/svg`,width:`20`,height:`20`,fill:`currentColor`,children:(0,eM.jsx)(`path`,{d:`M4.5 5.75c0-.69.56-1.25 1.25-1.25h8.5c.69 0 1.25.56 1.25 1.25v8.5c0 .69-.56 1.25-1.25 1.25h-8.5c-.69 0-1.25-.56-1.25-1.25v-8.5Z`})})})})})]})]})]})]})}),rM=[`button{cursor:pointer;border:0;outline:0;justify-content:center;align-items:center;display:flex}button.icon{padding:4px}button.text{height:28px;padding:0 12px}button.square{border-radius:6px}button.circle{border-radius:50%}button.primary{background-color:#0000000a}button.plain{background-color:#0000}button.error{color:#fff;background-color:#ff4d4f}button.primary:hover{background-color:#0000000f}button.plain:hover{background-color:#0000000a}button.error:hover{background-color:#ff7875}`,`.loading-dots{margin-left:3px;font-weight:700}.loading-dots:after{content:"";animation:1.5s infinite typing}@keyframes typing{0%{content:"."}33%{content:".."}66%{content:"..."}to{content:"."}}`,`.app-container{background:#fff;height:100%}.bottom-container{background:#fff;padding:12px;position:fixed;bottom:0;left:0;right:0}.action-bar{align-items:center;gap:12px;margin-bottom:12px;display:flex}.user-input-container{border:1px solid #72768b29;border-radius:16px;flex-direction:column;padding:12px;display:flex;box-shadow:0 10px 30px #0003}.user-input{resize:none;border:0;width:100%;font-size:14px;line-height:1.5}.button-wrap{justify-content:flex-end;align-items:center;gap:12px;display:flex}.messages-container{height:100%;padding:12px 12px calc(100vh - 12px);overflow:hidden auto}.message{max-width:80%;margin-bottom:12px;font-size:14px;line-height:1.5}.body-container{color:#000;border-radius:8px;padding:0 14px;overflow-x:auto}.message.user{margin-left:auto}.message.user .body-container{background:#e3f2fd}.message.assistant{margin-right:auto}.message.assistant .body-container{background:#f1f1f1}.button-container{margin-top:4px;display:flex}.button-container button{align-items:center;height:26px;display:flex}.message.user .button-container{justify-content:flex-end}.message.assistant .button-container{justify-content:flex-start}.submit-icon,.stop-icon{color:#fff;background-color:#000;border-radius:50%;justify-content:center;align-items:center;width:28px;height:28px;display:flex}.content-container{word-wrap:break-word}.message.assistant table{border-collapse:collapse;margin-block:1em}.message.assistant table th,.message.assistant table td{border:1px solid #ccc;padding:8px}.message.assistant table th{background-color:#e0e0e0}.message.assistant .reasoning-container{color:#6b7280;background-color:#f9fafb;border-radius:8px;margin-bottom:8px;padding:0 14px;font-size:12px;overflow-x:auto}.message.assistant .reasoning-container .reasoning-header{cursor:pointer;align-items:center;gap:4px;margin-bottom:8px;padding-top:8px;display:flex}.message.assistant .reasoning-container .reasoning-header svg{transition:transform .3s;transform:rotate(90deg)}.message.assistant .reasoning-container.collapsed .reasoning-header svg{transition:transform .3s;transform:rotate(0)}.message.assistant .reasoning-container.collapsed .reasoning-content{height:0;overflow:hidden}.context-container{background:#f3f4f6;border-radius:8px;align-items:center;gap:8px;margin-bottom:12px;padding:8px 12px;display:flex}.context-text{color:#374151;white-space:nowrap;text-overflow:ellipsis;flex:1;font-size:13px;overflow:hidden}.context-delete{color:#6b7280;cursor:pointer;background:0 0;border:none;border-radius:4px;flex-shrink:0;justify-content:center;align-items:center;padding:4px;transition:background-color .2s;display:flex}.context-delete:hover{color:#374151;background-color:#e5e7eb}`,`*{box-sizing:border-box}textarea{padding:0}textarea:focus-visible,select:focus-visible{outline:0}.flex{display:flex}:host{position:relative}`].join(`
|
|
422
422
|
`),iM=({domNode:e,onReady:t})=>{let n=document.createElement(`style`);n.textContent=rM,e.appendChild(n);let r=ts(),i=(0,U.createRef)();return Mi.createRoot(e).render((0,eM.jsx)(U.StrictMode,{children:(0,eM.jsx)(rs,{cache:r,container:e,children:(0,eM.jsx)(_h,{getPopupContainer:()=>e,children:(0,eM.jsx)(nM,{ref:i,onReady:t})})})})),i},aM;(function(e){e[e.AM=0]=`AM`,e[e.PM=1]=`PM`})(aM||={});var oM;(function(e){e[e.SUNDAY=0]=`SUNDAY`,e[e.MONDAY=1]=`MONDAY`,e[e.TUESDAY=2]=`TUESDAY`,e[e.WEDNESDAY=3]=`WEDNESDAY`,e[e.THURSDAY=4]=`THURSDAY`,e[e.FRIDAY=5]=`FRIDAY`,e[e.SATURDAY=6]=`SATURDAY`})(oM||={});var sM;(function(e){e[e.JANUARY=1]=`JANUARY`,e[e.FEBRUARY=2]=`FEBRUARY`,e[e.MARCH=3]=`MARCH`,e[e.APRIL=4]=`APRIL`,e[e.MAY=5]=`MAY`,e[e.JUNE=6]=`JUNE`,e[e.JULY=7]=`JULY`,e[e.AUGUST=8]=`AUGUST`,e[e.SEPTEMBER=9]=`SEPTEMBER`,e[e.OCTOBER=10]=`OCTOBER`,e[e.NOVEMBER=11]=`NOVEMBER`,e[e.DECEMBER=12]=`DECEMBER`})(sM||={});function cM(e,t){e.assign(`day`,t.getDate()),e.assign(`month`,t.getMonth()+1),e.assign(`year`,t.getFullYear())}function lM(e,t){e.assign(`hour`,t.getHours()),e.assign(`minute`,t.getMinutes()),e.assign(`second`,t.getSeconds()),e.assign(`millisecond`,t.getMilliseconds()),e.assign(`meridiem`,t.getHours()<12?aM.AM:aM.PM)}function uM(e,t){e.imply(`day`,t.getDate()),e.imply(`month`,t.getMonth()+1),e.imply(`year`,t.getFullYear())}function dM(e,t){e.imply(`hour`,t.getHours()),e.imply(`minute`,t.getMinutes()),e.imply(`second`,t.getSeconds()),e.imply(`millisecond`,t.getMilliseconds()),e.imply(`meridiem`,t.getHours()<12?aM.AM:aM.PM)}var fM={ACDT:630,ACST:570,ADT:-180,AEDT:660,AEST:600,AFT:270,AKDT:-480,AKST:-540,ALMT:360,AMST:-180,AMT:-240,ANAST:720,ANAT:720,AQTT:300,ART:-180,AST:-240,AWDT:540,AWST:480,AZOST:0,AZOT:-60,AZST:300,AZT:240,BNT:480,BOT:-240,BRST:-120,BRT:-180,BST:60,BTT:360,CAST:480,CAT:120,CCT:390,CDT:-300,CEST:120,CET:{timezoneOffsetDuringDst:120,timezoneOffsetNonDst:60,dstStart:e=>mM(e,sM.MARCH,oM.SUNDAY,2),dstEnd:e=>mM(e,sM.OCTOBER,oM.SUNDAY,3)},CHADT:825,CHAST:765,CKT:-600,CLST:-180,CLT:-240,COT:-300,CST:-360,CT:{timezoneOffsetDuringDst:-300,timezoneOffsetNonDst:-360,dstStart:e=>pM(e,sM.MARCH,oM.SUNDAY,2,2),dstEnd:e=>pM(e,sM.NOVEMBER,oM.SUNDAY,1,2)},CVT:-60,CXT:420,ChST:600,DAVT:420,EASST:-300,EAST:-360,EAT:180,ECT:-300,EDT:-240,EEST:180,EET:120,EGST:0,EGT:-60,EST:-300,ET:{timezoneOffsetDuringDst:-240,timezoneOffsetNonDst:-300,dstStart:e=>pM(e,sM.MARCH,oM.SUNDAY,2,2),dstEnd:e=>pM(e,sM.NOVEMBER,oM.SUNDAY,1,2)},FJST:780,FJT:720,FKST:-180,FKT:-240,FNT:-120,GALT:-360,GAMT:-540,GET:240,GFT:-180,GILT:720,GMT:0,GST:240,GYT:-240,HAA:-180,HAC:-300,HADT:-540,HAE:-240,HAP:-420,HAR:-360,HAST:-600,HAT:-90,HAY:-480,HKT:480,HLV:-210,HNA:-240,HNC:-360,HNE:-300,HNP:-480,HNR:-420,HNT:-150,HNY:-540,HOVT:420,ICT:420,IDT:180,IOT:360,IRDT:270,IRKST:540,IRKT:540,IRST:210,IST:330,JST:540,KGT:360,KRAST:480,KRAT:480,KST:540,KUYT:240,LHDT:660,LHST:630,LINT:840,MAGST:720,MAGT:720,MART:-510,MAWT:300,MDT:-360,MESZ:120,MEZ:60,MHT:720,MMT:390,MSD:240,MSK:180,MST:-420,MT:{timezoneOffsetDuringDst:-360,timezoneOffsetNonDst:-420,dstStart:e=>pM(e,sM.MARCH,oM.SUNDAY,2,2),dstEnd:e=>pM(e,sM.NOVEMBER,oM.SUNDAY,1,2)},MUT:240,MVT:300,MYT:480,NCT:660,NDT:-90,NFT:690,NOVST:420,NOVT:360,NPT:345,NST:-150,NUT:-660,NZDT:780,NZST:720,OMSST:420,OMST:420,PDT:-420,PET:-300,PETST:720,PETT:720,PGT:600,PHOT:780,PHT:480,PKT:300,PMDT:-120,PMST:-180,PONT:660,PST:-480,PT:{timezoneOffsetDuringDst:-420,timezoneOffsetNonDst:-480,dstStart:e=>pM(e,sM.MARCH,oM.SUNDAY,2,2),dstEnd:e=>pM(e,sM.NOVEMBER,oM.SUNDAY,1,2)},PWT:540,PYST:-180,PYT:-240,RET:240,SAMT:240,SAST:120,SBT:660,SCT:240,SGT:480,SRT:-180,SST:-660,TAHT:-600,TFT:300,TJT:300,TKT:780,TLT:540,TMT:300,TVT:720,ULAT:480,UTC:0,UYST:-120,UYT:-180,UZT:300,VET:-210,VLAST:660,VLAT:660,VUT:660,WAST:120,WAT:60,WEST:60,WESZ:60,WET:0,WEZ:0,WFT:720,WGST:-120,WGT:-180,WIB:420,WIT:540,WITA:480,WST:780,WT:0,YAKST:600,YAKT:600,YAPT:600,YEKST:360,YEKT:360};function pM(e,t,n,r,i=0){let a=0,o=0;for(;o<r;)a++,new Date(e,t-1,a).getDay()===n&&o++;return new Date(e,t-1,a,i)}function mM(e,t,n,r=0){let i=n===0?7:n,a=new Date(e,t-1+1,1,12),o=a.getDay()===0?7:a.getDay(),s;return s=o===i?7:o<i?7+o-i:o-i,a.setDate(a.getDate()-s),new Date(e,t-1,a.getDate(),r)}function hM(e,t,n={}){if(e==null)return null;if(typeof e==`number`)return e;let r=n[e]??fM[e];return r==null?null:typeof r==`number`?r:t==null?null:t>r.dstStart(t.getFullYear())&&!(t>r.dstEnd(t.getFullYear()))?r.timezoneOffsetDuringDst:r.timezoneOffsetNonDst}var gM={day:0,second:0,millisecond:0};function _M(e,t){let n=new Date(e);if(t.y&&(t.year=t.y,delete t.y),t.mo&&(t.month=t.mo,delete t.mo),t.M&&(t.month=t.M,delete t.M),t.w&&(t.week=t.w,delete t.w),t.d&&(t.day=t.d,delete t.d),t.h&&(t.hour=t.h,delete t.h),t.m&&(t.minute=t.m,delete t.m),t.s&&(t.second=t.s,delete t.s),t.ms&&(t.millisecond=t.ms,delete t.ms),`year`in t){let e=Math.floor(t.year);n.setFullYear(n.getFullYear()+e);let r=t.year-e;r>0&&(t.month=t?.month??0,t.month+=r*12)}if(`quarter`in t){let e=Math.floor(t.quarter);n.setMonth(n.getMonth()+e*3)}if(`month`in t){let e=Math.floor(t.month);n.setMonth(n.getMonth()+e);let r=t.month-e;r>0&&(t.week=t?.week??0,t.week+=r*4)}if(`week`in t){let e=Math.floor(t.week);n.setDate(n.getDate()+e*7);let r=t.week-e;r>0&&(t.day=t?.day??0,t.day+=Math.round(r*7))}if(`day`in t){let e=Math.floor(t.day);n.setDate(n.getDate()+e);let r=t.day-e;r>0&&(t.hour=t?.hour??0,t.hour+=Math.round(r*24))}if(`hour`in t){let e=Math.floor(t.hour);n.setHours(n.getHours()+e);let r=t.hour-e;r>0&&(t.minute=t?.minute??0,t.minute+=Math.round(r*60))}if(`minute`in t){let e=Math.floor(t.minute);n.setMinutes(n.getMinutes()+e);let r=t.minute-e;r>0&&(t.second=t?.second??0,t.second+=Math.round(r*60))}if(`second`in t){let e=Math.floor(t.second);n.setSeconds(n.getSeconds()+e);let r=t.second-e;r>0&&(t.millisecond=t?.millisecond??0,t.millisecond+=Math.round(r*1e3))}if(`millisecond`in t){let e=Math.floor(t.millisecond);n.setMilliseconds(n.getMilliseconds()+e)}return n}function vM(e){let t={};for(let n in e)t[n]=-e[n];return t}var yM=class e{instant;timezoneOffset;constructor(e,t){this.instant=e??new Date,this.timezoneOffset=t??null}static fromDate(t){return new e(t)}static fromInput(t,n){if(t instanceof Date)return e.fromDate(t);let r=t?.instant??new Date;return new e(r,hM(t?.timezone,r,n))}getDateWithAdjustedTimezone(){let e=new Date(this.instant);return this.timezoneOffset!==null&&e.setMinutes(e.getMinutes()-this.getSystemTimezoneAdjustmentMinute(this.instant)),e}getSystemTimezoneAdjustmentMinute(e,t){e||=new Date;let n=-e.getTimezoneOffset();return n-(t??this.timezoneOffset??n)}getTimezoneOffset(){return this.timezoneOffset??-this.instant.getTimezoneOffset()}},bM=class e{knownValues;impliedValues;reference;_tags=new Set;constructor(e,t){if(this.reference=e,this.knownValues={},this.impliedValues={},t)for(let e in t)this.knownValues[e]=t[e];let n=e.getDateWithAdjustedTimezone();this.imply(`day`,n.getDate()),this.imply(`month`,n.getMonth()+1),this.imply(`year`,n.getFullYear()),this.imply(`hour`,12),this.imply(`minute`,0),this.imply(`second`,0),this.imply(`millisecond`,0)}static createRelativeFromReference(t,n=gM){let r=_M(t.getDateWithAdjustedTimezone(),n),i=new e(t);return i.addTag(`result/relativeDate`),`hour`in n||`minute`in n||`second`in n||`millisecond`in n?(i.addTag(`result/relativeDateAndTime`),lM(i,r),cM(i,r),i.assign(`timezoneOffset`,t.getTimezoneOffset())):(dM(i,r),i.imply(`timezoneOffset`,t.getTimezoneOffset()),`day`in n?(i.assign(`day`,r.getDate()),i.assign(`month`,r.getMonth()+1),i.assign(`year`,r.getFullYear()),i.assign(`weekday`,r.getDay())):`week`in n?(i.assign(`day`,r.getDate()),i.assign(`month`,r.getMonth()+1),i.assign(`year`,r.getFullYear()),i.imply(`weekday`,r.getDay())):(i.imply(`day`,r.getDate()),`month`in n?(i.assign(`month`,r.getMonth()+1),i.assign(`year`,r.getFullYear())):(i.imply(`month`,r.getMonth()+1),`year`in n?i.assign(`year`,r.getFullYear()):i.imply(`year`,r.getFullYear())))),i}get(e){return e in this.knownValues?this.knownValues[e]:e in this.impliedValues?this.impliedValues[e]:null}isCertain(e){return e in this.knownValues}getCertainComponents(){return Object.keys(this.knownValues)}imply(e,t){return e in this.knownValues||(this.impliedValues[e]=t),this}assign(e,t){return this.knownValues[e]=t,delete this.impliedValues[e],this}addDurationAsImplied(e){let t=_M(this.dateWithoutTimezoneAdjustment(),e);return(`day`in e||`week`in e||`month`in e||`year`in e)&&(this.delete([`day`,`weekday`,`month`,`year`]),this.imply(`day`,t.getDate()),this.imply(`weekday`,t.getDay()),this.imply(`month`,t.getMonth()+1),this.imply(`year`,t.getFullYear())),(`second`in e||`minute`in e||`hour`in e)&&(this.delete([`second`,`minute`,`hour`]),this.imply(`second`,t.getSeconds()),this.imply(`minute`,t.getMinutes()),this.imply(`hour`,t.getHours())),this}delete(e){typeof e==`string`&&(e=[e]);for(let t of e)delete this.knownValues[t],delete this.impliedValues[t]}clone(){let t=new e(this.reference);t.knownValues={},t.impliedValues={};for(let e in this.knownValues)t.knownValues[e]=this.knownValues[e];for(let e in this.impliedValues)t.impliedValues[e]=this.impliedValues[e];return t}isOnlyDate(){return!this.isCertain(`hour`)&&!this.isCertain(`minute`)&&!this.isCertain(`second`)}isOnlyTime(){return!this.isCertain(`weekday`)&&!this.isCertain(`day`)&&!this.isCertain(`month`)&&!this.isCertain(`year`)}isOnlyWeekdayComponent(){return this.isCertain(`weekday`)&&!this.isCertain(`day`)&&!this.isCertain(`month`)}isDateWithUnknownYear(){return this.isCertain(`month`)&&!this.isCertain(`year`)}isValidDate(){let e=this.dateWithoutTimezoneAdjustment();return!(e.getFullYear()!==this.get(`year`)||e.getMonth()!==this.get(`month`)-1||e.getDate()!==this.get(`day`)||this.get(`hour`)!=null&&e.getHours()!=this.get(`hour`)||this.get(`minute`)!=null&&e.getMinutes()!=this.get(`minute`))}toString(){return`[ParsingComponents {
|
|
423
423
|
tags: ${JSON.stringify(Array.from(this._tags).sort())},
|
|
424
424
|
knownValues: ${JSON.stringify(this.knownValues)},
|
|
425
425
|
impliedValues: ${JSON.stringify(this.impliedValues)}},
|
|
426
|
-
reference: ${JSON.stringify(this.reference)}]`}date(){let e=this.dateWithoutTimezoneAdjustment(),t=this.reference.getSystemTimezoneAdjustmentMinute(e,this.get(`timezoneOffset`));return new Date(e.getTime()+t*6e4)}addTag(e){return this._tags.add(e),this}addTags(e){for(let t of e)this._tags.add(t);return this}tags(){return new Set(this._tags)}dateWithoutTimezoneAdjustment(){let e=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 e.setFullYear(this.get(`year`)),e}},xM=class e{refDate;index;text;reference;start;end;constructor(e,t,n,r,i){this.reference=e,this.refDate=e.instant,this.index=t,this.text=n,this.start=r||new bM(e),this.end=i}clone(){let t=new e(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(e){return this.start.addTag(e),this.end&&this.end.addTag(e),this}addTags(e){return this.start.addTags(e),this.end&&this.end.addTags(e),this}tags(){let e=new Set(this.start.tags());if(this.end)for(let t of this.end.tags())e.add(t);return e}toString(){let e=Array.from(this.tags()).sort();return`[ParsingResult {index: ${this.index}, text: '${this.text}', tags: ${JSON.stringify(e)} ...}]`}};function SM(e,t,n=`\\s{0,5},?\\s{0,5}`){let r=t.replace(/\((?!\?)/g,`(?:`);return`${e}${r}(?:${n}${r}){0,10}`}function CM(e){let t;return t=e instanceof Array?[...e]:e instanceof Map?Array.from(e.keys()):Object.keys(e),t}function wM(e){return`(?:${CM(e).sort((e,t)=>t.length-e.length).join(`|`).replace(/\./g,`\\.`)})`}function TM(e){return e<100&&(e>50?e+=1900:e+=2e3),e}function EM(e,t,n){let r=new Date(e);r.setMonth(n-1),r.setDate(t);let i=_M(r,{year:1}),a=_M(r,{year:-1});return Math.abs(i.getTime()-e.getTime())<Math.abs(r.getTime()-e.getTime())?r=i:Math.abs(a.getTime()-e.getTime())<Math.abs(r.getTime()-e.getTime())&&(r=a),r.getFullYear()}var DM={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},OM={january:1,february:2,march:3,april:4,may:5,june:6,july:7,august:8,september:9,october:10,november:11,december:12},kM={...OM,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},AM={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12},jM={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},MM={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`},NM={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`,...MM},PM=`(?:${wM(AM)}|[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 FM(e){let t=e.toLowerCase();return AM[t]===void 0?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):AM[t]}var IM=`(?:${wM(jM)}|[0-9]{1,2}(?:st|nd|rd|th)?)`;function LM(e){let t=e.toLowerCase();return jM[t]===void 0?(t=t.replace(/(?:st|nd|rd|th)$/i,``),parseInt(t)):jM[t]}var RM=`(?:[1-9][0-9]{0,3}\\s{0,2}(?:BE|AD|BC|BCE|CE)|[1-9][0-9]{3}|[5-9][0-9]|2[0-5])`;function zM(e){return/BE/i.test(e)?(e=e.replace(/BE/i,``),parseInt(e)-543):/BCE?/i.test(e)?(e=e.replace(/BCE?/i,``),-parseInt(e)):/(AD|CE)/i.test(e)?(e=e.replace(/(AD|CE)/i,``),parseInt(e)):TM(parseInt(e))}var BM=`(${PM})\\s{0,3}(${wM(NM)})`,VM=new RegExp(BM,`i`),HM=`(${PM})\\s{0,3}(${wM(MM)})`,UM=`\\s{0,5},?(?:\\s*and)?\\s{0,5}`,WM=SM(`(?:(?:about|around)\\s{0,3})?`,BM,UM),GM=SM(`(?:(?:about|around)\\s{0,3})?`,HM,UM);function KM(e){let t={},n=e,r=VM.exec(n);for(;r;)qM(t,r),n=n.substring(r[0].length).trim(),r=VM.exec(n);return Object.keys(t).length==0?null:t}function qM(e,t){if(t[0].match(/^[a-zA-Z]+$/))return;let n=FM(t[1]),r=NM[t[2].toLowerCase()];e[r]=n}var JM=class{innerPatternHasChange(e,t){return this.innerPattern(e)!==t}patternLeftBoundary(){return`(\\W|^)`}cachedInnerPattern=null;cachedPattern=null;pattern(e){return this.cachedInnerPattern&&!this.innerPatternHasChange(e,this.cachedInnerPattern)?this.cachedPattern:(this.cachedInnerPattern=this.innerPattern(e),this.cachedPattern=RegExp(`${this.patternLeftBoundary()}${this.cachedInnerPattern.source}`,this.cachedInnerPattern.flags),this.cachedPattern)}extract(e,t){let n=t[1]??``;t.index+=n.length,t[0]=t[0].substring(n.length);for(let e=2;e<t.length;e++)t[e-1]=t[e];return this.innerExtract(e,t)}},YM=RegExp(`(?:(?:within|in|for)\\s*)?(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${WM})(?=\\W|$)`,`i`),XM=RegExp(`(?:within|in|for)\\s*(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${WM})(?=\\W|$)`,`i`),ZM=RegExp(`(?:within|in|for)\\s*(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${GM})(?=\\W|$)`,`i`),QM=class extends JM{strictMode;constructor(e){super(),this.strictMode=e}innerPattern(e){return this.strictMode?ZM:e.option.forwardDate?YM:XM}innerExtract(e,t){if(t[0].match(/^for\s*the\s*\w+/))return null;let n=KM(t[1]);return n?bM.createRelativeFromReference(e.reference,n):null}},$M=RegExp(`(?:on\\s{0,3})?(${IM})(?:\\s{0,3}(?:to|\\-|\\–|until|through|till)?\\s{0,3}(${IM}))?(?:-|/|\\s{0,3}(?:of)?\\s{0,3})(${wM(kM)})(?:(?:-|/|,?\\s{0,3})(${RM}(?!\\w)))?(?=\\W|\$)`,`i`),eN=1,tN=2,nN=3,rN=4,iN=class extends JM{innerPattern(){return $M}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),r=kM[t[nN].toLowerCase()],i=LM(t[eN]);if(i>31)return t.index+=t[eN].length,null;if(n.start.assign(`month`,r),n.start.assign(`day`,i),t[rN]){let e=zM(t[rN]);n.start.assign(`year`,e)}else{let t=EM(e.refDate,i,r);n.start.imply(`year`,t)}if(t[tN]){let e=LM(t[tN]);n.end=n.start.clone(),n.end.assign(`day`,e)}return n}},aN=RegExp(`(${wM(kM)})(?:-|/|\\s*,?\\s*)(${IM})(?!\\s*(?:am|pm))\\s*(?:(?:to|\\-)\\s*(${IM})\\s*)?(?:(?:-|/|\\s*,\\s*|\\s+)(${RM}))?(?=\\W|\$)(?!\\:\\d)`,`i`),oN=1,sN=2,cN=3,lN=4,uN=class extends JM{shouldSkipYearLikeDate;constructor(e){super(),this.shouldSkipYearLikeDate=e}innerPattern(){return aN}innerExtract(e,t){let n=kM[t[oN].toLowerCase()],r=LM(t[sN]);if(r>31||this.shouldSkipYearLikeDate&&!t[cN]&&!t[lN]&&t[sN].match(/^2[0-5]$/))return null;let i=e.createParsingComponents({day:r,month:n}).addTag(`parser/ENMonthNameMiddleEndianParser`);if(t[lN]){let e=zM(t[lN]);i.assign(`year`,e)}else{let t=EM(e.refDate,r,n);i.imply(`year`,t)}if(!t[cN])return i;let a=LM(t[cN]),o=e.createParsingResult(t.index,t[0]);return o.start=i,o.end=i.clone(),o.end.assign(`day`,a),o}},dN=RegExp(`((?:in)\\s*)?(${wM(kM)})\\s*(?:(?:,|-|of)?\\s*(${RM})?)?(?=[^\\s\\w]|\\s+[^0-9]|\\s+\$|\$)`,`i`),fN=1,pN=2,mN=3,hN=class extends JM{innerPattern(){return dN}innerExtract(e,t){let n=t[pN].toLowerCase();if(t[0].length<=3&&!OM[n])return null;let r=e.createParsingResult(t.index+(t[fN]||``).length,t.index+t[0].length);r.start.imply(`day`,1),r.start.addTag(`parser/ENMonthNameParser`);let i=kM[n];if(r.start.assign(`month`,i),t[mN]){let e=zM(t[mN]);r.start.assign(`year`,e)}else{let t=EM(e.refDate,1,i);r.start.imply(`year`,t)}return r}},gN=RegExp(`([0-9]{4})[-\\.\\/\\s](?:(${wM(kM)})|([0-9]{1,2}))[-\\.\\/\\s]([0-9]{1,2})(?=\\W|\$)`,`i`),_N=1,vN=2,yN=3,bN=4,xN=class extends JM{strictMonthDateOrder;constructor(e){super(),this.strictMonthDateOrder=e}innerPattern(){return gN}innerExtract(e,t){let n=parseInt(t[_N]),r=parseInt(t[bN]),i=t[yN]?parseInt(t[yN]):kM[t[vN].toLowerCase()];if(i<1||i>12){if(this.strictMonthDateOrder)return null;r>=1&&r<=12&&([i,r]=[r,i])}return r<1||r>31?null:{day:r,month:i,year:n}}},SN=RegExp(`([0-9]|0[1-9]|1[012])/([0-9]{4})`,`i`),CN=1,wN=2,TN=class extends JM{innerPattern(){return SN}innerExtract(e,t){let n=parseInt(t[wN]),r=parseInt(t[CN]);return e.createParsingComponents().imply(`day`,1).assign(`month`,r).assign(`year`,n)}};function EN(e,t,n,r){return RegExp(`${e}${t}(\\d{1,4})(?:(?:\\.|:|:)(\\d{1,2})(?:(?::|:)(\\d{2})(?:\\.(\\d{1,6}))?)?)?(?:\\s*(a\\.m\\.|p\\.m\\.|am?|pm?))?${n}`,r)}function DN(e,t){return RegExp(`^(${e})(\\d{1,4})(?:(?:\\.|\\:|\\:)(\\d{1,2})(?:(?:\\.|\\:|\\:)(\\d{1,2})(?:\\.(\\d{1,6}))?)?)?(?:\\s*(a\\.m\\.|p\\.m\\.|am?|pm?))?${t}`,`i`)}var ON=2,kN=3,AN=4,jN=5,MN=6,NN=class{strictMode;constructor(e=!1){this.strictMode=e}patternFlags(){return`i`}primaryPatternLeftBoundary(){return`(^|\\s|T|\\b)`}primarySuffix(){return`(?!/)(?=\\W|$)`}followingSuffix(){return`(?!/)(?=\\W|$)`}pattern(e){return this.getPrimaryTimePatternThroughCache()}extract(e,t){let n=this.extractPrimaryTimeComponents(e,t);if(!n)return t[0].match(/^\d{4}/)?(t.index+=4,null):(t.index+=t[0].length,null);let r=t.index+t[1].length,i=t[0].substring(t[1].length),a=e.createParsingResult(r,i,n);t.index+=t[0].length;let o=e.text.substring(t.index),s=this.getFollowingTimePatternThroughCache().exec(o);return i.match(/^\d{3,4}/)&&s&&(s[0].match(/^\s*([+-])\s*\d{2,4}$/)||s[0].match(/^\s*([+-])\s*\d{2}\W\d{2}/))?null:!s||s[0].match(/^\s*([+-])\s*\d{3,4}$/)?this.checkAndReturnWithoutFollowingPattern(a):(a.end=this.extractFollowingTimeComponents(e,s,a),a.end&&(a.text+=s[0]),this.checkAndReturnWithFollowingPattern(a))}extractPrimaryTimeComponents(e,t,n=!1){let r=e.createParsingComponents(),i=0,a=null,o=parseInt(t[ON]);if(o>100){if(t[ON].length==4&&t[kN]==null&&!t[MN]||this.strictMode||t[kN]!=null)return null;i=o%100,o=Math.floor(o/100)}if(o>24)return null;if(t[kN]!=null){if(t[kN].length==1&&!t[MN])return null;i=parseInt(t[kN])}if(i>=60)return null;if(o>12&&(a=aM.PM),t[MN]!=null){if(o>12)return null;let e=t[MN][0].toLowerCase();e==`a`&&(a=aM.AM,o==12&&(o=0)),e==`p`&&(a=aM.PM,o!=12&&(o+=12))}if(r.assign(`hour`,o),r.assign(`minute`,i),a===null?o<12?r.imply(`meridiem`,aM.AM):r.imply(`meridiem`,aM.PM):r.assign(`meridiem`,a),t[jN]!=null){let e=parseInt(t[jN].substring(0,3));if(e>=1e3)return null;r.assign(`millisecond`,e)}if(t[AN]!=null){let e=parseInt(t[AN]);if(e>=60)return null;r.assign(`second`,e)}return r}extractFollowingTimeComponents(e,t,n){let r=e.createParsingComponents();if(t[jN]!=null){let e=parseInt(t[jN].substring(0,3));if(e>=1e3)return null;r.assign(`millisecond`,e)}if(t[AN]!=null){let e=parseInt(t[AN]);if(e>=60)return null;r.assign(`second`,e)}let i=parseInt(t[ON]),a=0,o=-1;if(t[kN]==null?i>100&&(a=i%100,i=Math.floor(i/100)):a=parseInt(t[kN]),a>=60||i>24)return null;if(i>=12&&(o=aM.PM),t[MN]!=null){if(i>12)return null;let e=t[MN][0].toLowerCase();e==`a`&&(o=aM.AM,i==12&&(i=0,r.isCertain(`day`)||r.imply(`day`,r.get(`day`)+1))),e==`p`&&(o=aM.PM,i!=12&&(i+=12)),n.start.isCertain(`meridiem`)||(o==aM.AM?(n.start.imply(`meridiem`,aM.AM),n.start.get(`hour`)==12&&n.start.assign(`hour`,0)):(n.start.imply(`meridiem`,aM.PM),n.start.get(`hour`)!=12&&n.start.assign(`hour`,n.start.get(`hour`)+12)))}return r.assign(`hour`,i),r.assign(`minute`,a),o>=0?r.assign(`meridiem`,o):n.start.isCertain(`meridiem`)&&n.start.get(`hour`)>12?n.start.get(`hour`)-12>i?r.imply(`meridiem`,aM.AM):i<=12&&(r.assign(`hour`,i+12),r.assign(`meridiem`,aM.PM)):i>12?r.imply(`meridiem`,aM.PM):i<=12&&r.imply(`meridiem`,aM.AM),r.date().getTime()<n.start.date().getTime()&&r.imply(`day`,r.get(`day`)+1),r}checkAndReturnWithoutFollowingPattern(e){if(e.text.match(/^\d$/)||e.text.match(/^\d\d\d+$/)||e.text.match(/\d[apAP]$/))return null;let t=e.text.match(/[^\d:.](\d[\d.]+)$/);if(t){let e=t[1];if(this.strictMode||e.includes(`.`)&&!e.match(/\d(\.\d{2})+$/)||parseInt(e)>24)return null}return e}checkAndReturnWithFollowingPattern(e){if(e.text.match(/^\d+-\d+$/))return null;let t=e.text.match(/[^\d:.](\d[\d.]+)\s*-\s*(\d[\d.]+)$/);if(t){if(this.strictMode)return null;let e=t[1],n=t[2];if(n.includes(`.`)&&!n.match(/\d(\.\d{2})+$/)||parseInt(n)>24||parseInt(e)>24)return null}return e}cachedPrimaryPrefix=null;cachedPrimarySuffix=null;cachedPrimaryTimePattern=null;getPrimaryTimePatternThroughCache(){let e=this.primaryPrefix(),t=this.primarySuffix();return this.cachedPrimaryPrefix===e&&this.cachedPrimarySuffix===t?this.cachedPrimaryTimePattern:(this.cachedPrimaryTimePattern=EN(this.primaryPatternLeftBoundary(),e,t,this.patternFlags()),this.cachedPrimaryPrefix=e,this.cachedPrimarySuffix=t,this.cachedPrimaryTimePattern)}cachedFollowingPhase=null;cachedFollowingSuffix=null;cachedFollowingTimePatten=null;getFollowingTimePatternThroughCache(){let e=this.followingPhase(),t=this.followingSuffix();return this.cachedFollowingPhase===e&&this.cachedFollowingSuffix===t?this.cachedFollowingTimePatten:(this.cachedFollowingTimePatten=DN(e,t),this.cachedFollowingPhase=e,this.cachedFollowingSuffix=t,this.cachedFollowingTimePatten)}},PN=class extends NN{constructor(e){super(e)}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(e,t){let n=super.extractPrimaryTimeComponents(e,t);if(!n)return n;if(t[0].endsWith(`night`)){let e=n.get(`hour`);e>=6&&e<12?(n.assign(`hour`,n.get(`hour`)+12),n.assign(`meridiem`,aM.PM)):e<6&&n.assign(`meridiem`,aM.AM)}if(t[0].endsWith(`afternoon`)){n.assign(`meridiem`,aM.PM);let e=n.get(`hour`);e>=0&&e<=6&&n.assign(`hour`,n.get(`hour`)+12)}return t[0].endsWith(`morning`)&&(n.assign(`meridiem`,aM.AM),n.get(`hour`)<12&&n.assign(`hour`,n.get(`hour`))),n.addTag(`parser/ENTimeExpressionParser`)}extractFollowingTimeComponents(e,t,n){let r=super.extractFollowingTimeComponents(e,t,n);return r&&r.addTag(`parser/ENTimeExpressionParser`),r}},FN=RegExp(`(${WM})\\s{0,5}(?:ago|before|earlier)(?=\\W|$)`,`i`),IN=RegExp(`(${GM})\\s{0,5}(?:ago|before|earlier)(?=\\W|$)`,`i`),LN=class extends JM{strictMode;constructor(e){super(),this.strictMode=e}innerPattern(){return this.strictMode?IN:FN}innerExtract(e,t){let n=KM(t[1]);return n?bM.createRelativeFromReference(e.reference,vM(n)):null}},RN=RegExp(`(${WM})\\s{0,5}(?:later|after|from now|henceforth|forward|out)(?=(?:\\W|\$))`,`i`),zN=RegExp(`(${GM})\\s{0,5}(later|after|from now)(?=\\W|$)`,`i`),BN=1,VN=class extends JM{strictMode;constructor(e){super(),this.strictMode=e}innerPattern(){return this.strictMode?zN:RN}innerExtract(e,t){let n=KM(t[BN]);return n?bM.createRelativeFromReference(e.reference,n):null}},HN=class{refine(e,t){return t.filter(t=>this.isValid(e,t))}},UN=class{refine(e,t){if(t.length<2)return t;let n=[],r=t[0],i=null;for(let a=1;a<t.length;a++){i=t[a];let o=e.text.substring(r.index+r.text.length,i.index);if(!this.shouldMergeResults(o,r,i,e))n.push(r),r=i;else{let t=r,n=i,a=this.mergeResults(o,t,n,e);e.debug(()=>{console.log(`${this.constructor.name} merged ${t} and ${n} into ${a}`)}),r=a}}return r!=null&&n.push(r),n}},WN=class extends UN{shouldMergeResults(e,t,n){return!t.end&&!n.end&&e.match(this.patternBetween())!=null}mergeResults(e,t,n){if(!t.start.isOnlyWeekdayComponent()&&!n.start.isOnlyWeekdayComponent()&&(n.start.getCertainComponents().forEach(e=>{t.start.isCertain(e)||t.start.imply(e,n.start.get(e))}),t.start.getCertainComponents().forEach(e=>{n.start.isCertain(e)||n.start.imply(e,t.start.get(e))})),t.start.date()>n.start.date()){let e=t.start.date(),r=n.start.date();n.start.isOnlyWeekdayComponent()&&_M(r,{day:7})>e?(r=_M(r,{day:7}),n.start.imply(`day`,r.getDate()),n.start.imply(`month`,r.getMonth()+1),n.start.imply(`year`,r.getFullYear())):t.start.isOnlyWeekdayComponent()&&_M(e,{day:-7})<r?(e=_M(e,{day:-7}),t.start.imply(`day`,e.getDate()),t.start.imply(`month`,e.getMonth()+1),t.start.imply(`year`,e.getFullYear())):n.start.isDateWithUnknownYear()&&_M(r,{year:1})>e?(r=_M(r,{year:1}),n.start.imply(`year`,r.getFullYear())):t.start.isDateWithUnknownYear()&&_M(e,{year:-1})<r?(e=_M(e,{year:-1}),t.start.imply(`year`,e.getFullYear())):[n,t]=[t,n]}let r=t.clone();return r.start=t.start,r.end=n.start,r.index=Math.min(t.index,n.index),t.index<n.index?r.text=t.text+e+n.text:r.text=n.text+e+t.text,r}},GN=class extends WN{patternBetween(){return/^\s*(to|-|–|until|through|till)\s*$/i}};function KN(e,t){let n=e.clone(),r=e.start,i=t.start;if(n.start=qN(r,i),e.end!=null||t.end!=null){let r=qN(e.end==null?e.start:e.end,t.end==null?t.start:t.end);if(e.end==null&&r.date().getTime()<n.start.date().getTime()){let e=new Date(r.date().getTime());e.setDate(e.getDate()+1),r.isCertain(`day`)?cM(r,e):uM(r,e)}n.end=r}return n}function qN(e,t){let n=e.clone();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`));let r=e.get(`meridiem`)!=null&&(e.isCertain(`meridiem`)||Array.from(e.tags()).some(e=>e.startsWith(`casualReference/`)));return t.isCertain(`meridiem`)?n.assign(`meridiem`,t.get(`meridiem`)):t.get(`meridiem`)!=null&&!r&&n.imply(`meridiem`,t.get(`meridiem`)),n.get(`meridiem`)==aM.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}var JN=class extends UN{shouldMergeResults(e,t,n){return(t.start.isOnlyDate()&&n.start.isOnlyTime()||n.start.isOnlyDate()&&t.start.isOnlyTime())&&e.match(this.patternBetween())!=null}mergeResults(e,t,n){let r=t.start.isOnlyDate()?KN(t,n):KN(n,t);return r.index=t.index,r.text=t.text+e+n.text,r}},YN=class extends JN{patternBetween(){return RegExp(`^\\s*(T|at|after|before|on|of|,|-|\\.|∙|:)?\\s*$`)}},XN=RegExp(`^\\s*,?\\s*\\(?([A-Z]{2,4})\\)?(?=\\W|$)`,`i`),ZN=class{timezoneOverrides;constructor(e){this.timezoneOverrides=e}refine(e,t){let n=e.option.timezones??{};return t.forEach(t=>{let r=e.text.substring(t.index+t.text.length),i=XN.exec(r);if(!i)return;let a=i[1].toUpperCase(),o=hM(a,t.start.date()??t.refDate??new Date,{...this.timezoneOverrides,...n});if(o==null)return;e.debug(()=>{console.log(`Extracting timezone: '${a}' into: ${o} for: ${t.start}`)});let s=t.start.get(`timezoneOffset`);s!==null&&o!=s&&(t.start.isCertain(`timezoneOffset`)||a!=i[1])||t.start.isOnlyDate()&&a!=i[1]||(t.text+=i[0],t.start.isCertain(`timezoneOffset`)||t.start.assign(`timezoneOffset`,o),t.end!=null&&!t.end.isCertain(`timezoneOffset`)&&t.end.assign(`timezoneOffset`,o))}),t}},QN=RegExp(`^\\s*(?:\\(?(?:GMT|UTC)\\s?)?([+-])(\\d{1,2})(?::?(\\d{2}))?\\)?`,`i`),$N=1,eP=2,tP=3,nP=class{refine(e,t){return t.forEach(function(t){if(t.start.isCertain(`timezoneOffset`))return;let n=e.text.substring(t.index+t.text.length),r=QN.exec(n);if(!r)return;e.debug(()=>{console.log(`Extracting timezone: '${r[0]}' into : ${t}`)});let i=parseInt(r[eP]),a=parseInt(r[tP]||`0`),o=i*60+a;o>840||(r[$N]===`-`&&(o=-o),t.end!=null&&t.end.assign(`timezoneOffset`,o),t.start.assign(`timezoneOffset`,o),t.text+=r[0])}),t}},rP=class{refine(e,t){if(t.length<2)return t;let n=[],r=t[0];for(let i=1;i<t.length;i++){let a=t[i];if(a.index>=r.index+r.text.length){n.push(r),r=a;continue}let o=null,s=null;a.text.length>r.text.length?(o=a,s=r):(o=r,s=a),e.debug(()=>{console.log(`${this.constructor.name} remove ${s} by ${o}`)}),r=o}return r!=null&&n.push(r),n}};function iP(e,t,n){let r=aP(e.getDateWithAdjustedTimezone(),t,n),i=new bM(e);return i=i.addDurationAsImplied({day:r}),i.assign(`weekday`,t),i}function aP(e,t,n){let r=e.getDay();switch(n){case`this`:return sP(e,t);case`last`:return cP(e,t);case`next`:return r==oM.SUNDAY?t==oM.SUNDAY?7:t:r==oM.SATURDAY?t==oM.SATURDAY?7:t==oM.SUNDAY?8:1+t:t<r&&t!=oM.SUNDAY?sP(e,t):sP(e,t)+7}return oP(e,t)}function oP(e,t){let n=cP(e,t),r=sP(e,t);return r<-n?r:n}function sP(e,t){let n=t-e.getDay();return n<0&&(n+=7),n}function cP(e,t){let n=t-e.getDay();return n>=0&&(n-=7),n}var lP=class{refine(e,t){return e.option.forwardDate&&t.forEach(t=>{let n=e.reference.getDateWithAdjustedTimezone();if(t.start.isOnlyTime()&&e.reference.instant>t.start.date()){let n=e.reference.getDateWithAdjustedTimezone(),r=new Date(n);r.setDate(r.getDate()+1),uM(t.start,r),e.debug(()=>{console.log(`${this.constructor.name} adjusted ${t} time from the ref date (${n}) to the following day (${r})`)}),t.end&&t.end.isOnlyTime()&&(uM(t.end,r),t.start.date()>t.end.date()&&(r.setDate(r.getDate()+1),uM(t.end,r)))}if(t.start.isOnlyWeekdayComponent()&&n>t.start.date()){let r=_M(n,{day:sP(n,t.start.get(`weekday`))||7});if(uM(t.start,r),e.debug(()=>{console.log(`${this.constructor.name} adjusted ${t} weekday (${t.start})`)}),t.end&&t.start.date()>t.end.date()){let r=_M(n,{day:sP(n,t.start.get(`weekday`))||7});uM(t.end,r),e.debug(()=>{console.log(`${this.constructor.name} adjusted ${t} weekday (${t.end})`)})}}if(t.start.isDateWithUnknownYear()&&n>t.start.date())for(let r=0;r<3&&n>t.start.date();r++)t.start.imply(`year`,t.start.get(`year`)+1),e.debug(()=>{console.log(`${this.constructor.name} adjusted ${t} year (${t.start})`)}),t.end&&!t.end.isCertain(`year`)&&(t.end.imply(`year`,t.end.get(`year`)+1),e.debug(()=>{console.log(`${this.constructor.name} adjusted ${t} month (${t.start})`)}))}),t}},uP=class extends HN{strictMode;constructor(e){super(),this.strictMode=e}isValid(e,t){return t.text.replace(` `,``).match(/^\d*(\.\d*)?$/)?(e.debug(()=>{console.log(`Removing unlikely result '${t.text}'`)}),!1):t.start.isValidDate()?t.end&&!t.end.isValidDate()?(e.debug(()=>{console.log(`Removing invalid result: ${t} (${t.end})`)}),!1):this.strictMode?this.isStrictModeValid(e,t):!0:(e.debug(()=>{console.log(`Removing invalid result: ${t} (${t.start})`)}),!1)}isStrictModeValid(e,t){return t.start.isOnlyWeekdayComponent()?(e.debug(()=>{console.log(`(Strict) Removing weekday only component: ${t} (${t.end})`)}),!1):!0}},dP=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`),fP=1,pP=2,mP=3,hP=4,gP=5,_P=6,vP=7,yP=8,bP=9,xP=10,SP=class extends JM{innerPattern(){return dP}innerExtract(e,t){let n=e.createParsingComponents({year:parseInt(t[fP]),month:parseInt(t[pP]),day:parseInt(t[mP])});if(t[hP]!=null&&(n.assign(`hour`,parseInt(t[hP])),n.assign(`minute`,parseInt(t[gP])),t[_P]!=null&&n.assign(`second`,parseInt(t[_P])),t[vP]!=null&&n.assign(`millisecond`,parseInt(t[vP])),t[yP]!=null)){let e=0;if(t[bP]){let n=parseInt(t[bP]),r=0;t[xP]!=null&&(r=parseInt(t[xP])),e=n*60,e<0?e-=r:e+=r}n.assign(`timezoneOffset`,e)}return n.addTag(`parser/ISOFormatParser`)}},CP=class extends UN{mergeResults(e,t,n){let r=n.clone();return r.index=t.index,r.text=t.text+e+r.text,r.start.assign(`weekday`,t.start.get(`weekday`)),r.end&&r.end.assign(`weekday`,t.start.get(`weekday`)),r}shouldMergeResults(e,t,n){return t.start.isOnlyWeekdayComponent()&&!t.start.isCertain(`hour`)&&n.start.isCertain(`day`)&&e.match(/^,?\s*$/)!=null}};function wP(e,t=!1){return e.parsers.unshift(new SP),e.refiners.unshift(new CP),e.refiners.unshift(new nP),e.refiners.unshift(new rP),e.refiners.push(new ZN),e.refiners.push(new rP),e.refiners.push(new lP),e.refiners.push(new uP(t)),e}function TP(e){let t=e.getDateWithAdjustedTimezone(),n=new bM(e,{});return cM(n,t),lM(n,t),n.assign(`timezoneOffset`,e.getTimezoneOffset()),n.addTag(`casualReference/now`),n}function EP(e){let t=e.getDateWithAdjustedTimezone(),n=new bM(e,{});return cM(n,t),dM(n,t),n.delete(`meridiem`),n.addTag(`casualReference/today`),n}function DP(e){return kP(e,1).addTag(`casualReference/yesterday`)}function OP(e){return AP(e,1).addTag(`casualReference/tomorrow`)}function kP(e,t){return AP(e,-t)}function AP(e,t){let n=e.getDateWithAdjustedTimezone(),r=new bM(e,{}),i=new Date(n.getTime());return i.setDate(i.getDate()+t),cM(r,i),dM(r,i),r.delete(`meridiem`),r}function jP(e,t=22){let n=e.getDateWithAdjustedTimezone(),r=new bM(e,{});return cM(r,n),r.imply(`hour`,t),r.imply(`meridiem`,aM.PM),r.addTag(`casualReference/tonight`),r}function MP(e,t=20){let n=new bM(e,{});return n.imply(`meridiem`,aM.PM),n.imply(`hour`,t),n.addTag(`casualReference/evening`),n}function NP(e){let t=new bM(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 PP(e,t=6){let n=new bM(e,{});return n.imply(`meridiem`,aM.AM),n.imply(`hour`,t),n.imply(`minute`,0),n.imply(`second`,0),n.imply(`millisecond`,0),n.addTag(`casualReference/morning`),n}function FP(e,t=15){let n=new bM(e,{});return n.imply(`meridiem`,aM.PM),n.imply(`hour`,t),n.imply(`minute`,0),n.imply(`second`,0),n.imply(`millisecond`,0),n.addTag(`casualReference/afternoon`),n}function IP(e){let t=new bM(e,{});return t.imply(`meridiem`,aM.AM),t.assign(`hour`,12),t.imply(`minute`,0),t.imply(`second`,0),t.imply(`millisecond`,0),t.addTag(`casualReference/noon`),t}var LP=/(now|today|tonight|tomorrow|overmorrow|tmr|tmrw|yesterday|last\s*night)(?=\W|$)/i,RP=class extends JM{innerPattern(e){return LP}innerExtract(e,t){let n=e.refDate,r=t[0].toLowerCase(),i=e.createParsingComponents();switch(r){case`now`:i=TP(e.reference);break;case`today`:i=EP(e.reference);break;case`yesterday`:i=DP(e.reference);break;case`tomorrow`:case`tmr`:case`tmrw`:i=OP(e.reference);break;case`tonight`:i=jP(e.reference);break;case`overmorrow`:i=AP(e.reference,2);break;default:if(r.match(/last\s*night/)){if(n.getHours()>6){let e=new Date(n.getTime());e.setDate(e.getDate()-1),n=e}cM(i,n),i.imply(`hour`,0)}break}return i.addTag(`parser/ENCasualDateParser`),i}},zP=/(?:this)?\s{0,3}(morning|afternoon|evening|night|midnight|midday|noon)(?=\W|$)/i,BP=class extends JM{innerPattern(){return zP}innerExtract(e,t){let n=null;switch(t[1].toLowerCase()){case`afternoon`:n=FP(e.reference);break;case`evening`:case`night`:n=MP(e.reference);break;case`midnight`:n=NP(e.reference);break;case`morning`:n=PP(e.reference);break;case`noon`:case`midday`:n=IP(e.reference);break}return n&&n.addTag(`parser/ENCasualTimeParser`),n}},VP=RegExp(`(?:(?:\\,|\\(|\\()\\s*)?(?:on\\s*?)?(?:(this|last|past|next)\\s*)?(${wM(DM)}|weekend|weekday)(?:\\s*(?:\\,|\\)|\\)))?(?:\\s*(?:of\\s*)?(this|last|past|next)\\s*week)?(?=\\W|\$)`,`i`),HP=1,UP=2,WP=3,GP=class extends JM{innerPattern(){return VP}innerExtract(e,t){let n=t[HP],r=t[WP],i=n||r;i||=``,i=i.toLowerCase();let a=null;i==`last`||i==`past`?a=`last`:i==`next`?a=`next`:i==`this`&&(a=`this`);let o=t[UP].toLowerCase(),s;if(DM[o]!==void 0)s=DM[o];else if(o==`weekend`)s=a==`last`?oM.SUNDAY:oM.SATURDAY;else if(o==`weekday`){let t=e.reference.getDateWithAdjustedTimezone().getDay();t==oM.SUNDAY||t==oM.SATURDAY?s=a==`last`?oM.FRIDAY:oM.MONDAY:(s=t-1,s=a==`last`?s-1:s+1,s=s%5+1)}else return null;return iP(e.reference,s,a)}},KP=RegExp(`(this|last|past|next|after\\s*this)\\s*(${wM(NM)})(?=\\s*)(?=\\W|\$)`,`i`),qP=1,JP=2,YP=class extends JM{innerPattern(){return KP}innerExtract(e,t){let n=t[qP].toLowerCase(),r=t[JP].toLowerCase(),i=NM[r];if(n==`next`||n.startsWith(`after`)){let t={};return t[i]=1,bM.createRelativeFromReference(e.reference,t)}if(n==`last`||n==`past`){let t={};return t[i]=-1,bM.createRelativeFromReference(e.reference,t)}let a=e.createParsingComponents(),o=new Date(e.reference.instant.getTime());return r.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())):r.match(/month/i)?(o.setDate(1),a.imply(`day`,o.getDate()),a.assign(`year`,o.getFullYear()),a.assign(`month`,o.getMonth()+1)):r.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}},XP=RegExp(`([^\\d]|^)([0-3]{0,1}[0-9]{1})[\\/\\.\\-]([0-3]{0,1}[0-9]{1})(?:[\\/\\.\\-]([0-9]{4}|[0-9]{2}))?(\\W|$)`,`i`),ZP=1,QP=5,$P=2,eF=3,tF=4,nF=class{groupNumberMonth;groupNumberDay;constructor(e){this.groupNumberMonth=e?eF:$P,this.groupNumberDay=e?$P:eF}pattern(){return XP}extract(e,t){let n=t.index+t[ZP].length,r=t.index+t[0].length-t[QP].length;if(n>0&&e.text.substring(0,n).match(`\\d/?$`)||r<e.text.length&&e.text.substring(r).match(`^/?\\d`))return;let i=e.text.substring(n,r);if(i.match(/^\d\.\d$/)||i.match(/^\d\.\d{1,2}\.\d{1,2}\s*$/)||!t[tF]&&i.indexOf(`/`)<0)return;let a=e.createParsingResult(n,i),o=parseInt(t[this.groupNumberMonth]),s=parseInt(t[this.groupNumberDay]);if((o<1||o>12)&&o>12)if(s>=1&&s<=12&&o<=31)[s,o]=[o,s];else return null;if(s<1||s>31)return null;if(a.start.assign(`day`,s),a.start.assign(`month`,o),t[tF]){let e=TM(parseInt(t[tF]));a.start.assign(`year`,e)}else{let t=EM(e.refDate,s,o);a.start.imply(`year`,t)}return a.addTag(`parser/SlashDateFormatParser`)}},rF=RegExp(`(this|last|past|next|after|\\+|-)\\s*(${WM})(?=\\W|$)`,`i`),iF=RegExp(`(this|last|past|next|after|\\+|-)\\s*(${GM})(?=\\W|$)`,`i`),aF=class extends JM{allowAbbreviations;constructor(e=!0){super(),this.allowAbbreviations=e}innerPattern(){return this.allowAbbreviations?rF:iF}innerExtract(e,t){let n=t[1].toLowerCase(),r=KM(t[2]);if(!r)return null;switch(n){case`last`:case`past`:case`-`:r=vM(r);break}return bM.createRelativeFromReference(e.reference,r)}};function oF(e){return e.text.match(/^[+-]/i)!=null}function sF(e){return e.text.match(/^-/i)!=null}var cF=class extends UN{shouldMergeResults(e,t,n){return e.match(/^\s*$/i)?oF(n)||sF(n):!1}mergeResults(e,t,n,r){let i=KM(n.text);sF(n)&&(i=vM(i));let a=bM.createRelativeFromReference(yM.fromDate(t.start.date()),i);return new xM(t.reference,t.index,`${t.text}${e}${n.text}`,a)}};function lF(e){return e.text.match(/\s+(before|from)$/i)!=null}function uF(e){return e.text.match(/\s+(after|since)$/i)!=null}var dF=class extends UN{patternBetween(){return/^\s*$/i}shouldMergeResults(e,t,n){return!e.match(this.patternBetween())||!lF(t)&&!uF(t)?!1:!!n.start.get(`day`)&&!!n.start.get(`month`)&&!!n.start.get(`year`)}mergeResults(e,t,n){let r=KM(t.text);lF(t)&&(r=vM(r));let i=bM.createRelativeFromReference(yM.fromDate(n.start.date()),r);return new xM(n.reference,t.index,`${t.text}${e}${n.text}`,i)}},fF=RegExp(`^\\s*(${RM})`,`i`),pF=1,mF=class{refine(e,t){return t.forEach(function(t){if(!t.start.isDateWithUnknownYear())return;let n=e.text.substring(t.index+t.text.length),r=fF.exec(n);if(!r||r[0].trim().length<=3)return;e.debug(()=>{console.log(`Extracting year: '${r[0]}' into : ${t}`)});let i=zM(r[pF]);t.end!=null&&t.end.assign(`year`,i),t.start.assign(`year`,i),t.text+=r[0]}),t}},hF=class extends HN{constructor(){super()}isValid(e,t){let n=t.text.trim();return n===e.text.trim()?!0:n.toLowerCase()===`may`&&!e.text.substring(0,t.index).trim().match(/\b(in)$/i)?(e.debug(()=>{console.log(`Removing unlikely result: ${t}`)}),!1):n.toLowerCase().endsWith(`the second`)?(e.text.substring(t.index+t.text.length).trim().length>0&&e.debug(()=>{console.log(`Removing unlikely result: ${t}`)}),!1):!0}},gF=class{createCasualConfiguration(e=!1){let t=this.createConfiguration(!1,e);return t.parsers.push(new RP),t.parsers.push(new BP),t.parsers.push(new hN),t.parsers.push(new YP),t.parsers.push(new aF),t.refiners.push(new hF),t}createConfiguration(e=!0,t=!1){let n=wP({parsers:[new nF(t),new QM(e),new iN,new uN(t),new GP,new TN,new PN(e),new LN(e),new VN(e)],refiners:[new YN]},e);return n.parsers.unshift(new xN(e)),n.refiners.unshift(new dF),n.refiners.unshift(new cF),n.refiners.unshift(new rP),n.refiners.push(new YN),n.refiners.push(new mF),n.refiners.push(new GN),n}},_F=class e{parsers;refiners;defaultConfig=new gF;constructor(e){e||=this.defaultConfig.createCasualConfiguration(),this.parsers=[...e.parsers],this.refiners=[...e.refiners]}clone(){return new e({parsers:[...this.parsers],refiners:[...this.refiners]})}parseDate(e,t,n){let r=this.parse(e,t,n);return r.length>0?r[0].start.date():null}parse(t,n,r){let i=new vF(t,n,r),a=[];return this.parsers.forEach(t=>{let n=e.executeParser(i,t);a=a.concat(n)}),a.sort((e,t)=>e.index-t.index),this.refiners.forEach(function(e){a=e.refine(i,a)}),a}static executeParser(e,t){let n=[],r=t.pattern(e),i=e.text,a=e.text,o=r.exec(a);for(;o;){let s=o.index+i.length-a.length;o.index=s;let c=t.extract(e,o);if(!c){a=i.substring(o.index+1),o=r.exec(a);continue}let l=null;c instanceof xM?l=c:c instanceof bM?(l=e.createParsingResult(o.index,o[0]),l.start=c):l=e.createParsingResult(o.index,o[0],c);let u=l.index,d=l.text;e.debug(()=>console.log(`${t.constructor.name} extracted (at index=${u}) '${d}'`)),n.push(l),a=i.substring(u+d.length),o=r.exec(a)}return n}},vF=class{text;option;reference;refDate;constructor(e,t,n){this.text=e,this.option=n??{},this.reference=yM.fromInput(t,this.option.timezones),this.refDate=this.reference.instant}createParsingComponents(e){return e instanceof bM?e:new bM(this.reference,e)}createParsingResult(e,t,n,r){let i=typeof t==`string`?t:this.text.substring(e,t),a=n?this.createParsingComponents(n):null,o=r?this.createParsingComponents(r):null;return new xM(this.reference,e,i,a,o)}debug(e){this.option.debug&&(this.option.debug instanceof Function?this.option.debug(e):this.option.debug.debug(e))}},yF={零:0,〇:0,一:1,二:2,两:2,三:3,四:4,五:5,六:6,七:7,八:8,九:9,十:10},bF={天:0,日:0,一:1,二:2,三:3,四:4,五:5,六:6};function xF(e){let t=0;for(let n=0;n<e.length;n++){let r=e[n];r===`十`?t=t===0?yF[r]:t*yF[r]:t+=yF[r]}return t}function SF(e){let t=``;for(let n=0;n<e.length;n++){let r=e[n];t+=yF[r]}return parseInt(t)}var CF=1,wF=2,TF=3,EF=class extends JM{innerPattern(){return RegExp(`(\\d{2,4}|[`+Object.keys(yF).join(``)+`]{4}|[`+Object.keys(yF).join(``)+`]{2})?(?:\\s*)(?:年)?(?:[\\s|,|,]*)(\\d{1,2}|[`+Object.keys(yF).join(``)+`]{1,3})(?:\\s*)(?:月)(?:\\s*)(\\d{1,2}|[`+Object.keys(yF).join(``)+`]{1,3})?(?:\\s*)(?:日|号)?`)}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),r=parseInt(t[wF]);if(isNaN(r)&&(r=xF(t[wF])),n.start.assign(`month`,r),t[TF]){let e=parseInt(t[TF]);isNaN(e)&&(e=xF(t[TF])),n.start.assign(`day`,e)}else n.start.imply(`day`,e.refDate.getDate());if(t[CF]){let e=parseInt(t[CF]);isNaN(e)&&(e=SF(t[CF])),n.start.assign(`year`,e)}else n.start.imply(`year`,e.refDate.getFullYear());return n}},DF=RegExp(`(\\d+|[`+Object.keys(yF).join(``)+`]+|半|几)(?:\\s*)(?:个)?(秒(?:钟)?|分钟|小时|钟|日|天|星期|礼拜|月|年)(?:(?:之|过)?后|(?:之)?内)`,`i`),OF=1,kF=2,AF=class extends JM{innerPattern(){return DF}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),r=parseInt(t[OF]);if(isNaN(r)&&(r=xF(t[OF])),isNaN(r)){let e=t[OF];if(e===`几`)r=3;else if(e===`半`)r=.5;else return null}let i={},a=t[kF][0];if(a.match(/[日天星礼月年]/)){a==`日`||a==`天`?i.day=r:a==`星`||a==`礼`?i.week=r:a==`月`?i.month=r:a==`年`&&(i.year=r);let t=_M(e.refDate,i);return n.start.assign(`year`,t.getFullYear()),n.start.assign(`month`,t.getMonth()+1),n.start.assign(`day`,t.getDate()),n}a==`秒`?i.second=r:a==`分`?i.minute=r:(a==`小`||a==`钟`)&&(i.hour=r);let o=_M(e.refDate,i);return n.start.imply(`year`,o.getFullYear()),n.start.imply(`month`,o.getMonth()+1),n.start.imply(`day`,o.getDate()),n.start.assign(`hour`,o.getHours()),n.start.assign(`minute`,o.getMinutes()),n.start.assign(`second`,o.getSeconds()),n}},jF=RegExp(`(?<prefix>上|下|这)(?:个)?(?:星期|礼拜|周)(?<weekday>`+Object.keys(bF).join(`|`)+`)`),MF=class extends JM{innerPattern(){return jF}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),r=bF[t.groups.weekday];if(r===void 0)return null;let i=null,a=t.groups.prefix;a==`上`?i=`last`:a==`下`?i=`next`:a==`这`&&(i=`this`);let o=new Date(e.refDate.getTime()),s=!1,c=o.getDay();if(i==`last`||i==`past`)o.setDate(o.getDate()+(r-7-c)),s=!0;else if(i==`next`)o.setDate(o.getDate()+(r+7-c)),s=!0;else if(i==`this`)o.setDate(o.getDate()+(r-c));else{let e=r-c;Math.abs(e-7)<Math.abs(e)&&(e-=7),Math.abs(e+7)<Math.abs(e)&&(e+=7),o.setDate(o.getDate()+e)}return n.start.assign(`weekday`,r),s?(n.start.assign(`day`,o.getDate()),n.start.assign(`month`,o.getMonth()+1),n.start.assign(`year`,o.getFullYear())):(n.start.imply(`day`,o.getDate()),n.start.imply(`month`,o.getMonth()+1),n.start.imply(`year`,o.getFullYear())),n}},NF=RegExp(`(?:从|自)?(?:(今|明|前|大前|后|大后|昨)(早|朝|晚)|(上(?:午)|早(?:上)|下(?:午)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨))|(今|明|前|大前|后|大后|昨)(?:日|天)(?:[\\s,,]*)(?:(上(?:午)|早(?:上)|下(?:午)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨)))?)?(?:[\\s,,]*)(?:(\\d+|[`+Object.keys(yF).join(``)+`]+)(?:\\s*)(?:点|时|:|:)(?:\\s*)(\\d+|半|正|整|[`+Object.keys(yF).join(``)+`]+)?(?:\\s*)(?:分|:|:)?(?:\\s*)(\\d+|[`+Object.keys(yF).join(``)+`]+)?(?:\\s*)(?:秒)?)(?:\\s*(A.M.|P.M.|AM?|PM?))?`,`i`),PF=RegExp(`(?:^\\s*(?:到|至|\\-|\\–|\\~|\\〜)\\s*)(?:(今|明|前|大前|后|大后|昨)(早|朝|晚)|(上(?:午)|早(?:上)|下(?:午)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨))|(今|明|前|大前|后|大后|昨)(?:日|天)(?:[\\s,,]*)(?:(上(?:午)|早(?:上)|下(?:午)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨)))?)?(?:[\\s,,]*)(?:(\\d+|[`+Object.keys(yF).join(``)+`]+)(?:\\s*)(?:点|时|:|:)(?:\\s*)(\\d+|半|正|整|[`+Object.keys(yF).join(``)+`]+)?(?:\\s*)(?:分|:|:)?(?:\\s*)(\\d+|[`+Object.keys(yF).join(``)+`]+)?(?:\\s*)(?:秒)?)(?:\\s*(A.M.|P.M.|AM?|PM?))?`,`i`),FF=1,IF=2,LF=3,RF=4,zF=5,BF=6,VF=7,HF=8,UF=9,WF=class extends JM{patternLeftBoundary(){return`()`}innerPattern(){return NF}innerExtract(e,t){if(t.index>0&&e.text[t.index-1].match(/\w/))return null;let n=e.createParsingResult(t.index,t[0]),r=new Date(e.reference.instant.getTime());if(t[FF]){let i=t[FF];i==`明`?e.reference.instant.getHours()>1&&r.setDate(r.getDate()+1):i==`昨`?r.setDate(r.getDate()-1):i==`前`?r.setDate(r.getDate()-2):i==`大前`?r.setDate(r.getDate()-3):i==`后`?r.setDate(r.getDate()+2):i==`大后`&&r.setDate(r.getDate()+3),n.start.assign(`day`,r.getDate()),n.start.assign(`month`,r.getMonth()+1),n.start.assign(`year`,r.getFullYear())}else if(t[RF]){let e=t[RF];e==`明`?r.setDate(r.getDate()+1):e==`昨`?r.setDate(r.getDate()-1):e==`前`?r.setDate(r.getDate()-2):e==`大前`?r.setDate(r.getDate()-3):e==`后`?r.setDate(r.getDate()+2):e==`大后`&&r.setDate(r.getDate()+3),n.start.assign(`day`,r.getDate()),n.start.assign(`month`,r.getMonth()+1),n.start.assign(`year`,r.getFullYear())}else n.start.imply(`day`,r.getDate()),n.start.imply(`month`,r.getMonth()+1),n.start.imply(`year`,r.getFullYear());let i=0,a=0,o=-1;if(t[HF]){let e=parseInt(t[HF]);if(isNaN(e)&&(e=xF(t[HF])),e>=60)return null;n.start.assign(`second`,e)}if(i=parseInt(t[BF]),isNaN(i)&&(i=xF(t[BF])),t[VF]?t[VF]==`半`?a=30:t[VF]==`正`||t[VF]==`整`?a=0:(a=parseInt(t[VF]),isNaN(a)&&(a=xF(t[VF]))):i>100&&(a=i%100,i=Math.floor(i/100)),a>=60||i>24)return null;if(i>=12&&(o=1),t[UF]){if(i>12)return null;let e=t[UF][0].toLowerCase();e==`a`&&(o=0,i==12&&(i=0)),e==`p`&&(o=1,i!=12&&(i+=12))}else if(t[IF]){let e=t[IF][0];e==`早`?(o=0,i==12&&(i=0)):e==`晚`&&(o=1,i!=12&&(i+=12))}else if(t[LF]){let e=t[LF][0];e==`上`||e==`早`||e==`凌`?(o=0,i==12&&(i=0)):(e==`下`||e==`晚`)&&(o=1,i!=12&&(i+=12))}else if(t[zF]){let e=t[zF][0];e==`上`||e==`早`||e==`凌`?(o=0,i==12&&(i=0)):(e==`下`||e==`晚`)&&(o=1,i!=12&&(i+=12))}n.start.assign(`hour`,i),n.start.assign(`minute`,a),o>=0?n.start.assign(`meridiem`,o):i<12?n.start.imply(`meridiem`,0):n.start.imply(`meridiem`,1);let s=PF.exec(e.text.substring(n.index+n.text.length));if(!s)return n.text.match(/^\d+$/)?null:n;let c=new Date(r.getTime());if((s[FF]||s[RF])&&(c=new Date(e.reference.instant.getTime())),n.end=e.createParsingComponents(),s[FF]){let t=s[FF];t==`明`?e.reference.instant.getHours()>1&&c.setDate(c.getDate()+1):t==`昨`?c.setDate(c.getDate()-1):t==`前`?c.setDate(c.getDate()-2):t==`大前`?c.setDate(c.getDate()-3):t==`后`?c.setDate(c.getDate()+2):t==`大后`&&c.setDate(c.getDate()+3),n.end.assign(`day`,c.getDate()),n.end.assign(`month`,c.getMonth()+1),n.end.assign(`year`,c.getFullYear())}else if(s[RF]){let e=s[RF];e==`明`?c.setDate(c.getDate()+1):e==`昨`?c.setDate(c.getDate()-1):e==`前`?c.setDate(c.getDate()-2):e==`大前`?c.setDate(c.getDate()-3):e==`后`?c.setDate(c.getDate()+2):e==`大后`&&c.setDate(c.getDate()+3),n.end.assign(`day`,c.getDate()),n.end.assign(`month`,c.getMonth()+1),n.end.assign(`year`,c.getFullYear())}else n.end.imply(`day`,c.getDate()),n.end.imply(`month`,c.getMonth()+1),n.end.imply(`year`,c.getFullYear());if(i=0,a=0,o=-1,s[HF]){let e=parseInt(s[HF]);if(isNaN(e)&&(e=xF(s[HF])),e>=60)return null;n.end.assign(`second`,e)}if(i=parseInt(s[BF]),isNaN(i)&&(i=xF(s[BF])),s[VF]?s[VF]==`半`?a=30:s[VF]==`正`||s[VF]==`整`?a=0:(a=parseInt(s[VF]),isNaN(a)&&(a=xF(s[VF]))):i>100&&(a=i%100,i=Math.floor(i/100)),a>=60||i>24)return null;if(i>=12&&(o=1),s[UF]){if(i>12)return null;let e=s[UF][0].toLowerCase();e==`a`&&(o=0,i==12&&(i=0)),e==`p`&&(o=1,i!=12&&(i+=12)),n.start.isCertain(`meridiem`)||(o==0?(n.start.imply(`meridiem`,0),n.start.get(`hour`)==12&&n.start.assign(`hour`,0)):(n.start.imply(`meridiem`,1),n.start.get(`hour`)!=12&&n.start.assign(`hour`,n.start.get(`hour`)+12)))}else if(s[IF]){let e=s[IF][0];e==`早`?(o=0,i==12&&(i=0)):e==`晚`&&(o=1,i!=12&&(i+=12))}else if(s[LF]){let e=s[LF][0];e==`上`||e==`早`||e==`凌`?(o=0,i==12&&(i=0)):(e==`下`||e==`晚`)&&(o=1,i!=12&&(i+=12))}else if(s[zF]){let e=s[zF][0];e==`上`||e==`早`||e==`凌`?(o=0,i==12&&(i=0)):(e==`下`||e==`晚`)&&(o=1,i!=12&&(i+=12))}return n.text+=s[0],n.end.assign(`hour`,i),n.end.assign(`minute`,a),o>=0?n.end.assign(`meridiem`,o):n.start.isCertain(`meridiem`)&&n.start.get(`meridiem`)==1&&n.start.get(`hour`)>i?n.end.imply(`meridiem`,0):i>12&&n.end.imply(`meridiem`,1),n.end.date().getTime()<n.start.date().getTime()&&n.end.imply(`day`,n.end.get(`day`)+1),n}},GF=RegExp(`(?:星期|礼拜|周)(?<weekday>`+Object.keys(bF).join(`|`)+`)`),KF=class extends JM{innerPattern(){return GF}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),r=bF[t.groups.weekday];if(r===void 0)return null;let i=new Date(e.refDate.getTime()),a=r-i.getDay();return Math.abs(a-7)<Math.abs(a)&&(a-=7),Math.abs(a+7)<Math.abs(a)&&(a+=7),i.setDate(i.getDate()+a),n.start.assign(`weekday`,r),n.start.imply(`day`,i.getDate()),n.start.imply(`month`,i.getMonth()+1),n.start.imply(`year`,i.getFullYear()),n}},qF=1,JF=2,YF=3,XF=4,ZF=5,QF=6,$F=class extends JM{innerPattern(e){return RegExp(`(而家|立(?:刻|即)|即刻)|(今|明|前|大前|後|大後|聽|昨|尋|琴)(早|朝|晚)|(上(?:午|晝)|朝(?:早)|早(?:上)|下(?:午|晝)|晏(?:晝)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨))|(今|明|前|大前|後|大後|聽|昨|尋|琴)(?:日|天)(?:[\\s|,|,]*)(?:(上(?:午|晝)|朝(?:早)|早(?:上)|下(?:午|晝)|晏(?:晝)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨)))?`,`i`)}innerExtract(e,t){let n=t.index,r=e.createParsingResult(n,t[0]),i=e.refDate,a=new Date(i.getTime());if(t[qF])r.start.imply(`hour`,i.getHours()),r.start.imply(`minute`,i.getMinutes()),r.start.imply(`second`,i.getSeconds()),r.start.imply(`millisecond`,i.getMilliseconds());else if(t[JF]){let e=t[JF],n=t[YF];e==`明`||e==`聽`?i.getHours()>1&&a.setDate(a.getDate()+1):e==`昨`||e==`尋`||e==`琴`?a.setDate(a.getDate()-1):e==`前`?a.setDate(a.getDate()-2):e==`大前`?a.setDate(a.getDate()-3):e==`後`?a.setDate(a.getDate()+2):e==`大後`&&a.setDate(a.getDate()+3),n==`早`||n==`朝`?r.start.imply(`hour`,6):n==`晚`&&(r.start.imply(`hour`,22),r.start.imply(`meridiem`,1))}else if(t[XF]){let e=t[XF][0];e==`早`||e==`朝`||e==`上`?r.start.imply(`hour`,6):e==`下`||e==`晏`?(r.start.imply(`hour`,15),r.start.imply(`meridiem`,1)):e==`中`?(r.start.imply(`hour`,12),r.start.imply(`meridiem`,1)):e==`夜`||e==`晚`?(r.start.imply(`hour`,22),r.start.imply(`meridiem`,1)):e==`凌`&&r.start.imply(`hour`,0)}else if(t[ZF]){let e=t[ZF];e==`明`||e==`聽`?i.getHours()>1&&a.setDate(a.getDate()+1):e==`昨`||e==`尋`||e==`琴`?a.setDate(a.getDate()-1):e==`前`?a.setDate(a.getDate()-2):e==`大前`?a.setDate(a.getDate()-3):e==`後`?a.setDate(a.getDate()+2):e==`大後`&&a.setDate(a.getDate()+3);let n=t[QF];if(n){let e=n[0];e==`早`||e==`朝`||e==`上`?r.start.imply(`hour`,6):e==`下`||e==`晏`?(r.start.imply(`hour`,15),r.start.imply(`meridiem`,1)):e==`中`?(r.start.imply(`hour`,12),r.start.imply(`meridiem`,1)):e==`夜`||e==`晚`?(r.start.imply(`hour`,22),r.start.imply(`meridiem`,1)):e==`凌`&&r.start.imply(`hour`,0)}}return r.start.assign(`day`,a.getDate()),r.start.assign(`month`,a.getMonth()+1),r.start.assign(`year`,a.getFullYear()),r}},eI={零:0,一:1,二:2,兩:2,三:3,四:4,五:5,六:6,七:7,八:8,九:9,十:10,廿:20,卅:30},tI={天:0,日:0,一:1,二:2,三:3,四:4,五:5,六:6};function nI(e){let t=0;for(let n=0;n<e.length;n++){let r=e[n];r===`十`?t=t===0?eI[r]:t*eI[r]:t+=eI[r]}return t}function rI(e){let t=``;for(let n=0;n<e.length;n++){let r=e[n];t+=eI[r]}return parseInt(t)}var iI=1,aI=2,oI=3,sI=class extends JM{innerPattern(){return RegExp(`(\\d{2,4}|[`+Object.keys(eI).join(``)+`]{4}|[`+Object.keys(eI).join(``)+`]{2})?(?:\\s*)(?:年)?(?:[\\s|,|,]*)(\\d{1,2}|[`+Object.keys(eI).join(``)+`]{1,2})(?:\\s*)(?:月)(?:\\s*)(\\d{1,2}|[`+Object.keys(eI).join(``)+`]{1,2})?(?:\\s*)(?:日|號)?`)}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),r=parseInt(t[aI]);if(isNaN(r)&&(r=nI(t[aI])),n.start.assign(`month`,r),t[oI]){let e=parseInt(t[oI]);isNaN(e)&&(e=nI(t[oI])),n.start.assign(`day`,e)}else n.start.imply(`day`,e.refDate.getDate());if(t[iI]){let e=parseInt(t[iI]);isNaN(e)&&(e=rI(t[iI])),n.start.assign(`year`,e)}else n.start.imply(`year`,e.refDate.getFullYear());return n}},cI=RegExp(`(\\d+|[`+Object.keys(eI).join(``)+`]+|半|幾)(?:\\s*)(?:個)?(秒(?:鐘)?|分鐘|小時|鐘|日|天|星期|禮拜|月|年)(?:(?:之|過)?後|(?:之)?內)`,`i`),lI=1,uI=2,dI=class extends JM{innerPattern(){return cI}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),r=parseInt(t[lI]);if(isNaN(r)&&(r=nI(t[lI])),isNaN(r)){let e=t[lI];if(e===`幾`)r=3;else if(e===`半`)r=.5;else return null}let i={},a=t[uI][0];if(a.match(/[日天星禮月年]/)){a==`日`||a==`天`?i.day=r:a==`星`||a==`禮`?i.week=r:a==`月`?i.month=r:a==`年`&&(i.year=r);let t=_M(e.refDate,i);return n.start.assign(`year`,t.getFullYear()),n.start.assign(`month`,t.getMonth()+1),n.start.assign(`day`,t.getDate()),n}a==`秒`?i.second=r:a==`分`?i.minute=r:(a==`小`||a==`鐘`)&&(i.hour=r);let o=_M(e.refDate,i);return n.start.imply(`year`,o.getFullYear()),n.start.imply(`month`,o.getMonth()+1),n.start.imply(`day`,o.getDate()),n.start.assign(`hour`,o.getHours()),n.start.assign(`minute`,o.getMinutes()),n.start.assign(`second`,o.getSeconds()),n}},fI=RegExp(`(?<prefix>上|今|下|這|呢)(?:個)?(?:星期|禮拜|週)(?<weekday>`+Object.keys(tI).join(`|`)+`)`),pI=class extends JM{innerPattern(){return fI}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),r=tI[t.groups.weekday];if(r===void 0)return null;let i=null,a=t.groups.prefix;a==`上`?i=`last`:a==`下`?i=`next`:(a==`今`||a==`這`||a==`呢`)&&(i=`this`);let o=new Date(e.refDate.getTime()),s=!1,c=o.getDay();if(i==`last`||i==`past`)o.setDate(o.getDate()+(r-7-c)),s=!0;else if(i==`next`)o.setDate(o.getDate()+(r+7-c)),s=!0;else if(i==`this`)o.setDate(o.getDate()+(r-c));else{let e=r-c;Math.abs(e-7)<Math.abs(e)&&(e-=7),Math.abs(e+7)<Math.abs(e)&&(e+=7),o.setDate(o.getDate()+e)}return n.start.assign(`weekday`,r),s?(n.start.assign(`day`,o.getDate()),n.start.assign(`month`,o.getMonth()+1),n.start.assign(`year`,o.getFullYear())):(n.start.imply(`day`,o.getDate()),n.start.imply(`month`,o.getMonth()+1),n.start.imply(`year`,o.getFullYear())),n}},mI=RegExp(`(?:由|從|自)?(?:(今|明|前|大前|後|大後|聽|昨|尋|琴)(早|朝|晚)|(上(?:午|晝)|朝(?:早)|早(?:上)|下(?:午|晝)|晏(?:晝)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨))|(今|明|前|大前|後|大後|聽|昨|尋|琴)(?:日|天)(?:[\\s,,]*)(?:(上(?:午|晝)|朝(?:早)|早(?:上)|下(?:午|晝)|晏(?:晝)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨)))?)?(?:[\\s,,]*)(?:(\\d+|[`+Object.keys(eI).join(``)+`]+)(?:\\s*)(?:點|時|:|:)(?:\\s*)(\\d+|半|正|整|[`+Object.keys(eI).join(``)+`]+)?(?:\\s*)(?:分|:|:)?(?:\\s*)(\\d+|[`+Object.keys(eI).join(``)+`]+)?(?:\\s*)(?:秒)?)(?:\\s*(A.M.|P.M.|AM?|PM?))?`,`i`),hI=RegExp(`(?:^\\s*(?:到|至|\\-|\\–|\\~|\\〜)\\s*)(?:(今|明|前|大前|後|大後|聽|昨|尋|琴)(早|朝|晚)|(上(?:午|晝)|朝(?:早)|早(?:上)|下(?:午|晝)|晏(?:晝)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨))|(今|明|前|大前|後|大後|聽|昨|尋|琴)(?:日|天)(?:[\\s,,]*)(?:(上(?:午|晝)|朝(?:早)|早(?:上)|下(?:午|晝)|晏(?:晝)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨)))?)?(?:[\\s,,]*)(?:(\\d+|[`+Object.keys(eI).join(``)+`]+)(?:\\s*)(?:點|時|:|:)(?:\\s*)(\\d+|半|正|整|[`+Object.keys(eI).join(``)+`]+)?(?:\\s*)(?:分|:|:)?(?:\\s*)(\\d+|[`+Object.keys(eI).join(``)+`]+)?(?:\\s*)(?:秒)?)(?:\\s*(A.M.|P.M.|AM?|PM?))?`,`i`),gI=1,_I=2,vI=3,yI=4,bI=5,xI=6,SI=7,CI=8,wI=9,TI=class extends JM{patternLeftBoundary(){return`()`}innerPattern(){return mI}innerExtract(e,t){if(t.index>0&&e.text[t.index-1].match(/\w/))return null;let n=e.createParsingResult(t.index,t[0]),r=new Date(e.reference.instant.getTime());if(t[gI]){let i=t[gI];i==`明`||i==`聽`?e.refDate.getHours()>1&&r.setDate(r.getDate()+1):i==`昨`||i==`尋`||i==`琴`?r.setDate(r.getDate()-1):i==`前`?r.setDate(r.getDate()-2):i==`大前`?r.setDate(r.getDate()-3):i==`後`?r.setDate(r.getDate()+2):i==`大後`&&r.setDate(r.getDate()+3),n.start.assign(`day`,r.getDate()),n.start.assign(`month`,r.getMonth()+1),n.start.assign(`year`,r.getFullYear())}else if(t[yI]){let e=t[yI];e==`明`||e==`聽`?r.setDate(r.getDate()+1):e==`昨`||e==`尋`||e==`琴`?r.setDate(r.getDate()-1):e==`前`?r.setDate(r.getDate()-2):e==`大前`?r.setDate(r.getDate()-3):e==`後`?r.setDate(r.getDate()+2):e==`大後`&&r.setDate(r.getDate()+3),n.start.assign(`day`,r.getDate()),n.start.assign(`month`,r.getMonth()+1),n.start.assign(`year`,r.getFullYear())}else n.start.imply(`day`,r.getDate()),n.start.imply(`month`,r.getMonth()+1),n.start.imply(`year`,r.getFullYear());let i=0,a=0,o=-1;if(t[CI]){var s=parseInt(t[CI]);if(isNaN(s)&&(s=nI(t[CI])),s>=60)return null;n.start.assign(`second`,s)}if(i=parseInt(t[xI]),isNaN(i)&&(i=nI(t[xI])),t[SI]?t[SI]==`半`?a=30:t[SI]==`正`||t[SI]==`整`?a=0:(a=parseInt(t[SI]),isNaN(a)&&(a=nI(t[SI]))):i>100&&(a=i%100,i=Math.floor(i/100)),a>=60||i>24)return null;if(i>=12&&(o=1),t[wI]){if(i>12)return null;var c=t[wI][0].toLowerCase();c==`a`&&(o=0,i==12&&(i=0)),c==`p`&&(o=1,i!=12&&(i+=12))}else if(t[_I]){var l=t[_I][0];l==`朝`||l==`早`?(o=0,i==12&&(i=0)):l==`晚`&&(o=1,i!=12&&(i+=12))}else if(t[vI]){var u=t[vI][0];u==`上`||u==`朝`||u==`早`||u==`凌`?(o=0,i==12&&(i=0)):(u==`下`||u==`晏`||u==`晚`)&&(o=1,i!=12&&(i+=12))}else if(t[bI]){var d=t[bI][0];d==`上`||d==`朝`||d==`早`||d==`凌`?(o=0,i==12&&(i=0)):(d==`下`||d==`晏`||d==`晚`)&&(o=1,i!=12&&(i+=12))}n.start.assign(`hour`,i),n.start.assign(`minute`,a),o>=0?n.start.assign(`meridiem`,o):i<12?n.start.imply(`meridiem`,0):n.start.imply(`meridiem`,1);let f=hI.exec(e.text.substring(n.index+n.text.length));if(!f)return n.text.match(/^\d+$/)?null:n;let p=new Date(r.getTime());if((f[gI]||f[yI])&&(p=new Date(e.reference.instant.getTime())),n.end=e.createParsingComponents(),f[gI]){let t=f[gI];t==`明`||t==`聽`?e.refDate.getHours()>1&&p.setDate(p.getDate()+1):t==`昨`||t==`尋`||t==`琴`?p.setDate(p.getDate()-1):t==`前`?p.setDate(p.getDate()-2):t==`大前`?p.setDate(p.getDate()-3):t==`後`?p.setDate(p.getDate()+2):t==`大後`&&p.setDate(p.getDate()+3),n.end.assign(`day`,p.getDate()),n.end.assign(`month`,p.getMonth()+1),n.end.assign(`year`,p.getFullYear())}else if(f[yI]){let e=f[yI];e==`明`||e==`聽`?p.setDate(p.getDate()+1):e==`昨`||e==`尋`||e==`琴`?p.setDate(p.getDate()-1):e==`前`?p.setDate(p.getDate()-2):e==`大前`?p.setDate(p.getDate()-3):e==`後`?p.setDate(p.getDate()+2):e==`大後`&&p.setDate(p.getDate()+3),n.end.assign(`day`,p.getDate()),n.end.assign(`month`,p.getMonth()+1),n.end.assign(`year`,p.getFullYear())}else n.end.imply(`day`,p.getDate()),n.end.imply(`month`,p.getMonth()+1),n.end.imply(`year`,p.getFullYear());if(i=0,a=0,o=-1,f[CI]){let e=parseInt(f[CI]);if(isNaN(e)&&(e=nI(f[CI])),e>=60)return null;n.end.assign(`second`,e)}if(i=parseInt(f[xI]),isNaN(i)&&(i=nI(f[xI])),f[SI]?f[SI]==`半`?a=30:f[SI]==`正`||f[SI]==`整`?a=0:(a=parseInt(f[SI]),isNaN(a)&&(a=nI(f[SI]))):i>100&&(a=i%100,i=Math.floor(i/100)),a>=60||i>24)return null;if(i>=12&&(o=1),f[wI]){if(i>12)return null;var c=f[wI][0].toLowerCase();c==`a`&&(o=0,i==12&&(i=0)),c==`p`&&(o=1,i!=12&&(i+=12)),n.start.isCertain(`meridiem`)||(o==0?(n.start.imply(`meridiem`,0),n.start.get(`hour`)==12&&n.start.assign(`hour`,0)):(n.start.imply(`meridiem`,1),n.start.get(`hour`)!=12&&n.start.assign(`hour`,n.start.get(`hour`)+12)))}else if(f[_I]){var l=f[_I][0];l==`朝`||l==`早`?(o=0,i==12&&(i=0)):l==`晚`&&(o=1,i!=12&&(i+=12))}else if(f[vI]){var u=f[vI][0];u==`上`||u==`朝`||u==`早`||u==`凌`?(o=0,i==12&&(i=0)):(u==`下`||u==`晏`||u==`晚`)&&(o=1,i!=12&&(i+=12))}else if(f[bI]){var d=f[bI][0];d==`上`||d==`朝`||d==`早`||d==`凌`?(o=0,i==12&&(i=0)):(d==`下`||d==`晏`||d==`晚`)&&(o=1,i!=12&&(i+=12))}return n.text+=f[0],n.end.assign(`hour`,i),n.end.assign(`minute`,a),o>=0?n.end.assign(`meridiem`,o):n.start.isCertain(`meridiem`)&&n.start.get(`meridiem`)==1&&n.start.get(`hour`)>i?n.end.imply(`meridiem`,0):i>12&&n.end.imply(`meridiem`,1),n.end.date().getTime()<n.start.date().getTime()&&n.end.imply(`day`,n.end.get(`day`)+1),n}},EI=RegExp(`(?:星期|禮拜|週)(?<weekday>`+Object.keys(tI).join(`|`)+`)`),DI=class extends JM{innerPattern(){return EI}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),r=tI[t.groups.weekday];if(r===void 0)return null;let i=new Date(e.refDate.getTime()),a=r-i.getDay();return Math.abs(a-7)<Math.abs(a)&&(a-=7),Math.abs(a+7)<Math.abs(a)&&(a+=7),i.setDate(i.getDate()+a),n.start.assign(`weekday`,r),n.start.imply(`day`,i.getDate()),n.start.imply(`month`,i.getMonth()+1),n.start.imply(`year`,i.getFullYear()),n}},OI=class extends WN{patternBetween(){return/^\s*(至|到|\-|\~|~|-|ー)\s*$/i}},kI=class extends JN{patternBetween(){return/^\s*$/i}},AI=new _F(MI());new _F(NI());function jI(e,t,n){return AI.parseDate(e,t,n)}function MI(){let e=NI();return e.parsers.unshift(new $F),e}function NI(){let e=wP({parsers:[new sI,new EF,new pI,new MF,new DI,new KF,new TI,new WF,new dI,new AF],refiners:[new OI,new kI]});return e.refiners=e.refiners.filter(e=>!(e instanceof nP)),e}var PI=c(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self).dayjs_plugin_isoWeek=r()})(e,(function(){"use strict";var e=`day`;return function(t,n,r){var i=function(t){return t.add(4-t.isoWeekday(),e)},a=n.prototype;a.isoWeekYear=function(){return i(this).year()},a.isoWeek=function(t){if(!this.$utils().u(t))return this.add(7*(t-this.isoWeek()),e);var n,a,o,s,c=i(this),l=(n=this.isoWeekYear(),a=this.$u,o=(a?r.utc:r)().year(n).startOf(`year`),s=4-o.isoWeekday(),o.isoWeekday()>4&&(s+=7),o.add(s,e));return c.diff(l,`week`)+1},a.isoWeekday=function(e){return this.$utils().u(e)?this.day()||7:this.day(this.day()%7?e:e-7)};var o=a.startOf;a.startOf=function(e,t){var n=this.$utils(),r=!!n.u(t)||t;return n.p(e)===`isoweek`?r?this.date(this.date()-(this.isoWeekday()-1)).startOf(`day`):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf(`day`):o.bind(this)(e,t)}}}))})),FI=d(ob()),II=d(PI());FI.default.extend(II.default);function LI(){return(0,FI.default)().startOf(`isoWeek`).toDate()}var RI=/大*后天/g;function zI(e){if(!RI.test(e))return e;let t=(0,FI.default)();return RI.lastIndex=0,e.replace(RI,e=>{let n=2+(e.length-2);return t.add(n,`day`).format(`YYYY年MM月DD日`)})}function BI(e){let t=zI(e),n=jI(t,{instant:/(?:本|这|上|下)?(?:周|星期)/.test(t)?LI():new Date});return n?(0,FI.default)(n).format(`YYYY-MM-DD HH:mm:ss`):`无法解析,请输入具体时间`}var VI={parse_relative_date:{def:{type:`function`,function:{name:`parse_relative_date`,description:`把相对时间转成绝对时间`,parameters:{type:`object`,properties:{input:{type:`string`,description:`相对时间`}},required:[`input`]}}},handler:e=>BI(e.input)}},HI=class extends HTMLElement{appRef;promise;resolve;constructor(){super(),this.attachShadow({mode:`open`}),this.promise=new Promise(e=>{this.resolve=e})}connectedCallback(){this.shadowRoot&&(this.appRef=iM({domNode:this.shadowRoot,onReady:()=>this.resolve()}))}ready(){return this.promise}async pushMessage(e){await this.promise,this.appRef?.current?.pushMessage(e)}async pushMessages(e){await this.promise,this.appRef?.current?.pushMessages(e)}async pushLoadingMessage(){await this.promise,this.appRef?.current?.pushLoadingMessage()}async updateLoadingMessageReasoningContent(e){await this.promise,this.appRef?.current?.updateLoadingMessageReasoningContent(e)}async updateLoadingMessageContent(e){await this.promise,this.appRef?.current?.updateLoadingMessageContent(e)}};customElements.define(`ai-chat-panel`,HI),e.AIChatPanel=class{on=p.on;panelElement;constructor(e){let{container:t}=e;if(!t)throw Error(`未提供有效的 container`);this.panelElement=document.createElement(`ai-chat-panel`),t.appendChild(this.panelElement)}ready(){return this.panelElement.ready()}pushMessage(e){return this.panelElement.pushMessage(e)}pushMessages(e){return this.panelElement.pushMessages(e)}pushLoadingMessage(){return this.panelElement.pushLoadingMessage()}updateLoadingMessageReasoningContent(e){return this.panelElement.updateLoadingMessageReasoningContent(e)}updateLoadingMessageContent(e){return this.panelElement.updateLoadingMessageContent(e)}},e.Agent=Li,e.tools=VI});
|
|
426
|
+
reference: ${JSON.stringify(this.reference)}]`}date(){let e=this.dateWithoutTimezoneAdjustment(),t=this.reference.getSystemTimezoneAdjustmentMinute(e,this.get(`timezoneOffset`));return new Date(e.getTime()+t*6e4)}addTag(e){return this._tags.add(e),this}addTags(e){for(let t of e)this._tags.add(t);return this}tags(){return new Set(this._tags)}dateWithoutTimezoneAdjustment(){let e=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 e.setFullYear(this.get(`year`)),e}},xM=class e{refDate;index;text;reference;start;end;constructor(e,t,n,r,i){this.reference=e,this.refDate=e.instant,this.index=t,this.text=n,this.start=r||new bM(e),this.end=i}clone(){let t=new e(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(e){return this.start.addTag(e),this.end&&this.end.addTag(e),this}addTags(e){return this.start.addTags(e),this.end&&this.end.addTags(e),this}tags(){let e=new Set(this.start.tags());if(this.end)for(let t of this.end.tags())e.add(t);return e}toString(){let e=Array.from(this.tags()).sort();return`[ParsingResult {index: ${this.index}, text: '${this.text}', tags: ${JSON.stringify(e)} ...}]`}};function SM(e,t,n=`\\s{0,5},?\\s{0,5}`){let r=t.replace(/\((?!\?)/g,`(?:`);return`${e}${r}(?:${n}${r}){0,10}`}function CM(e){let t;return t=e instanceof Array?[...e]:e instanceof Map?Array.from(e.keys()):Object.keys(e),t}function wM(e){return`(?:${CM(e).sort((e,t)=>t.length-e.length).join(`|`).replace(/\./g,`\\.`)})`}function TM(e){return e<100&&(e>50?e+=1900:e+=2e3),e}function EM(e,t,n){let r=new Date(e);r.setMonth(n-1),r.setDate(t);let i=_M(r,{year:1}),a=_M(r,{year:-1});return Math.abs(i.getTime()-e.getTime())<Math.abs(r.getTime()-e.getTime())?r=i:Math.abs(a.getTime()-e.getTime())<Math.abs(r.getTime()-e.getTime())&&(r=a),r.getFullYear()}var DM={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},OM={january:1,february:2,march:3,april:4,may:5,june:6,july:7,august:8,september:9,october:10,november:11,december:12},kM={...OM,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},AM={one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12},jM={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},MM={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`},NM={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`,...MM},PM=`(?:${wM(AM)}|[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 FM(e){let t=e.toLowerCase();return AM[t]===void 0?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):AM[t]}var IM=`(?:${wM(jM)}|[0-9]{1,2}(?:st|nd|rd|th)?)`;function LM(e){let t=e.toLowerCase();return jM[t]===void 0?(t=t.replace(/(?:st|nd|rd|th)$/i,``),parseInt(t)):jM[t]}var RM=`(?:[1-9][0-9]{0,3}\\s{0,2}(?:BE|AD|BC|BCE|CE)|[1-9][0-9]{3}|[5-9][0-9]|2[0-5])`;function zM(e){return/BE/i.test(e)?(e=e.replace(/BE/i,``),parseInt(e)-543):/BCE?/i.test(e)?(e=e.replace(/BCE?/i,``),-parseInt(e)):/(AD|CE)/i.test(e)?(e=e.replace(/(AD|CE)/i,``),parseInt(e)):TM(parseInt(e))}var BM=`(${PM})\\s{0,3}(${wM(NM)})`,VM=new RegExp(BM,`i`),HM=`(${PM})\\s{0,3}(${wM(MM)})`,UM=`\\s{0,5},?(?:\\s*and)?\\s{0,5}`,WM=SM(`(?:(?:about|around)\\s{0,3})?`,BM,UM),GM=SM(`(?:(?:about|around)\\s{0,3})?`,HM,UM);function KM(e){let t={},n=e,r=VM.exec(n);for(;r;)qM(t,r),n=n.substring(r[0].length).trim(),r=VM.exec(n);return Object.keys(t).length==0?null:t}function qM(e,t){if(t[0].match(/^[a-zA-Z]+$/))return;let n=FM(t[1]),r=NM[t[2].toLowerCase()];e[r]=n}var JM=class{innerPatternHasChange(e,t){return this.innerPattern(e)!==t}patternLeftBoundary(){return`(\\W|^)`}cachedInnerPattern=null;cachedPattern=null;pattern(e){return this.cachedInnerPattern&&!this.innerPatternHasChange(e,this.cachedInnerPattern)?this.cachedPattern:(this.cachedInnerPattern=this.innerPattern(e),this.cachedPattern=RegExp(`${this.patternLeftBoundary()}${this.cachedInnerPattern.source}`,this.cachedInnerPattern.flags),this.cachedPattern)}extract(e,t){let n=t[1]??``;t.index+=n.length,t[0]=t[0].substring(n.length);for(let e=2;e<t.length;e++)t[e-1]=t[e];return this.innerExtract(e,t)}},YM=RegExp(`(?:(?:within|in|for)\\s*)?(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${WM})(?=\\W|$)`,`i`),XM=RegExp(`(?:within|in|for)\\s*(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${WM})(?=\\W|$)`,`i`),ZM=RegExp(`(?:within|in|for)\\s*(?:(?:about|around|roughly|approximately|just)\\s*(?:~\\s*)?)?(${GM})(?=\\W|$)`,`i`),QM=class extends JM{strictMode;constructor(e){super(),this.strictMode=e}innerPattern(e){return this.strictMode?ZM:e.option.forwardDate?YM:XM}innerExtract(e,t){if(t[0].match(/^for\s*the\s*\w+/))return null;let n=KM(t[1]);return n?bM.createRelativeFromReference(e.reference,n):null}},$M=RegExp(`(?:on\\s{0,3})?(${IM})(?:\\s{0,3}(?:to|\\-|\\–|until|through|till)?\\s{0,3}(${IM}))?(?:-|/|\\s{0,3}(?:of)?\\s{0,3})(${wM(kM)})(?:(?:-|/|,?\\s{0,3})(${RM}(?!\\w)))?(?=\\W|\$)`,`i`),eN=1,tN=2,nN=3,rN=4,iN=class extends JM{innerPattern(){return $M}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),r=kM[t[nN].toLowerCase()],i=LM(t[eN]);if(i>31)return t.index+=t[eN].length,null;if(n.start.assign(`month`,r),n.start.assign(`day`,i),t[rN]){let e=zM(t[rN]);n.start.assign(`year`,e)}else{let t=EM(e.refDate,i,r);n.start.imply(`year`,t)}if(t[tN]){let e=LM(t[tN]);n.end=n.start.clone(),n.end.assign(`day`,e)}return n}},aN=RegExp(`(${wM(kM)})(?:-|/|\\s*,?\\s*)(${IM})(?!\\s*(?:am|pm))\\s*(?:(?:to|\\-)\\s*(${IM})\\s*)?(?:(?:-|/|\\s*,\\s*|\\s+)(${RM}))?(?=\\W|\$)(?!\\:\\d)`,`i`),oN=1,sN=2,cN=3,lN=4,uN=class extends JM{shouldSkipYearLikeDate;constructor(e){super(),this.shouldSkipYearLikeDate=e}innerPattern(){return aN}innerExtract(e,t){let n=kM[t[oN].toLowerCase()],r=LM(t[sN]);if(r>31||this.shouldSkipYearLikeDate&&!t[cN]&&!t[lN]&&t[sN].match(/^2[0-5]$/))return null;let i=e.createParsingComponents({day:r,month:n}).addTag(`parser/ENMonthNameMiddleEndianParser`);if(t[lN]){let e=zM(t[lN]);i.assign(`year`,e)}else{let t=EM(e.refDate,r,n);i.imply(`year`,t)}if(!t[cN])return i;let a=LM(t[cN]),o=e.createParsingResult(t.index,t[0]);return o.start=i,o.end=i.clone(),o.end.assign(`day`,a),o}},dN=RegExp(`((?:in)\\s*)?(${wM(kM)})\\s*(?:(?:,|-|of)?\\s*(${RM})?)?(?=[^\\s\\w]|\\s+[^0-9]|\\s+\$|\$)`,`i`),fN=1,pN=2,mN=3,hN=class extends JM{innerPattern(){return dN}innerExtract(e,t){let n=t[pN].toLowerCase();if(t[0].length<=3&&!OM[n])return null;let r=e.createParsingResult(t.index+(t[fN]||``).length,t.index+t[0].length);r.start.imply(`day`,1),r.start.addTag(`parser/ENMonthNameParser`);let i=kM[n];if(r.start.assign(`month`,i),t[mN]){let e=zM(t[mN]);r.start.assign(`year`,e)}else{let t=EM(e.refDate,1,i);r.start.imply(`year`,t)}return r}},gN=RegExp(`([0-9]{4})[-\\.\\/\\s](?:(${wM(kM)})|([0-9]{1,2}))[-\\.\\/\\s]([0-9]{1,2})(?=\\W|\$)`,`i`),_N=1,vN=2,yN=3,bN=4,xN=class extends JM{strictMonthDateOrder;constructor(e){super(),this.strictMonthDateOrder=e}innerPattern(){return gN}innerExtract(e,t){let n=parseInt(t[_N]),r=parseInt(t[bN]),i=t[yN]?parseInt(t[yN]):kM[t[vN].toLowerCase()];if(i<1||i>12){if(this.strictMonthDateOrder)return null;r>=1&&r<=12&&([i,r]=[r,i])}return r<1||r>31?null:{day:r,month:i,year:n}}},SN=RegExp(`([0-9]|0[1-9]|1[012])/([0-9]{4})`,`i`),CN=1,wN=2,TN=class extends JM{innerPattern(){return SN}innerExtract(e,t){let n=parseInt(t[wN]),r=parseInt(t[CN]);return e.createParsingComponents().imply(`day`,1).assign(`month`,r).assign(`year`,n)}};function EN(e,t,n,r){return RegExp(`${e}${t}(\\d{1,4})(?:(?:\\.|:|:)(\\d{1,2})(?:(?::|:)(\\d{2})(?:\\.(\\d{1,6}))?)?)?(?:\\s*(a\\.m\\.|p\\.m\\.|am?|pm?))?${n}`,r)}function DN(e,t){return RegExp(`^(${e})(\\d{1,4})(?:(?:\\.|\\:|\\:)(\\d{1,2})(?:(?:\\.|\\:|\\:)(\\d{1,2})(?:\\.(\\d{1,6}))?)?)?(?:\\s*(a\\.m\\.|p\\.m\\.|am?|pm?))?${t}`,`i`)}var ON=2,kN=3,AN=4,jN=5,MN=6,NN=class{strictMode;constructor(e=!1){this.strictMode=e}patternFlags(){return`i`}primaryPatternLeftBoundary(){return`(^|\\s|T|\\b)`}primarySuffix(){return`(?!/)(?=\\W|$)`}followingSuffix(){return`(?!/)(?=\\W|$)`}pattern(e){return this.getPrimaryTimePatternThroughCache()}extract(e,t){let n=this.extractPrimaryTimeComponents(e,t);if(!n)return t[0].match(/^\d{4}/)?(t.index+=4,null):(t.index+=t[0].length,null);let r=t.index+t[1].length,i=t[0].substring(t[1].length),a=e.createParsingResult(r,i,n);t.index+=t[0].length;let o=e.text.substring(t.index),s=this.getFollowingTimePatternThroughCache().exec(o);return i.match(/^\d{3,4}/)&&s&&(s[0].match(/^\s*([+-])\s*\d{2,4}$/)||s[0].match(/^\s*([+-])\s*\d{2}\W\d{2}/))?null:!s||s[0].match(/^\s*([+-])\s*\d{3,4}$/)?this.checkAndReturnWithoutFollowingPattern(a):(a.end=this.extractFollowingTimeComponents(e,s,a),a.end&&(a.text+=s[0]),this.checkAndReturnWithFollowingPattern(a))}extractPrimaryTimeComponents(e,t,n=!1){let r=e.createParsingComponents(),i=0,a=null,o=parseInt(t[ON]);if(o>100){if(t[ON].length==4&&t[kN]==null&&!t[MN]||this.strictMode||t[kN]!=null)return null;i=o%100,o=Math.floor(o/100)}if(o>24)return null;if(t[kN]!=null){if(t[kN].length==1&&!t[MN])return null;i=parseInt(t[kN])}if(i>=60)return null;if(o>12&&(a=aM.PM),t[MN]!=null){if(o>12)return null;let e=t[MN][0].toLowerCase();e==`a`&&(a=aM.AM,o==12&&(o=0)),e==`p`&&(a=aM.PM,o!=12&&(o+=12))}if(r.assign(`hour`,o),r.assign(`minute`,i),a===null?o<12?r.imply(`meridiem`,aM.AM):r.imply(`meridiem`,aM.PM):r.assign(`meridiem`,a),t[jN]!=null){let e=parseInt(t[jN].substring(0,3));if(e>=1e3)return null;r.assign(`millisecond`,e)}if(t[AN]!=null){let e=parseInt(t[AN]);if(e>=60)return null;r.assign(`second`,e)}return r}extractFollowingTimeComponents(e,t,n){let r=e.createParsingComponents();if(t[jN]!=null){let e=parseInt(t[jN].substring(0,3));if(e>=1e3)return null;r.assign(`millisecond`,e)}if(t[AN]!=null){let e=parseInt(t[AN]);if(e>=60)return null;r.assign(`second`,e)}let i=parseInt(t[ON]),a=0,o=-1;if(t[kN]==null?i>100&&(a=i%100,i=Math.floor(i/100)):a=parseInt(t[kN]),a>=60||i>24)return null;if(i>=12&&(o=aM.PM),t[MN]!=null){if(i>12)return null;let e=t[MN][0].toLowerCase();e==`a`&&(o=aM.AM,i==12&&(i=0,r.isCertain(`day`)||r.imply(`day`,r.get(`day`)+1))),e==`p`&&(o=aM.PM,i!=12&&(i+=12)),n.start.isCertain(`meridiem`)||(o==aM.AM?(n.start.imply(`meridiem`,aM.AM),n.start.get(`hour`)==12&&n.start.assign(`hour`,0)):(n.start.imply(`meridiem`,aM.PM),n.start.get(`hour`)!=12&&n.start.assign(`hour`,n.start.get(`hour`)+12)))}return r.assign(`hour`,i),r.assign(`minute`,a),o>=0?r.assign(`meridiem`,o):n.start.isCertain(`meridiem`)&&n.start.get(`hour`)>12?n.start.get(`hour`)-12>i?r.imply(`meridiem`,aM.AM):i<=12&&(r.assign(`hour`,i+12),r.assign(`meridiem`,aM.PM)):i>12?r.imply(`meridiem`,aM.PM):i<=12&&r.imply(`meridiem`,aM.AM),r.date().getTime()<n.start.date().getTime()&&r.imply(`day`,r.get(`day`)+1),r}checkAndReturnWithoutFollowingPattern(e){if(e.text.match(/^\d$/)||e.text.match(/^\d\d\d+$/)||e.text.match(/\d[apAP]$/))return null;let t=e.text.match(/[^\d:.](\d[\d.]+)$/);if(t){let e=t[1];if(this.strictMode||e.includes(`.`)&&!e.match(/\d(\.\d{2})+$/)||parseInt(e)>24)return null}return e}checkAndReturnWithFollowingPattern(e){if(e.text.match(/^\d+-\d+$/))return null;let t=e.text.match(/[^\d:.](\d[\d.]+)\s*-\s*(\d[\d.]+)$/);if(t){if(this.strictMode)return null;let e=t[1],n=t[2];if(n.includes(`.`)&&!n.match(/\d(\.\d{2})+$/)||parseInt(n)>24||parseInt(e)>24)return null}return e}cachedPrimaryPrefix=null;cachedPrimarySuffix=null;cachedPrimaryTimePattern=null;getPrimaryTimePatternThroughCache(){let e=this.primaryPrefix(),t=this.primarySuffix();return this.cachedPrimaryPrefix===e&&this.cachedPrimarySuffix===t?this.cachedPrimaryTimePattern:(this.cachedPrimaryTimePattern=EN(this.primaryPatternLeftBoundary(),e,t,this.patternFlags()),this.cachedPrimaryPrefix=e,this.cachedPrimarySuffix=t,this.cachedPrimaryTimePattern)}cachedFollowingPhase=null;cachedFollowingSuffix=null;cachedFollowingTimePatten=null;getFollowingTimePatternThroughCache(){let e=this.followingPhase(),t=this.followingSuffix();return this.cachedFollowingPhase===e&&this.cachedFollowingSuffix===t?this.cachedFollowingTimePatten:(this.cachedFollowingTimePatten=DN(e,t),this.cachedFollowingPhase=e,this.cachedFollowingSuffix=t,this.cachedFollowingTimePatten)}},PN=class extends NN{constructor(e){super(e)}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(e,t){let n=super.extractPrimaryTimeComponents(e,t);if(!n)return n;if(t[0].endsWith(`night`)){let e=n.get(`hour`);e>=6&&e<12?(n.assign(`hour`,n.get(`hour`)+12),n.assign(`meridiem`,aM.PM)):e<6&&n.assign(`meridiem`,aM.AM)}if(t[0].endsWith(`afternoon`)){n.assign(`meridiem`,aM.PM);let e=n.get(`hour`);e>=0&&e<=6&&n.assign(`hour`,n.get(`hour`)+12)}return t[0].endsWith(`morning`)&&(n.assign(`meridiem`,aM.AM),n.get(`hour`)<12&&n.assign(`hour`,n.get(`hour`))),n.addTag(`parser/ENTimeExpressionParser`)}extractFollowingTimeComponents(e,t,n){let r=super.extractFollowingTimeComponents(e,t,n);return r&&r.addTag(`parser/ENTimeExpressionParser`),r}},FN=RegExp(`(${WM})\\s{0,5}(?:ago|before|earlier)(?=\\W|$)`,`i`),IN=RegExp(`(${GM})\\s{0,5}(?:ago|before|earlier)(?=\\W|$)`,`i`),LN=class extends JM{strictMode;constructor(e){super(),this.strictMode=e}innerPattern(){return this.strictMode?IN:FN}innerExtract(e,t){let n=KM(t[1]);return n?bM.createRelativeFromReference(e.reference,vM(n)):null}},RN=RegExp(`(${WM})\\s{0,5}(?:later|after|from now|henceforth|forward|out)(?=(?:\\W|\$))`,`i`),zN=RegExp(`(${GM})\\s{0,5}(later|after|from now)(?=\\W|$)`,`i`),BN=1,VN=class extends JM{strictMode;constructor(e){super(),this.strictMode=e}innerPattern(){return this.strictMode?zN:RN}innerExtract(e,t){let n=KM(t[BN]);return n?bM.createRelativeFromReference(e.reference,n):null}},HN=class{refine(e,t){return t.filter(t=>this.isValid(e,t))}},UN=class{refine(e,t){if(t.length<2)return t;let n=[],r=t[0],i=null;for(let a=1;a<t.length;a++){i=t[a];let o=e.text.substring(r.index+r.text.length,i.index);if(!this.shouldMergeResults(o,r,i,e))n.push(r),r=i;else{let t=r,n=i,a=this.mergeResults(o,t,n,e);e.debug(()=>{console.log(`${this.constructor.name} merged ${t} and ${n} into ${a}`)}),r=a}}return r!=null&&n.push(r),n}},WN=class extends UN{shouldMergeResults(e,t,n){return!t.end&&!n.end&&e.match(this.patternBetween())!=null}mergeResults(e,t,n){if(!t.start.isOnlyWeekdayComponent()&&!n.start.isOnlyWeekdayComponent()&&(n.start.getCertainComponents().forEach(e=>{t.start.isCertain(e)||t.start.imply(e,n.start.get(e))}),t.start.getCertainComponents().forEach(e=>{n.start.isCertain(e)||n.start.imply(e,t.start.get(e))})),t.start.date()>n.start.date()){let e=t.start.date(),r=n.start.date();n.start.isOnlyWeekdayComponent()&&_M(r,{day:7})>e?(r=_M(r,{day:7}),n.start.imply(`day`,r.getDate()),n.start.imply(`month`,r.getMonth()+1),n.start.imply(`year`,r.getFullYear())):t.start.isOnlyWeekdayComponent()&&_M(e,{day:-7})<r?(e=_M(e,{day:-7}),t.start.imply(`day`,e.getDate()),t.start.imply(`month`,e.getMonth()+1),t.start.imply(`year`,e.getFullYear())):n.start.isDateWithUnknownYear()&&_M(r,{year:1})>e?(r=_M(r,{year:1}),n.start.imply(`year`,r.getFullYear())):t.start.isDateWithUnknownYear()&&_M(e,{year:-1})<r?(e=_M(e,{year:-1}),t.start.imply(`year`,e.getFullYear())):[n,t]=[t,n]}let r=t.clone();return r.start=t.start,r.end=n.start,r.index=Math.min(t.index,n.index),t.index<n.index?r.text=t.text+e+n.text:r.text=n.text+e+t.text,r}},GN=class extends WN{patternBetween(){return/^\s*(to|-|–|until|through|till)\s*$/i}};function KN(e,t){let n=e.clone(),r=e.start,i=t.start;if(n.start=qN(r,i),e.end!=null||t.end!=null){let r=qN(e.end==null?e.start:e.end,t.end==null?t.start:t.end);if(e.end==null&&r.date().getTime()<n.start.date().getTime()){let e=new Date(r.date().getTime());e.setDate(e.getDate()+1),r.isCertain(`day`)?cM(r,e):uM(r,e)}n.end=r}return n}function qN(e,t){let n=e.clone();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`));let r=e.get(`meridiem`)!=null&&(e.isCertain(`meridiem`)||Array.from(e.tags()).some(e=>e.startsWith(`casualReference/`)));return t.isCertain(`meridiem`)?n.assign(`meridiem`,t.get(`meridiem`)):t.get(`meridiem`)!=null&&!r&&n.imply(`meridiem`,t.get(`meridiem`)),n.get(`meridiem`)==aM.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}var JN=class extends UN{shouldMergeResults(e,t,n){return(t.start.isOnlyDate()&&n.start.isOnlyTime()||n.start.isOnlyDate()&&t.start.isOnlyTime())&&e.match(this.patternBetween())!=null}mergeResults(e,t,n){let r=t.start.isOnlyDate()?KN(t,n):KN(n,t);return r.index=t.index,r.text=t.text+e+n.text,r}},YN=class extends JN{patternBetween(){return RegExp(`^\\s*(T|at|after|before|on|of|,|-|\\.|∙|:)?\\s*$`)}},XN=RegExp(`^\\s*,?\\s*\\(?([A-Z]{2,4})\\)?(?=\\W|$)`,`i`),ZN=class{timezoneOverrides;constructor(e){this.timezoneOverrides=e}refine(e,t){let n=e.option.timezones??{};return t.forEach(t=>{let r=e.text.substring(t.index+t.text.length),i=XN.exec(r);if(!i)return;let a=i[1].toUpperCase(),o=hM(a,t.start.date()??t.refDate??new Date,{...this.timezoneOverrides,...n});if(o==null)return;e.debug(()=>{console.log(`Extracting timezone: '${a}' into: ${o} for: ${t.start}`)});let s=t.start.get(`timezoneOffset`);s!==null&&o!=s&&(t.start.isCertain(`timezoneOffset`)||a!=i[1])||t.start.isOnlyDate()&&a!=i[1]||(t.text+=i[0],t.start.isCertain(`timezoneOffset`)||t.start.assign(`timezoneOffset`,o),t.end!=null&&!t.end.isCertain(`timezoneOffset`)&&t.end.assign(`timezoneOffset`,o))}),t}},QN=RegExp(`^\\s*(?:\\(?(?:GMT|UTC)\\s?)?([+-])(\\d{1,2})(?::?(\\d{2}))?\\)?`,`i`),$N=1,eP=2,tP=3,nP=class{refine(e,t){return t.forEach(function(t){if(t.start.isCertain(`timezoneOffset`))return;let n=e.text.substring(t.index+t.text.length),r=QN.exec(n);if(!r)return;e.debug(()=>{console.log(`Extracting timezone: '${r[0]}' into : ${t}`)});let i=parseInt(r[eP]),a=parseInt(r[tP]||`0`),o=i*60+a;o>840||(r[$N]===`-`&&(o=-o),t.end!=null&&t.end.assign(`timezoneOffset`,o),t.start.assign(`timezoneOffset`,o),t.text+=r[0])}),t}},rP=class{refine(e,t){if(t.length<2)return t;let n=[],r=t[0];for(let i=1;i<t.length;i++){let a=t[i];if(a.index>=r.index+r.text.length){n.push(r),r=a;continue}let o=null,s=null;a.text.length>r.text.length?(o=a,s=r):(o=r,s=a),e.debug(()=>{console.log(`${this.constructor.name} remove ${s} by ${o}`)}),r=o}return r!=null&&n.push(r),n}};function iP(e,t,n){let r=aP(e.getDateWithAdjustedTimezone(),t,n),i=new bM(e);return i=i.addDurationAsImplied({day:r}),i.assign(`weekday`,t),i}function aP(e,t,n){let r=e.getDay();switch(n){case`this`:return sP(e,t);case`last`:return cP(e,t);case`next`:return r==oM.SUNDAY?t==oM.SUNDAY?7:t:r==oM.SATURDAY?t==oM.SATURDAY?7:t==oM.SUNDAY?8:1+t:t<r&&t!=oM.SUNDAY?sP(e,t):sP(e,t)+7}return oP(e,t)}function oP(e,t){let n=cP(e,t),r=sP(e,t);return r<-n?r:n}function sP(e,t){let n=t-e.getDay();return n<0&&(n+=7),n}function cP(e,t){let n=t-e.getDay();return n>=0&&(n-=7),n}var lP=class{refine(e,t){return e.option.forwardDate&&t.forEach(t=>{let n=e.reference.getDateWithAdjustedTimezone();if(t.start.isOnlyTime()&&e.reference.instant>t.start.date()){let n=e.reference.getDateWithAdjustedTimezone(),r=new Date(n);r.setDate(r.getDate()+1),uM(t.start,r),e.debug(()=>{console.log(`${this.constructor.name} adjusted ${t} time from the ref date (${n}) to the following day (${r})`)}),t.end&&t.end.isOnlyTime()&&(uM(t.end,r),t.start.date()>t.end.date()&&(r.setDate(r.getDate()+1),uM(t.end,r)))}if(t.start.isOnlyWeekdayComponent()&&n>t.start.date()){let r=_M(n,{day:sP(n,t.start.get(`weekday`))||7});if(uM(t.start,r),e.debug(()=>{console.log(`${this.constructor.name} adjusted ${t} weekday (${t.start})`)}),t.end&&t.start.date()>t.end.date()){let r=_M(n,{day:sP(n,t.start.get(`weekday`))||7});uM(t.end,r),e.debug(()=>{console.log(`${this.constructor.name} adjusted ${t} weekday (${t.end})`)})}}if(t.start.isDateWithUnknownYear()&&n>t.start.date())for(let r=0;r<3&&n>t.start.date();r++)t.start.imply(`year`,t.start.get(`year`)+1),e.debug(()=>{console.log(`${this.constructor.name} adjusted ${t} year (${t.start})`)}),t.end&&!t.end.isCertain(`year`)&&(t.end.imply(`year`,t.end.get(`year`)+1),e.debug(()=>{console.log(`${this.constructor.name} adjusted ${t} month (${t.start})`)}))}),t}},uP=class extends HN{strictMode;constructor(e){super(),this.strictMode=e}isValid(e,t){return t.text.replace(` `,``).match(/^\d*(\.\d*)?$/)?(e.debug(()=>{console.log(`Removing unlikely result '${t.text}'`)}),!1):t.start.isValidDate()?t.end&&!t.end.isValidDate()?(e.debug(()=>{console.log(`Removing invalid result: ${t} (${t.end})`)}),!1):this.strictMode?this.isStrictModeValid(e,t):!0:(e.debug(()=>{console.log(`Removing invalid result: ${t} (${t.start})`)}),!1)}isStrictModeValid(e,t){return t.start.isOnlyWeekdayComponent()?(e.debug(()=>{console.log(`(Strict) Removing weekday only component: ${t} (${t.end})`)}),!1):!0}},dP=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`),fP=1,pP=2,mP=3,hP=4,gP=5,_P=6,vP=7,yP=8,bP=9,xP=10,SP=class extends JM{innerPattern(){return dP}innerExtract(e,t){let n=e.createParsingComponents({year:parseInt(t[fP]),month:parseInt(t[pP]),day:parseInt(t[mP])});if(t[hP]!=null&&(n.assign(`hour`,parseInt(t[hP])),n.assign(`minute`,parseInt(t[gP])),t[_P]!=null&&n.assign(`second`,parseInt(t[_P])),t[vP]!=null&&n.assign(`millisecond`,parseInt(t[vP])),t[yP]!=null)){let e=0;if(t[bP]){let n=parseInt(t[bP]),r=0;t[xP]!=null&&(r=parseInt(t[xP])),e=n*60,e<0?e-=r:e+=r}n.assign(`timezoneOffset`,e)}return n.addTag(`parser/ISOFormatParser`)}},CP=class extends UN{mergeResults(e,t,n){let r=n.clone();return r.index=t.index,r.text=t.text+e+r.text,r.start.assign(`weekday`,t.start.get(`weekday`)),r.end&&r.end.assign(`weekday`,t.start.get(`weekday`)),r}shouldMergeResults(e,t,n){return t.start.isOnlyWeekdayComponent()&&!t.start.isCertain(`hour`)&&n.start.isCertain(`day`)&&e.match(/^,?\s*$/)!=null}};function wP(e,t=!1){return e.parsers.unshift(new SP),e.refiners.unshift(new CP),e.refiners.unshift(new nP),e.refiners.unshift(new rP),e.refiners.push(new ZN),e.refiners.push(new rP),e.refiners.push(new lP),e.refiners.push(new uP(t)),e}function TP(e){let t=e.getDateWithAdjustedTimezone(),n=new bM(e,{});return cM(n,t),lM(n,t),n.assign(`timezoneOffset`,e.getTimezoneOffset()),n.addTag(`casualReference/now`),n}function EP(e){let t=e.getDateWithAdjustedTimezone(),n=new bM(e,{});return cM(n,t),dM(n,t),n.delete(`meridiem`),n.addTag(`casualReference/today`),n}function DP(e){return kP(e,1).addTag(`casualReference/yesterday`)}function OP(e){return AP(e,1).addTag(`casualReference/tomorrow`)}function kP(e,t){return AP(e,-t)}function AP(e,t){let n=e.getDateWithAdjustedTimezone(),r=new bM(e,{}),i=new Date(n.getTime());return i.setDate(i.getDate()+t),cM(r,i),dM(r,i),r.delete(`meridiem`),r}function jP(e,t=22){let n=e.getDateWithAdjustedTimezone(),r=new bM(e,{});return cM(r,n),r.imply(`hour`,t),r.imply(`meridiem`,aM.PM),r.addTag(`casualReference/tonight`),r}function MP(e,t=20){let n=new bM(e,{});return n.imply(`meridiem`,aM.PM),n.imply(`hour`,t),n.addTag(`casualReference/evening`),n}function NP(e){let t=new bM(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 PP(e,t=6){let n=new bM(e,{});return n.imply(`meridiem`,aM.AM),n.imply(`hour`,t),n.imply(`minute`,0),n.imply(`second`,0),n.imply(`millisecond`,0),n.addTag(`casualReference/morning`),n}function FP(e,t=15){let n=new bM(e,{});return n.imply(`meridiem`,aM.PM),n.imply(`hour`,t),n.imply(`minute`,0),n.imply(`second`,0),n.imply(`millisecond`,0),n.addTag(`casualReference/afternoon`),n}function IP(e){let t=new bM(e,{});return t.imply(`meridiem`,aM.AM),t.assign(`hour`,12),t.imply(`minute`,0),t.imply(`second`,0),t.imply(`millisecond`,0),t.addTag(`casualReference/noon`),t}var LP=/(now|today|tonight|tomorrow|overmorrow|tmr|tmrw|yesterday|last\s*night)(?=\W|$)/i,RP=class extends JM{innerPattern(e){return LP}innerExtract(e,t){let n=e.refDate,r=t[0].toLowerCase(),i=e.createParsingComponents();switch(r){case`now`:i=TP(e.reference);break;case`today`:i=EP(e.reference);break;case`yesterday`:i=DP(e.reference);break;case`tomorrow`:case`tmr`:case`tmrw`:i=OP(e.reference);break;case`tonight`:i=jP(e.reference);break;case`overmorrow`:i=AP(e.reference,2);break;default:if(r.match(/last\s*night/)){if(n.getHours()>6){let e=new Date(n.getTime());e.setDate(e.getDate()-1),n=e}cM(i,n),i.imply(`hour`,0)}break}return i.addTag(`parser/ENCasualDateParser`),i}},zP=/(?:this)?\s{0,3}(morning|afternoon|evening|night|midnight|midday|noon)(?=\W|$)/i,BP=class extends JM{innerPattern(){return zP}innerExtract(e,t){let n=null;switch(t[1].toLowerCase()){case`afternoon`:n=FP(e.reference);break;case`evening`:case`night`:n=MP(e.reference);break;case`midnight`:n=NP(e.reference);break;case`morning`:n=PP(e.reference);break;case`noon`:case`midday`:n=IP(e.reference);break}return n&&n.addTag(`parser/ENCasualTimeParser`),n}},VP=RegExp(`(?:(?:\\,|\\(|\\()\\s*)?(?:on\\s*?)?(?:(this|last|past|next)\\s*)?(${wM(DM)}|weekend|weekday)(?:\\s*(?:\\,|\\)|\\)))?(?:\\s*(?:of\\s*)?(this|last|past|next)\\s*week)?(?=\\W|\$)`,`i`),HP=1,UP=2,WP=3,GP=class extends JM{innerPattern(){return VP}innerExtract(e,t){let n=t[HP],r=t[WP],i=n||r;i||=``,i=i.toLowerCase();let a=null;i==`last`||i==`past`?a=`last`:i==`next`?a=`next`:i==`this`&&(a=`this`);let o=t[UP].toLowerCase(),s;if(DM[o]!==void 0)s=DM[o];else if(o==`weekend`)s=a==`last`?oM.SUNDAY:oM.SATURDAY;else if(o==`weekday`){let t=e.reference.getDateWithAdjustedTimezone().getDay();t==oM.SUNDAY||t==oM.SATURDAY?s=a==`last`?oM.FRIDAY:oM.MONDAY:(s=t-1,s=a==`last`?s-1:s+1,s=s%5+1)}else return null;return iP(e.reference,s,a)}},KP=RegExp(`(this|last|past|next|after\\s*this)\\s*(${wM(NM)})(?=\\s*)(?=\\W|\$)`,`i`),qP=1,JP=2,YP=class extends JM{innerPattern(){return KP}innerExtract(e,t){let n=t[qP].toLowerCase(),r=t[JP].toLowerCase(),i=NM[r];if(n==`next`||n.startsWith(`after`)){let t={};return t[i]=1,bM.createRelativeFromReference(e.reference,t)}if(n==`last`||n==`past`){let t={};return t[i]=-1,bM.createRelativeFromReference(e.reference,t)}let a=e.createParsingComponents(),o=new Date(e.reference.instant.getTime());return r.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())):r.match(/month/i)?(o.setDate(1),a.imply(`day`,o.getDate()),a.assign(`year`,o.getFullYear()),a.assign(`month`,o.getMonth()+1)):r.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}},XP=RegExp(`([^\\d]|^)([0-3]{0,1}[0-9]{1})[\\/\\.\\-]([0-3]{0,1}[0-9]{1})(?:[\\/\\.\\-]([0-9]{4}|[0-9]{2}))?(\\W|$)`,`i`),ZP=1,QP=5,$P=2,eF=3,tF=4,nF=class{groupNumberMonth;groupNumberDay;constructor(e){this.groupNumberMonth=e?eF:$P,this.groupNumberDay=e?$P:eF}pattern(){return XP}extract(e,t){let n=t.index+t[ZP].length,r=t.index+t[0].length-t[QP].length;if(n>0&&e.text.substring(0,n).match(`\\d/?$`)||r<e.text.length&&e.text.substring(r).match(`^/?\\d`))return;let i=e.text.substring(n,r);if(i.match(/^\d\.\d$/)||i.match(/^\d\.\d{1,2}\.\d{1,2}\s*$/)||!t[tF]&&i.indexOf(`/`)<0)return;let a=e.createParsingResult(n,i),o=parseInt(t[this.groupNumberMonth]),s=parseInt(t[this.groupNumberDay]);if((o<1||o>12)&&o>12)if(s>=1&&s<=12&&o<=31)[s,o]=[o,s];else return null;if(s<1||s>31)return null;if(a.start.assign(`day`,s),a.start.assign(`month`,o),t[tF]){let e=TM(parseInt(t[tF]));a.start.assign(`year`,e)}else{let t=EM(e.refDate,s,o);a.start.imply(`year`,t)}return a.addTag(`parser/SlashDateFormatParser`)}},rF=RegExp(`(this|last|past|next|after|\\+|-)\\s*(${WM})(?=\\W|$)`,`i`),iF=RegExp(`(this|last|past|next|after|\\+|-)\\s*(${GM})(?=\\W|$)`,`i`),aF=class extends JM{allowAbbreviations;constructor(e=!0){super(),this.allowAbbreviations=e}innerPattern(){return this.allowAbbreviations?rF:iF}innerExtract(e,t){let n=t[1].toLowerCase(),r=KM(t[2]);if(!r)return null;switch(n){case`last`:case`past`:case`-`:r=vM(r);break}return bM.createRelativeFromReference(e.reference,r)}};function oF(e){return e.text.match(/^[+-]/i)!=null}function sF(e){return e.text.match(/^-/i)!=null}var cF=class extends UN{shouldMergeResults(e,t,n){return e.match(/^\s*$/i)?oF(n)||sF(n):!1}mergeResults(e,t,n,r){let i=KM(n.text);sF(n)&&(i=vM(i));let a=bM.createRelativeFromReference(yM.fromDate(t.start.date()),i);return new xM(t.reference,t.index,`${t.text}${e}${n.text}`,a)}};function lF(e){return e.text.match(/\s+(before|from)$/i)!=null}function uF(e){return e.text.match(/\s+(after|since)$/i)!=null}var dF=class extends UN{patternBetween(){return/^\s*$/i}shouldMergeResults(e,t,n){return!e.match(this.patternBetween())||!lF(t)&&!uF(t)?!1:!!n.start.get(`day`)&&!!n.start.get(`month`)&&!!n.start.get(`year`)}mergeResults(e,t,n){let r=KM(t.text);lF(t)&&(r=vM(r));let i=bM.createRelativeFromReference(yM.fromDate(n.start.date()),r);return new xM(n.reference,t.index,`${t.text}${e}${n.text}`,i)}},fF=RegExp(`^\\s*(${RM})`,`i`),pF=1,mF=class{refine(e,t){return t.forEach(function(t){if(!t.start.isDateWithUnknownYear())return;let n=e.text.substring(t.index+t.text.length),r=fF.exec(n);if(!r||r[0].trim().length<=3)return;e.debug(()=>{console.log(`Extracting year: '${r[0]}' into : ${t}`)});let i=zM(r[pF]);t.end!=null&&t.end.assign(`year`,i),t.start.assign(`year`,i),t.text+=r[0]}),t}},hF=class extends HN{constructor(){super()}isValid(e,t){let n=t.text.trim();return n===e.text.trim()?!0:n.toLowerCase()===`may`&&!e.text.substring(0,t.index).trim().match(/\b(in)$/i)?(e.debug(()=>{console.log(`Removing unlikely result: ${t}`)}),!1):n.toLowerCase().endsWith(`the second`)?(e.text.substring(t.index+t.text.length).trim().length>0&&e.debug(()=>{console.log(`Removing unlikely result: ${t}`)}),!1):!0}},gF=class{createCasualConfiguration(e=!1){let t=this.createConfiguration(!1,e);return t.parsers.push(new RP),t.parsers.push(new BP),t.parsers.push(new hN),t.parsers.push(new YP),t.parsers.push(new aF),t.refiners.push(new hF),t}createConfiguration(e=!0,t=!1){let n=wP({parsers:[new nF(t),new QM(e),new iN,new uN(t),new GP,new TN,new PN(e),new LN(e),new VN(e)],refiners:[new YN]},e);return n.parsers.unshift(new xN(e)),n.refiners.unshift(new dF),n.refiners.unshift(new cF),n.refiners.unshift(new rP),n.refiners.push(new YN),n.refiners.push(new mF),n.refiners.push(new GN),n}},_F=class e{parsers;refiners;defaultConfig=new gF;constructor(e){e||=this.defaultConfig.createCasualConfiguration(),this.parsers=[...e.parsers],this.refiners=[...e.refiners]}clone(){return new e({parsers:[...this.parsers],refiners:[...this.refiners]})}parseDate(e,t,n){let r=this.parse(e,t,n);return r.length>0?r[0].start.date():null}parse(t,n,r){let i=new vF(t,n,r),a=[];return this.parsers.forEach(t=>{let n=e.executeParser(i,t);a=a.concat(n)}),a.sort((e,t)=>e.index-t.index),this.refiners.forEach(function(e){a=e.refine(i,a)}),a}static executeParser(e,t){let n=[],r=t.pattern(e),i=e.text,a=e.text,o=r.exec(a);for(;o;){let s=o.index+i.length-a.length;o.index=s;let c=t.extract(e,o);if(!c){a=i.substring(o.index+1),o=r.exec(a);continue}let l=null;c instanceof xM?l=c:c instanceof bM?(l=e.createParsingResult(o.index,o[0]),l.start=c):l=e.createParsingResult(o.index,o[0],c);let u=l.index,d=l.text;e.debug(()=>console.log(`${t.constructor.name} extracted (at index=${u}) '${d}'`)),n.push(l),a=i.substring(u+d.length),o=r.exec(a)}return n}},vF=class{text;option;reference;refDate;constructor(e,t,n){this.text=e,this.option=n??{},this.reference=yM.fromInput(t,this.option.timezones),this.refDate=this.reference.instant}createParsingComponents(e){return e instanceof bM?e:new bM(this.reference,e)}createParsingResult(e,t,n,r){let i=typeof t==`string`?t:this.text.substring(e,t),a=n?this.createParsingComponents(n):null,o=r?this.createParsingComponents(r):null;return new xM(this.reference,e,i,a,o)}debug(e){this.option.debug&&(this.option.debug instanceof Function?this.option.debug(e):this.option.debug.debug(e))}},yF={零:0,〇:0,一:1,二:2,两:2,三:3,四:4,五:5,六:6,七:7,八:8,九:9,十:10},bF={天:0,日:0,一:1,二:2,三:3,四:4,五:5,六:6};function xF(e){let t=0;for(let n=0;n<e.length;n++){let r=e[n];r===`十`?t=t===0?yF[r]:t*yF[r]:t+=yF[r]}return t}function SF(e){let t=``;for(let n=0;n<e.length;n++){let r=e[n];t+=yF[r]}return parseInt(t)}var CF=1,wF=2,TF=3,EF=class extends JM{innerPattern(){return RegExp(`(\\d{2,4}|[`+Object.keys(yF).join(``)+`]{4}|[`+Object.keys(yF).join(``)+`]{2})?(?:\\s*)(?:年)?(?:[\\s|,|,]*)(\\d{1,2}|[`+Object.keys(yF).join(``)+`]{1,3})(?:\\s*)(?:月)(?:\\s*)(\\d{1,2}|[`+Object.keys(yF).join(``)+`]{1,3})?(?:\\s*)(?:日|号)?`)}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),r=parseInt(t[wF]);if(isNaN(r)&&(r=xF(t[wF])),n.start.assign(`month`,r),t[TF]){let e=parseInt(t[TF]);isNaN(e)&&(e=xF(t[TF])),n.start.assign(`day`,e)}else n.start.imply(`day`,e.refDate.getDate());if(t[CF]){let e=parseInt(t[CF]);isNaN(e)&&(e=SF(t[CF])),n.start.assign(`year`,e)}else n.start.imply(`year`,e.refDate.getFullYear());return n}},DF=RegExp(`(\\d+|[`+Object.keys(yF).join(``)+`]+|半|几)(?:\\s*)(?:个)?(秒(?:钟)?|分钟|小时|钟|日|天|星期|礼拜|月|年)(?:(?:之|过)?后|(?:之)?内)`,`i`),OF=1,kF=2,AF=class extends JM{innerPattern(){return DF}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),r=parseInt(t[OF]);if(isNaN(r)&&(r=xF(t[OF])),isNaN(r)){let e=t[OF];if(e===`几`)r=3;else if(e===`半`)r=.5;else return null}let i={},a=t[kF][0];if(a.match(/[日天星礼月年]/)){a==`日`||a==`天`?i.day=r:a==`星`||a==`礼`?i.week=r:a==`月`?i.month=r:a==`年`&&(i.year=r);let t=_M(e.refDate,i);return n.start.assign(`year`,t.getFullYear()),n.start.assign(`month`,t.getMonth()+1),n.start.assign(`day`,t.getDate()),n}a==`秒`?i.second=r:a==`分`?i.minute=r:(a==`小`||a==`钟`)&&(i.hour=r);let o=_M(e.refDate,i);return n.start.imply(`year`,o.getFullYear()),n.start.imply(`month`,o.getMonth()+1),n.start.imply(`day`,o.getDate()),n.start.assign(`hour`,o.getHours()),n.start.assign(`minute`,o.getMinutes()),n.start.assign(`second`,o.getSeconds()),n}},jF=RegExp(`(?<prefix>上|下|这)(?:个)?(?:星期|礼拜|周)(?<weekday>`+Object.keys(bF).join(`|`)+`)`),MF=class extends JM{innerPattern(){return jF}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),r=bF[t.groups.weekday];if(r===void 0)return null;let i=null,a=t.groups.prefix;a==`上`?i=`last`:a==`下`?i=`next`:a==`这`&&(i=`this`);let o=new Date(e.refDate.getTime()),s=!1,c=o.getDay();if(i==`last`||i==`past`)o.setDate(o.getDate()+(r-7-c)),s=!0;else if(i==`next`)o.setDate(o.getDate()+(r+7-c)),s=!0;else if(i==`this`)o.setDate(o.getDate()+(r-c));else{let e=r-c;Math.abs(e-7)<Math.abs(e)&&(e-=7),Math.abs(e+7)<Math.abs(e)&&(e+=7),o.setDate(o.getDate()+e)}return n.start.assign(`weekday`,r),s?(n.start.assign(`day`,o.getDate()),n.start.assign(`month`,o.getMonth()+1),n.start.assign(`year`,o.getFullYear())):(n.start.imply(`day`,o.getDate()),n.start.imply(`month`,o.getMonth()+1),n.start.imply(`year`,o.getFullYear())),n}},NF=RegExp(`(?:从|自)?(?:(今|明|前|大前|后|大后|昨)(早|朝|晚)|(上(?:午)|早(?:上)|下(?:午)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨))|(今|明|前|大前|后|大后|昨)(?:日|天)(?:[\\s,,]*)(?:(上(?:午)|早(?:上)|下(?:午)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨)))?)?(?:[\\s,,]*)(?:(\\d+|[`+Object.keys(yF).join(``)+`]+)(?:\\s*)(?:点|时|:|:)(?:\\s*)(\\d+|半|正|整|[`+Object.keys(yF).join(``)+`]+)?(?:\\s*)(?:分|:|:)?(?:\\s*)(\\d+|[`+Object.keys(yF).join(``)+`]+)?(?:\\s*)(?:秒)?)(?:\\s*(A.M.|P.M.|AM?|PM?))?`,`i`),PF=RegExp(`(?:^\\s*(?:到|至|\\-|\\–|\\~|\\〜)\\s*)(?:(今|明|前|大前|后|大后|昨)(早|朝|晚)|(上(?:午)|早(?:上)|下(?:午)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨))|(今|明|前|大前|后|大后|昨)(?:日|天)(?:[\\s,,]*)(?:(上(?:午)|早(?:上)|下(?:午)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨)))?)?(?:[\\s,,]*)(?:(\\d+|[`+Object.keys(yF).join(``)+`]+)(?:\\s*)(?:点|时|:|:)(?:\\s*)(\\d+|半|正|整|[`+Object.keys(yF).join(``)+`]+)?(?:\\s*)(?:分|:|:)?(?:\\s*)(\\d+|[`+Object.keys(yF).join(``)+`]+)?(?:\\s*)(?:秒)?)(?:\\s*(A.M.|P.M.|AM?|PM?))?`,`i`),FF=1,IF=2,LF=3,RF=4,zF=5,BF=6,VF=7,HF=8,UF=9,WF=class extends JM{patternLeftBoundary(){return`()`}innerPattern(){return NF}innerExtract(e,t){if(t.index>0&&e.text[t.index-1].match(/\w/))return null;let n=e.createParsingResult(t.index,t[0]),r=new Date(e.reference.instant.getTime());if(t[FF]){let i=t[FF];i==`明`?e.reference.instant.getHours()>1&&r.setDate(r.getDate()+1):i==`昨`?r.setDate(r.getDate()-1):i==`前`?r.setDate(r.getDate()-2):i==`大前`?r.setDate(r.getDate()-3):i==`后`?r.setDate(r.getDate()+2):i==`大后`&&r.setDate(r.getDate()+3),n.start.assign(`day`,r.getDate()),n.start.assign(`month`,r.getMonth()+1),n.start.assign(`year`,r.getFullYear())}else if(t[RF]){let e=t[RF];e==`明`?r.setDate(r.getDate()+1):e==`昨`?r.setDate(r.getDate()-1):e==`前`?r.setDate(r.getDate()-2):e==`大前`?r.setDate(r.getDate()-3):e==`后`?r.setDate(r.getDate()+2):e==`大后`&&r.setDate(r.getDate()+3),n.start.assign(`day`,r.getDate()),n.start.assign(`month`,r.getMonth()+1),n.start.assign(`year`,r.getFullYear())}else n.start.imply(`day`,r.getDate()),n.start.imply(`month`,r.getMonth()+1),n.start.imply(`year`,r.getFullYear());let i=0,a=0,o=-1;if(t[HF]){let e=parseInt(t[HF]);if(isNaN(e)&&(e=xF(t[HF])),e>=60)return null;n.start.assign(`second`,e)}if(i=parseInt(t[BF]),isNaN(i)&&(i=xF(t[BF])),t[VF]?t[VF]==`半`?a=30:t[VF]==`正`||t[VF]==`整`?a=0:(a=parseInt(t[VF]),isNaN(a)&&(a=xF(t[VF]))):i>100&&(a=i%100,i=Math.floor(i/100)),a>=60||i>24)return null;if(i>=12&&(o=1),t[UF]){if(i>12)return null;let e=t[UF][0].toLowerCase();e==`a`&&(o=0,i==12&&(i=0)),e==`p`&&(o=1,i!=12&&(i+=12))}else if(t[IF]){let e=t[IF][0];e==`早`?(o=0,i==12&&(i=0)):e==`晚`&&(o=1,i!=12&&(i+=12))}else if(t[LF]){let e=t[LF][0];e==`上`||e==`早`||e==`凌`?(o=0,i==12&&(i=0)):(e==`下`||e==`晚`)&&(o=1,i!=12&&(i+=12))}else if(t[zF]){let e=t[zF][0];e==`上`||e==`早`||e==`凌`?(o=0,i==12&&(i=0)):(e==`下`||e==`晚`)&&(o=1,i!=12&&(i+=12))}n.start.assign(`hour`,i),n.start.assign(`minute`,a),o>=0?n.start.assign(`meridiem`,o):i<12?n.start.imply(`meridiem`,0):n.start.imply(`meridiem`,1);let s=PF.exec(e.text.substring(n.index+n.text.length));if(!s)return n.text.match(/^\d+$/)?null:n;let c=new Date(r.getTime());if((s[FF]||s[RF])&&(c=new Date(e.reference.instant.getTime())),n.end=e.createParsingComponents(),s[FF]){let t=s[FF];t==`明`?e.reference.instant.getHours()>1&&c.setDate(c.getDate()+1):t==`昨`?c.setDate(c.getDate()-1):t==`前`?c.setDate(c.getDate()-2):t==`大前`?c.setDate(c.getDate()-3):t==`后`?c.setDate(c.getDate()+2):t==`大后`&&c.setDate(c.getDate()+3),n.end.assign(`day`,c.getDate()),n.end.assign(`month`,c.getMonth()+1),n.end.assign(`year`,c.getFullYear())}else if(s[RF]){let e=s[RF];e==`明`?c.setDate(c.getDate()+1):e==`昨`?c.setDate(c.getDate()-1):e==`前`?c.setDate(c.getDate()-2):e==`大前`?c.setDate(c.getDate()-3):e==`后`?c.setDate(c.getDate()+2):e==`大后`&&c.setDate(c.getDate()+3),n.end.assign(`day`,c.getDate()),n.end.assign(`month`,c.getMonth()+1),n.end.assign(`year`,c.getFullYear())}else n.end.imply(`day`,c.getDate()),n.end.imply(`month`,c.getMonth()+1),n.end.imply(`year`,c.getFullYear());if(i=0,a=0,o=-1,s[HF]){let e=parseInt(s[HF]);if(isNaN(e)&&(e=xF(s[HF])),e>=60)return null;n.end.assign(`second`,e)}if(i=parseInt(s[BF]),isNaN(i)&&(i=xF(s[BF])),s[VF]?s[VF]==`半`?a=30:s[VF]==`正`||s[VF]==`整`?a=0:(a=parseInt(s[VF]),isNaN(a)&&(a=xF(s[VF]))):i>100&&(a=i%100,i=Math.floor(i/100)),a>=60||i>24)return null;if(i>=12&&(o=1),s[UF]){if(i>12)return null;let e=s[UF][0].toLowerCase();e==`a`&&(o=0,i==12&&(i=0)),e==`p`&&(o=1,i!=12&&(i+=12)),n.start.isCertain(`meridiem`)||(o==0?(n.start.imply(`meridiem`,0),n.start.get(`hour`)==12&&n.start.assign(`hour`,0)):(n.start.imply(`meridiem`,1),n.start.get(`hour`)!=12&&n.start.assign(`hour`,n.start.get(`hour`)+12)))}else if(s[IF]){let e=s[IF][0];e==`早`?(o=0,i==12&&(i=0)):e==`晚`&&(o=1,i!=12&&(i+=12))}else if(s[LF]){let e=s[LF][0];e==`上`||e==`早`||e==`凌`?(o=0,i==12&&(i=0)):(e==`下`||e==`晚`)&&(o=1,i!=12&&(i+=12))}else if(s[zF]){let e=s[zF][0];e==`上`||e==`早`||e==`凌`?(o=0,i==12&&(i=0)):(e==`下`||e==`晚`)&&(o=1,i!=12&&(i+=12))}return n.text+=s[0],n.end.assign(`hour`,i),n.end.assign(`minute`,a),o>=0?n.end.assign(`meridiem`,o):n.start.isCertain(`meridiem`)&&n.start.get(`meridiem`)==1&&n.start.get(`hour`)>i?n.end.imply(`meridiem`,0):i>12&&n.end.imply(`meridiem`,1),n.end.date().getTime()<n.start.date().getTime()&&n.end.imply(`day`,n.end.get(`day`)+1),n}},GF=RegExp(`(?:星期|礼拜|周)(?<weekday>`+Object.keys(bF).join(`|`)+`)`),KF=class extends JM{innerPattern(){return GF}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),r=bF[t.groups.weekday];if(r===void 0)return null;let i=new Date(e.refDate.getTime()),a=r-i.getDay();return Math.abs(a-7)<Math.abs(a)&&(a-=7),Math.abs(a+7)<Math.abs(a)&&(a+=7),i.setDate(i.getDate()+a),n.start.assign(`weekday`,r),n.start.imply(`day`,i.getDate()),n.start.imply(`month`,i.getMonth()+1),n.start.imply(`year`,i.getFullYear()),n}},qF=1,JF=2,YF=3,XF=4,ZF=5,QF=6,$F=class extends JM{innerPattern(e){return RegExp(`(而家|立(?:刻|即)|即刻)|(今|明|前|大前|後|大後|聽|昨|尋|琴)(早|朝|晚)|(上(?:午|晝)|朝(?:早)|早(?:上)|下(?:午|晝)|晏(?:晝)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨))|(今|明|前|大前|後|大後|聽|昨|尋|琴)(?:日|天)(?:[\\s|,|,]*)(?:(上(?:午|晝)|朝(?:早)|早(?:上)|下(?:午|晝)|晏(?:晝)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨)))?`,`i`)}innerExtract(e,t){let n=t.index,r=e.createParsingResult(n,t[0]),i=e.refDate,a=new Date(i.getTime());if(t[qF])r.start.imply(`hour`,i.getHours()),r.start.imply(`minute`,i.getMinutes()),r.start.imply(`second`,i.getSeconds()),r.start.imply(`millisecond`,i.getMilliseconds());else if(t[JF]){let e=t[JF],n=t[YF];e==`明`||e==`聽`?i.getHours()>1&&a.setDate(a.getDate()+1):e==`昨`||e==`尋`||e==`琴`?a.setDate(a.getDate()-1):e==`前`?a.setDate(a.getDate()-2):e==`大前`?a.setDate(a.getDate()-3):e==`後`?a.setDate(a.getDate()+2):e==`大後`&&a.setDate(a.getDate()+3),n==`早`||n==`朝`?r.start.imply(`hour`,6):n==`晚`&&(r.start.imply(`hour`,22),r.start.imply(`meridiem`,1))}else if(t[XF]){let e=t[XF][0];e==`早`||e==`朝`||e==`上`?r.start.imply(`hour`,6):e==`下`||e==`晏`?(r.start.imply(`hour`,15),r.start.imply(`meridiem`,1)):e==`中`?(r.start.imply(`hour`,12),r.start.imply(`meridiem`,1)):e==`夜`||e==`晚`?(r.start.imply(`hour`,22),r.start.imply(`meridiem`,1)):e==`凌`&&r.start.imply(`hour`,0)}else if(t[ZF]){let e=t[ZF];e==`明`||e==`聽`?i.getHours()>1&&a.setDate(a.getDate()+1):e==`昨`||e==`尋`||e==`琴`?a.setDate(a.getDate()-1):e==`前`?a.setDate(a.getDate()-2):e==`大前`?a.setDate(a.getDate()-3):e==`後`?a.setDate(a.getDate()+2):e==`大後`&&a.setDate(a.getDate()+3);let n=t[QF];if(n){let e=n[0];e==`早`||e==`朝`||e==`上`?r.start.imply(`hour`,6):e==`下`||e==`晏`?(r.start.imply(`hour`,15),r.start.imply(`meridiem`,1)):e==`中`?(r.start.imply(`hour`,12),r.start.imply(`meridiem`,1)):e==`夜`||e==`晚`?(r.start.imply(`hour`,22),r.start.imply(`meridiem`,1)):e==`凌`&&r.start.imply(`hour`,0)}}return r.start.assign(`day`,a.getDate()),r.start.assign(`month`,a.getMonth()+1),r.start.assign(`year`,a.getFullYear()),r}},eI={零:0,一:1,二:2,兩:2,三:3,四:4,五:5,六:6,七:7,八:8,九:9,十:10,廿:20,卅:30},tI={天:0,日:0,一:1,二:2,三:3,四:4,五:5,六:6};function nI(e){let t=0;for(let n=0;n<e.length;n++){let r=e[n];r===`十`?t=t===0?eI[r]:t*eI[r]:t+=eI[r]}return t}function rI(e){let t=``;for(let n=0;n<e.length;n++){let r=e[n];t+=eI[r]}return parseInt(t)}var iI=1,aI=2,oI=3,sI=class extends JM{innerPattern(){return RegExp(`(\\d{2,4}|[`+Object.keys(eI).join(``)+`]{4}|[`+Object.keys(eI).join(``)+`]{2})?(?:\\s*)(?:年)?(?:[\\s|,|,]*)(\\d{1,2}|[`+Object.keys(eI).join(``)+`]{1,2})(?:\\s*)(?:月)(?:\\s*)(\\d{1,2}|[`+Object.keys(eI).join(``)+`]{1,2})?(?:\\s*)(?:日|號)?`)}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),r=parseInt(t[aI]);if(isNaN(r)&&(r=nI(t[aI])),n.start.assign(`month`,r),t[oI]){let e=parseInt(t[oI]);isNaN(e)&&(e=nI(t[oI])),n.start.assign(`day`,e)}else n.start.imply(`day`,e.refDate.getDate());if(t[iI]){let e=parseInt(t[iI]);isNaN(e)&&(e=rI(t[iI])),n.start.assign(`year`,e)}else n.start.imply(`year`,e.refDate.getFullYear());return n}},cI=RegExp(`(\\d+|[`+Object.keys(eI).join(``)+`]+|半|幾)(?:\\s*)(?:個)?(秒(?:鐘)?|分鐘|小時|鐘|日|天|星期|禮拜|月|年)(?:(?:之|過)?後|(?:之)?內)`,`i`),lI=1,uI=2,dI=class extends JM{innerPattern(){return cI}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),r=parseInt(t[lI]);if(isNaN(r)&&(r=nI(t[lI])),isNaN(r)){let e=t[lI];if(e===`幾`)r=3;else if(e===`半`)r=.5;else return null}let i={},a=t[uI][0];if(a.match(/[日天星禮月年]/)){a==`日`||a==`天`?i.day=r:a==`星`||a==`禮`?i.week=r:a==`月`?i.month=r:a==`年`&&(i.year=r);let t=_M(e.refDate,i);return n.start.assign(`year`,t.getFullYear()),n.start.assign(`month`,t.getMonth()+1),n.start.assign(`day`,t.getDate()),n}a==`秒`?i.second=r:a==`分`?i.minute=r:(a==`小`||a==`鐘`)&&(i.hour=r);let o=_M(e.refDate,i);return n.start.imply(`year`,o.getFullYear()),n.start.imply(`month`,o.getMonth()+1),n.start.imply(`day`,o.getDate()),n.start.assign(`hour`,o.getHours()),n.start.assign(`minute`,o.getMinutes()),n.start.assign(`second`,o.getSeconds()),n}},fI=RegExp(`(?<prefix>上|今|下|這|呢)(?:個)?(?:星期|禮拜|週)(?<weekday>`+Object.keys(tI).join(`|`)+`)`),pI=class extends JM{innerPattern(){return fI}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),r=tI[t.groups.weekday];if(r===void 0)return null;let i=null,a=t.groups.prefix;a==`上`?i=`last`:a==`下`?i=`next`:(a==`今`||a==`這`||a==`呢`)&&(i=`this`);let o=new Date(e.refDate.getTime()),s=!1,c=o.getDay();if(i==`last`||i==`past`)o.setDate(o.getDate()+(r-7-c)),s=!0;else if(i==`next`)o.setDate(o.getDate()+(r+7-c)),s=!0;else if(i==`this`)o.setDate(o.getDate()+(r-c));else{let e=r-c;Math.abs(e-7)<Math.abs(e)&&(e-=7),Math.abs(e+7)<Math.abs(e)&&(e+=7),o.setDate(o.getDate()+e)}return n.start.assign(`weekday`,r),s?(n.start.assign(`day`,o.getDate()),n.start.assign(`month`,o.getMonth()+1),n.start.assign(`year`,o.getFullYear())):(n.start.imply(`day`,o.getDate()),n.start.imply(`month`,o.getMonth()+1),n.start.imply(`year`,o.getFullYear())),n}},mI=RegExp(`(?:由|從|自)?(?:(今|明|前|大前|後|大後|聽|昨|尋|琴)(早|朝|晚)|(上(?:午|晝)|朝(?:早)|早(?:上)|下(?:午|晝)|晏(?:晝)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨))|(今|明|前|大前|後|大後|聽|昨|尋|琴)(?:日|天)(?:[\\s,,]*)(?:(上(?:午|晝)|朝(?:早)|早(?:上)|下(?:午|晝)|晏(?:晝)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨)))?)?(?:[\\s,,]*)(?:(\\d+|[`+Object.keys(eI).join(``)+`]+)(?:\\s*)(?:點|時|:|:)(?:\\s*)(\\d+|半|正|整|[`+Object.keys(eI).join(``)+`]+)?(?:\\s*)(?:分|:|:)?(?:\\s*)(\\d+|[`+Object.keys(eI).join(``)+`]+)?(?:\\s*)(?:秒)?)(?:\\s*(A.M.|P.M.|AM?|PM?))?`,`i`),hI=RegExp(`(?:^\\s*(?:到|至|\\-|\\–|\\~|\\〜)\\s*)(?:(今|明|前|大前|後|大後|聽|昨|尋|琴)(早|朝|晚)|(上(?:午|晝)|朝(?:早)|早(?:上)|下(?:午|晝)|晏(?:晝)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨))|(今|明|前|大前|後|大後|聽|昨|尋|琴)(?:日|天)(?:[\\s,,]*)(?:(上(?:午|晝)|朝(?:早)|早(?:上)|下(?:午|晝)|晏(?:晝)|晚(?:上)|夜(?:晚)?|中(?:午)|凌(?:晨)))?)?(?:[\\s,,]*)(?:(\\d+|[`+Object.keys(eI).join(``)+`]+)(?:\\s*)(?:點|時|:|:)(?:\\s*)(\\d+|半|正|整|[`+Object.keys(eI).join(``)+`]+)?(?:\\s*)(?:分|:|:)?(?:\\s*)(\\d+|[`+Object.keys(eI).join(``)+`]+)?(?:\\s*)(?:秒)?)(?:\\s*(A.M.|P.M.|AM?|PM?))?`,`i`),gI=1,_I=2,vI=3,yI=4,bI=5,xI=6,SI=7,CI=8,wI=9,TI=class extends JM{patternLeftBoundary(){return`()`}innerPattern(){return mI}innerExtract(e,t){if(t.index>0&&e.text[t.index-1].match(/\w/))return null;let n=e.createParsingResult(t.index,t[0]),r=new Date(e.reference.instant.getTime());if(t[gI]){let i=t[gI];i==`明`||i==`聽`?e.refDate.getHours()>1&&r.setDate(r.getDate()+1):i==`昨`||i==`尋`||i==`琴`?r.setDate(r.getDate()-1):i==`前`?r.setDate(r.getDate()-2):i==`大前`?r.setDate(r.getDate()-3):i==`後`?r.setDate(r.getDate()+2):i==`大後`&&r.setDate(r.getDate()+3),n.start.assign(`day`,r.getDate()),n.start.assign(`month`,r.getMonth()+1),n.start.assign(`year`,r.getFullYear())}else if(t[yI]){let e=t[yI];e==`明`||e==`聽`?r.setDate(r.getDate()+1):e==`昨`||e==`尋`||e==`琴`?r.setDate(r.getDate()-1):e==`前`?r.setDate(r.getDate()-2):e==`大前`?r.setDate(r.getDate()-3):e==`後`?r.setDate(r.getDate()+2):e==`大後`&&r.setDate(r.getDate()+3),n.start.assign(`day`,r.getDate()),n.start.assign(`month`,r.getMonth()+1),n.start.assign(`year`,r.getFullYear())}else n.start.imply(`day`,r.getDate()),n.start.imply(`month`,r.getMonth()+1),n.start.imply(`year`,r.getFullYear());let i=0,a=0,o=-1;if(t[CI]){var s=parseInt(t[CI]);if(isNaN(s)&&(s=nI(t[CI])),s>=60)return null;n.start.assign(`second`,s)}if(i=parseInt(t[xI]),isNaN(i)&&(i=nI(t[xI])),t[SI]?t[SI]==`半`?a=30:t[SI]==`正`||t[SI]==`整`?a=0:(a=parseInt(t[SI]),isNaN(a)&&(a=nI(t[SI]))):i>100&&(a=i%100,i=Math.floor(i/100)),a>=60||i>24)return null;if(i>=12&&(o=1),t[wI]){if(i>12)return null;var c=t[wI][0].toLowerCase();c==`a`&&(o=0,i==12&&(i=0)),c==`p`&&(o=1,i!=12&&(i+=12))}else if(t[_I]){var l=t[_I][0];l==`朝`||l==`早`?(o=0,i==12&&(i=0)):l==`晚`&&(o=1,i!=12&&(i+=12))}else if(t[vI]){var u=t[vI][0];u==`上`||u==`朝`||u==`早`||u==`凌`?(o=0,i==12&&(i=0)):(u==`下`||u==`晏`||u==`晚`)&&(o=1,i!=12&&(i+=12))}else if(t[bI]){var d=t[bI][0];d==`上`||d==`朝`||d==`早`||d==`凌`?(o=0,i==12&&(i=0)):(d==`下`||d==`晏`||d==`晚`)&&(o=1,i!=12&&(i+=12))}n.start.assign(`hour`,i),n.start.assign(`minute`,a),o>=0?n.start.assign(`meridiem`,o):i<12?n.start.imply(`meridiem`,0):n.start.imply(`meridiem`,1);let f=hI.exec(e.text.substring(n.index+n.text.length));if(!f)return n.text.match(/^\d+$/)?null:n;let p=new Date(r.getTime());if((f[gI]||f[yI])&&(p=new Date(e.reference.instant.getTime())),n.end=e.createParsingComponents(),f[gI]){let t=f[gI];t==`明`||t==`聽`?e.refDate.getHours()>1&&p.setDate(p.getDate()+1):t==`昨`||t==`尋`||t==`琴`?p.setDate(p.getDate()-1):t==`前`?p.setDate(p.getDate()-2):t==`大前`?p.setDate(p.getDate()-3):t==`後`?p.setDate(p.getDate()+2):t==`大後`&&p.setDate(p.getDate()+3),n.end.assign(`day`,p.getDate()),n.end.assign(`month`,p.getMonth()+1),n.end.assign(`year`,p.getFullYear())}else if(f[yI]){let e=f[yI];e==`明`||e==`聽`?p.setDate(p.getDate()+1):e==`昨`||e==`尋`||e==`琴`?p.setDate(p.getDate()-1):e==`前`?p.setDate(p.getDate()-2):e==`大前`?p.setDate(p.getDate()-3):e==`後`?p.setDate(p.getDate()+2):e==`大後`&&p.setDate(p.getDate()+3),n.end.assign(`day`,p.getDate()),n.end.assign(`month`,p.getMonth()+1),n.end.assign(`year`,p.getFullYear())}else n.end.imply(`day`,p.getDate()),n.end.imply(`month`,p.getMonth()+1),n.end.imply(`year`,p.getFullYear());if(i=0,a=0,o=-1,f[CI]){let e=parseInt(f[CI]);if(isNaN(e)&&(e=nI(f[CI])),e>=60)return null;n.end.assign(`second`,e)}if(i=parseInt(f[xI]),isNaN(i)&&(i=nI(f[xI])),f[SI]?f[SI]==`半`?a=30:f[SI]==`正`||f[SI]==`整`?a=0:(a=parseInt(f[SI]),isNaN(a)&&(a=nI(f[SI]))):i>100&&(a=i%100,i=Math.floor(i/100)),a>=60||i>24)return null;if(i>=12&&(o=1),f[wI]){if(i>12)return null;var c=f[wI][0].toLowerCase();c==`a`&&(o=0,i==12&&(i=0)),c==`p`&&(o=1,i!=12&&(i+=12)),n.start.isCertain(`meridiem`)||(o==0?(n.start.imply(`meridiem`,0),n.start.get(`hour`)==12&&n.start.assign(`hour`,0)):(n.start.imply(`meridiem`,1),n.start.get(`hour`)!=12&&n.start.assign(`hour`,n.start.get(`hour`)+12)))}else if(f[_I]){var l=f[_I][0];l==`朝`||l==`早`?(o=0,i==12&&(i=0)):l==`晚`&&(o=1,i!=12&&(i+=12))}else if(f[vI]){var u=f[vI][0];u==`上`||u==`朝`||u==`早`||u==`凌`?(o=0,i==12&&(i=0)):(u==`下`||u==`晏`||u==`晚`)&&(o=1,i!=12&&(i+=12))}else if(f[bI]){var d=f[bI][0];d==`上`||d==`朝`||d==`早`||d==`凌`?(o=0,i==12&&(i=0)):(d==`下`||d==`晏`||d==`晚`)&&(o=1,i!=12&&(i+=12))}return n.text+=f[0],n.end.assign(`hour`,i),n.end.assign(`minute`,a),o>=0?n.end.assign(`meridiem`,o):n.start.isCertain(`meridiem`)&&n.start.get(`meridiem`)==1&&n.start.get(`hour`)>i?n.end.imply(`meridiem`,0):i>12&&n.end.imply(`meridiem`,1),n.end.date().getTime()<n.start.date().getTime()&&n.end.imply(`day`,n.end.get(`day`)+1),n}},EI=RegExp(`(?:星期|禮拜|週)(?<weekday>`+Object.keys(tI).join(`|`)+`)`),DI=class extends JM{innerPattern(){return EI}innerExtract(e,t){let n=e.createParsingResult(t.index,t[0]),r=tI[t.groups.weekday];if(r===void 0)return null;let i=new Date(e.refDate.getTime()),a=r-i.getDay();return Math.abs(a-7)<Math.abs(a)&&(a-=7),Math.abs(a+7)<Math.abs(a)&&(a+=7),i.setDate(i.getDate()+a),n.start.assign(`weekday`,r),n.start.imply(`day`,i.getDate()),n.start.imply(`month`,i.getMonth()+1),n.start.imply(`year`,i.getFullYear()),n}},OI=class extends WN{patternBetween(){return/^\s*(至|到|\-|\~|~|-|ー)\s*$/i}},kI=class extends JN{patternBetween(){return/^\s*$/i}},AI=new _F(MI());new _F(NI());function jI(e,t,n){return AI.parseDate(e,t,n)}function MI(){let e=NI();return e.parsers.unshift(new $F),e}function NI(){let e=wP({parsers:[new sI,new EF,new pI,new MF,new DI,new KF,new TI,new WF,new dI,new AF],refiners:[new OI,new kI]});return e.refiners=e.refiners.filter(e=>!(e instanceof nP)),e}var PI=c(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self).dayjs_plugin_isoWeek=r()})(e,(function(){"use strict";var e=`day`;return function(t,n,r){var i=function(t){return t.add(4-t.isoWeekday(),e)},a=n.prototype;a.isoWeekYear=function(){return i(this).year()},a.isoWeek=function(t){if(!this.$utils().u(t))return this.add(7*(t-this.isoWeek()),e);var n,a,o,s,c=i(this),l=(n=this.isoWeekYear(),a=this.$u,o=(a?r.utc:r)().year(n).startOf(`year`),s=4-o.isoWeekday(),o.isoWeekday()>4&&(s+=7),o.add(s,e));return c.diff(l,`week`)+1},a.isoWeekday=function(e){return this.$utils().u(e)?this.day()||7:this.day(this.day()%7?e:e-7)};var o=a.startOf;a.startOf=function(e,t){var n=this.$utils(),r=!!n.u(t)||t;return n.p(e)===`isoweek`?r?this.date(this.date()-(this.isoWeekday()-1)).startOf(`day`):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf(`day`):o.bind(this)(e,t)}}}))})),FI=d(ob()),II=d(PI());FI.default.extend(II.default);function LI(){return(0,FI.default)().startOf(`isoWeek`).toDate()}var RI=/大*后天/g;function zI(e){if(!RI.test(e))return e;let t=(0,FI.default)();return RI.lastIndex=0,e.replace(RI,e=>{let n=2+(e.length-2);return t.add(n,`day`).format(`YYYY年MM月DD日`)})}function BI(e){let t=zI(e),n=jI(t,{instant:/(?:本|这|上|下)?(?:周|星期)/.test(t)?LI():new Date});return n?(0,FI.default)(n).format(`YYYY-MM-DD HH:mm:ss`):`无法解析,请输入具体时间`}var VI={parse_relative_date:{def:{type:`function`,function:{name:`parse_relative_date`,description:`把相对时间转成绝对时间`,parameters:{type:`object`,properties:{input:{type:`string`,description:`相对时间`}},required:[`input`]}}},handler:e=>BI(e.input)}},HI=class extends HTMLElement{appRef;promise;resolve;constructor(){super(),this.attachShadow({mode:`open`}),this.promise=new Promise(e=>{this.resolve=e})}connectedCallback(){this.shadowRoot&&(this.appRef=iM({domNode:this.shadowRoot,onReady:()=>this.resolve()}))}ready(){return this.promise}async pushMessage(e){await this.promise,this.appRef?.current?.pushMessage(e)}async pushMessages(e){await this.promise,this.appRef?.current?.pushMessages(e)}async pushLoadingMessage(){await this.promise,this.appRef?.current?.pushLoadingMessage()}async updateLoadingMessageReasoningContent(e){await this.promise,this.appRef?.current?.updateLoadingMessageReasoningContent(e)}async updateLoadingMessageContent(e){await this.promise,this.appRef?.current?.updateLoadingMessageContent(e)}async updateContext(e){await this.promise,this.appRef?.current?.updateContext(e)}};customElements.define(`ai-chat-panel`,HI),e.AIChatPanel=class{on=p.on;panelElement;constructor(e){let{container:t}=e;if(!t)throw Error(`未提供有效的 container`);this.panelElement=document.createElement(`ai-chat-panel`),t.appendChild(this.panelElement)}ready(){return this.panelElement.ready()}pushMessage(e){return this.panelElement.pushMessage(e)}pushMessages(e){return this.panelElement.pushMessages(e)}pushLoadingMessage(){return this.panelElement.pushLoadingMessage()}updateLoadingMessageReasoningContent(e){return this.panelElement.updateLoadingMessageReasoningContent(e)}updateLoadingMessageContent(e){return this.panelElement.updateLoadingMessageContent(e)}updateContext(e){return this.panelElement.updateContext(e)}},e.Agent=Li,e.tools=VI});
|
package/dist/index.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ export interface PanelElement extends HTMLElement {
|
|
|
23
23
|
pushLoadingMessage(): Promise<void>;
|
|
24
24
|
updateLoadingMessageReasoningContent(content: string): Promise<void>;
|
|
25
25
|
updateLoadingMessageContent(content: string): Promise<void>;
|
|
26
|
+
updateContext(content: string): Promise<void>;
|
|
26
27
|
}
|
|
27
28
|
interface Config {
|
|
28
29
|
container: HTMLElement | null;
|
|
@@ -40,5 +41,6 @@ export declare class AIChatPanel {
|
|
|
40
41
|
pushLoadingMessage(): Promise<void>;
|
|
41
42
|
updateLoadingMessageReasoningContent(content: string): Promise<void>;
|
|
42
43
|
updateLoadingMessageContent(content: string): Promise<void>;
|
|
44
|
+
updateContext(content: string): Promise<void>;
|
|
43
45
|
}
|
|
44
46
|
export { tools, Agent, type Message, type StreamResult, type AssistantMessage };
|
package/dist/view/App.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export interface AppRef {
|
|
|
20
20
|
pushLoadingMessage: () => void;
|
|
21
21
|
updateLoadingMessageReasoningContent: (content: string) => void;
|
|
22
22
|
updateLoadingMessageContent: (content: string) => void;
|
|
23
|
+
updateContext: (content: string) => void;
|
|
23
24
|
}
|
|
24
25
|
interface AppProps {
|
|
25
26
|
onReady: () => void;
|