droplinked-chatbot-next 1.0.2 → 1.0.3
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/assets/icons/Action/Send/SendMd.d.ts +2 -0
- package/dist/assets/icons/system/Letter/LetterMd.d.ts +2 -0
- package/dist/components/SmartLink.d.ts +9 -0
- package/dist/components/TypingIndicator.d.ts +0 -2
- package/dist/index.esm.js +1968 -231
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +2005 -268
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
var Chakra = require('@chakra-ui/react');
|
|
5
|
-
var
|
|
5
|
+
var React3 = require('react');
|
|
6
6
|
|
|
7
7
|
function _interopNamespaceDefault(e) {
|
|
8
8
|
var n = Object.create(null);
|
|
@@ -22,7 +22,7 @@ function _interopNamespaceDefault(e) {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
var Chakra__namespace = /*#__PURE__*/_interopNamespaceDefault(Chakra);
|
|
25
|
-
var
|
|
25
|
+
var React3__namespace = /*#__PURE__*/_interopNamespaceDefault(React3);
|
|
26
26
|
|
|
27
27
|
function _arrayLikeToArray(r, a) {
|
|
28
28
|
(null == a || a > r.length) && (a = r.length);
|
|
@@ -4367,11 +4367,11 @@ var useChatbot = function useChatbot(_ref) {
|
|
|
4367
4367
|
apiKey = _ref.apiKey,
|
|
4368
4368
|
initialUser = _ref.initialUser,
|
|
4369
4369
|
client = _ref.client;
|
|
4370
|
-
var _useState =
|
|
4370
|
+
var _useState = React3.useState([]),
|
|
4371
4371
|
_useState2 = _slicedToArray(_useState, 2),
|
|
4372
4372
|
messages = _useState2[0],
|
|
4373
4373
|
setMessages = _useState2[1];
|
|
4374
|
-
var _useState3 =
|
|
4374
|
+
var _useState3 = React3.useState({
|
|
4375
4375
|
email: (_initialUser$email = initialUser === null || initialUser === void 0 ? void 0 : initialUser.email) !== null && _initialUser$email !== void 0 ? _initialUser$email : "",
|
|
4376
4376
|
isLoggedIn: (initialUser === null || initialUser === void 0 ? void 0 : initialUser.isLoggedIn) !== undefined ? initialUser.isLoggedIn : Boolean(initialUser === null || initialUser === void 0 ? void 0 : initialUser.email),
|
|
4377
4377
|
name: initialUser === null || initialUser === void 0 ? void 0 : initialUser.name,
|
|
@@ -4380,55 +4380,55 @@ var useChatbot = function useChatbot(_ref) {
|
|
|
4380
4380
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
4381
4381
|
user = _useState4[0],
|
|
4382
4382
|
setUser = _useState4[1];
|
|
4383
|
-
var _useState5 =
|
|
4383
|
+
var _useState5 = React3.useState("hello"),
|
|
4384
4384
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
4385
4385
|
currentView = _useState6[0],
|
|
4386
4386
|
setCurrentView = _useState6[1];
|
|
4387
|
-
var _useState7 =
|
|
4387
|
+
var _useState7 = React3.useState(""),
|
|
4388
4388
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
4389
4389
|
threadId = _useState8[0],
|
|
4390
4390
|
setThreadId = _useState8[1];
|
|
4391
|
-
var _useState9 =
|
|
4391
|
+
var _useState9 = React3.useState(false),
|
|
4392
4392
|
_useState0 = _slicedToArray(_useState9, 2),
|
|
4393
4393
|
isLoading = _useState0[0],
|
|
4394
4394
|
setIsLoading = _useState0[1];
|
|
4395
|
-
var _useState1 =
|
|
4395
|
+
var _useState1 = React3.useState(false),
|
|
4396
4396
|
_useState10 = _slicedToArray(_useState1, 2),
|
|
4397
4397
|
isTyping = _useState10[0],
|
|
4398
4398
|
setIsTyping = _useState10[1];
|
|
4399
|
-
var _useState11 =
|
|
4399
|
+
var _useState11 = React3.useState(false),
|
|
4400
4400
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
4401
4401
|
isEmailSubmitting = _useState12[0],
|
|
4402
4402
|
setIsEmailSubmitting = _useState12[1];
|
|
4403
|
-
var _useState13 =
|
|
4403
|
+
var _useState13 = React3.useState(false),
|
|
4404
4404
|
_useState14 = _slicedToArray(_useState13, 2),
|
|
4405
4405
|
isStartingChat = _useState14[0],
|
|
4406
4406
|
setIsStartingChat = _useState14[1];
|
|
4407
|
-
var _useState15 =
|
|
4407
|
+
var _useState15 = React3.useState(new Set()),
|
|
4408
4408
|
_useState16 = _slicedToArray(_useState15, 2),
|
|
4409
4409
|
historyMessageIds = _useState16[0],
|
|
4410
4410
|
setHistoryMessageIds = _useState16[1];
|
|
4411
|
-
var _useState17 =
|
|
4411
|
+
var _useState17 = React3.useState(null),
|
|
4412
4412
|
_useState18 = _slicedToArray(_useState17, 2),
|
|
4413
4413
|
currentlyProcessingMessageId = _useState18[0],
|
|
4414
4414
|
setCurrentlyProcessingMessageId = _useState18[1];
|
|
4415
|
-
var _useState19 =
|
|
4415
|
+
var _useState19 = React3.useState(null),
|
|
4416
4416
|
_useState20 = _slicedToArray(_useState19, 2),
|
|
4417
4417
|
lastFailedMessage = _useState20[0],
|
|
4418
4418
|
setLastFailedMessage = _useState20[1];
|
|
4419
|
-
var api =
|
|
4419
|
+
var api = React3.useMemo(function () {
|
|
4420
4420
|
return client !== null && client !== void 0 ? client : new ChatbotAPI(apiBaseUrl, apiKey);
|
|
4421
4421
|
}, [client, apiBaseUrl, apiKey]);
|
|
4422
|
-
var startControllerRef =
|
|
4423
|
-
var sendControllerRef =
|
|
4424
|
-
|
|
4422
|
+
var startControllerRef = React3.useRef(null);
|
|
4423
|
+
var sendControllerRef = React3.useRef(null);
|
|
4424
|
+
React3.useEffect(function () {
|
|
4425
4425
|
return function () {
|
|
4426
4426
|
var _startControllerRef$c, _sendControllerRef$cu;
|
|
4427
4427
|
(_startControllerRef$c = startControllerRef.current) === null || _startControllerRef$c === void 0 || _startControllerRef$c.abort();
|
|
4428
4428
|
(_sendControllerRef$cu = sendControllerRef.current) === null || _sendControllerRef$cu === void 0 || _sendControllerRef$cu.abort();
|
|
4429
4429
|
};
|
|
4430
4430
|
}, []);
|
|
4431
|
-
var loadConversationHistory =
|
|
4431
|
+
var loadConversationHistory = React3.useCallback(/*#__PURE__*/function () {
|
|
4432
4432
|
var _ref2 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(thread) {
|
|
4433
4433
|
var _startControllerRef$c2;
|
|
4434
4434
|
var history, historyIds;
|
|
@@ -4455,7 +4455,7 @@ var useChatbot = function useChatbot(_ref) {
|
|
|
4455
4455
|
return _ref2.apply(this, arguments);
|
|
4456
4456
|
};
|
|
4457
4457
|
}(), [api]);
|
|
4458
|
-
var handleStartChat =
|
|
4458
|
+
var handleStartChat = React3.useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2() {
|
|
4459
4459
|
var _startControllerRef$c3;
|
|
4460
4460
|
var startChatRequest, response, _t;
|
|
4461
4461
|
return _regenerator().w(function (_context2) {
|
|
@@ -4502,10 +4502,10 @@ var useChatbot = function useChatbot(_ref) {
|
|
|
4502
4502
|
}
|
|
4503
4503
|
}, _callee2, null, [[1, 4, 5, 6]]);
|
|
4504
4504
|
})), [api, threadId, user.email, user.isLoggedIn, loadConversationHistory]);
|
|
4505
|
-
var handleBackToHello =
|
|
4505
|
+
var handleBackToHello = React3.useCallback(function () {
|
|
4506
4506
|
setCurrentView("hello");
|
|
4507
4507
|
}, []);
|
|
4508
|
-
var handleEmailSubmit =
|
|
4508
|
+
var handleEmailSubmit = React3.useCallback(/*#__PURE__*/function () {
|
|
4509
4509
|
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee3(email, showToast) {
|
|
4510
4510
|
var _startControllerRef$c4;
|
|
4511
4511
|
var startChatRequest, response, errorMessage, _errorMessage, _t2;
|
|
@@ -4567,7 +4567,7 @@ var useChatbot = function useChatbot(_ref) {
|
|
|
4567
4567
|
return _ref4.apply(this, arguments);
|
|
4568
4568
|
};
|
|
4569
4569
|
}(), [api, loadConversationHistory]);
|
|
4570
|
-
var handleSendMessage =
|
|
4570
|
+
var handleSendMessage = React3.useCallback(/*#__PURE__*/function () {
|
|
4571
4571
|
var _ref5 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee4(text) {
|
|
4572
4572
|
var newMessage, _sendControllerRef$cu2, request, response, botResponse, errorMessage, _t3;
|
|
4573
4573
|
return _regenerator().w(function (_context4) {
|
|
@@ -4644,7 +4644,7 @@ var useChatbot = function useChatbot(_ref) {
|
|
|
4644
4644
|
return _ref5.apply(this, arguments);
|
|
4645
4645
|
};
|
|
4646
4646
|
}(), [api, threadId]);
|
|
4647
|
-
var resetChat =
|
|
4647
|
+
var resetChat = React3.useCallback(function () {
|
|
4648
4648
|
setMessages([]);
|
|
4649
4649
|
setUser({
|
|
4650
4650
|
email: "",
|
|
@@ -4658,7 +4658,7 @@ var useChatbot = function useChatbot(_ref) {
|
|
|
4658
4658
|
setCurrentlyProcessingMessageId(null);
|
|
4659
4659
|
setLastFailedMessage(null);
|
|
4660
4660
|
}, []);
|
|
4661
|
-
var handleRetryLastMessage =
|
|
4661
|
+
var handleRetryLastMessage = React3.useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee5() {
|
|
4662
4662
|
var _sendControllerRef$cu3, request, response, botResponse, errorMessage, _t4;
|
|
4663
4663
|
return _regenerator().w(function (_context5) {
|
|
4664
4664
|
while (1) switch (_context5.p = _context5.n) {
|
|
@@ -4750,36 +4750,64 @@ var useChatbot = function useChatbot(_ref) {
|
|
|
4750
4750
|
};
|
|
4751
4751
|
};
|
|
4752
4752
|
|
|
4753
|
-
var _excluded$
|
|
4754
|
-
var
|
|
4753
|
+
var _excluded$b = ["color"];
|
|
4754
|
+
var SendMd = function SendMd(_ref) {
|
|
4755
4755
|
var _ref$color = _ref.color,
|
|
4756
4756
|
color = _ref$color === void 0 ? "black" : _ref$color,
|
|
4757
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
|
4757
|
+
props = _objectWithoutProperties(_ref, _excluded$b);
|
|
4758
4758
|
return jsxRuntime.jsxs("svg", _objectSpread2(_objectSpread2({
|
|
4759
|
-
width: "
|
|
4760
|
-
height: "
|
|
4761
|
-
viewBox: "0 0
|
|
4759
|
+
width: "20",
|
|
4760
|
+
height: "20",
|
|
4761
|
+
viewBox: "0 0 20 20",
|
|
4762
4762
|
fill: "none",
|
|
4763
4763
|
xmlns: "http://www.w3.org/2000/svg"
|
|
4764
4764
|
}, props), {}, {
|
|
4765
4765
|
children: [jsxRuntime.jsx("path", {
|
|
4766
|
-
d: "
|
|
4766
|
+
d: "M5.3738 3.48795L15.9045 8.7562C16.1339 8.87345 16.3265 9.05162 16.4609 9.27115C16.5953 9.49055 16.6663 9.74278 16.6663 9.99991C16.6663 10.2572 16.5953 10.5093 16.4609 10.7288C16.3265 10.9482 16.1339 11.1264 15.9045 11.2436L5.3738 16.5119C5.1108 16.6469 4.81174 16.6952 4.51947 16.6502C4.22721 16.6051 3.95674 16.4688 3.74686 16.2609C3.53697 16.0531 3.39842 15.7842 3.35107 15.4929C3.30372 15.2015 3.35002 14.9027 3.48331 14.6393L5.49983 10.6287C5.59832 10.4337 5.64963 10.2183 5.64963 9.99991C5.64963 9.78149 5.59832 9.56615 5.49983 9.37107L3.48331 5.36049C3.35002 5.09705 3.30372 4.79827 3.35107 4.50696C3.39842 4.21565 3.53697 3.94678 3.74686 3.73888C3.95674 3.53099 4.22721 3.39473 4.51947 3.34965C4.81174 3.30458 5.1108 3.35299 5.3738 3.48795Z",
|
|
4767
4767
|
stroke: color,
|
|
4768
|
+
strokeWidth: "1.5",
|
|
4768
4769
|
"stroke-miterlimit": "10"
|
|
4769
4770
|
}), jsxRuntime.jsx("path", {
|
|
4770
|
-
d: "
|
|
4771
|
+
d: "M5.83301 10H9.16634",
|
|
4771
4772
|
stroke: color,
|
|
4773
|
+
strokeWidth: "1.5",
|
|
4772
4774
|
"stroke-miterlimit": "10",
|
|
4773
4775
|
strokeLinecap: "round"
|
|
4774
4776
|
})]
|
|
4775
4777
|
}));
|
|
4776
4778
|
};
|
|
4777
4779
|
|
|
4780
|
+
var _excluded$a = ["color"];
|
|
4781
|
+
var LetterMd = function LetterMd(_ref) {
|
|
4782
|
+
var _ref$color = _ref.color,
|
|
4783
|
+
color = _ref$color === void 0 ? "black" : _ref$color,
|
|
4784
|
+
props = _objectWithoutProperties(_ref, _excluded$a);
|
|
4785
|
+
return jsxRuntime.jsxs("svg", _objectSpread2(_objectSpread2({
|
|
4786
|
+
width: "20",
|
|
4787
|
+
height: "20",
|
|
4788
|
+
viewBox: "0 0 20 20",
|
|
4789
|
+
fill: "none",
|
|
4790
|
+
xmlns: "http://www.w3.org/2000/svg"
|
|
4791
|
+
}, props), {}, {
|
|
4792
|
+
children: [jsxRuntime.jsx("path", {
|
|
4793
|
+
d: "M5.83301 7.5L9.99967 10.4167L14.1663 7.5",
|
|
4794
|
+
stroke: color,
|
|
4795
|
+
strokeWidth: "1.5",
|
|
4796
|
+
strokeLinecap: "round",
|
|
4797
|
+
strokeLinejoin: "round"
|
|
4798
|
+
}), jsxRuntime.jsx("path", {
|
|
4799
|
+
d: "M1.66699 14.1667V5.83334C1.66699 4.91286 2.41318 4.16667 3.33366 4.16667H16.667C17.5875 4.16667 18.3337 4.91286 18.3337 5.83334V14.1667C18.3337 15.0872 17.5875 15.8333 16.667 15.8333H3.33366C2.41318 15.8333 1.66699 15.0872 1.66699 14.1667Z",
|
|
4800
|
+
stroke: color,
|
|
4801
|
+
strokeWidth: "1.5"
|
|
4802
|
+
})]
|
|
4803
|
+
}));
|
|
4804
|
+
};
|
|
4805
|
+
|
|
4778
4806
|
function EmailCapture(_ref) {
|
|
4779
4807
|
var onSubmit = _ref.onSubmit,
|
|
4780
4808
|
_ref$isSubmitting = _ref.isSubmitting,
|
|
4781
4809
|
isSubmitting = _ref$isSubmitting === void 0 ? false : _ref$isSubmitting;
|
|
4782
|
-
var _useState =
|
|
4810
|
+
var _useState = React3.useState(""),
|
|
4783
4811
|
_useState2 = _slicedToArray(_useState, 2),
|
|
4784
4812
|
email = _useState2[0],
|
|
4785
4813
|
setEmail = _useState2[1];
|
|
@@ -4808,7 +4836,9 @@ function EmailCapture(_ref) {
|
|
|
4808
4836
|
border: "1px solid",
|
|
4809
4837
|
borderColor: "#27272A",
|
|
4810
4838
|
overflow: "hidden",
|
|
4811
|
-
children: [jsxRuntime.jsx(
|
|
4839
|
+
children: [jsxRuntime.jsx(LetterMd, {
|
|
4840
|
+
color: "#7B7B7B"
|
|
4841
|
+
}), jsxRuntime.jsx(Chakra.Input, {
|
|
4812
4842
|
value: email,
|
|
4813
4843
|
onChange: function onChange(e) {
|
|
4814
4844
|
return setEmail(e.target.value);
|
|
@@ -4854,8 +4884,8 @@ function EmailCapture(_ref) {
|
|
|
4854
4884
|
color: "#525252",
|
|
4855
4885
|
cursor: "not-allowed"
|
|
4856
4886
|
},
|
|
4857
|
-
px:
|
|
4858
|
-
py:
|
|
4887
|
+
px: 3,
|
|
4888
|
+
py: 2,
|
|
4859
4889
|
borderRadius: "md",
|
|
4860
4890
|
height: "auto",
|
|
4861
4891
|
minHeight: "auto",
|
|
@@ -4897,6 +4927,8 @@ function SuggestionChips(_ref) {
|
|
|
4897
4927
|
fontSize: "sm",
|
|
4898
4928
|
fontWeight: "normal",
|
|
4899
4929
|
lineHeight: "tight",
|
|
4930
|
+
_hover: "none",
|
|
4931
|
+
_active: "none",
|
|
4900
4932
|
children: s.text
|
|
4901
4933
|
}, s.id);
|
|
4902
4934
|
})
|
|
@@ -4926,7 +4958,7 @@ function MessageInput(_ref) {
|
|
|
4926
4958
|
isEmailSubmitting = _ref$isEmailSubmittin === void 0 ? false : _ref$isEmailSubmittin,
|
|
4927
4959
|
_ref$messages = _ref.messages,
|
|
4928
4960
|
messages = _ref$messages === void 0 ? [] : _ref$messages;
|
|
4929
|
-
var _useState =
|
|
4961
|
+
var _useState = React3.useState(""),
|
|
4930
4962
|
_useState2 = _slicedToArray(_useState, 2),
|
|
4931
4963
|
input = _useState2[0],
|
|
4932
4964
|
setInput = _useState2[1];
|
|
@@ -4974,7 +5006,7 @@ function MessageInput(_ref) {
|
|
|
4974
5006
|
onKeyDown: function onKeyDown(e) {
|
|
4975
5007
|
return e.key === "Enter" && handleSend();
|
|
4976
5008
|
},
|
|
4977
|
-
placeholder: "
|
|
5009
|
+
placeholder: "Send a message",
|
|
4978
5010
|
bg: "transparent",
|
|
4979
5011
|
color: "white",
|
|
4980
5012
|
border: "none",
|
|
@@ -4996,7 +5028,6 @@ function MessageInput(_ref) {
|
|
|
4996
5028
|
fontSize: "sm"
|
|
4997
5029
|
})
|
|
4998
5030
|
}), jsxRuntime.jsxs(Chakra.HStack, {
|
|
4999
|
-
p: 2,
|
|
5000
5031
|
align: "center",
|
|
5001
5032
|
w: "full",
|
|
5002
5033
|
children: [user.logoUrl && jsxRuntime.jsx(Chakra.HStack, {
|
|
@@ -5014,7 +5045,7 @@ function MessageInput(_ref) {
|
|
|
5014
5045
|
onClick: handleSend,
|
|
5015
5046
|
isDisabled: !input.trim() || isLoading,
|
|
5016
5047
|
isLoading: isLoading,
|
|
5017
|
-
size: "
|
|
5048
|
+
size: "md",
|
|
5018
5049
|
bg: !input.trim() || isLoading ? "#262626" : "#2BCFA1",
|
|
5019
5050
|
_hover: {
|
|
5020
5051
|
bg: !input.trim() || isLoading ? "#262626" : "#22B890"
|
|
@@ -5025,7 +5056,7 @@ function MessageInput(_ref) {
|
|
|
5025
5056
|
},
|
|
5026
5057
|
borderRadius: "lg",
|
|
5027
5058
|
border: "none",
|
|
5028
|
-
children: jsxRuntime.jsx(
|
|
5059
|
+
children: jsxRuntime.jsx(SendMd, {
|
|
5029
5060
|
color: !input.trim() || isLoading ? "#525252" : "white"
|
|
5030
5061
|
})
|
|
5031
5062
|
})]
|
|
@@ -5043,14 +5074,10 @@ if (typeof document !== "undefined" && !document.getElementById("typing-indicato
|
|
|
5043
5074
|
styleElement.textContent = typingIndicatorStyles;
|
|
5044
5075
|
document.head.appendChild(styleElement);
|
|
5045
5076
|
}
|
|
5046
|
-
var TypingIndicator = /*#__PURE__*/
|
|
5047
|
-
var isVisible = _ref.isVisible
|
|
5048
|
-
|
|
5049
|
-
|
|
5050
|
-
_ref$state = _ref.state,
|
|
5051
|
-
state = _ref$state === void 0 ? "typing" : _ref$state;
|
|
5052
|
-
var getDotStyle = React.useMemo(function () {
|
|
5053
|
-
return function (index, delay, small) {
|
|
5077
|
+
var TypingIndicator = /*#__PURE__*/React3.memo(function TypingIndicator(_ref) {
|
|
5078
|
+
var isVisible = _ref.isVisible;
|
|
5079
|
+
var getDotStyle = React3.useMemo(function () {
|
|
5080
|
+
return function (index, delay) {
|
|
5054
5081
|
var animationDelay = "".concat(index * 0.2 + delay * 0.5, "s");
|
|
5055
5082
|
return {
|
|
5056
5083
|
animation: "typingDotBounce 1.6s ease-in-out infinite",
|
|
@@ -5063,11 +5090,11 @@ var TypingIndicator = /*#__PURE__*/React.memo(function TypingIndicator(_ref) {
|
|
|
5063
5090
|
animation: isVisible ? 'scaleIn 0.5s ease-out forwards' : 'scaleOut 0.5s ease-in forwards',
|
|
5064
5091
|
transformOrigin: 'bottom left'
|
|
5065
5092
|
};
|
|
5066
|
-
var _React$useState =
|
|
5093
|
+
var _React$useState = React3.useState(isVisible),
|
|
5067
5094
|
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
5068
5095
|
shouldRender = _React$useState2[0],
|
|
5069
5096
|
setShouldRender = _React$useState2[1];
|
|
5070
|
-
|
|
5097
|
+
React3.useEffect(function () {
|
|
5071
5098
|
var timer = null;
|
|
5072
5099
|
if (isVisible) {
|
|
5073
5100
|
setShouldRender(true);
|
|
@@ -5083,85 +5110,40 @@ var TypingIndicator = /*#__PURE__*/React.memo(function TypingIndicator(_ref) {
|
|
|
5083
5110
|
};
|
|
5084
5111
|
}, [isVisible]);
|
|
5085
5112
|
if (!shouldRender) return null;
|
|
5086
|
-
var
|
|
5087
|
-
|
|
5088
|
-
var smallDotSize = isSmall ? "5px" : "6px";
|
|
5089
|
-
var containerPadding = isSmall ? "8px 12px" : "12px 16px";
|
|
5090
|
-
var smallContainerPadding = isSmall ? "6px 10px" : "8px 12px";
|
|
5091
|
-
var isCompleted = state === "completed";
|
|
5092
|
-
var TypingDots = React.useMemo(function () {
|
|
5093
|
-
return /*#__PURE__*/React.memo(function (_ref2) {
|
|
5113
|
+
var TypingDots = React3.useMemo(function () {
|
|
5114
|
+
return /*#__PURE__*/React3.memo(function (_ref2) {
|
|
5094
5115
|
var _ref2$delay = _ref2.delay,
|
|
5095
|
-
delay = _ref2$delay === void 0 ? 0 : _ref2$delay
|
|
5096
|
-
_ref2$small = _ref2.small,
|
|
5097
|
-
small = _ref2$small === void 0 ? false : _ref2$small;
|
|
5116
|
+
delay = _ref2$delay === void 0 ? 0 : _ref2$delay;
|
|
5098
5117
|
return jsxRuntime.jsx(Chakra.HStack, {
|
|
5099
|
-
gap:
|
|
5118
|
+
gap: "4px",
|
|
5100
5119
|
justify: "center",
|
|
5101
5120
|
children: [0, 1, 2].map(function (index) {
|
|
5102
5121
|
return jsxRuntime.jsx(Chakra.Box, {
|
|
5103
|
-
|
|
5104
|
-
h: small ? smallDotSize : dotSize,
|
|
5122
|
+
boxSize: "8px",
|
|
5105
5123
|
bg: "#2BCFA1",
|
|
5106
5124
|
borderRadius: "full",
|
|
5107
|
-
style: getDotStyle(index, delay
|
|
5125
|
+
style: getDotStyle(index, delay)
|
|
5108
5126
|
}, index);
|
|
5109
5127
|
})
|
|
5110
5128
|
});
|
|
5111
5129
|
});
|
|
5112
|
-
}, [getDotStyle
|
|
5113
|
-
if (isCompleted) {
|
|
5114
|
-
return jsxRuntime.jsx(Chakra.Box, {
|
|
5115
|
-
alignSelf: "flex-start",
|
|
5116
|
-
maxW: "80%",
|
|
5117
|
-
mb: isSmall ? 2 : 4,
|
|
5118
|
-
style: containerAnimationStyle,
|
|
5119
|
-
children: jsxRuntime.jsx(Chakra.Box, {
|
|
5120
|
-
bg: "rgba(43, 207, 161, 0.15)",
|
|
5121
|
-
p: smallContainerPadding,
|
|
5122
|
-
borderRadius: "16px",
|
|
5123
|
-
w: "fit-content",
|
|
5124
|
-
border: "1px solid rgba(43, 207, 161, 0.2)",
|
|
5125
|
-
backdropFilter: "blur(10px)",
|
|
5126
|
-
boxShadow: "0 4px 12px rgba(0, 0, 0, 0.1)",
|
|
5127
|
-
children: jsxRuntime.jsx(TypingDots, {
|
|
5128
|
-
delay: 0.1,
|
|
5129
|
-
small: true
|
|
5130
|
-
})
|
|
5131
|
-
})
|
|
5132
|
-
});
|
|
5133
|
-
}
|
|
5130
|
+
}, [getDotStyle]);
|
|
5134
5131
|
return jsxRuntime.jsx(Chakra.Box, {
|
|
5135
5132
|
alignSelf: "flex-start",
|
|
5136
5133
|
maxW: "80%",
|
|
5137
|
-
mb:
|
|
5134
|
+
mb: 2,
|
|
5138
5135
|
style: containerAnimationStyle,
|
|
5139
|
-
children: jsxRuntime.
|
|
5140
|
-
|
|
5141
|
-
|
|
5142
|
-
|
|
5143
|
-
|
|
5144
|
-
|
|
5145
|
-
|
|
5146
|
-
|
|
5147
|
-
|
|
5148
|
-
|
|
5149
|
-
|
|
5150
|
-
boxShadow: "0 4px 12px rgba(0, 0, 0, 0.1)",
|
|
5151
|
-
children: jsxRuntime.jsx(TypingDots, {})
|
|
5152
|
-
}), jsxRuntime.jsx(Chakra.Box, {
|
|
5153
|
-
bg: "rgba(34, 197, 94, 0.2)",
|
|
5154
|
-
p: smallContainerPadding,
|
|
5155
|
-
borderRadius: "16px",
|
|
5156
|
-
w: "fit-content",
|
|
5157
|
-
border: "1px solid rgba(34, 197, 94, 0.3)",
|
|
5158
|
-
backdropFilter: "blur(10px)",
|
|
5159
|
-
boxShadow: "0 4px 12px rgba(0, 0, 0, 0.1)",
|
|
5160
|
-
children: jsxRuntime.jsx(TypingDots, {
|
|
5161
|
-
delay: 0.1,
|
|
5162
|
-
small: true
|
|
5163
|
-
})
|
|
5164
|
-
})]
|
|
5136
|
+
children: jsxRuntime.jsx(Chakra.Box, {
|
|
5137
|
+
bg: "rgba(34, 197, 94, 0.2)",
|
|
5138
|
+
p: "10px 14px",
|
|
5139
|
+
borderRadius: "16px",
|
|
5140
|
+
w: "fit-content",
|
|
5141
|
+
border: "1px solid rgba(34, 197, 94, 0.3)",
|
|
5142
|
+
backdropFilter: "blur(10px)",
|
|
5143
|
+
boxShadow: "0 4px 12px rgba(0, 0, 0, 0.1)",
|
|
5144
|
+
children: jsxRuntime.jsx(TypingDots, {
|
|
5145
|
+
delay: 0.1
|
|
5146
|
+
})
|
|
5165
5147
|
})
|
|
5166
5148
|
});
|
|
5167
5149
|
});
|
|
@@ -41538,29 +41520,29 @@ function GradualMessageDisplay(_ref) {
|
|
|
41538
41520
|
onComplete = _ref.onComplete,
|
|
41539
41521
|
_ref$isHistoryMessage = _ref.isHistoryMessage,
|
|
41540
41522
|
isHistoryMessage = _ref$isHistoryMessage === void 0 ? false : _ref$isHistoryMessage;
|
|
41541
|
-
var _useState =
|
|
41523
|
+
var _useState = React3.useState("typing"),
|
|
41542
41524
|
_useState2 = _slicedToArray(_useState, 2),
|
|
41543
41525
|
phase = _useState2[0],
|
|
41544
41526
|
setPhase = _useState2[1];
|
|
41545
|
-
var _useState3 =
|
|
41527
|
+
var _useState3 = React3.useState([]),
|
|
41546
41528
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
41547
41529
|
displayedLines = _useState4[0],
|
|
41548
41530
|
setDisplayedLines = _useState4[1];
|
|
41549
|
-
var _useState5 =
|
|
41531
|
+
var _useState5 = React3.useState(0),
|
|
41550
41532
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
41551
41533
|
currentLineIndex = _useState6[0],
|
|
41552
41534
|
setCurrentLineIndex = _useState6[1];
|
|
41553
|
-
var _useState7 =
|
|
41535
|
+
var _useState7 = React3.useState(0),
|
|
41554
41536
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
41555
41537
|
lineProgress = _useState8[0],
|
|
41556
41538
|
setLineProgress = _useState8[1];
|
|
41557
|
-
var intervalRef =
|
|
41558
|
-
var onCompleteRef =
|
|
41559
|
-
var messageLines =
|
|
41560
|
-
|
|
41539
|
+
var intervalRef = React3.useRef(null);
|
|
41540
|
+
var onCompleteRef = React3.useRef(onComplete);
|
|
41541
|
+
var messageLines = React3.useRef([]);
|
|
41542
|
+
React3.useEffect(function () {
|
|
41561
41543
|
onCompleteRef.current = onComplete;
|
|
41562
41544
|
}, [onComplete]);
|
|
41563
|
-
|
|
41545
|
+
React3.useEffect(function () {
|
|
41564
41546
|
if (!isBot || isHistoryMessage) {
|
|
41565
41547
|
var _onCompleteRef$curren;
|
|
41566
41548
|
setDisplayedLines([message]);
|
|
@@ -41645,38 +41627,36 @@ function GradualMessageDisplay(_ref) {
|
|
|
41645
41627
|
flexDirection: "column",
|
|
41646
41628
|
gap: 2,
|
|
41647
41629
|
children: [(phase === "typing" || phase === "revealing") && jsxRuntime.jsx(TypingIndicator, {
|
|
41648
|
-
isVisible: true
|
|
41649
|
-
size: "normal",
|
|
41650
|
-
state: phase === "typing" ? "typing" : "completed"
|
|
41630
|
+
isVisible: true
|
|
41651
41631
|
}), (phase === "revealing" || phase === "complete") && jsxRuntime.jsx(Chakra.Box, {
|
|
41652
41632
|
position: "relative",
|
|
41653
41633
|
borderRadius: "12px",
|
|
41654
41634
|
_before: {
|
|
41655
41635
|
content: '""',
|
|
41656
|
-
position:
|
|
41636
|
+
position: "absolute",
|
|
41657
41637
|
zIndex: -1,
|
|
41658
|
-
width:
|
|
41659
|
-
height:
|
|
41638
|
+
width: "calc(100% + 1px)",
|
|
41639
|
+
height: "calc(100% + 1px)",
|
|
41660
41640
|
top: 0,
|
|
41661
41641
|
left: 0,
|
|
41662
|
-
borderRadius:
|
|
41663
|
-
backgroundSize:
|
|
41642
|
+
borderRadius: "12px",
|
|
41643
|
+
backgroundSize: "400% 400%",
|
|
41664
41644
|
opacity: phase === "revealing" ? 1 : 0,
|
|
41665
|
-
transition:
|
|
41645
|
+
transition: "opacity 0.3s ease"
|
|
41666
41646
|
},
|
|
41667
41647
|
_after: {
|
|
41668
41648
|
content: '""',
|
|
41669
|
-
position:
|
|
41649
|
+
position: "absolute",
|
|
41670
41650
|
zIndex: -1,
|
|
41671
|
-
width:
|
|
41672
|
-
height:
|
|
41651
|
+
width: "calc(100% + 1px)",
|
|
41652
|
+
height: "calc(100% + 1px)",
|
|
41673
41653
|
top: 0,
|
|
41674
41654
|
left: 0,
|
|
41675
|
-
borderRadius:
|
|
41676
|
-
backgroundSize:
|
|
41655
|
+
borderRadius: "12px",
|
|
41656
|
+
backgroundSize: "400% 400%",
|
|
41677
41657
|
opacity: phase === "revealing" ? 1 : 0,
|
|
41678
|
-
transition:
|
|
41679
|
-
filter:
|
|
41658
|
+
transition: "opacity 0.3s ease",
|
|
41659
|
+
filter: "blur(100px)"
|
|
41680
41660
|
},
|
|
41681
41661
|
children: jsxRuntime.jsx(Chakra.Box, {
|
|
41682
41662
|
borderRadius: "11px",
|
|
@@ -41802,7 +41782,7 @@ function ErrorMessage(_ref) {
|
|
|
41802
41782
|
var onRetry = _ref.onRetry,
|
|
41803
41783
|
_ref$showRetry = _ref.showRetry,
|
|
41804
41784
|
showRetry = _ref$showRetry === void 0 ? true : _ref$showRetry;
|
|
41805
|
-
var _useState =
|
|
41785
|
+
var _useState = React3.useState(false),
|
|
41806
41786
|
_useState2 = _slicedToArray(_useState, 2),
|
|
41807
41787
|
isRetrying = _useState2[0],
|
|
41808
41788
|
setIsRetrying = _useState2[1];
|
|
@@ -58983,7 +58963,7 @@ function requireIndex_umd () {
|
|
|
58983
58963
|
hasRequiredIndex_umd = 1;
|
|
58984
58964
|
(function (module, exports) {
|
|
58985
58965
|
(function (global, factory) {
|
|
58986
|
-
factory(exports, /*@__PURE__*/ requireLottie(),
|
|
58966
|
+
factory(exports, /*@__PURE__*/ requireLottie(), React3) ;
|
|
58987
58967
|
})(index_umd, (function (exports, lottie, React) {
|
|
58988
58968
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
58989
58969
|
|
|
@@ -65653,12 +65633,12 @@ function MessageList(_ref) {
|
|
|
65653
65633
|
currentlyProcessingMessageId = _ref.currentlyProcessingMessageId,
|
|
65654
65634
|
clearProcessingMessageId = _ref.clearProcessingMessageId,
|
|
65655
65635
|
onRetryMessage = _ref.onRetryMessage;
|
|
65656
|
-
var scrollContainerRef =
|
|
65657
|
-
var _useState =
|
|
65636
|
+
var scrollContainerRef = React3.useRef(null);
|
|
65637
|
+
var _useState = React3.useState(new Set()),
|
|
65658
65638
|
_useState2 = _slicedToArray(_useState, 2),
|
|
65659
65639
|
completedMessages = _useState2[0],
|
|
65660
65640
|
setCompletedMessages = _useState2[1];
|
|
65661
|
-
var _useState3 =
|
|
65641
|
+
var _useState3 = React3.useState(null),
|
|
65662
65642
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
65663
65643
|
currentlyDisplayingMessage = _useState4[0],
|
|
65664
65644
|
setCurrentlyDisplayingMessage = _useState4[1];
|
|
@@ -65670,7 +65650,7 @@ function MessageList(_ref) {
|
|
|
65670
65650
|
});
|
|
65671
65651
|
setCurrentlyDisplayingMessage(null);
|
|
65672
65652
|
};
|
|
65673
|
-
|
|
65653
|
+
React3.useEffect(function () {
|
|
65674
65654
|
var latestBotMessage = messages.filter(function (msg) {
|
|
65675
65655
|
return msg.sender === "bot";
|
|
65676
65656
|
}).slice(-1)[0];
|
|
@@ -65678,7 +65658,7 @@ function MessageList(_ref) {
|
|
|
65678
65658
|
setCurrentlyDisplayingMessage(latestBotMessage.id);
|
|
65679
65659
|
}
|
|
65680
65660
|
}, [messages, completedMessages]);
|
|
65681
|
-
|
|
65661
|
+
React3.useEffect(function () {
|
|
65682
65662
|
if (scrollContainerRef.current) {
|
|
65683
65663
|
scrollContainerRef.current.scrollTo({
|
|
65684
65664
|
top: scrollContainerRef.current.scrollHeight,
|
|
@@ -65782,8 +65762,7 @@ function MessageList(_ref) {
|
|
|
65782
65762
|
clearProcessingMessageId: clearProcessingMessageId
|
|
65783
65763
|
}, message.id);
|
|
65784
65764
|
}), isTyping && !currentlyDisplayingMessage && jsxRuntime.jsx(TypingIndicator, {
|
|
65785
|
-
isVisible: true
|
|
65786
|
-
size: "normal"
|
|
65765
|
+
isVisible: true
|
|
65787
65766
|
})]
|
|
65788
65767
|
})
|
|
65789
65768
|
})
|
|
@@ -65834,6 +65813,1735 @@ function ChatPage(_ref) {
|
|
|
65834
65813
|
});
|
|
65835
65814
|
}
|
|
65836
65815
|
|
|
65816
|
+
/**
|
|
65817
|
+
* react-router v7.8.2
|
|
65818
|
+
*
|
|
65819
|
+
* Copyright (c) Remix Software Inc.
|
|
65820
|
+
*
|
|
65821
|
+
* This source code is licensed under the MIT license found in the
|
|
65822
|
+
* LICENSE.md file in the root directory of this source tree.
|
|
65823
|
+
*
|
|
65824
|
+
* @license MIT
|
|
65825
|
+
*/
|
|
65826
|
+
function invariant(value, message) {
|
|
65827
|
+
if (value === false || value === null || typeof value === "undefined") {
|
|
65828
|
+
throw new Error(message);
|
|
65829
|
+
}
|
|
65830
|
+
}
|
|
65831
|
+
function warning(cond, message) {
|
|
65832
|
+
if (!cond) {
|
|
65833
|
+
if (typeof console !== "undefined") console.warn(message);
|
|
65834
|
+
try {
|
|
65835
|
+
throw new Error(message);
|
|
65836
|
+
} catch (e) {
|
|
65837
|
+
}
|
|
65838
|
+
}
|
|
65839
|
+
}
|
|
65840
|
+
function createPath({
|
|
65841
|
+
pathname = "/",
|
|
65842
|
+
search = "",
|
|
65843
|
+
hash = ""
|
|
65844
|
+
}) {
|
|
65845
|
+
if (search && search !== "?")
|
|
65846
|
+
pathname += search.charAt(0) === "?" ? search : "?" + search;
|
|
65847
|
+
if (hash && hash !== "#")
|
|
65848
|
+
pathname += hash.charAt(0) === "#" ? hash : "#" + hash;
|
|
65849
|
+
return pathname;
|
|
65850
|
+
}
|
|
65851
|
+
function parsePath(path) {
|
|
65852
|
+
let parsedPath = {};
|
|
65853
|
+
if (path) {
|
|
65854
|
+
let hashIndex = path.indexOf("#");
|
|
65855
|
+
if (hashIndex >= 0) {
|
|
65856
|
+
parsedPath.hash = path.substring(hashIndex);
|
|
65857
|
+
path = path.substring(0, hashIndex);
|
|
65858
|
+
}
|
|
65859
|
+
let searchIndex = path.indexOf("?");
|
|
65860
|
+
if (searchIndex >= 0) {
|
|
65861
|
+
parsedPath.search = path.substring(searchIndex);
|
|
65862
|
+
path = path.substring(0, searchIndex);
|
|
65863
|
+
}
|
|
65864
|
+
if (path) {
|
|
65865
|
+
parsedPath.pathname = path;
|
|
65866
|
+
}
|
|
65867
|
+
}
|
|
65868
|
+
return parsedPath;
|
|
65869
|
+
}
|
|
65870
|
+
function matchRoutes(routes, locationArg, basename = "/") {
|
|
65871
|
+
return matchRoutesImpl(routes, locationArg, basename, false);
|
|
65872
|
+
}
|
|
65873
|
+
function matchRoutesImpl(routes, locationArg, basename, allowPartial) {
|
|
65874
|
+
let location = typeof locationArg === "string" ? parsePath(locationArg) : locationArg;
|
|
65875
|
+
let pathname = stripBasename(location.pathname || "/", basename);
|
|
65876
|
+
if (pathname == null) {
|
|
65877
|
+
return null;
|
|
65878
|
+
}
|
|
65879
|
+
let branches = flattenRoutes(routes);
|
|
65880
|
+
rankRouteBranches(branches);
|
|
65881
|
+
let matches = null;
|
|
65882
|
+
for (let i = 0; matches == null && i < branches.length; ++i) {
|
|
65883
|
+
let decoded = decodePath(pathname);
|
|
65884
|
+
matches = matchRouteBranch(
|
|
65885
|
+
branches[i],
|
|
65886
|
+
decoded,
|
|
65887
|
+
allowPartial
|
|
65888
|
+
);
|
|
65889
|
+
}
|
|
65890
|
+
return matches;
|
|
65891
|
+
}
|
|
65892
|
+
function flattenRoutes(routes, branches = [], parentsMeta = [], parentPath = "", _hasParentOptionalSegments = false) {
|
|
65893
|
+
let flattenRoute = (route, index, hasParentOptionalSegments = _hasParentOptionalSegments, relativePath) => {
|
|
65894
|
+
let meta = {
|
|
65895
|
+
relativePath: relativePath === void 0 ? route.path || "" : relativePath,
|
|
65896
|
+
caseSensitive: route.caseSensitive === true,
|
|
65897
|
+
childrenIndex: index,
|
|
65898
|
+
route
|
|
65899
|
+
};
|
|
65900
|
+
if (meta.relativePath.startsWith("/")) {
|
|
65901
|
+
if (!meta.relativePath.startsWith(parentPath) && hasParentOptionalSegments) {
|
|
65902
|
+
return;
|
|
65903
|
+
}
|
|
65904
|
+
invariant(
|
|
65905
|
+
meta.relativePath.startsWith(parentPath),
|
|
65906
|
+
`Absolute route path "${meta.relativePath}" nested under path "${parentPath}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`
|
|
65907
|
+
);
|
|
65908
|
+
meta.relativePath = meta.relativePath.slice(parentPath.length);
|
|
65909
|
+
}
|
|
65910
|
+
let path = joinPaths([parentPath, meta.relativePath]);
|
|
65911
|
+
let routesMeta = parentsMeta.concat(meta);
|
|
65912
|
+
if (route.children && route.children.length > 0) {
|
|
65913
|
+
invariant(
|
|
65914
|
+
// Our types know better, but runtime JS may not!
|
|
65915
|
+
// @ts-expect-error
|
|
65916
|
+
route.index !== true,
|
|
65917
|
+
`Index routes must not have child routes. Please remove all child routes from route path "${path}".`
|
|
65918
|
+
);
|
|
65919
|
+
flattenRoutes(
|
|
65920
|
+
route.children,
|
|
65921
|
+
branches,
|
|
65922
|
+
routesMeta,
|
|
65923
|
+
path,
|
|
65924
|
+
hasParentOptionalSegments
|
|
65925
|
+
);
|
|
65926
|
+
}
|
|
65927
|
+
if (route.path == null && !route.index) {
|
|
65928
|
+
return;
|
|
65929
|
+
}
|
|
65930
|
+
branches.push({
|
|
65931
|
+
path,
|
|
65932
|
+
score: computeScore(path, route.index),
|
|
65933
|
+
routesMeta
|
|
65934
|
+
});
|
|
65935
|
+
};
|
|
65936
|
+
routes.forEach((route, index) => {
|
|
65937
|
+
if (route.path === "" || !route.path?.includes("?")) {
|
|
65938
|
+
flattenRoute(route, index);
|
|
65939
|
+
} else {
|
|
65940
|
+
for (let exploded of explodeOptionalSegments(route.path)) {
|
|
65941
|
+
flattenRoute(route, index, true, exploded);
|
|
65942
|
+
}
|
|
65943
|
+
}
|
|
65944
|
+
});
|
|
65945
|
+
return branches;
|
|
65946
|
+
}
|
|
65947
|
+
function explodeOptionalSegments(path) {
|
|
65948
|
+
let segments = path.split("/");
|
|
65949
|
+
if (segments.length === 0) return [];
|
|
65950
|
+
let [first, ...rest] = segments;
|
|
65951
|
+
let isOptional = first.endsWith("?");
|
|
65952
|
+
let required = first.replace(/\?$/, "");
|
|
65953
|
+
if (rest.length === 0) {
|
|
65954
|
+
return isOptional ? [required, ""] : [required];
|
|
65955
|
+
}
|
|
65956
|
+
let restExploded = explodeOptionalSegments(rest.join("/"));
|
|
65957
|
+
let result = [];
|
|
65958
|
+
result.push(
|
|
65959
|
+
...restExploded.map(
|
|
65960
|
+
(subpath) => subpath === "" ? required : [required, subpath].join("/")
|
|
65961
|
+
)
|
|
65962
|
+
);
|
|
65963
|
+
if (isOptional) {
|
|
65964
|
+
result.push(...restExploded);
|
|
65965
|
+
}
|
|
65966
|
+
return result.map(
|
|
65967
|
+
(exploded) => path.startsWith("/") && exploded === "" ? "/" : exploded
|
|
65968
|
+
);
|
|
65969
|
+
}
|
|
65970
|
+
function rankRouteBranches(branches) {
|
|
65971
|
+
branches.sort(
|
|
65972
|
+
(a, b) => a.score !== b.score ? b.score - a.score : compareIndexes(
|
|
65973
|
+
a.routesMeta.map((meta) => meta.childrenIndex),
|
|
65974
|
+
b.routesMeta.map((meta) => meta.childrenIndex)
|
|
65975
|
+
)
|
|
65976
|
+
);
|
|
65977
|
+
}
|
|
65978
|
+
var paramRe = /^:[\w-]+$/;
|
|
65979
|
+
var dynamicSegmentValue = 3;
|
|
65980
|
+
var indexRouteValue = 2;
|
|
65981
|
+
var emptySegmentValue = 1;
|
|
65982
|
+
var staticSegmentValue = 10;
|
|
65983
|
+
var splatPenalty = -2;
|
|
65984
|
+
var isSplat = (s) => s === "*";
|
|
65985
|
+
function computeScore(path, index) {
|
|
65986
|
+
let segments = path.split("/");
|
|
65987
|
+
let initialScore = segments.length;
|
|
65988
|
+
if (segments.some(isSplat)) {
|
|
65989
|
+
initialScore += splatPenalty;
|
|
65990
|
+
}
|
|
65991
|
+
if (index) {
|
|
65992
|
+
initialScore += indexRouteValue;
|
|
65993
|
+
}
|
|
65994
|
+
return segments.filter((s) => !isSplat(s)).reduce(
|
|
65995
|
+
(score, segment) => score + (paramRe.test(segment) ? dynamicSegmentValue : segment === "" ? emptySegmentValue : staticSegmentValue),
|
|
65996
|
+
initialScore
|
|
65997
|
+
);
|
|
65998
|
+
}
|
|
65999
|
+
function compareIndexes(a, b) {
|
|
66000
|
+
let siblings = a.length === b.length && a.slice(0, -1).every((n, i) => n === b[i]);
|
|
66001
|
+
return siblings ? (
|
|
66002
|
+
// If two routes are siblings, we should try to match the earlier sibling
|
|
66003
|
+
// first. This allows people to have fine-grained control over the matching
|
|
66004
|
+
// behavior by simply putting routes with identical paths in the order they
|
|
66005
|
+
// want them tried.
|
|
66006
|
+
a[a.length - 1] - b[b.length - 1]
|
|
66007
|
+
) : (
|
|
66008
|
+
// Otherwise, it doesn't really make sense to rank non-siblings by index,
|
|
66009
|
+
// so they sort equally.
|
|
66010
|
+
0
|
|
66011
|
+
);
|
|
66012
|
+
}
|
|
66013
|
+
function matchRouteBranch(branch, pathname, allowPartial = false) {
|
|
66014
|
+
let { routesMeta } = branch;
|
|
66015
|
+
let matchedParams = {};
|
|
66016
|
+
let matchedPathname = "/";
|
|
66017
|
+
let matches = [];
|
|
66018
|
+
for (let i = 0; i < routesMeta.length; ++i) {
|
|
66019
|
+
let meta = routesMeta[i];
|
|
66020
|
+
let end = i === routesMeta.length - 1;
|
|
66021
|
+
let remainingPathname = matchedPathname === "/" ? pathname : pathname.slice(matchedPathname.length) || "/";
|
|
66022
|
+
let match = matchPath(
|
|
66023
|
+
{ path: meta.relativePath, caseSensitive: meta.caseSensitive, end },
|
|
66024
|
+
remainingPathname
|
|
66025
|
+
);
|
|
66026
|
+
let route = meta.route;
|
|
66027
|
+
if (!match && end && allowPartial && !routesMeta[routesMeta.length - 1].route.index) {
|
|
66028
|
+
match = matchPath(
|
|
66029
|
+
{
|
|
66030
|
+
path: meta.relativePath,
|
|
66031
|
+
caseSensitive: meta.caseSensitive,
|
|
66032
|
+
end: false
|
|
66033
|
+
},
|
|
66034
|
+
remainingPathname
|
|
66035
|
+
);
|
|
66036
|
+
}
|
|
66037
|
+
if (!match) {
|
|
66038
|
+
return null;
|
|
66039
|
+
}
|
|
66040
|
+
Object.assign(matchedParams, match.params);
|
|
66041
|
+
matches.push({
|
|
66042
|
+
// TODO: Can this as be avoided?
|
|
66043
|
+
params: matchedParams,
|
|
66044
|
+
pathname: joinPaths([matchedPathname, match.pathname]),
|
|
66045
|
+
pathnameBase: normalizePathname(
|
|
66046
|
+
joinPaths([matchedPathname, match.pathnameBase])
|
|
66047
|
+
),
|
|
66048
|
+
route
|
|
66049
|
+
});
|
|
66050
|
+
if (match.pathnameBase !== "/") {
|
|
66051
|
+
matchedPathname = joinPaths([matchedPathname, match.pathnameBase]);
|
|
66052
|
+
}
|
|
66053
|
+
}
|
|
66054
|
+
return matches;
|
|
66055
|
+
}
|
|
66056
|
+
function matchPath(pattern, pathname) {
|
|
66057
|
+
if (typeof pattern === "string") {
|
|
66058
|
+
pattern = { path: pattern, caseSensitive: false, end: true };
|
|
66059
|
+
}
|
|
66060
|
+
let [matcher, compiledParams] = compilePath(
|
|
66061
|
+
pattern.path,
|
|
66062
|
+
pattern.caseSensitive,
|
|
66063
|
+
pattern.end
|
|
66064
|
+
);
|
|
66065
|
+
let match = pathname.match(matcher);
|
|
66066
|
+
if (!match) return null;
|
|
66067
|
+
let matchedPathname = match[0];
|
|
66068
|
+
let pathnameBase = matchedPathname.replace(/(.)\/+$/, "$1");
|
|
66069
|
+
let captureGroups = match.slice(1);
|
|
66070
|
+
let params = compiledParams.reduce(
|
|
66071
|
+
(memo2, { paramName, isOptional }, index) => {
|
|
66072
|
+
if (paramName === "*") {
|
|
66073
|
+
let splatValue = captureGroups[index] || "";
|
|
66074
|
+
pathnameBase = matchedPathname.slice(0, matchedPathname.length - splatValue.length).replace(/(.)\/+$/, "$1");
|
|
66075
|
+
}
|
|
66076
|
+
const value = captureGroups[index];
|
|
66077
|
+
if (isOptional && !value) {
|
|
66078
|
+
memo2[paramName] = void 0;
|
|
66079
|
+
} else {
|
|
66080
|
+
memo2[paramName] = (value || "").replace(/%2F/g, "/");
|
|
66081
|
+
}
|
|
66082
|
+
return memo2;
|
|
66083
|
+
},
|
|
66084
|
+
{}
|
|
66085
|
+
);
|
|
66086
|
+
return {
|
|
66087
|
+
params,
|
|
66088
|
+
pathname: matchedPathname,
|
|
66089
|
+
pathnameBase,
|
|
66090
|
+
pattern
|
|
66091
|
+
};
|
|
66092
|
+
}
|
|
66093
|
+
function compilePath(path, caseSensitive = false, end = true) {
|
|
66094
|
+
warning(
|
|
66095
|
+
path === "*" || !path.endsWith("*") || path.endsWith("/*"),
|
|
66096
|
+
`Route path "${path}" will be treated as if it were "${path.replace(/\*$/, "/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${path.replace(/\*$/, "/*")}".`
|
|
66097
|
+
);
|
|
66098
|
+
let params = [];
|
|
66099
|
+
let regexpSource = "^" + path.replace(/\/*\*?$/, "").replace(/^\/*/, "/").replace(/[\\.*+^${}|()[\]]/g, "\\$&").replace(
|
|
66100
|
+
/\/:([\w-]+)(\?)?/g,
|
|
66101
|
+
(_, paramName, isOptional) => {
|
|
66102
|
+
params.push({ paramName, isOptional: isOptional != null });
|
|
66103
|
+
return isOptional ? "/?([^\\/]+)?" : "/([^\\/]+)";
|
|
66104
|
+
}
|
|
66105
|
+
).replace(/\/([\w-]+)\?(\/|$)/g, "(/$1)?$2");
|
|
66106
|
+
if (path.endsWith("*")) {
|
|
66107
|
+
params.push({ paramName: "*" });
|
|
66108
|
+
regexpSource += path === "*" || path === "/*" ? "(.*)$" : "(?:\\/(.+)|\\/*)$";
|
|
66109
|
+
} else if (end) {
|
|
66110
|
+
regexpSource += "\\/*$";
|
|
66111
|
+
} else if (path !== "" && path !== "/") {
|
|
66112
|
+
regexpSource += "(?:(?=\\/|$))";
|
|
66113
|
+
} else ;
|
|
66114
|
+
let matcher = new RegExp(regexpSource, caseSensitive ? void 0 : "i");
|
|
66115
|
+
return [matcher, params];
|
|
66116
|
+
}
|
|
66117
|
+
function decodePath(value) {
|
|
66118
|
+
try {
|
|
66119
|
+
return value.split("/").map((v) => decodeURIComponent(v).replace(/\//g, "%2F")).join("/");
|
|
66120
|
+
} catch (error) {
|
|
66121
|
+
warning(
|
|
66122
|
+
false,
|
|
66123
|
+
`The URL path "${value}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${error}).`
|
|
66124
|
+
);
|
|
66125
|
+
return value;
|
|
66126
|
+
}
|
|
66127
|
+
}
|
|
66128
|
+
function stripBasename(pathname, basename) {
|
|
66129
|
+
if (basename === "/") return pathname;
|
|
66130
|
+
if (!pathname.toLowerCase().startsWith(basename.toLowerCase())) {
|
|
66131
|
+
return null;
|
|
66132
|
+
}
|
|
66133
|
+
let startIndex = basename.endsWith("/") ? basename.length - 1 : basename.length;
|
|
66134
|
+
let nextChar = pathname.charAt(startIndex);
|
|
66135
|
+
if (nextChar && nextChar !== "/") {
|
|
66136
|
+
return null;
|
|
66137
|
+
}
|
|
66138
|
+
return pathname.slice(startIndex) || "/";
|
|
66139
|
+
}
|
|
66140
|
+
function resolvePath(to, fromPathname = "/") {
|
|
66141
|
+
let {
|
|
66142
|
+
pathname: toPathname,
|
|
66143
|
+
search = "",
|
|
66144
|
+
hash = ""
|
|
66145
|
+
} = typeof to === "string" ? parsePath(to) : to;
|
|
66146
|
+
let pathname = toPathname ? toPathname.startsWith("/") ? toPathname : resolvePathname(toPathname, fromPathname) : fromPathname;
|
|
66147
|
+
return {
|
|
66148
|
+
pathname,
|
|
66149
|
+
search: normalizeSearch(search),
|
|
66150
|
+
hash: normalizeHash(hash)
|
|
66151
|
+
};
|
|
66152
|
+
}
|
|
66153
|
+
function resolvePathname(relativePath, fromPathname) {
|
|
66154
|
+
let segments = fromPathname.replace(/\/+$/, "").split("/");
|
|
66155
|
+
let relativeSegments = relativePath.split("/");
|
|
66156
|
+
relativeSegments.forEach((segment) => {
|
|
66157
|
+
if (segment === "..") {
|
|
66158
|
+
if (segments.length > 1) segments.pop();
|
|
66159
|
+
} else if (segment !== ".") {
|
|
66160
|
+
segments.push(segment);
|
|
66161
|
+
}
|
|
66162
|
+
});
|
|
66163
|
+
return segments.length > 1 ? segments.join("/") : "/";
|
|
66164
|
+
}
|
|
66165
|
+
function getInvalidPathError(char, field, dest, path) {
|
|
66166
|
+
return `Cannot include a '${char}' character in a manually specified \`to.${field}\` field [${JSON.stringify(
|
|
66167
|
+
path
|
|
66168
|
+
)}]. Please separate it out to the \`to.${dest}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`;
|
|
66169
|
+
}
|
|
66170
|
+
function getPathContributingMatches(matches) {
|
|
66171
|
+
return matches.filter(
|
|
66172
|
+
(match, index) => index === 0 || match.route.path && match.route.path.length > 0
|
|
66173
|
+
);
|
|
66174
|
+
}
|
|
66175
|
+
function getResolveToMatches(matches) {
|
|
66176
|
+
let pathMatches = getPathContributingMatches(matches);
|
|
66177
|
+
return pathMatches.map(
|
|
66178
|
+
(match, idx) => idx === pathMatches.length - 1 ? match.pathname : match.pathnameBase
|
|
66179
|
+
);
|
|
66180
|
+
}
|
|
66181
|
+
function resolveTo(toArg, routePathnames, locationPathname, isPathRelative = false) {
|
|
66182
|
+
let to;
|
|
66183
|
+
if (typeof toArg === "string") {
|
|
66184
|
+
to = parsePath(toArg);
|
|
66185
|
+
} else {
|
|
66186
|
+
to = { ...toArg };
|
|
66187
|
+
invariant(
|
|
66188
|
+
!to.pathname || !to.pathname.includes("?"),
|
|
66189
|
+
getInvalidPathError("?", "pathname", "search", to)
|
|
66190
|
+
);
|
|
66191
|
+
invariant(
|
|
66192
|
+
!to.pathname || !to.pathname.includes("#"),
|
|
66193
|
+
getInvalidPathError("#", "pathname", "hash", to)
|
|
66194
|
+
);
|
|
66195
|
+
invariant(
|
|
66196
|
+
!to.search || !to.search.includes("#"),
|
|
66197
|
+
getInvalidPathError("#", "search", "hash", to)
|
|
66198
|
+
);
|
|
66199
|
+
}
|
|
66200
|
+
let isEmptyPath = toArg === "" || to.pathname === "";
|
|
66201
|
+
let toPathname = isEmptyPath ? "/" : to.pathname;
|
|
66202
|
+
let from;
|
|
66203
|
+
if (toPathname == null) {
|
|
66204
|
+
from = locationPathname;
|
|
66205
|
+
} else {
|
|
66206
|
+
let routePathnameIndex = routePathnames.length - 1;
|
|
66207
|
+
if (!isPathRelative && toPathname.startsWith("..")) {
|
|
66208
|
+
let toSegments = toPathname.split("/");
|
|
66209
|
+
while (toSegments[0] === "..") {
|
|
66210
|
+
toSegments.shift();
|
|
66211
|
+
routePathnameIndex -= 1;
|
|
66212
|
+
}
|
|
66213
|
+
to.pathname = toSegments.join("/");
|
|
66214
|
+
}
|
|
66215
|
+
from = routePathnameIndex >= 0 ? routePathnames[routePathnameIndex] : "/";
|
|
66216
|
+
}
|
|
66217
|
+
let path = resolvePath(to, from);
|
|
66218
|
+
let hasExplicitTrailingSlash = toPathname && toPathname !== "/" && toPathname.endsWith("/");
|
|
66219
|
+
let hasCurrentTrailingSlash = (isEmptyPath || toPathname === ".") && locationPathname.endsWith("/");
|
|
66220
|
+
if (!path.pathname.endsWith("/") && (hasExplicitTrailingSlash || hasCurrentTrailingSlash)) {
|
|
66221
|
+
path.pathname += "/";
|
|
66222
|
+
}
|
|
66223
|
+
return path;
|
|
66224
|
+
}
|
|
66225
|
+
var joinPaths = (paths) => paths.join("/").replace(/\/\/+/g, "/");
|
|
66226
|
+
var normalizePathname = (pathname) => pathname.replace(/\/+$/, "").replace(/^\/*/, "/");
|
|
66227
|
+
var normalizeSearch = (search) => !search || search === "?" ? "" : search.startsWith("?") ? search : "?" + search;
|
|
66228
|
+
var normalizeHash = (hash) => !hash || hash === "#" ? "" : hash.startsWith("#") ? hash : "#" + hash;
|
|
66229
|
+
function isRouteErrorResponse(error) {
|
|
66230
|
+
return error != null && typeof error.status === "number" && typeof error.statusText === "string" && typeof error.internal === "boolean" && "data" in error;
|
|
66231
|
+
}
|
|
66232
|
+
|
|
66233
|
+
// lib/router/router.ts
|
|
66234
|
+
var validMutationMethodsArr = [
|
|
66235
|
+
"POST",
|
|
66236
|
+
"PUT",
|
|
66237
|
+
"PATCH",
|
|
66238
|
+
"DELETE"
|
|
66239
|
+
];
|
|
66240
|
+
new Set(
|
|
66241
|
+
validMutationMethodsArr
|
|
66242
|
+
);
|
|
66243
|
+
var validRequestMethodsArr = [
|
|
66244
|
+
"GET",
|
|
66245
|
+
...validMutationMethodsArr
|
|
66246
|
+
];
|
|
66247
|
+
new Set(validRequestMethodsArr);
|
|
66248
|
+
var DataRouterContext = React3__namespace.createContext(null);
|
|
66249
|
+
DataRouterContext.displayName = "DataRouter";
|
|
66250
|
+
var DataRouterStateContext = React3__namespace.createContext(null);
|
|
66251
|
+
DataRouterStateContext.displayName = "DataRouterState";
|
|
66252
|
+
React3__namespace.createContext(false);
|
|
66253
|
+
var ViewTransitionContext = React3__namespace.createContext({
|
|
66254
|
+
isTransitioning: false
|
|
66255
|
+
});
|
|
66256
|
+
ViewTransitionContext.displayName = "ViewTransition";
|
|
66257
|
+
var FetchersContext = React3__namespace.createContext(
|
|
66258
|
+
/* @__PURE__ */ new Map()
|
|
66259
|
+
);
|
|
66260
|
+
FetchersContext.displayName = "Fetchers";
|
|
66261
|
+
var AwaitContext = React3__namespace.createContext(null);
|
|
66262
|
+
AwaitContext.displayName = "Await";
|
|
66263
|
+
var NavigationContext = React3__namespace.createContext(
|
|
66264
|
+
null
|
|
66265
|
+
);
|
|
66266
|
+
NavigationContext.displayName = "Navigation";
|
|
66267
|
+
var LocationContext = React3__namespace.createContext(
|
|
66268
|
+
null
|
|
66269
|
+
);
|
|
66270
|
+
LocationContext.displayName = "Location";
|
|
66271
|
+
var RouteContext = React3__namespace.createContext({
|
|
66272
|
+
outlet: null,
|
|
66273
|
+
matches: [],
|
|
66274
|
+
isDataRoute: false
|
|
66275
|
+
});
|
|
66276
|
+
RouteContext.displayName = "Route";
|
|
66277
|
+
var RouteErrorContext = React3__namespace.createContext(null);
|
|
66278
|
+
RouteErrorContext.displayName = "RouteError";
|
|
66279
|
+
function useHref(to, { relative } = {}) {
|
|
66280
|
+
invariant(
|
|
66281
|
+
useInRouterContext(),
|
|
66282
|
+
// TODO: This error is probably because they somehow have 2 versions of the
|
|
66283
|
+
// router loaded. We can help them understand how to avoid that.
|
|
66284
|
+
`useHref() may be used only in the context of a <Router> component.`
|
|
66285
|
+
);
|
|
66286
|
+
let { basename, navigator } = React3__namespace.useContext(NavigationContext);
|
|
66287
|
+
let { hash, pathname, search } = useResolvedPath(to, { relative });
|
|
66288
|
+
let joinedPathname = pathname;
|
|
66289
|
+
if (basename !== "/") {
|
|
66290
|
+
joinedPathname = pathname === "/" ? basename : joinPaths([basename, pathname]);
|
|
66291
|
+
}
|
|
66292
|
+
return navigator.createHref({ pathname: joinedPathname, search, hash });
|
|
66293
|
+
}
|
|
66294
|
+
function useInRouterContext() {
|
|
66295
|
+
return React3__namespace.useContext(LocationContext) != null;
|
|
66296
|
+
}
|
|
66297
|
+
function useLocation() {
|
|
66298
|
+
invariant(
|
|
66299
|
+
useInRouterContext(),
|
|
66300
|
+
// TODO: This error is probably because they somehow have 2 versions of the
|
|
66301
|
+
// router loaded. We can help them understand how to avoid that.
|
|
66302
|
+
`useLocation() may be used only in the context of a <Router> component.`
|
|
66303
|
+
);
|
|
66304
|
+
return React3__namespace.useContext(LocationContext).location;
|
|
66305
|
+
}
|
|
66306
|
+
var navigateEffectWarning = `You should call navigate() in a React.useEffect(), not when your component is first rendered.`;
|
|
66307
|
+
function useIsomorphicLayoutEffect(cb) {
|
|
66308
|
+
let isStatic = React3__namespace.useContext(NavigationContext).static;
|
|
66309
|
+
if (!isStatic) {
|
|
66310
|
+
React3__namespace.useLayoutEffect(cb);
|
|
66311
|
+
}
|
|
66312
|
+
}
|
|
66313
|
+
function useNavigate() {
|
|
66314
|
+
let { isDataRoute } = React3__namespace.useContext(RouteContext);
|
|
66315
|
+
return isDataRoute ? useNavigateStable() : useNavigateUnstable();
|
|
66316
|
+
}
|
|
66317
|
+
function useNavigateUnstable() {
|
|
66318
|
+
invariant(
|
|
66319
|
+
useInRouterContext(),
|
|
66320
|
+
// TODO: This error is probably because they somehow have 2 versions of the
|
|
66321
|
+
// router loaded. We can help them understand how to avoid that.
|
|
66322
|
+
`useNavigate() may be used only in the context of a <Router> component.`
|
|
66323
|
+
);
|
|
66324
|
+
let dataRouterContext = React3__namespace.useContext(DataRouterContext);
|
|
66325
|
+
let { basename, navigator } = React3__namespace.useContext(NavigationContext);
|
|
66326
|
+
let { matches } = React3__namespace.useContext(RouteContext);
|
|
66327
|
+
let { pathname: locationPathname } = useLocation();
|
|
66328
|
+
let routePathnamesJson = JSON.stringify(getResolveToMatches(matches));
|
|
66329
|
+
let activeRef = React3__namespace.useRef(false);
|
|
66330
|
+
useIsomorphicLayoutEffect(() => {
|
|
66331
|
+
activeRef.current = true;
|
|
66332
|
+
});
|
|
66333
|
+
let navigate = React3__namespace.useCallback(
|
|
66334
|
+
(to, options = {}) => {
|
|
66335
|
+
warning(activeRef.current, navigateEffectWarning);
|
|
66336
|
+
if (!activeRef.current) return;
|
|
66337
|
+
if (typeof to === "number") {
|
|
66338
|
+
navigator.go(to);
|
|
66339
|
+
return;
|
|
66340
|
+
}
|
|
66341
|
+
let path = resolveTo(
|
|
66342
|
+
to,
|
|
66343
|
+
JSON.parse(routePathnamesJson),
|
|
66344
|
+
locationPathname,
|
|
66345
|
+
options.relative === "path"
|
|
66346
|
+
);
|
|
66347
|
+
if (dataRouterContext == null && basename !== "/") {
|
|
66348
|
+
path.pathname = path.pathname === "/" ? basename : joinPaths([basename, path.pathname]);
|
|
66349
|
+
}
|
|
66350
|
+
(!!options.replace ? navigator.replace : navigator.push)(
|
|
66351
|
+
path,
|
|
66352
|
+
options.state,
|
|
66353
|
+
options
|
|
66354
|
+
);
|
|
66355
|
+
},
|
|
66356
|
+
[
|
|
66357
|
+
basename,
|
|
66358
|
+
navigator,
|
|
66359
|
+
routePathnamesJson,
|
|
66360
|
+
locationPathname,
|
|
66361
|
+
dataRouterContext
|
|
66362
|
+
]
|
|
66363
|
+
);
|
|
66364
|
+
return navigate;
|
|
66365
|
+
}
|
|
66366
|
+
React3__namespace.createContext(null);
|
|
66367
|
+
function useResolvedPath(to, { relative } = {}) {
|
|
66368
|
+
let { matches } = React3__namespace.useContext(RouteContext);
|
|
66369
|
+
let { pathname: locationPathname } = useLocation();
|
|
66370
|
+
let routePathnamesJson = JSON.stringify(getResolveToMatches(matches));
|
|
66371
|
+
return React3__namespace.useMemo(
|
|
66372
|
+
() => resolveTo(
|
|
66373
|
+
to,
|
|
66374
|
+
JSON.parse(routePathnamesJson),
|
|
66375
|
+
locationPathname,
|
|
66376
|
+
relative === "path"
|
|
66377
|
+
),
|
|
66378
|
+
[to, routePathnamesJson, locationPathname, relative]
|
|
66379
|
+
);
|
|
66380
|
+
}
|
|
66381
|
+
function useRoutesImpl(routes, locationArg, dataRouterState, unstable_onError, future) {
|
|
66382
|
+
invariant(
|
|
66383
|
+
useInRouterContext(),
|
|
66384
|
+
// TODO: This error is probably because they somehow have 2 versions of the
|
|
66385
|
+
// router loaded. We can help them understand how to avoid that.
|
|
66386
|
+
`useRoutes() may be used only in the context of a <Router> component.`
|
|
66387
|
+
);
|
|
66388
|
+
let { navigator } = React3__namespace.useContext(NavigationContext);
|
|
66389
|
+
let { matches: parentMatches } = React3__namespace.useContext(RouteContext);
|
|
66390
|
+
let routeMatch = parentMatches[parentMatches.length - 1];
|
|
66391
|
+
let parentParams = routeMatch ? routeMatch.params : {};
|
|
66392
|
+
let parentPathname = routeMatch ? routeMatch.pathname : "/";
|
|
66393
|
+
let parentPathnameBase = routeMatch ? routeMatch.pathnameBase : "/";
|
|
66394
|
+
let parentRoute = routeMatch && routeMatch.route;
|
|
66395
|
+
{
|
|
66396
|
+
let parentPath = parentRoute && parentRoute.path || "";
|
|
66397
|
+
warningOnce(
|
|
66398
|
+
parentPathname,
|
|
66399
|
+
!parentRoute || parentPath.endsWith("*") || parentPath.endsWith("*?"),
|
|
66400
|
+
`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${parentPathname}" (under <Route path="${parentPath}">) but the parent route path has no trailing "*". This means if you navigate deeper, the parent won't match anymore and therefore the child routes will never render.
|
|
66401
|
+
|
|
66402
|
+
Please change the parent <Route path="${parentPath}"> to <Route path="${parentPath === "/" ? "*" : `${parentPath}/*`}">.`
|
|
66403
|
+
);
|
|
66404
|
+
}
|
|
66405
|
+
let locationFromContext = useLocation();
|
|
66406
|
+
let location;
|
|
66407
|
+
{
|
|
66408
|
+
location = locationFromContext;
|
|
66409
|
+
}
|
|
66410
|
+
let pathname = location.pathname || "/";
|
|
66411
|
+
let remainingPathname = pathname;
|
|
66412
|
+
if (parentPathnameBase !== "/") {
|
|
66413
|
+
let parentSegments = parentPathnameBase.replace(/^\//, "").split("/");
|
|
66414
|
+
let segments = pathname.replace(/^\//, "").split("/");
|
|
66415
|
+
remainingPathname = "/" + segments.slice(parentSegments.length).join("/");
|
|
66416
|
+
}
|
|
66417
|
+
let matches = matchRoutes(routes, { pathname: remainingPathname });
|
|
66418
|
+
{
|
|
66419
|
+
warning(
|
|
66420
|
+
parentRoute || matches != null,
|
|
66421
|
+
`No routes matched location "${location.pathname}${location.search}${location.hash}" `
|
|
66422
|
+
);
|
|
66423
|
+
warning(
|
|
66424
|
+
matches == null || matches[matches.length - 1].route.element !== void 0 || matches[matches.length - 1].route.Component !== void 0 || matches[matches.length - 1].route.lazy !== void 0,
|
|
66425
|
+
`Matched leaf route at location "${location.pathname}${location.search}${location.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`
|
|
66426
|
+
);
|
|
66427
|
+
}
|
|
66428
|
+
let renderedMatches = _renderMatches(
|
|
66429
|
+
matches && matches.map(
|
|
66430
|
+
(match) => Object.assign({}, match, {
|
|
66431
|
+
params: Object.assign({}, parentParams, match.params),
|
|
66432
|
+
pathname: joinPaths([
|
|
66433
|
+
parentPathnameBase,
|
|
66434
|
+
// Re-encode pathnames that were decoded inside matchRoutes
|
|
66435
|
+
navigator.encodeLocation ? navigator.encodeLocation(match.pathname).pathname : match.pathname
|
|
66436
|
+
]),
|
|
66437
|
+
pathnameBase: match.pathnameBase === "/" ? parentPathnameBase : joinPaths([
|
|
66438
|
+
parentPathnameBase,
|
|
66439
|
+
// Re-encode pathnames that were decoded inside matchRoutes
|
|
66440
|
+
navigator.encodeLocation ? navigator.encodeLocation(match.pathnameBase).pathname : match.pathnameBase
|
|
66441
|
+
])
|
|
66442
|
+
})
|
|
66443
|
+
),
|
|
66444
|
+
parentMatches,
|
|
66445
|
+
dataRouterState,
|
|
66446
|
+
unstable_onError,
|
|
66447
|
+
future
|
|
66448
|
+
);
|
|
66449
|
+
return renderedMatches;
|
|
66450
|
+
}
|
|
66451
|
+
function DefaultErrorComponent() {
|
|
66452
|
+
let error = useRouteError();
|
|
66453
|
+
let message = isRouteErrorResponse(error) ? `${error.status} ${error.statusText}` : error instanceof Error ? error.message : JSON.stringify(error);
|
|
66454
|
+
let stack = error instanceof Error ? error.stack : null;
|
|
66455
|
+
let lightgrey = "rgba(200,200,200, 0.5)";
|
|
66456
|
+
let preStyles = { padding: "0.5rem", backgroundColor: lightgrey };
|
|
66457
|
+
let codeStyles = { padding: "2px 4px", backgroundColor: lightgrey };
|
|
66458
|
+
let devInfo = null;
|
|
66459
|
+
{
|
|
66460
|
+
console.error(
|
|
66461
|
+
"Error handled by React Router default ErrorBoundary:",
|
|
66462
|
+
error
|
|
66463
|
+
);
|
|
66464
|
+
devInfo = /* @__PURE__ */ React3__namespace.createElement(React3__namespace.Fragment, null, /* @__PURE__ */ React3__namespace.createElement("p", null, "\u{1F4BF} Hey developer \u{1F44B}"), /* @__PURE__ */ React3__namespace.createElement("p", null, "You can provide a way better UX than this when your app throws errors by providing your own ", /* @__PURE__ */ React3__namespace.createElement("code", { style: codeStyles }, "ErrorBoundary"), " or", " ", /* @__PURE__ */ React3__namespace.createElement("code", { style: codeStyles }, "errorElement"), " prop on your route."));
|
|
66465
|
+
}
|
|
66466
|
+
return /* @__PURE__ */ React3__namespace.createElement(React3__namespace.Fragment, null, /* @__PURE__ */ React3__namespace.createElement("h2", null, "Unexpected Application Error!"), /* @__PURE__ */ React3__namespace.createElement("h3", { style: { fontStyle: "italic" } }, message), stack ? /* @__PURE__ */ React3__namespace.createElement("pre", { style: preStyles }, stack) : null, devInfo);
|
|
66467
|
+
}
|
|
66468
|
+
var defaultErrorElement = /* @__PURE__ */ React3__namespace.createElement(DefaultErrorComponent, null);
|
|
66469
|
+
var RenderErrorBoundary = class extends React3__namespace.Component {
|
|
66470
|
+
constructor(props) {
|
|
66471
|
+
super(props);
|
|
66472
|
+
this.state = {
|
|
66473
|
+
location: props.location,
|
|
66474
|
+
revalidation: props.revalidation,
|
|
66475
|
+
error: props.error
|
|
66476
|
+
};
|
|
66477
|
+
}
|
|
66478
|
+
static getDerivedStateFromError(error) {
|
|
66479
|
+
return { error };
|
|
66480
|
+
}
|
|
66481
|
+
static getDerivedStateFromProps(props, state) {
|
|
66482
|
+
if (state.location !== props.location || state.revalidation !== "idle" && props.revalidation === "idle") {
|
|
66483
|
+
return {
|
|
66484
|
+
error: props.error,
|
|
66485
|
+
location: props.location,
|
|
66486
|
+
revalidation: props.revalidation
|
|
66487
|
+
};
|
|
66488
|
+
}
|
|
66489
|
+
return {
|
|
66490
|
+
error: props.error !== void 0 ? props.error : state.error,
|
|
66491
|
+
location: state.location,
|
|
66492
|
+
revalidation: props.revalidation || state.revalidation
|
|
66493
|
+
};
|
|
66494
|
+
}
|
|
66495
|
+
componentDidCatch(error, errorInfo) {
|
|
66496
|
+
if (this.props.unstable_onError) {
|
|
66497
|
+
this.props.unstable_onError(error, errorInfo);
|
|
66498
|
+
} else {
|
|
66499
|
+
console.error(
|
|
66500
|
+
"React Router caught the following error during render",
|
|
66501
|
+
error
|
|
66502
|
+
);
|
|
66503
|
+
}
|
|
66504
|
+
}
|
|
66505
|
+
render() {
|
|
66506
|
+
return this.state.error !== void 0 ? /* @__PURE__ */ React3__namespace.createElement(RouteContext.Provider, { value: this.props.routeContext }, /* @__PURE__ */ React3__namespace.createElement(
|
|
66507
|
+
RouteErrorContext.Provider,
|
|
66508
|
+
{
|
|
66509
|
+
value: this.state.error,
|
|
66510
|
+
children: this.props.component
|
|
66511
|
+
}
|
|
66512
|
+
)) : this.props.children;
|
|
66513
|
+
}
|
|
66514
|
+
};
|
|
66515
|
+
function RenderedRoute({ routeContext, match, children }) {
|
|
66516
|
+
let dataRouterContext = React3__namespace.useContext(DataRouterContext);
|
|
66517
|
+
if (dataRouterContext && dataRouterContext.static && dataRouterContext.staticContext && (match.route.errorElement || match.route.ErrorBoundary)) {
|
|
66518
|
+
dataRouterContext.staticContext._deepestRenderedBoundaryId = match.route.id;
|
|
66519
|
+
}
|
|
66520
|
+
return /* @__PURE__ */ React3__namespace.createElement(RouteContext.Provider, { value: routeContext }, children);
|
|
66521
|
+
}
|
|
66522
|
+
function _renderMatches(matches, parentMatches = [], dataRouterState = null, unstable_onError = null, future = null) {
|
|
66523
|
+
if (matches == null) {
|
|
66524
|
+
if (!dataRouterState) {
|
|
66525
|
+
return null;
|
|
66526
|
+
}
|
|
66527
|
+
if (dataRouterState.errors) {
|
|
66528
|
+
matches = dataRouterState.matches;
|
|
66529
|
+
} else if (parentMatches.length === 0 && !dataRouterState.initialized && dataRouterState.matches.length > 0) {
|
|
66530
|
+
matches = dataRouterState.matches;
|
|
66531
|
+
} else {
|
|
66532
|
+
return null;
|
|
66533
|
+
}
|
|
66534
|
+
}
|
|
66535
|
+
let renderedMatches = matches;
|
|
66536
|
+
let errors = dataRouterState?.errors;
|
|
66537
|
+
if (errors != null) {
|
|
66538
|
+
let errorIndex = renderedMatches.findIndex(
|
|
66539
|
+
(m) => m.route.id && errors?.[m.route.id] !== void 0
|
|
66540
|
+
);
|
|
66541
|
+
invariant(
|
|
66542
|
+
errorIndex >= 0,
|
|
66543
|
+
`Could not find a matching route for errors on route IDs: ${Object.keys(
|
|
66544
|
+
errors
|
|
66545
|
+
).join(",")}`
|
|
66546
|
+
);
|
|
66547
|
+
renderedMatches = renderedMatches.slice(
|
|
66548
|
+
0,
|
|
66549
|
+
Math.min(renderedMatches.length, errorIndex + 1)
|
|
66550
|
+
);
|
|
66551
|
+
}
|
|
66552
|
+
let renderFallback = false;
|
|
66553
|
+
let fallbackIndex = -1;
|
|
66554
|
+
if (dataRouterState) {
|
|
66555
|
+
for (let i = 0; i < renderedMatches.length; i++) {
|
|
66556
|
+
let match = renderedMatches[i];
|
|
66557
|
+
if (match.route.HydrateFallback || match.route.hydrateFallbackElement) {
|
|
66558
|
+
fallbackIndex = i;
|
|
66559
|
+
}
|
|
66560
|
+
if (match.route.id) {
|
|
66561
|
+
let { loaderData, errors: errors2 } = dataRouterState;
|
|
66562
|
+
let needsToRunLoader = match.route.loader && !loaderData.hasOwnProperty(match.route.id) && (!errors2 || errors2[match.route.id] === void 0);
|
|
66563
|
+
if (match.route.lazy || needsToRunLoader) {
|
|
66564
|
+
renderFallback = true;
|
|
66565
|
+
if (fallbackIndex >= 0) {
|
|
66566
|
+
renderedMatches = renderedMatches.slice(0, fallbackIndex + 1);
|
|
66567
|
+
} else {
|
|
66568
|
+
renderedMatches = [renderedMatches[0]];
|
|
66569
|
+
}
|
|
66570
|
+
break;
|
|
66571
|
+
}
|
|
66572
|
+
}
|
|
66573
|
+
}
|
|
66574
|
+
}
|
|
66575
|
+
return renderedMatches.reduceRight(
|
|
66576
|
+
(outlet, match, index) => {
|
|
66577
|
+
let error;
|
|
66578
|
+
let shouldRenderHydrateFallback = false;
|
|
66579
|
+
let errorElement = null;
|
|
66580
|
+
let hydrateFallbackElement = null;
|
|
66581
|
+
if (dataRouterState) {
|
|
66582
|
+
error = errors && match.route.id ? errors[match.route.id] : void 0;
|
|
66583
|
+
errorElement = match.route.errorElement || defaultErrorElement;
|
|
66584
|
+
if (renderFallback) {
|
|
66585
|
+
if (fallbackIndex < 0 && index === 0) {
|
|
66586
|
+
warningOnce(
|
|
66587
|
+
"route-fallback",
|
|
66588
|
+
false,
|
|
66589
|
+
"No `HydrateFallback` element provided to render during initial hydration"
|
|
66590
|
+
);
|
|
66591
|
+
shouldRenderHydrateFallback = true;
|
|
66592
|
+
hydrateFallbackElement = null;
|
|
66593
|
+
} else if (fallbackIndex === index) {
|
|
66594
|
+
shouldRenderHydrateFallback = true;
|
|
66595
|
+
hydrateFallbackElement = match.route.hydrateFallbackElement || null;
|
|
66596
|
+
}
|
|
66597
|
+
}
|
|
66598
|
+
}
|
|
66599
|
+
let matches2 = parentMatches.concat(renderedMatches.slice(0, index + 1));
|
|
66600
|
+
let getChildren = () => {
|
|
66601
|
+
let children;
|
|
66602
|
+
if (error) {
|
|
66603
|
+
children = errorElement;
|
|
66604
|
+
} else if (shouldRenderHydrateFallback) {
|
|
66605
|
+
children = hydrateFallbackElement;
|
|
66606
|
+
} else if (match.route.Component) {
|
|
66607
|
+
children = /* @__PURE__ */ React3__namespace.createElement(match.route.Component, null);
|
|
66608
|
+
} else if (match.route.element) {
|
|
66609
|
+
children = match.route.element;
|
|
66610
|
+
} else {
|
|
66611
|
+
children = outlet;
|
|
66612
|
+
}
|
|
66613
|
+
return /* @__PURE__ */ React3__namespace.createElement(
|
|
66614
|
+
RenderedRoute,
|
|
66615
|
+
{
|
|
66616
|
+
match,
|
|
66617
|
+
routeContext: {
|
|
66618
|
+
outlet,
|
|
66619
|
+
matches: matches2,
|
|
66620
|
+
isDataRoute: dataRouterState != null
|
|
66621
|
+
},
|
|
66622
|
+
children
|
|
66623
|
+
}
|
|
66624
|
+
);
|
|
66625
|
+
};
|
|
66626
|
+
return dataRouterState && (match.route.ErrorBoundary || match.route.errorElement || index === 0) ? /* @__PURE__ */ React3__namespace.createElement(
|
|
66627
|
+
RenderErrorBoundary,
|
|
66628
|
+
{
|
|
66629
|
+
location: dataRouterState.location,
|
|
66630
|
+
revalidation: dataRouterState.revalidation,
|
|
66631
|
+
component: errorElement,
|
|
66632
|
+
error,
|
|
66633
|
+
children: getChildren(),
|
|
66634
|
+
routeContext: { outlet: null, matches: matches2, isDataRoute: true },
|
|
66635
|
+
unstable_onError
|
|
66636
|
+
}
|
|
66637
|
+
) : getChildren();
|
|
66638
|
+
},
|
|
66639
|
+
null
|
|
66640
|
+
);
|
|
66641
|
+
}
|
|
66642
|
+
function getDataRouterConsoleError(hookName) {
|
|
66643
|
+
return `${hookName} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
|
|
66644
|
+
}
|
|
66645
|
+
function useDataRouterContext(hookName) {
|
|
66646
|
+
let ctx = React3__namespace.useContext(DataRouterContext);
|
|
66647
|
+
invariant(ctx, getDataRouterConsoleError(hookName));
|
|
66648
|
+
return ctx;
|
|
66649
|
+
}
|
|
66650
|
+
function useDataRouterState(hookName) {
|
|
66651
|
+
let state = React3__namespace.useContext(DataRouterStateContext);
|
|
66652
|
+
invariant(state, getDataRouterConsoleError(hookName));
|
|
66653
|
+
return state;
|
|
66654
|
+
}
|
|
66655
|
+
function useRouteContext(hookName) {
|
|
66656
|
+
let route = React3__namespace.useContext(RouteContext);
|
|
66657
|
+
invariant(route, getDataRouterConsoleError(hookName));
|
|
66658
|
+
return route;
|
|
66659
|
+
}
|
|
66660
|
+
function useCurrentRouteId(hookName) {
|
|
66661
|
+
let route = useRouteContext(hookName);
|
|
66662
|
+
let thisRoute = route.matches[route.matches.length - 1];
|
|
66663
|
+
invariant(
|
|
66664
|
+
thisRoute.route.id,
|
|
66665
|
+
`${hookName} can only be used on routes that contain a unique "id"`
|
|
66666
|
+
);
|
|
66667
|
+
return thisRoute.route.id;
|
|
66668
|
+
}
|
|
66669
|
+
function useRouteId() {
|
|
66670
|
+
return useCurrentRouteId("useRouteId" /* UseRouteId */);
|
|
66671
|
+
}
|
|
66672
|
+
function useRouteError() {
|
|
66673
|
+
let error = React3__namespace.useContext(RouteErrorContext);
|
|
66674
|
+
let state = useDataRouterState("useRouteError" /* UseRouteError */);
|
|
66675
|
+
let routeId = useCurrentRouteId("useRouteError" /* UseRouteError */);
|
|
66676
|
+
if (error !== void 0) {
|
|
66677
|
+
return error;
|
|
66678
|
+
}
|
|
66679
|
+
return state.errors?.[routeId];
|
|
66680
|
+
}
|
|
66681
|
+
function useNavigateStable() {
|
|
66682
|
+
let { router } = useDataRouterContext("useNavigate" /* UseNavigateStable */);
|
|
66683
|
+
let id = useCurrentRouteId("useNavigate" /* UseNavigateStable */);
|
|
66684
|
+
let activeRef = React3__namespace.useRef(false);
|
|
66685
|
+
useIsomorphicLayoutEffect(() => {
|
|
66686
|
+
activeRef.current = true;
|
|
66687
|
+
});
|
|
66688
|
+
let navigate = React3__namespace.useCallback(
|
|
66689
|
+
async (to, options = {}) => {
|
|
66690
|
+
warning(activeRef.current, navigateEffectWarning);
|
|
66691
|
+
if (!activeRef.current) return;
|
|
66692
|
+
if (typeof to === "number") {
|
|
66693
|
+
router.navigate(to);
|
|
66694
|
+
} else {
|
|
66695
|
+
await router.navigate(to, { fromRouteId: id, ...options });
|
|
66696
|
+
}
|
|
66697
|
+
},
|
|
66698
|
+
[router, id]
|
|
66699
|
+
);
|
|
66700
|
+
return navigate;
|
|
66701
|
+
}
|
|
66702
|
+
var alreadyWarned = {};
|
|
66703
|
+
function warningOnce(key, cond, message) {
|
|
66704
|
+
if (!cond && !alreadyWarned[key]) {
|
|
66705
|
+
alreadyWarned[key] = true;
|
|
66706
|
+
warning(false, message);
|
|
66707
|
+
}
|
|
66708
|
+
}
|
|
66709
|
+
React3__namespace.memo(DataRoutes);
|
|
66710
|
+
function DataRoutes({
|
|
66711
|
+
routes,
|
|
66712
|
+
future,
|
|
66713
|
+
state,
|
|
66714
|
+
unstable_onError
|
|
66715
|
+
}) {
|
|
66716
|
+
return useRoutesImpl(routes, void 0, state, unstable_onError, future);
|
|
66717
|
+
}
|
|
66718
|
+
|
|
66719
|
+
// lib/dom/dom.ts
|
|
66720
|
+
var defaultMethod = "get";
|
|
66721
|
+
var defaultEncType = "application/x-www-form-urlencoded";
|
|
66722
|
+
function isHtmlElement(object) {
|
|
66723
|
+
return object != null && typeof object.tagName === "string";
|
|
66724
|
+
}
|
|
66725
|
+
function isButtonElement(object) {
|
|
66726
|
+
return isHtmlElement(object) && object.tagName.toLowerCase() === "button";
|
|
66727
|
+
}
|
|
66728
|
+
function isFormElement(object) {
|
|
66729
|
+
return isHtmlElement(object) && object.tagName.toLowerCase() === "form";
|
|
66730
|
+
}
|
|
66731
|
+
function isInputElement(object) {
|
|
66732
|
+
return isHtmlElement(object) && object.tagName.toLowerCase() === "input";
|
|
66733
|
+
}
|
|
66734
|
+
function isModifiedEvent(event) {
|
|
66735
|
+
return !!(event.metaKey || event.altKey || event.ctrlKey || event.shiftKey);
|
|
66736
|
+
}
|
|
66737
|
+
function shouldProcessLinkClick(event, target) {
|
|
66738
|
+
return event.button === 0 && // Ignore everything but left clicks
|
|
66739
|
+
(!target || target === "_self") && // Let browser handle "target=_blank" etc.
|
|
66740
|
+
!isModifiedEvent(event);
|
|
66741
|
+
}
|
|
66742
|
+
var _formDataSupportsSubmitter = null;
|
|
66743
|
+
function isFormDataSubmitterSupported() {
|
|
66744
|
+
if (_formDataSupportsSubmitter === null) {
|
|
66745
|
+
try {
|
|
66746
|
+
new FormData(
|
|
66747
|
+
document.createElement("form"),
|
|
66748
|
+
// @ts-expect-error if FormData supports the submitter parameter, this will throw
|
|
66749
|
+
0
|
|
66750
|
+
);
|
|
66751
|
+
_formDataSupportsSubmitter = false;
|
|
66752
|
+
} catch (e) {
|
|
66753
|
+
_formDataSupportsSubmitter = true;
|
|
66754
|
+
}
|
|
66755
|
+
}
|
|
66756
|
+
return _formDataSupportsSubmitter;
|
|
66757
|
+
}
|
|
66758
|
+
var supportedFormEncTypes = /* @__PURE__ */ new Set([
|
|
66759
|
+
"application/x-www-form-urlencoded",
|
|
66760
|
+
"multipart/form-data",
|
|
66761
|
+
"text/plain"
|
|
66762
|
+
]);
|
|
66763
|
+
function getFormEncType(encType) {
|
|
66764
|
+
if (encType != null && !supportedFormEncTypes.has(encType)) {
|
|
66765
|
+
warning(
|
|
66766
|
+
false,
|
|
66767
|
+
`"${encType}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${defaultEncType}"`
|
|
66768
|
+
);
|
|
66769
|
+
return null;
|
|
66770
|
+
}
|
|
66771
|
+
return encType;
|
|
66772
|
+
}
|
|
66773
|
+
function getFormSubmissionInfo(target, basename) {
|
|
66774
|
+
let method;
|
|
66775
|
+
let action;
|
|
66776
|
+
let encType;
|
|
66777
|
+
let formData;
|
|
66778
|
+
let body;
|
|
66779
|
+
if (isFormElement(target)) {
|
|
66780
|
+
let attr = target.getAttribute("action");
|
|
66781
|
+
action = attr ? stripBasename(attr, basename) : null;
|
|
66782
|
+
method = target.getAttribute("method") || defaultMethod;
|
|
66783
|
+
encType = getFormEncType(target.getAttribute("enctype")) || defaultEncType;
|
|
66784
|
+
formData = new FormData(target);
|
|
66785
|
+
} else if (isButtonElement(target) || isInputElement(target) && (target.type === "submit" || target.type === "image")) {
|
|
66786
|
+
let form = target.form;
|
|
66787
|
+
if (form == null) {
|
|
66788
|
+
throw new Error(
|
|
66789
|
+
`Cannot submit a <button> or <input type="submit"> without a <form>`
|
|
66790
|
+
);
|
|
66791
|
+
}
|
|
66792
|
+
let attr = target.getAttribute("formaction") || form.getAttribute("action");
|
|
66793
|
+
action = attr ? stripBasename(attr, basename) : null;
|
|
66794
|
+
method = target.getAttribute("formmethod") || form.getAttribute("method") || defaultMethod;
|
|
66795
|
+
encType = getFormEncType(target.getAttribute("formenctype")) || getFormEncType(form.getAttribute("enctype")) || defaultEncType;
|
|
66796
|
+
formData = new FormData(form, target);
|
|
66797
|
+
if (!isFormDataSubmitterSupported()) {
|
|
66798
|
+
let { name, type, value } = target;
|
|
66799
|
+
if (type === "image") {
|
|
66800
|
+
let prefix = name ? `${name}.` : "";
|
|
66801
|
+
formData.append(`${prefix}x`, "0");
|
|
66802
|
+
formData.append(`${prefix}y`, "0");
|
|
66803
|
+
} else if (name) {
|
|
66804
|
+
formData.append(name, value);
|
|
66805
|
+
}
|
|
66806
|
+
}
|
|
66807
|
+
} else if (isHtmlElement(target)) {
|
|
66808
|
+
throw new Error(
|
|
66809
|
+
`Cannot submit element that is not <form>, <button>, or <input type="submit|image">`
|
|
66810
|
+
);
|
|
66811
|
+
} else {
|
|
66812
|
+
method = defaultMethod;
|
|
66813
|
+
action = null;
|
|
66814
|
+
encType = defaultEncType;
|
|
66815
|
+
body = target;
|
|
66816
|
+
}
|
|
66817
|
+
if (formData && encType === "text/plain") {
|
|
66818
|
+
body = formData;
|
|
66819
|
+
formData = void 0;
|
|
66820
|
+
}
|
|
66821
|
+
return { action, method: method.toLowerCase(), encType, formData, body };
|
|
66822
|
+
}
|
|
66823
|
+
Object.getOwnPropertyNames(Object.prototype).sort().join("\0");
|
|
66824
|
+
|
|
66825
|
+
// lib/dom/ssr/invariant.ts
|
|
66826
|
+
function invariant2(value, message) {
|
|
66827
|
+
if (value === false || value === null || typeof value === "undefined") {
|
|
66828
|
+
throw new Error(message);
|
|
66829
|
+
}
|
|
66830
|
+
}
|
|
66831
|
+
function singleFetchUrl(reqUrl, basename, extension) {
|
|
66832
|
+
let url = typeof reqUrl === "string" ? new URL(
|
|
66833
|
+
reqUrl,
|
|
66834
|
+
// This can be called during the SSR flow via PrefetchPageLinksImpl so
|
|
66835
|
+
// don't assume window is available
|
|
66836
|
+
typeof window === "undefined" ? "server://singlefetch/" : window.location.origin
|
|
66837
|
+
) : reqUrl;
|
|
66838
|
+
if (url.pathname === "/") {
|
|
66839
|
+
url.pathname = `_root.${extension}`;
|
|
66840
|
+
} else if (basename && stripBasename(url.pathname, basename) === "/") {
|
|
66841
|
+
url.pathname = `${basename.replace(/\/$/, "")}/_root.${extension}`;
|
|
66842
|
+
} else {
|
|
66843
|
+
url.pathname = `${url.pathname.replace(/\/$/, "")}.${extension}`;
|
|
66844
|
+
}
|
|
66845
|
+
return url;
|
|
66846
|
+
}
|
|
66847
|
+
|
|
66848
|
+
// lib/dom/ssr/routeModules.ts
|
|
66849
|
+
async function loadRouteModule(route, routeModulesCache) {
|
|
66850
|
+
if (route.id in routeModulesCache) {
|
|
66851
|
+
return routeModulesCache[route.id];
|
|
66852
|
+
}
|
|
66853
|
+
try {
|
|
66854
|
+
let routeModule = await import(
|
|
66855
|
+
/* @vite-ignore */
|
|
66856
|
+
/* webpackIgnore: true */
|
|
66857
|
+
route.module
|
|
66858
|
+
);
|
|
66859
|
+
routeModulesCache[route.id] = routeModule;
|
|
66860
|
+
return routeModule;
|
|
66861
|
+
} catch (error) {
|
|
66862
|
+
console.error(
|
|
66863
|
+
`Error loading route module \`${route.module}\`, reloading page...`
|
|
66864
|
+
);
|
|
66865
|
+
console.error(error);
|
|
66866
|
+
if (window.__reactRouterContext && window.__reactRouterContext.isSpaMode && // @ts-expect-error
|
|
66867
|
+
undefined) {
|
|
66868
|
+
throw error;
|
|
66869
|
+
}
|
|
66870
|
+
window.location.reload();
|
|
66871
|
+
return new Promise(() => {
|
|
66872
|
+
});
|
|
66873
|
+
}
|
|
66874
|
+
}
|
|
66875
|
+
function isHtmlLinkDescriptor(object) {
|
|
66876
|
+
if (object == null) {
|
|
66877
|
+
return false;
|
|
66878
|
+
}
|
|
66879
|
+
if (object.href == null) {
|
|
66880
|
+
return object.rel === "preload" && typeof object.imageSrcSet === "string" && typeof object.imageSizes === "string";
|
|
66881
|
+
}
|
|
66882
|
+
return typeof object.rel === "string" && typeof object.href === "string";
|
|
66883
|
+
}
|
|
66884
|
+
async function getKeyedPrefetchLinks(matches, manifest, routeModules) {
|
|
66885
|
+
let links = await Promise.all(
|
|
66886
|
+
matches.map(async (match) => {
|
|
66887
|
+
let route = manifest.routes[match.route.id];
|
|
66888
|
+
if (route) {
|
|
66889
|
+
let mod = await loadRouteModule(route, routeModules);
|
|
66890
|
+
return mod.links ? mod.links() : [];
|
|
66891
|
+
}
|
|
66892
|
+
return [];
|
|
66893
|
+
})
|
|
66894
|
+
);
|
|
66895
|
+
return dedupeLinkDescriptors(
|
|
66896
|
+
links.flat(1).filter(isHtmlLinkDescriptor).filter((link) => link.rel === "stylesheet" || link.rel === "preload").map(
|
|
66897
|
+
(link) => link.rel === "stylesheet" ? { ...link, rel: "prefetch", as: "style" } : { ...link, rel: "prefetch" }
|
|
66898
|
+
)
|
|
66899
|
+
);
|
|
66900
|
+
}
|
|
66901
|
+
function getNewMatchesForLinks(page, nextMatches, currentMatches, manifest, location, mode) {
|
|
66902
|
+
let isNew = (match, index) => {
|
|
66903
|
+
if (!currentMatches[index]) return true;
|
|
66904
|
+
return match.route.id !== currentMatches[index].route.id;
|
|
66905
|
+
};
|
|
66906
|
+
let matchPathChanged = (match, index) => {
|
|
66907
|
+
return (
|
|
66908
|
+
// param change, /users/123 -> /users/456
|
|
66909
|
+
currentMatches[index].pathname !== match.pathname || // splat param changed, which is not present in match.path
|
|
66910
|
+
// e.g. /files/images/avatar.jpg -> files/finances.xls
|
|
66911
|
+
currentMatches[index].route.path?.endsWith("*") && currentMatches[index].params["*"] !== match.params["*"]
|
|
66912
|
+
);
|
|
66913
|
+
};
|
|
66914
|
+
if (mode === "assets") {
|
|
66915
|
+
return nextMatches.filter(
|
|
66916
|
+
(match, index) => isNew(match, index) || matchPathChanged(match, index)
|
|
66917
|
+
);
|
|
66918
|
+
}
|
|
66919
|
+
if (mode === "data") {
|
|
66920
|
+
return nextMatches.filter((match, index) => {
|
|
66921
|
+
let manifestRoute = manifest.routes[match.route.id];
|
|
66922
|
+
if (!manifestRoute || !manifestRoute.hasLoader) {
|
|
66923
|
+
return false;
|
|
66924
|
+
}
|
|
66925
|
+
if (isNew(match, index) || matchPathChanged(match, index)) {
|
|
66926
|
+
return true;
|
|
66927
|
+
}
|
|
66928
|
+
if (match.route.shouldRevalidate) {
|
|
66929
|
+
let routeChoice = match.route.shouldRevalidate({
|
|
66930
|
+
currentUrl: new URL(
|
|
66931
|
+
location.pathname + location.search + location.hash,
|
|
66932
|
+
window.origin
|
|
66933
|
+
),
|
|
66934
|
+
currentParams: currentMatches[0]?.params || {},
|
|
66935
|
+
nextUrl: new URL(page, window.origin),
|
|
66936
|
+
nextParams: match.params,
|
|
66937
|
+
defaultShouldRevalidate: true
|
|
66938
|
+
});
|
|
66939
|
+
if (typeof routeChoice === "boolean") {
|
|
66940
|
+
return routeChoice;
|
|
66941
|
+
}
|
|
66942
|
+
}
|
|
66943
|
+
return true;
|
|
66944
|
+
});
|
|
66945
|
+
}
|
|
66946
|
+
return [];
|
|
66947
|
+
}
|
|
66948
|
+
function getModuleLinkHrefs(matches, manifest, { includeHydrateFallback } = {}) {
|
|
66949
|
+
return dedupeHrefs(
|
|
66950
|
+
matches.map((match) => {
|
|
66951
|
+
let route = manifest.routes[match.route.id];
|
|
66952
|
+
if (!route) return [];
|
|
66953
|
+
let hrefs = [route.module];
|
|
66954
|
+
if (route.clientActionModule) {
|
|
66955
|
+
hrefs = hrefs.concat(route.clientActionModule);
|
|
66956
|
+
}
|
|
66957
|
+
if (route.clientLoaderModule) {
|
|
66958
|
+
hrefs = hrefs.concat(route.clientLoaderModule);
|
|
66959
|
+
}
|
|
66960
|
+
if (includeHydrateFallback && route.hydrateFallbackModule) {
|
|
66961
|
+
hrefs = hrefs.concat(route.hydrateFallbackModule);
|
|
66962
|
+
}
|
|
66963
|
+
if (route.imports) {
|
|
66964
|
+
hrefs = hrefs.concat(route.imports);
|
|
66965
|
+
}
|
|
66966
|
+
return hrefs;
|
|
66967
|
+
}).flat(1)
|
|
66968
|
+
);
|
|
66969
|
+
}
|
|
66970
|
+
function dedupeHrefs(hrefs) {
|
|
66971
|
+
return [...new Set(hrefs)];
|
|
66972
|
+
}
|
|
66973
|
+
function sortKeys(obj) {
|
|
66974
|
+
let sorted = {};
|
|
66975
|
+
let keys = Object.keys(obj).sort();
|
|
66976
|
+
for (let key of keys) {
|
|
66977
|
+
sorted[key] = obj[key];
|
|
66978
|
+
}
|
|
66979
|
+
return sorted;
|
|
66980
|
+
}
|
|
66981
|
+
function dedupeLinkDescriptors(descriptors, preloads) {
|
|
66982
|
+
let set = /* @__PURE__ */ new Set();
|
|
66983
|
+
new Set(preloads);
|
|
66984
|
+
return descriptors.reduce((deduped, descriptor) => {
|
|
66985
|
+
let key = JSON.stringify(sortKeys(descriptor));
|
|
66986
|
+
if (!set.has(key)) {
|
|
66987
|
+
set.add(key);
|
|
66988
|
+
deduped.push({ key, link: descriptor });
|
|
66989
|
+
}
|
|
66990
|
+
return deduped;
|
|
66991
|
+
}, []);
|
|
66992
|
+
}
|
|
66993
|
+
|
|
66994
|
+
// lib/dom/ssr/components.tsx
|
|
66995
|
+
function useDataRouterContext2() {
|
|
66996
|
+
let context = React3__namespace.useContext(DataRouterContext);
|
|
66997
|
+
invariant2(
|
|
66998
|
+
context,
|
|
66999
|
+
"You must render this element inside a <DataRouterContext.Provider> element"
|
|
67000
|
+
);
|
|
67001
|
+
return context;
|
|
67002
|
+
}
|
|
67003
|
+
function useDataRouterStateContext() {
|
|
67004
|
+
let context = React3__namespace.useContext(DataRouterStateContext);
|
|
67005
|
+
invariant2(
|
|
67006
|
+
context,
|
|
67007
|
+
"You must render this element inside a <DataRouterStateContext.Provider> element"
|
|
67008
|
+
);
|
|
67009
|
+
return context;
|
|
67010
|
+
}
|
|
67011
|
+
var FrameworkContext = React3__namespace.createContext(void 0);
|
|
67012
|
+
FrameworkContext.displayName = "FrameworkContext";
|
|
67013
|
+
function useFrameworkContext() {
|
|
67014
|
+
let context = React3__namespace.useContext(FrameworkContext);
|
|
67015
|
+
invariant2(
|
|
67016
|
+
context,
|
|
67017
|
+
"You must render this element inside a <HydratedRouter> element"
|
|
67018
|
+
);
|
|
67019
|
+
return context;
|
|
67020
|
+
}
|
|
67021
|
+
function usePrefetchBehavior(prefetch, theirElementProps) {
|
|
67022
|
+
let frameworkContext = React3__namespace.useContext(FrameworkContext);
|
|
67023
|
+
let [maybePrefetch, setMaybePrefetch] = React3__namespace.useState(false);
|
|
67024
|
+
let [shouldPrefetch, setShouldPrefetch] = React3__namespace.useState(false);
|
|
67025
|
+
let { onFocus, onBlur, onMouseEnter, onMouseLeave, onTouchStart } = theirElementProps;
|
|
67026
|
+
let ref = React3__namespace.useRef(null);
|
|
67027
|
+
React3__namespace.useEffect(() => {
|
|
67028
|
+
if (prefetch === "render") {
|
|
67029
|
+
setShouldPrefetch(true);
|
|
67030
|
+
}
|
|
67031
|
+
if (prefetch === "viewport") {
|
|
67032
|
+
let callback = (entries) => {
|
|
67033
|
+
entries.forEach((entry) => {
|
|
67034
|
+
setShouldPrefetch(entry.isIntersecting);
|
|
67035
|
+
});
|
|
67036
|
+
};
|
|
67037
|
+
let observer = new IntersectionObserver(callback, { threshold: 0.5 });
|
|
67038
|
+
if (ref.current) observer.observe(ref.current);
|
|
67039
|
+
return () => {
|
|
67040
|
+
observer.disconnect();
|
|
67041
|
+
};
|
|
67042
|
+
}
|
|
67043
|
+
}, [prefetch]);
|
|
67044
|
+
React3__namespace.useEffect(() => {
|
|
67045
|
+
if (maybePrefetch) {
|
|
67046
|
+
let id = setTimeout(() => {
|
|
67047
|
+
setShouldPrefetch(true);
|
|
67048
|
+
}, 100);
|
|
67049
|
+
return () => {
|
|
67050
|
+
clearTimeout(id);
|
|
67051
|
+
};
|
|
67052
|
+
}
|
|
67053
|
+
}, [maybePrefetch]);
|
|
67054
|
+
let setIntent = () => {
|
|
67055
|
+
setMaybePrefetch(true);
|
|
67056
|
+
};
|
|
67057
|
+
let cancelIntent = () => {
|
|
67058
|
+
setMaybePrefetch(false);
|
|
67059
|
+
setShouldPrefetch(false);
|
|
67060
|
+
};
|
|
67061
|
+
if (!frameworkContext) {
|
|
67062
|
+
return [false, ref, {}];
|
|
67063
|
+
}
|
|
67064
|
+
if (prefetch !== "intent") {
|
|
67065
|
+
return [shouldPrefetch, ref, {}];
|
|
67066
|
+
}
|
|
67067
|
+
return [
|
|
67068
|
+
shouldPrefetch,
|
|
67069
|
+
ref,
|
|
67070
|
+
{
|
|
67071
|
+
onFocus: composeEventHandlers(onFocus, setIntent),
|
|
67072
|
+
onBlur: composeEventHandlers(onBlur, cancelIntent),
|
|
67073
|
+
onMouseEnter: composeEventHandlers(onMouseEnter, setIntent),
|
|
67074
|
+
onMouseLeave: composeEventHandlers(onMouseLeave, cancelIntent),
|
|
67075
|
+
onTouchStart: composeEventHandlers(onTouchStart, setIntent)
|
|
67076
|
+
}
|
|
67077
|
+
];
|
|
67078
|
+
}
|
|
67079
|
+
function composeEventHandlers(theirHandler, ourHandler) {
|
|
67080
|
+
return (event) => {
|
|
67081
|
+
theirHandler && theirHandler(event);
|
|
67082
|
+
if (!event.defaultPrevented) {
|
|
67083
|
+
ourHandler(event);
|
|
67084
|
+
}
|
|
67085
|
+
};
|
|
67086
|
+
}
|
|
67087
|
+
function PrefetchPageLinks({ page, ...linkProps }) {
|
|
67088
|
+
let { router } = useDataRouterContext2();
|
|
67089
|
+
let matches = React3__namespace.useMemo(
|
|
67090
|
+
() => matchRoutes(router.routes, page, router.basename),
|
|
67091
|
+
[router.routes, page, router.basename]
|
|
67092
|
+
);
|
|
67093
|
+
if (!matches) {
|
|
67094
|
+
return null;
|
|
67095
|
+
}
|
|
67096
|
+
return /* @__PURE__ */ React3__namespace.createElement(PrefetchPageLinksImpl, { page, matches, ...linkProps });
|
|
67097
|
+
}
|
|
67098
|
+
function useKeyedPrefetchLinks(matches) {
|
|
67099
|
+
let { manifest, routeModules } = useFrameworkContext();
|
|
67100
|
+
let [keyedPrefetchLinks, setKeyedPrefetchLinks] = React3__namespace.useState([]);
|
|
67101
|
+
React3__namespace.useEffect(() => {
|
|
67102
|
+
let interrupted = false;
|
|
67103
|
+
void getKeyedPrefetchLinks(matches, manifest, routeModules).then(
|
|
67104
|
+
(links) => {
|
|
67105
|
+
if (!interrupted) {
|
|
67106
|
+
setKeyedPrefetchLinks(links);
|
|
67107
|
+
}
|
|
67108
|
+
}
|
|
67109
|
+
);
|
|
67110
|
+
return () => {
|
|
67111
|
+
interrupted = true;
|
|
67112
|
+
};
|
|
67113
|
+
}, [matches, manifest, routeModules]);
|
|
67114
|
+
return keyedPrefetchLinks;
|
|
67115
|
+
}
|
|
67116
|
+
function PrefetchPageLinksImpl({
|
|
67117
|
+
page,
|
|
67118
|
+
matches: nextMatches,
|
|
67119
|
+
...linkProps
|
|
67120
|
+
}) {
|
|
67121
|
+
let location = useLocation();
|
|
67122
|
+
let { manifest, routeModules } = useFrameworkContext();
|
|
67123
|
+
let { basename } = useDataRouterContext2();
|
|
67124
|
+
let { loaderData, matches } = useDataRouterStateContext();
|
|
67125
|
+
let newMatchesForData = React3__namespace.useMemo(
|
|
67126
|
+
() => getNewMatchesForLinks(
|
|
67127
|
+
page,
|
|
67128
|
+
nextMatches,
|
|
67129
|
+
matches,
|
|
67130
|
+
manifest,
|
|
67131
|
+
location,
|
|
67132
|
+
"data"
|
|
67133
|
+
),
|
|
67134
|
+
[page, nextMatches, matches, manifest, location]
|
|
67135
|
+
);
|
|
67136
|
+
let newMatchesForAssets = React3__namespace.useMemo(
|
|
67137
|
+
() => getNewMatchesForLinks(
|
|
67138
|
+
page,
|
|
67139
|
+
nextMatches,
|
|
67140
|
+
matches,
|
|
67141
|
+
manifest,
|
|
67142
|
+
location,
|
|
67143
|
+
"assets"
|
|
67144
|
+
),
|
|
67145
|
+
[page, nextMatches, matches, manifest, location]
|
|
67146
|
+
);
|
|
67147
|
+
let dataHrefs = React3__namespace.useMemo(() => {
|
|
67148
|
+
if (page === location.pathname + location.search + location.hash) {
|
|
67149
|
+
return [];
|
|
67150
|
+
}
|
|
67151
|
+
let routesParams = /* @__PURE__ */ new Set();
|
|
67152
|
+
let foundOptOutRoute = false;
|
|
67153
|
+
nextMatches.forEach((m) => {
|
|
67154
|
+
let manifestRoute = manifest.routes[m.route.id];
|
|
67155
|
+
if (!manifestRoute || !manifestRoute.hasLoader) {
|
|
67156
|
+
return;
|
|
67157
|
+
}
|
|
67158
|
+
if (!newMatchesForData.some((m2) => m2.route.id === m.route.id) && m.route.id in loaderData && routeModules[m.route.id]?.shouldRevalidate) {
|
|
67159
|
+
foundOptOutRoute = true;
|
|
67160
|
+
} else if (manifestRoute.hasClientLoader) {
|
|
67161
|
+
foundOptOutRoute = true;
|
|
67162
|
+
} else {
|
|
67163
|
+
routesParams.add(m.route.id);
|
|
67164
|
+
}
|
|
67165
|
+
});
|
|
67166
|
+
if (routesParams.size === 0) {
|
|
67167
|
+
return [];
|
|
67168
|
+
}
|
|
67169
|
+
let url = singleFetchUrl(page, basename, "data");
|
|
67170
|
+
if (foundOptOutRoute && routesParams.size > 0) {
|
|
67171
|
+
url.searchParams.set(
|
|
67172
|
+
"_routes",
|
|
67173
|
+
nextMatches.filter((m) => routesParams.has(m.route.id)).map((m) => m.route.id).join(",")
|
|
67174
|
+
);
|
|
67175
|
+
}
|
|
67176
|
+
return [url.pathname + url.search];
|
|
67177
|
+
}, [
|
|
67178
|
+
basename,
|
|
67179
|
+
loaderData,
|
|
67180
|
+
location,
|
|
67181
|
+
manifest,
|
|
67182
|
+
newMatchesForData,
|
|
67183
|
+
nextMatches,
|
|
67184
|
+
page,
|
|
67185
|
+
routeModules
|
|
67186
|
+
]);
|
|
67187
|
+
let moduleHrefs = React3__namespace.useMemo(
|
|
67188
|
+
() => getModuleLinkHrefs(newMatchesForAssets, manifest),
|
|
67189
|
+
[newMatchesForAssets, manifest]
|
|
67190
|
+
);
|
|
67191
|
+
let keyedPrefetchLinks = useKeyedPrefetchLinks(newMatchesForAssets);
|
|
67192
|
+
return /* @__PURE__ */ React3__namespace.createElement(React3__namespace.Fragment, null, dataHrefs.map((href) => /* @__PURE__ */ React3__namespace.createElement("link", { key: href, rel: "prefetch", as: "fetch", href, ...linkProps })), moduleHrefs.map((href) => /* @__PURE__ */ React3__namespace.createElement("link", { key: href, rel: "modulepreload", href, ...linkProps })), keyedPrefetchLinks.map(({ key, link }) => (
|
|
67193
|
+
// these don't spread `linkProps` because they are full link descriptors
|
|
67194
|
+
// already with their own props
|
|
67195
|
+
/* @__PURE__ */ React3__namespace.createElement("link", { key, nonce: linkProps.nonce, ...link })
|
|
67196
|
+
)));
|
|
67197
|
+
}
|
|
67198
|
+
function mergeRefs(...refs) {
|
|
67199
|
+
return (value) => {
|
|
67200
|
+
refs.forEach((ref) => {
|
|
67201
|
+
if (typeof ref === "function") {
|
|
67202
|
+
ref(value);
|
|
67203
|
+
} else if (ref != null) {
|
|
67204
|
+
ref.current = value;
|
|
67205
|
+
}
|
|
67206
|
+
});
|
|
67207
|
+
};
|
|
67208
|
+
}
|
|
67209
|
+
var isBrowser = typeof window !== "undefined" && typeof window.document !== "undefined" && typeof window.document.createElement !== "undefined";
|
|
67210
|
+
try {
|
|
67211
|
+
if (isBrowser) {
|
|
67212
|
+
window.__reactRouterVersion = // @ts-expect-error
|
|
67213
|
+
"7.8.2";
|
|
67214
|
+
}
|
|
67215
|
+
} catch (e) {
|
|
67216
|
+
}
|
|
67217
|
+
var ABSOLUTE_URL_REGEX2 = /^(?:[a-z][a-z0-9+.-]*:|\/\/)/i;
|
|
67218
|
+
var Link = React3__namespace.forwardRef(
|
|
67219
|
+
function LinkWithRef({
|
|
67220
|
+
onClick,
|
|
67221
|
+
discover = "render",
|
|
67222
|
+
prefetch = "none",
|
|
67223
|
+
relative,
|
|
67224
|
+
reloadDocument,
|
|
67225
|
+
replace: replace2,
|
|
67226
|
+
state,
|
|
67227
|
+
target,
|
|
67228
|
+
to,
|
|
67229
|
+
preventScrollReset,
|
|
67230
|
+
viewTransition,
|
|
67231
|
+
...rest
|
|
67232
|
+
}, forwardedRef) {
|
|
67233
|
+
let { basename } = React3__namespace.useContext(NavigationContext);
|
|
67234
|
+
let isAbsolute = typeof to === "string" && ABSOLUTE_URL_REGEX2.test(to);
|
|
67235
|
+
let absoluteHref;
|
|
67236
|
+
let isExternal = false;
|
|
67237
|
+
if (typeof to === "string" && isAbsolute) {
|
|
67238
|
+
absoluteHref = to;
|
|
67239
|
+
if (isBrowser) {
|
|
67240
|
+
try {
|
|
67241
|
+
let currentUrl = new URL(window.location.href);
|
|
67242
|
+
let targetUrl = to.startsWith("//") ? new URL(currentUrl.protocol + to) : new URL(to);
|
|
67243
|
+
let path = stripBasename(targetUrl.pathname, basename);
|
|
67244
|
+
if (targetUrl.origin === currentUrl.origin && path != null) {
|
|
67245
|
+
to = path + targetUrl.search + targetUrl.hash;
|
|
67246
|
+
} else {
|
|
67247
|
+
isExternal = true;
|
|
67248
|
+
}
|
|
67249
|
+
} catch (e) {
|
|
67250
|
+
warning(
|
|
67251
|
+
false,
|
|
67252
|
+
`<Link to="${to}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`
|
|
67253
|
+
);
|
|
67254
|
+
}
|
|
67255
|
+
}
|
|
67256
|
+
}
|
|
67257
|
+
let href = useHref(to, { relative });
|
|
67258
|
+
let [shouldPrefetch, prefetchRef, prefetchHandlers] = usePrefetchBehavior(
|
|
67259
|
+
prefetch,
|
|
67260
|
+
rest
|
|
67261
|
+
);
|
|
67262
|
+
let internalOnClick = useLinkClickHandler(to, {
|
|
67263
|
+
replace: replace2,
|
|
67264
|
+
state,
|
|
67265
|
+
target,
|
|
67266
|
+
preventScrollReset,
|
|
67267
|
+
relative,
|
|
67268
|
+
viewTransition
|
|
67269
|
+
});
|
|
67270
|
+
function handleClick(event) {
|
|
67271
|
+
if (onClick) onClick(event);
|
|
67272
|
+
if (!event.defaultPrevented) {
|
|
67273
|
+
internalOnClick(event);
|
|
67274
|
+
}
|
|
67275
|
+
}
|
|
67276
|
+
let link = (
|
|
67277
|
+
// eslint-disable-next-line jsx-a11y/anchor-has-content
|
|
67278
|
+
/* @__PURE__ */ React3__namespace.createElement(
|
|
67279
|
+
"a",
|
|
67280
|
+
{
|
|
67281
|
+
...rest,
|
|
67282
|
+
...prefetchHandlers,
|
|
67283
|
+
href: absoluteHref || href,
|
|
67284
|
+
onClick: isExternal || reloadDocument ? onClick : handleClick,
|
|
67285
|
+
ref: mergeRefs(forwardedRef, prefetchRef),
|
|
67286
|
+
target,
|
|
67287
|
+
"data-discover": !isAbsolute && discover === "render" ? "true" : void 0
|
|
67288
|
+
}
|
|
67289
|
+
)
|
|
67290
|
+
);
|
|
67291
|
+
return shouldPrefetch && !isAbsolute ? /* @__PURE__ */ React3__namespace.createElement(React3__namespace.Fragment, null, link, /* @__PURE__ */ React3__namespace.createElement(PrefetchPageLinks, { page: href })) : link;
|
|
67292
|
+
}
|
|
67293
|
+
);
|
|
67294
|
+
Link.displayName = "Link";
|
|
67295
|
+
var NavLink = React3__namespace.forwardRef(
|
|
67296
|
+
function NavLinkWithRef({
|
|
67297
|
+
"aria-current": ariaCurrentProp = "page",
|
|
67298
|
+
caseSensitive = false,
|
|
67299
|
+
className: classNameProp = "",
|
|
67300
|
+
end = false,
|
|
67301
|
+
style: styleProp,
|
|
67302
|
+
to,
|
|
67303
|
+
viewTransition,
|
|
67304
|
+
children,
|
|
67305
|
+
...rest
|
|
67306
|
+
}, ref) {
|
|
67307
|
+
let path = useResolvedPath(to, { relative: rest.relative });
|
|
67308
|
+
let location = useLocation();
|
|
67309
|
+
let routerState = React3__namespace.useContext(DataRouterStateContext);
|
|
67310
|
+
let { navigator, basename } = React3__namespace.useContext(NavigationContext);
|
|
67311
|
+
let isTransitioning = routerState != null && // Conditional usage is OK here because the usage of a data router is static
|
|
67312
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
67313
|
+
useViewTransitionState(path) && viewTransition === true;
|
|
67314
|
+
let toPathname = navigator.encodeLocation ? navigator.encodeLocation(path).pathname : path.pathname;
|
|
67315
|
+
let locationPathname = location.pathname;
|
|
67316
|
+
let nextLocationPathname = routerState && routerState.navigation && routerState.navigation.location ? routerState.navigation.location.pathname : null;
|
|
67317
|
+
if (!caseSensitive) {
|
|
67318
|
+
locationPathname = locationPathname.toLowerCase();
|
|
67319
|
+
nextLocationPathname = nextLocationPathname ? nextLocationPathname.toLowerCase() : null;
|
|
67320
|
+
toPathname = toPathname.toLowerCase();
|
|
67321
|
+
}
|
|
67322
|
+
if (nextLocationPathname && basename) {
|
|
67323
|
+
nextLocationPathname = stripBasename(nextLocationPathname, basename) || nextLocationPathname;
|
|
67324
|
+
}
|
|
67325
|
+
const endSlashPosition = toPathname !== "/" && toPathname.endsWith("/") ? toPathname.length - 1 : toPathname.length;
|
|
67326
|
+
let isActive = locationPathname === toPathname || !end && locationPathname.startsWith(toPathname) && locationPathname.charAt(endSlashPosition) === "/";
|
|
67327
|
+
let isPending = nextLocationPathname != null && (nextLocationPathname === toPathname || !end && nextLocationPathname.startsWith(toPathname) && nextLocationPathname.charAt(toPathname.length) === "/");
|
|
67328
|
+
let renderProps = {
|
|
67329
|
+
isActive,
|
|
67330
|
+
isPending,
|
|
67331
|
+
isTransitioning
|
|
67332
|
+
};
|
|
67333
|
+
let ariaCurrent = isActive ? ariaCurrentProp : void 0;
|
|
67334
|
+
let className;
|
|
67335
|
+
if (typeof classNameProp === "function") {
|
|
67336
|
+
className = classNameProp(renderProps);
|
|
67337
|
+
} else {
|
|
67338
|
+
className = [
|
|
67339
|
+
classNameProp,
|
|
67340
|
+
isActive ? "active" : null,
|
|
67341
|
+
isPending ? "pending" : null,
|
|
67342
|
+
isTransitioning ? "transitioning" : null
|
|
67343
|
+
].filter(Boolean).join(" ");
|
|
67344
|
+
}
|
|
67345
|
+
let style = typeof styleProp === "function" ? styleProp(renderProps) : styleProp;
|
|
67346
|
+
return /* @__PURE__ */ React3__namespace.createElement(
|
|
67347
|
+
Link,
|
|
67348
|
+
{
|
|
67349
|
+
...rest,
|
|
67350
|
+
"aria-current": ariaCurrent,
|
|
67351
|
+
className,
|
|
67352
|
+
ref,
|
|
67353
|
+
style,
|
|
67354
|
+
to,
|
|
67355
|
+
viewTransition
|
|
67356
|
+
},
|
|
67357
|
+
typeof children === "function" ? children(renderProps) : children
|
|
67358
|
+
);
|
|
67359
|
+
}
|
|
67360
|
+
);
|
|
67361
|
+
NavLink.displayName = "NavLink";
|
|
67362
|
+
var Form = React3__namespace.forwardRef(
|
|
67363
|
+
({
|
|
67364
|
+
discover = "render",
|
|
67365
|
+
fetcherKey,
|
|
67366
|
+
navigate,
|
|
67367
|
+
reloadDocument,
|
|
67368
|
+
replace: replace2,
|
|
67369
|
+
state,
|
|
67370
|
+
method = defaultMethod,
|
|
67371
|
+
action,
|
|
67372
|
+
onSubmit,
|
|
67373
|
+
relative,
|
|
67374
|
+
preventScrollReset,
|
|
67375
|
+
viewTransition,
|
|
67376
|
+
...props
|
|
67377
|
+
}, forwardedRef) => {
|
|
67378
|
+
let submit = useSubmit();
|
|
67379
|
+
let formAction = useFormAction(action, { relative });
|
|
67380
|
+
let formMethod = method.toLowerCase() === "get" ? "get" : "post";
|
|
67381
|
+
let isAbsolute = typeof action === "string" && ABSOLUTE_URL_REGEX2.test(action);
|
|
67382
|
+
let submitHandler = (event) => {
|
|
67383
|
+
onSubmit && onSubmit(event);
|
|
67384
|
+
if (event.defaultPrevented) return;
|
|
67385
|
+
event.preventDefault();
|
|
67386
|
+
let submitter = event.nativeEvent.submitter;
|
|
67387
|
+
let submitMethod = submitter?.getAttribute("formmethod") || method;
|
|
67388
|
+
submit(submitter || event.currentTarget, {
|
|
67389
|
+
fetcherKey,
|
|
67390
|
+
method: submitMethod,
|
|
67391
|
+
navigate,
|
|
67392
|
+
replace: replace2,
|
|
67393
|
+
state,
|
|
67394
|
+
relative,
|
|
67395
|
+
preventScrollReset,
|
|
67396
|
+
viewTransition
|
|
67397
|
+
});
|
|
67398
|
+
};
|
|
67399
|
+
return /* @__PURE__ */ React3__namespace.createElement(
|
|
67400
|
+
"form",
|
|
67401
|
+
{
|
|
67402
|
+
ref: forwardedRef,
|
|
67403
|
+
method: formMethod,
|
|
67404
|
+
action: formAction,
|
|
67405
|
+
onSubmit: reloadDocument ? onSubmit : submitHandler,
|
|
67406
|
+
...props,
|
|
67407
|
+
"data-discover": !isAbsolute && discover === "render" ? "true" : void 0
|
|
67408
|
+
}
|
|
67409
|
+
);
|
|
67410
|
+
}
|
|
67411
|
+
);
|
|
67412
|
+
Form.displayName = "Form";
|
|
67413
|
+
function getDataRouterConsoleError2(hookName) {
|
|
67414
|
+
return `${hookName} must be used within a data router. See https://reactrouter.com/en/main/routers/picking-a-router.`;
|
|
67415
|
+
}
|
|
67416
|
+
function useDataRouterContext3(hookName) {
|
|
67417
|
+
let ctx = React3__namespace.useContext(DataRouterContext);
|
|
67418
|
+
invariant(ctx, getDataRouterConsoleError2(hookName));
|
|
67419
|
+
return ctx;
|
|
67420
|
+
}
|
|
67421
|
+
function useLinkClickHandler(to, {
|
|
67422
|
+
target,
|
|
67423
|
+
replace: replaceProp,
|
|
67424
|
+
state,
|
|
67425
|
+
preventScrollReset,
|
|
67426
|
+
relative,
|
|
67427
|
+
viewTransition
|
|
67428
|
+
} = {}) {
|
|
67429
|
+
let navigate = useNavigate();
|
|
67430
|
+
let location = useLocation();
|
|
67431
|
+
let path = useResolvedPath(to, { relative });
|
|
67432
|
+
return React3__namespace.useCallback(
|
|
67433
|
+
(event) => {
|
|
67434
|
+
if (shouldProcessLinkClick(event, target)) {
|
|
67435
|
+
event.preventDefault();
|
|
67436
|
+
let replace2 = replaceProp !== void 0 ? replaceProp : createPath(location) === createPath(path);
|
|
67437
|
+
navigate(to, {
|
|
67438
|
+
replace: replace2,
|
|
67439
|
+
state,
|
|
67440
|
+
preventScrollReset,
|
|
67441
|
+
relative,
|
|
67442
|
+
viewTransition
|
|
67443
|
+
});
|
|
67444
|
+
}
|
|
67445
|
+
},
|
|
67446
|
+
[
|
|
67447
|
+
location,
|
|
67448
|
+
navigate,
|
|
67449
|
+
path,
|
|
67450
|
+
replaceProp,
|
|
67451
|
+
state,
|
|
67452
|
+
target,
|
|
67453
|
+
to,
|
|
67454
|
+
preventScrollReset,
|
|
67455
|
+
relative,
|
|
67456
|
+
viewTransition
|
|
67457
|
+
]
|
|
67458
|
+
);
|
|
67459
|
+
}
|
|
67460
|
+
var fetcherId = 0;
|
|
67461
|
+
var getUniqueFetcherId = () => `__${String(++fetcherId)}__`;
|
|
67462
|
+
function useSubmit() {
|
|
67463
|
+
let { router } = useDataRouterContext3("useSubmit" /* UseSubmit */);
|
|
67464
|
+
let { basename } = React3__namespace.useContext(NavigationContext);
|
|
67465
|
+
let currentRouteId = useRouteId();
|
|
67466
|
+
return React3__namespace.useCallback(
|
|
67467
|
+
async (target, options = {}) => {
|
|
67468
|
+
let { action, method, encType, formData, body } = getFormSubmissionInfo(
|
|
67469
|
+
target,
|
|
67470
|
+
basename
|
|
67471
|
+
);
|
|
67472
|
+
if (options.navigate === false) {
|
|
67473
|
+
let key = options.fetcherKey || getUniqueFetcherId();
|
|
67474
|
+
await router.fetch(key, currentRouteId, options.action || action, {
|
|
67475
|
+
preventScrollReset: options.preventScrollReset,
|
|
67476
|
+
formData,
|
|
67477
|
+
body,
|
|
67478
|
+
formMethod: options.method || method,
|
|
67479
|
+
formEncType: options.encType || encType,
|
|
67480
|
+
flushSync: options.flushSync
|
|
67481
|
+
});
|
|
67482
|
+
} else {
|
|
67483
|
+
await router.navigate(options.action || action, {
|
|
67484
|
+
preventScrollReset: options.preventScrollReset,
|
|
67485
|
+
formData,
|
|
67486
|
+
body,
|
|
67487
|
+
formMethod: options.method || method,
|
|
67488
|
+
formEncType: options.encType || encType,
|
|
67489
|
+
replace: options.replace,
|
|
67490
|
+
state: options.state,
|
|
67491
|
+
fromRouteId: currentRouteId,
|
|
67492
|
+
flushSync: options.flushSync,
|
|
67493
|
+
viewTransition: options.viewTransition
|
|
67494
|
+
});
|
|
67495
|
+
}
|
|
67496
|
+
},
|
|
67497
|
+
[router, basename, currentRouteId]
|
|
67498
|
+
);
|
|
67499
|
+
}
|
|
67500
|
+
function useFormAction(action, { relative } = {}) {
|
|
67501
|
+
let { basename } = React3__namespace.useContext(NavigationContext);
|
|
67502
|
+
let routeContext = React3__namespace.useContext(RouteContext);
|
|
67503
|
+
invariant(routeContext, "useFormAction must be used inside a RouteContext");
|
|
67504
|
+
let [match] = routeContext.matches.slice(-1);
|
|
67505
|
+
let path = { ...useResolvedPath(action ? action : ".", { relative }) };
|
|
67506
|
+
let location = useLocation();
|
|
67507
|
+
if (action == null) {
|
|
67508
|
+
path.search = location.search;
|
|
67509
|
+
let params = new URLSearchParams(path.search);
|
|
67510
|
+
let indexValues = params.getAll("index");
|
|
67511
|
+
let hasNakedIndexParam = indexValues.some((v) => v === "");
|
|
67512
|
+
if (hasNakedIndexParam) {
|
|
67513
|
+
params.delete("index");
|
|
67514
|
+
indexValues.filter((v) => v).forEach((v) => params.append("index", v));
|
|
67515
|
+
let qs = params.toString();
|
|
67516
|
+
path.search = qs ? `?${qs}` : "";
|
|
67517
|
+
}
|
|
67518
|
+
}
|
|
67519
|
+
if ((!action || action === ".") && match.route.index) {
|
|
67520
|
+
path.search = path.search ? path.search.replace(/^\?/, "?index&") : "?index";
|
|
67521
|
+
}
|
|
67522
|
+
if (basename !== "/") {
|
|
67523
|
+
path.pathname = path.pathname === "/" ? basename : joinPaths([basename, path.pathname]);
|
|
67524
|
+
}
|
|
67525
|
+
return createPath(path);
|
|
67526
|
+
}
|
|
67527
|
+
function useViewTransitionState(to, { relative } = {}) {
|
|
67528
|
+
let vtContext = React3__namespace.useContext(ViewTransitionContext);
|
|
67529
|
+
invariant(
|
|
67530
|
+
vtContext != null,
|
|
67531
|
+
"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`. Did you accidentally import `RouterProvider` from `react-router`?"
|
|
67532
|
+
);
|
|
67533
|
+
let { basename } = useDataRouterContext3(
|
|
67534
|
+
"useViewTransitionState" /* useViewTransitionState */
|
|
67535
|
+
);
|
|
67536
|
+
let path = useResolvedPath(to, { relative });
|
|
67537
|
+
if (!vtContext.isTransitioning) {
|
|
67538
|
+
return false;
|
|
67539
|
+
}
|
|
67540
|
+
let currentPath = stripBasename(vtContext.currentLocation.pathname, basename) || vtContext.currentLocation.pathname;
|
|
67541
|
+
let nextPath = stripBasename(vtContext.nextLocation.pathname, basename) || vtContext.nextLocation.pathname;
|
|
67542
|
+
return matchPath(path.pathname, nextPath) != null || matchPath(path.pathname, currentPath) != null;
|
|
67543
|
+
}
|
|
67544
|
+
|
|
65837
67545
|
var _excluded$6 = ["color"];
|
|
65838
67546
|
var ExternalarrowMd = function ExternalarrowMd(_ref) {
|
|
65839
67547
|
var _ref$color = _ref.color,
|
|
@@ -65861,7 +67569,7 @@ function RuledGrid(_ref) {
|
|
|
65861
67569
|
var columns = _ref.columns,
|
|
65862
67570
|
children = _ref.children,
|
|
65863
67571
|
rest = _objectWithoutProperties(_ref, _excluded$5);
|
|
65864
|
-
var childrenArray =
|
|
67572
|
+
var childrenArray = React3.Children.toArray(children);
|
|
65865
67573
|
return jsxRuntime.jsx(Chakra.Grid, _objectSpread2(_objectSpread2({
|
|
65866
67574
|
templateColumns: "repeat(".concat(columns, ", 1fr)"),
|
|
65867
67575
|
border: "1px solid",
|
|
@@ -65893,10 +67601,6 @@ function HelloPage(_ref) {
|
|
|
65893
67601
|
label: "Contact Us",
|
|
65894
67602
|
href: "/contact-us",
|
|
65895
67603
|
isExternal: false
|
|
65896
|
-
}, {
|
|
65897
|
-
label: "About Us",
|
|
65898
|
-
href: "/about",
|
|
65899
|
-
isExternal: false
|
|
65900
67604
|
}, {
|
|
65901
67605
|
label: "Changelog",
|
|
65902
67606
|
href: "/analytics/changelog",
|
|
@@ -65910,114 +67614,141 @@ function HelloPage(_ref) {
|
|
|
65910
67614
|
href: "https://www.youtube.com/watch?v=fuZLWeku6fw&list=PLwoJzeXHsBW6bAHmPz04RtWvpg_09-vqi",
|
|
65911
67615
|
isExternal: true
|
|
65912
67616
|
}];
|
|
65913
|
-
return jsxRuntime.jsx(Chakra.
|
|
67617
|
+
return jsxRuntime.jsx(Chakra.VStack, {
|
|
65914
67618
|
w: "full",
|
|
65915
|
-
h: "
|
|
65916
|
-
|
|
65917
|
-
|
|
65918
|
-
|
|
65919
|
-
children: jsxRuntime.
|
|
65920
|
-
|
|
65921
|
-
|
|
65922
|
-
|
|
65923
|
-
|
|
65924
|
-
|
|
65925
|
-
|
|
65926
|
-
|
|
65927
|
-
|
|
65928
|
-
|
|
65929
|
-
|
|
65930
|
-
|
|
65931
|
-
|
|
65932
|
-
|
|
65933
|
-
|
|
65934
|
-
|
|
65935
|
-
|
|
65936
|
-
|
|
65937
|
-
|
|
65938
|
-
|
|
65939
|
-
|
|
65940
|
-
|
|
65941
|
-
|
|
65942
|
-
|
|
65943
|
-
|
|
65944
|
-
|
|
65945
|
-
|
|
65946
|
-
|
|
65947
|
-
|
|
65948
|
-
|
|
65949
|
-
|
|
65950
|
-
|
|
65951
|
-
|
|
65952
|
-
|
|
65953
|
-
|
|
65954
|
-
|
|
65955
|
-
|
|
65956
|
-
|
|
65957
|
-
|
|
65958
|
-
children:
|
|
65959
|
-
|
|
65960
|
-
|
|
65961
|
-
|
|
65962
|
-
|
|
67619
|
+
h: "full",
|
|
67620
|
+
minH: 0,
|
|
67621
|
+
spacing: 0,
|
|
67622
|
+
flex: 1,
|
|
67623
|
+
children: jsxRuntime.jsx(Chakra.Box, {
|
|
67624
|
+
flex: 1,
|
|
67625
|
+
minH: 0,
|
|
67626
|
+
w: "full",
|
|
67627
|
+
overflowY: "auto",
|
|
67628
|
+
overflowX: "hidden",
|
|
67629
|
+
p: 4,
|
|
67630
|
+
css: {
|
|
67631
|
+
"&::-webkit-scrollbar": {
|
|
67632
|
+
width: "6px"
|
|
67633
|
+
},
|
|
67634
|
+
"&::-webkit-scrollbar-track": {
|
|
67635
|
+
background: "rgba(255, 255, 255, 0.1)",
|
|
67636
|
+
borderRadius: "3px"
|
|
67637
|
+
},
|
|
67638
|
+
"&::-webkit-scrollbar-thumb": {
|
|
67639
|
+
background: "rgba(255, 255, 255, 0.3)",
|
|
67640
|
+
borderRadius: "3px"
|
|
67641
|
+
},
|
|
67642
|
+
"&::-webkit-scrollbar-thumb:hover": {
|
|
67643
|
+
background: "rgba(255, 255, 255, 0.5)"
|
|
67644
|
+
},
|
|
67645
|
+
scrollBehavior: "smooth",
|
|
67646
|
+
WebkitOverflowScrolling: "touch"
|
|
67647
|
+
},
|
|
67648
|
+
children: jsxRuntime.jsxs(Chakra.VStack, {
|
|
67649
|
+
align: "stretch",
|
|
67650
|
+
justify: "flex-start",
|
|
67651
|
+
gap: 4,
|
|
67652
|
+
children: [jsxRuntime.jsxs(Chakra.Flex, {
|
|
67653
|
+
flexDirection: "column",
|
|
67654
|
+
justifyContent: "flex-end",
|
|
67655
|
+
flexShrink: 0,
|
|
67656
|
+
paddingTop: "48px",
|
|
67657
|
+
children: [jsxRuntime.jsx(Chakra.Text, {
|
|
67658
|
+
color: "#2BCFA1",
|
|
67659
|
+
fontSize: "3xl",
|
|
67660
|
+
fontWeight: "bold",
|
|
67661
|
+
lineHeight: "40px",
|
|
67662
|
+
children: "Hi ".concat(userName ? userName : "", " \uD83D\uDC4B\uD83C\uDFFB")
|
|
67663
|
+
}), jsxRuntime.jsx(Chakra.Text, {
|
|
67664
|
+
color: "white",
|
|
67665
|
+
fontSize: "3xl",
|
|
67666
|
+
fontWeight: "bold",
|
|
67667
|
+
lineHeight: "40px",
|
|
67668
|
+
children: "How can I help?"
|
|
67669
|
+
})]
|
|
67670
|
+
}), jsxRuntime.jsxs(RuledGrid, {
|
|
67671
|
+
columns: 1,
|
|
67672
|
+
borderRadius: 16,
|
|
67673
|
+
bg: "#222",
|
|
67674
|
+
overflow: "hidden",
|
|
67675
|
+
children: [jsxRuntime.jsxs(Chakra.VStack, {
|
|
65963
67676
|
align: "stretch",
|
|
65964
|
-
|
|
65965
|
-
|
|
65966
|
-
|
|
65967
|
-
|
|
65968
|
-
|
|
65969
|
-
|
|
65970
|
-
|
|
65971
|
-
|
|
65972
|
-
|
|
65973
|
-
|
|
65974
|
-
|
|
65975
|
-
|
|
67677
|
+
gap: 3,
|
|
67678
|
+
p: 4,
|
|
67679
|
+
children: [jsxRuntime.jsx(Chakra.Box, {
|
|
67680
|
+
p: 2.5,
|
|
67681
|
+
w: "fit-content",
|
|
67682
|
+
bg: "rgba(43, 207, 161, 0.1)",
|
|
67683
|
+
border: "1px solid",
|
|
67684
|
+
borderColor: "rgba(43, 207, 161, 0.1)",
|
|
67685
|
+
borderRadius: "lg",
|
|
67686
|
+
children: jsxRuntime.jsx(AIMd, {
|
|
67687
|
+
color: "#2BCFA1"
|
|
67688
|
+
})
|
|
67689
|
+
}), jsxRuntime.jsxs(Chakra.VStack, {
|
|
67690
|
+
gap: 0.5,
|
|
67691
|
+
align: "stretch",
|
|
67692
|
+
children: [jsxRuntime.jsx(Chakra.Text, {
|
|
67693
|
+
color: "white",
|
|
67694
|
+
fontSize: "base",
|
|
67695
|
+
fontWeight: "medium",
|
|
67696
|
+
lineHeight: "normal",
|
|
67697
|
+
children: "AI Merchant Assistant"
|
|
67698
|
+
}), jsxRuntime.jsx(Chakra.Text, {
|
|
67699
|
+
color: "#737373",
|
|
67700
|
+
fontSize: "sm",
|
|
67701
|
+
fontWeight: "normal",
|
|
67702
|
+
lineHeight: "tight",
|
|
67703
|
+
children: "I can help with your shop setup, payment and more"
|
|
67704
|
+
})]
|
|
65976
67705
|
})]
|
|
65977
|
-
})
|
|
65978
|
-
|
|
65979
|
-
|
|
65980
|
-
|
|
65981
|
-
|
|
65982
|
-
|
|
65983
|
-
|
|
65984
|
-
|
|
65985
|
-
},
|
|
65986
|
-
fontSize: 14,
|
|
65987
|
-
fontWeight: 500,
|
|
65988
|
-
color: "#2BCFA1",
|
|
65989
|
-
onClick: onStartChat,
|
|
65990
|
-
isLoading: isStartingChat,
|
|
65991
|
-
isDisabled: isStartingChat,
|
|
65992
|
-
_disabled: {
|
|
65993
|
-
color: "#525252",
|
|
65994
|
-
cursor: "not-allowed"
|
|
65995
|
-
},
|
|
65996
|
-
children: "Start Chat"
|
|
65997
|
-
})]
|
|
65998
|
-
}), jsxRuntime.jsx(RuledGrid, {
|
|
65999
|
-
columns: 1,
|
|
66000
|
-
borderRadius: 16,
|
|
66001
|
-
bg: "#222",
|
|
66002
|
-
children: navigationItems.map(function (item, index) {
|
|
66003
|
-
return jsxRuntime.jsxs(Chakra.Link, {
|
|
66004
|
-
display: "flex",
|
|
66005
|
-
justifyContent: "space-between",
|
|
66006
|
-
alignItems: "center",
|
|
66007
|
-
gap: 4,
|
|
66008
|
-
padding: "12px 16px",
|
|
67706
|
+
}), jsxRuntime.jsx(Chakra.Button, {
|
|
67707
|
+
w: "full",
|
|
67708
|
+
padding: "10px 14px",
|
|
67709
|
+
borderRadius: 0,
|
|
67710
|
+
variant: "ghost",
|
|
67711
|
+
_hover: {
|
|
67712
|
+
bg: "rgba(43, 207, 161, 0.1)"
|
|
67713
|
+
},
|
|
66009
67714
|
fontSize: 14,
|
|
66010
67715
|
fontWeight: 500,
|
|
66011
|
-
color: "
|
|
66012
|
-
|
|
66013
|
-
|
|
66014
|
-
|
|
66015
|
-
|
|
66016
|
-
color: "
|
|
66017
|
-
|
|
66018
|
-
|
|
66019
|
-
|
|
66020
|
-
|
|
67716
|
+
color: "#2BCFA1",
|
|
67717
|
+
onClick: onStartChat,
|
|
67718
|
+
isLoading: isStartingChat,
|
|
67719
|
+
isDisabled: isStartingChat,
|
|
67720
|
+
_disabled: {
|
|
67721
|
+
color: "#525252",
|
|
67722
|
+
cursor: "not-allowed"
|
|
67723
|
+
},
|
|
67724
|
+
children: "Start Chat"
|
|
67725
|
+
})]
|
|
67726
|
+
}), jsxRuntime.jsx(RuledGrid, {
|
|
67727
|
+
columns: 1,
|
|
67728
|
+
borderRadius: 16,
|
|
67729
|
+
bg: "#222",
|
|
67730
|
+
children: navigationItems.map(function (item, index) {
|
|
67731
|
+
return jsxRuntime.jsxs(Chakra.Link, {
|
|
67732
|
+
display: "flex",
|
|
67733
|
+
justifyContent: "space-between",
|
|
67734
|
+
alignItems: "center",
|
|
67735
|
+
gap: 4,
|
|
67736
|
+
padding: "12px 16px",
|
|
67737
|
+
fontSize: 14,
|
|
67738
|
+
fontWeight: 500,
|
|
67739
|
+
color: "white",
|
|
67740
|
+
textDecoration: "none",
|
|
67741
|
+
as: item.isExternal ? undefined : Link,
|
|
67742
|
+
to: item.isExternal ? undefined : item.href,
|
|
67743
|
+
href: item.isExternal ? item.href : undefined,
|
|
67744
|
+
isExternal: item.isExternal,
|
|
67745
|
+
children: [item.label, jsxRuntime.jsx(ExternalarrowMd, {
|
|
67746
|
+
color: "white"
|
|
67747
|
+
})]
|
|
67748
|
+
}, index);
|
|
67749
|
+
})
|
|
67750
|
+
})]
|
|
67751
|
+
})
|
|
66021
67752
|
})
|
|
66022
67753
|
});
|
|
66023
67754
|
}
|
|
@@ -66044,6 +67775,7 @@ function ChatDrawer(_ref) {
|
|
|
66044
67775
|
flexDirection: "column",
|
|
66045
67776
|
position: "relative",
|
|
66046
67777
|
overflow: "hidden",
|
|
67778
|
+
minH: 0,
|
|
66047
67779
|
maxW: {
|
|
66048
67780
|
base: "100%",
|
|
66049
67781
|
md: "420px"
|
|
@@ -66188,29 +67920,31 @@ var TooltipMd = function TooltipMd(_ref) {
|
|
|
66188
67920
|
};
|
|
66189
67921
|
|
|
66190
67922
|
var _excluded = ["showArrow", "children", "disabled", "portalled", "content", "portalRef", "placement"];
|
|
66191
|
-
var Tooltip = /*#__PURE__*/
|
|
67923
|
+
var Tooltip = /*#__PURE__*/React3__namespace.forwardRef(function Tooltip(_ref2, _ref) {
|
|
66192
67924
|
var showArrow = _ref2.showArrow,
|
|
66193
67925
|
children = _ref2.children,
|
|
66194
67926
|
disabled = _ref2.disabled;
|
|
66195
67927
|
_ref2.portalled;
|
|
66196
|
-
var content = _ref2.content
|
|
66197
|
-
|
|
66198
|
-
placement = _ref2.placement,
|
|
67928
|
+
var content = _ref2.content;
|
|
67929
|
+
_ref2.portalRef;
|
|
67930
|
+
var placement = _ref2.placement,
|
|
66199
67931
|
rest = _objectWithoutProperties(_ref2, _excluded);
|
|
66200
67932
|
if (disabled) return jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
66201
67933
|
children: children
|
|
66202
67934
|
});
|
|
66203
67935
|
return jsxRuntime.jsx(Chakra.Tooltip, _objectSpread2(_objectSpread2({
|
|
67936
|
+
border: "1px solid",
|
|
67937
|
+
borderColor: "#292929",
|
|
67938
|
+
borderRadius: "6px",
|
|
67939
|
+
padding: "4px 16px",
|
|
67940
|
+
backgroundColor: "#1c1c1c",
|
|
67941
|
+
color: "white",
|
|
67942
|
+
placement: placement !== null && placement !== void 0 ? placement : "auto",
|
|
66204
67943
|
label: content,
|
|
66205
67944
|
hasArrow: !!showArrow,
|
|
66206
|
-
|
|
66207
|
-
containerRef: portalRef
|
|
66208
|
-
},
|
|
66209
|
-
placement: placement
|
|
67945
|
+
shouldWrapChildren: true
|
|
66210
67946
|
}, rest), {}, {
|
|
66211
|
-
children:
|
|
66212
|
-
children: children
|
|
66213
|
-
})
|
|
67947
|
+
children: children
|
|
66214
67948
|
}));
|
|
66215
67949
|
});
|
|
66216
67950
|
|
|
@@ -66453,6 +68187,9 @@ function Chatbot(_ref) {
|
|
|
66453
68187
|
flex: 1,
|
|
66454
68188
|
overflow: "hidden",
|
|
66455
68189
|
p: 0,
|
|
68190
|
+
minH: 0,
|
|
68191
|
+
display: "flex",
|
|
68192
|
+
flexDirection: "column",
|
|
66456
68193
|
children: currentView === "hello" ? jsxRuntime.jsx(HelloPage, {
|
|
66457
68194
|
userName: user === null || user === void 0 ? void 0 : user.name,
|
|
66458
68195
|
onStartChat: handleStartChat,
|