@rxdrag/website-lib-react 0.0.4 → 0.0.7

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.
Files changed (99) hide show
  1. package/dist/ReactModalTrigger-9207e763.js +26 -0
  2. package/dist/ReactModalTrigger-9207e763.js.map +1 -0
  3. package/dist/components/ContactForm/ContactForm.d.ts +2 -1
  4. package/dist/components/Icon/index.d.ts +2 -1
  5. package/dist/components/RichTextOutline/parseOutline.d.ts +5 -0
  6. package/dist/components/all.d.ts +0 -21
  7. package/dist/components/index.d.ts +0 -5
  8. package/dist/forms.d.ts +1 -0
  9. package/dist/forms.mjs +1649 -0
  10. package/dist/forms.mjs.map +1 -0
  11. package/dist/index.mjs +9 -3918
  12. package/dist/index.mjs.map +1 -1
  13. package/dist/jsx-runtime-c02cc059.js +325 -0
  14. package/dist/jsx-runtime-c02cc059.js.map +1 -0
  15. package/dist/media.d.ts +1 -0
  16. package/dist/media.mjs +613 -0
  17. package/dist/media.mjs.map +1 -0
  18. package/dist/richtext.d.ts +1 -0
  19. package/dist/richtext.mjs +191 -0
  20. package/dist/richtext.mjs.map +1 -0
  21. package/dist/ui.d.ts +10 -0
  22. package/dist/ui.mjs +687 -0
  23. package/dist/ui.mjs.map +1 -0
  24. package/dist/video.d.ts +2 -0
  25. package/dist/video.mjs +426 -0
  26. package/dist/video.mjs.map +1 -0
  27. package/forms.ts +1 -0
  28. package/index.ts +1 -0
  29. package/media.ts +1 -0
  30. package/package.json +40 -5
  31. package/richtext.ts +1 -0
  32. package/src/components/Analytics/eventHandlers.ts +173 -0
  33. package/src/components/Analytics/index.tsx +21 -0
  34. package/src/components/Analytics/singleton.ts +214 -0
  35. package/src/components/Analytics/tracking.ts +221 -0
  36. package/src/components/Analytics/types.ts +60 -0
  37. package/src/components/Analytics/utils.ts +95 -0
  38. package/src/components/AttachmentIcon/index.tsx +53 -0
  39. package/src/components/BackgroundHlsVideoPlayer.tsx +97 -0
  40. package/src/components/BackgroundVideoPlayer.tsx +32 -0
  41. package/src/components/Bulletin.tsx +30 -0
  42. package/src/components/ContactForm/ContactForm.tsx +296 -0
  43. package/src/components/ContactForm/FileUpload2.tsx +423 -0
  44. package/src/components/ContactForm/Input.tsx +48 -0
  45. package/src/components/ContactForm/Input2.tsx +59 -0
  46. package/src/components/ContactForm/Submit.tsx +48 -0
  47. package/src/components/ContactForm/TelInput.tsx +215 -0
  48. package/src/components/ContactForm/TelInput2.tsx +213 -0
  49. package/src/components/ContactForm/Textarea.tsx +48 -0
  50. package/src/components/ContactForm/Textarea2.tsx +89 -0
  51. package/src/components/ContactForm/countryDialCodes.ts +243 -0
  52. package/src/components/ContactForm/factory.tsx +60 -0
  53. package/src/components/ContactForm/funcs.ts +64 -0
  54. package/src/components/ContactForm/hooks/useInlineLabelPadding.ts +43 -0
  55. package/src/components/ContactForm/hooks/useTelControl.ts +81 -0
  56. package/src/components/ContactForm/index.ts +7 -0
  57. package/src/components/ContactForm/types.ts +68 -0
  58. package/src/components/Icon/index.tsx +20 -0
  59. package/src/components/Medias/MainMedia.tsx +257 -0
  60. package/src/components/Medias/Thumbnail.tsx +62 -0
  61. package/src/components/Medias/VideoPlayer.tsx +114 -0
  62. package/src/components/Medias/index.tsx +271 -0
  63. package/src/components/ProductCard/ProductCard.tsx +24 -0
  64. package/src/components/ProductCard/ProductCta/index.tsx +28 -0
  65. package/src/components/ProductCard/ProductCta/style.css +4 -0
  66. package/src/components/ProductCard/ProductDescription/index.tsx +13 -0
  67. package/src/components/ProductCard/ProductDescription/style.css +6 -0
  68. package/src/components/ProductCard/ProductMedia/index.tsx +35 -0
  69. package/src/components/ProductCard/ProductMedia/style.css +6 -0
  70. package/src/components/ProductCard/ProductTitle/index.tsx +7 -0
  71. package/src/components/ProductCard/ProductTitle/style.css +4 -0
  72. package/src/components/ProductCard/ProductView.tsx +36 -0
  73. package/src/components/ProductCard/index.ts +5 -0
  74. package/src/components/ProductCard/useQueryProduct.ts +32 -0
  75. package/src/components/ReactModalTrigger.tsx +28 -0
  76. package/src/components/ReactVideoPlayer.tsx +332 -0
  77. package/src/components/RichTextOutline/index.tsx +74 -0
  78. package/src/components/RichTextOutline/parseOutline.ts +63 -0
  79. package/src/components/RichTextOutline/useAcitviedHeading.ts +142 -0
  80. package/src/components/RichTextOutline/useAnchorScroll.ts +24 -0
  81. package/src/components/Scroller.tsx +39 -0
  82. package/src/components/SearchInput.tsx +21 -0
  83. package/src/components/Share/index.tsx +86 -0
  84. package/src/components/Share/socials.tsx +80 -0
  85. package/src/components/Share//350/265/204/346/226/231.md +7 -0
  86. package/src/components/ToTop.tsx +72 -0
  87. package/src/components/VideoPlayIcon.tsx +43 -0
  88. package/src/components/all.ts +25 -0
  89. package/src/components/index.ts +12 -0
  90. package/src/forms.ts +1 -0
  91. package/src/index.ts +1 -0
  92. package/src/media.ts +1 -0
  93. package/src/richtext.ts +1 -0
  94. package/src/types/view-model.ts +37 -0
  95. package/src/ui.ts +10 -0
  96. package/src/video.ts +2 -0
  97. package/ui.ts +1 -0
  98. package/video.ts +1 -0
  99. package/dist/style.css +0 -17
package/dist/ui.mjs ADDED
@@ -0,0 +1,687 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
+ var __publicField = (obj, key, value) => {
4
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
+ return value;
6
+ };
7
+ import { useEffect, forwardRef, useState, useRef, useCallback } from "react";
8
+ import { j as jsxRuntimeExports } from "./jsx-runtime-c02cc059.js";
9
+ import { Icon as Icon$1 } from "@iconify/react";
10
+ import clsx from "clsx";
11
+ import { R } from "./ReactModalTrigger-9207e763.js";
12
+ function isDevelopmentEnvironment() {
13
+ return window.location.hostname === "localhost" || window.location.hostname.startsWith("192.168.") || window.location.hostname === "127.0.0.1";
14
+ }
15
+ function createDebugLogger() {
16
+ const isDev = isDevelopmentEnvironment();
17
+ return function debugLog(...args) {
18
+ if (isDev) {
19
+ console.log("[Analytics]", ...args);
20
+ }
21
+ };
22
+ }
23
+ function generateId(prefix = "v") {
24
+ return prefix + Date.now().toString(36) + Math.random().toString(36).substring(2, 8);
25
+ }
26
+ function setCookie(name, value, days) {
27
+ const expires = /* @__PURE__ */ new Date();
28
+ expires.setTime(expires.getTime() + days * 24 * 60 * 60 * 1e3);
29
+ document.cookie = `${name}=${value};expires=${expires.toUTCString()};path=/;SameSite=Lax`;
30
+ }
31
+ function getCookie(name) {
32
+ const match = document.cookie.match(
33
+ new RegExp("(^| )" + name + "=([^;]+)")
34
+ );
35
+ return match ? match[2] : null;
36
+ }
37
+ function getVisitorId() {
38
+ let visitorId = getCookie("visitor_id");
39
+ if (!visitorId) {
40
+ visitorId = generateId("v");
41
+ setCookie("visitor_id", visitorId, 365);
42
+ }
43
+ return visitorId;
44
+ }
45
+ function getDeviceInfo() {
46
+ const ua = navigator.userAgent;
47
+ if (/Mobile|Android|iPhone|iPad/.test(ua)) {
48
+ return /iPad/.test(ua) ? "tablet" : "mobile";
49
+ }
50
+ return "desktop";
51
+ }
52
+ function getPlatform() {
53
+ const ua = navigator.userAgent;
54
+ if (/Windows/.test(ua))
55
+ return "Windows";
56
+ if (/Mac/.test(ua))
57
+ return "macOS";
58
+ if (/Linux/.test(ua))
59
+ return "Linux";
60
+ if (/Android/.test(ua))
61
+ return "Android";
62
+ if (/iPhone|iPad/.test(ua))
63
+ return "iOS";
64
+ return "Unknown";
65
+ }
66
+ function getBrowserLanguage() {
67
+ return navigator.language || navigator.userLanguage || "en";
68
+ }
69
+ function detectPageType(defaultType = "pageView") {
70
+ const currentPath = window.location.pathname.toLowerCase();
71
+ if (currentPath.includes("/thanks") || currentPath.includes("/thank-you")) {
72
+ return "enquiry";
73
+ }
74
+ return defaultType;
75
+ }
76
+ function updateActiveTime(state) {
77
+ if (state.isPageVisible) {
78
+ const now = Date.now();
79
+ state.activeTime += now - state.lastActiveTime;
80
+ state.lastActiveTime = now;
81
+ }
82
+ }
83
+ function isRealPageVisit(state) {
84
+ const now = Date.now();
85
+ if (state.isPageTracked) {
86
+ return false;
87
+ }
88
+ if (state.lastTrackTime > 0 && now - state.lastTrackTime < 1e3) {
89
+ return false;
90
+ }
91
+ if (document.hidden || document.visibilityState === "hidden") {
92
+ return false;
93
+ }
94
+ return true;
95
+ }
96
+ function processQueue(state, apiEndpoint) {
97
+ state.isRequestPending = false;
98
+ if (state.requestQueue.length > 0) {
99
+ const { data, eventType } = state.requestQueue.shift();
100
+ setTimeout(() => {
101
+ sendImmediately(data, eventType, state, apiEndpoint);
102
+ }, 100);
103
+ }
104
+ }
105
+ function sendImmediately(data, eventType, state, apiEndpoint) {
106
+ state.isRequestPending = true;
107
+ fetch(apiEndpoint, {
108
+ method: "POST",
109
+ headers: {
110
+ "Content-Type": "application/json",
111
+ "X-Requested-With": "XMLHttpRequest"
112
+ },
113
+ body: JSON.stringify(data),
114
+ keepalive: true
115
+ }).then(() => {
116
+ if (eventType === "pageView") {
117
+ state.isPageTracked = true;
118
+ state.lastTrackTime = Date.now();
119
+ if (typeof window !== "undefined") {
120
+ window.__analyticsGlobalState = {
121
+ lastPageUrl: window.location.href,
122
+ lastTrackTime: Date.now()
123
+ };
124
+ }
125
+ }
126
+ processQueue(state, apiEndpoint);
127
+ }).catch(() => {
128
+ processQueue(state, apiEndpoint);
129
+ });
130
+ }
131
+ function sendTrackingData(data, eventType, state, apiEndpoint) {
132
+ if (eventType === "pageLeave") {
133
+ sendImmediately(data, eventType, state, apiEndpoint);
134
+ return;
135
+ }
136
+ if (state.isRequestPending) {
137
+ state.requestQueue.push({ data, eventType });
138
+ return;
139
+ }
140
+ sendImmediately(data, eventType, state, apiEndpoint);
141
+ }
142
+ function createTrackingData(pageData, state, eventType, effectiveDuration) {
143
+ return {
144
+ visitor_id: pageData.visitor_id,
145
+ session_id: pageData.session_id,
146
+ url: window.location.href,
147
+ path: window.location.pathname,
148
+ referrer: state.currentReferrer,
149
+ user_agent: pageData.user_agent,
150
+ duration_ms: effectiveDuration,
151
+ // 使用活跃时间
152
+ timestamp: Date.now(),
153
+ type: eventType,
154
+ // 添加事件类型
155
+ // 设备和平台信息
156
+ device: getDeviceInfo(),
157
+ platform: getPlatform(),
158
+ browser_language: getBrowserLanguage(),
159
+ // 页面信息
160
+ page_title: document.title || null,
161
+ // 屏幕信息
162
+ screen_width: screen.width,
163
+ screen_height: screen.height,
164
+ viewport_width: window.innerWidth,
165
+ viewport_height: window.innerHeight,
166
+ // 时区信息
167
+ timezone: Intl.DateTimeFormat().resolvedOptions().timeZone,
168
+ // 是否新用户(简单判断:第一次访问该域名)
169
+ is_new_user: !getCookie("visitor_id") || getCookie("visitor_id") === pageData.visitor_id
170
+ };
171
+ }
172
+ function trackPageEvent(eventType, pageData, state, apiEndpoint, debugLog) {
173
+ if (eventType === "pageView") {
174
+ eventType = detectPageType(eventType);
175
+ debugLog("Detected page type:", eventType);
176
+ if (!isRealPageVisit(state)) {
177
+ return;
178
+ }
179
+ }
180
+ let effectiveDuration = 0;
181
+ if (eventType === "pageLeave") {
182
+ updateActiveTime(state);
183
+ effectiveDuration = state.activeTime;
184
+ }
185
+ debugLog("Using referrer:", state.currentReferrer, "for event:", eventType);
186
+ const data = createTrackingData(pageData, state, eventType, effectiveDuration);
187
+ sendTrackingData(data, eventType, state, apiEndpoint);
188
+ }
189
+ const _AnalyticsSingleton = class _AnalyticsSingleton {
190
+ constructor(apiEndpoint) {
191
+ __publicField(this, "initialized", false);
192
+ __publicField(this, "state");
193
+ __publicField(this, "pageData");
194
+ __publicField(this, "apiEndpoint");
195
+ __publicField(this, "debugLog");
196
+ __publicField(this, "eventHandlers", []);
197
+ this.apiEndpoint = apiEndpoint;
198
+ this.debugLog = createDebugLogger();
199
+ const visitorId = getVisitorId();
200
+ let sessionId = sessionStorage.getItem("session_id");
201
+ if (!sessionId) {
202
+ sessionId = generateId("s");
203
+ sessionStorage.setItem("session_id", sessionId);
204
+ }
205
+ this.pageData = {
206
+ visitor_id: visitorId,
207
+ session_id: sessionId,
208
+ url: window.location.href,
209
+ path: window.location.pathname,
210
+ referrer: document.referrer || null,
211
+ user_agent: navigator.userAgent,
212
+ start_time: Date.now()
213
+ };
214
+ this.state = {
215
+ isPageTracked: false,
216
+ currentPageUrl: window.location.href,
217
+ pageLoadTime: Date.now(),
218
+ lastTrackTime: 0,
219
+ currentReferrer: document.referrer || null,
220
+ activeTime: 0,
221
+ lastActiveTime: Date.now(),
222
+ isPageVisible: !document.hidden,
223
+ requestQueue: [],
224
+ isRequestPending: false,
225
+ isAstroEnvironment: false,
226
+ pageLeaveTracked: false,
227
+ initialLoadHandled: false,
228
+ interactionThrottled: false,
229
+ lastInteractionTime: 0
230
+ };
231
+ }
232
+ static getInstance(apiEndpoint = "/api/track-visitor") {
233
+ if (!_AnalyticsSingleton.instance) {
234
+ _AnalyticsSingleton.instance = new _AnalyticsSingleton(apiEndpoint);
235
+ }
236
+ return _AnalyticsSingleton.instance;
237
+ }
238
+ static reset() {
239
+ if (_AnalyticsSingleton.instance) {
240
+ _AnalyticsSingleton.instance.cleanup();
241
+ _AnalyticsSingleton.instance = null;
242
+ }
243
+ }
244
+ init() {
245
+ if (this.initialized) {
246
+ return;
247
+ }
248
+ this.initialized = true;
249
+ this.setupEventListeners();
250
+ this.handleInitialPageLoad();
251
+ }
252
+ setupEventListeners() {
253
+ const handlePageLeave = () => {
254
+ if (this.state.pageLeaveTracked || this.state.lastTrackTime === 0) {
255
+ return;
256
+ }
257
+ this.state.pageLeaveTracked = true;
258
+ trackPageEvent("pageLeave", this.pageData, this.state, this.apiEndpoint, this.debugLog);
259
+ };
260
+ const handleBeforeUnload = () => handlePageLeave();
261
+ const handlePageHide = () => handlePageLeave();
262
+ window.addEventListener("beforeunload", handleBeforeUnload);
263
+ window.addEventListener("pagehide", handlePageHide);
264
+ const handleAstroBeforeSwap = () => {
265
+ handlePageLeave();
266
+ };
267
+ const handleAstroAfterSwap = () => {
268
+ this.state.isAstroEnvironment = true;
269
+ const newUrl = window.location.href;
270
+ if (newUrl !== this.state.currentPageUrl) {
271
+ this.state.currentReferrer = this.state.currentPageUrl;
272
+ this.state.currentPageUrl = newUrl;
273
+ this.pageData.url = newUrl;
274
+ this.pageData.path = window.location.pathname;
275
+ this.pageData.start_time = Date.now();
276
+ this.state.pageLoadTime = Date.now();
277
+ this.state.isPageTracked = false;
278
+ this.state.pageLeaveTracked = false;
279
+ this.state.activeTime = 0;
280
+ this.state.lastActiveTime = Date.now();
281
+ this.state.isPageVisible = !document.hidden;
282
+ this.trackPageVisit();
283
+ }
284
+ };
285
+ document.addEventListener("astro:before-swap", handleAstroBeforeSwap);
286
+ document.addEventListener("astro:after-swap", handleAstroAfterSwap);
287
+ const handleVisibilityChange = () => {
288
+ const now = Date.now();
289
+ if (document.visibilityState === "visible") {
290
+ this.state.isPageVisible = true;
291
+ this.state.lastActiveTime = now;
292
+ } else {
293
+ if (this.state.isPageVisible) {
294
+ this.state.activeTime += now - this.state.lastActiveTime;
295
+ }
296
+ this.state.isPageVisible = false;
297
+ }
298
+ };
299
+ document.addEventListener("visibilitychange", handleVisibilityChange);
300
+ const handleUserInteraction = () => {
301
+ if (!this.state.isPageVisible || this.state.interactionThrottled)
302
+ return;
303
+ const now = Date.now();
304
+ if (now - this.state.lastInteractionTime < 1e3)
305
+ return;
306
+ this.state.lastInteractionTime = now;
307
+ this.state.interactionThrottled = true;
308
+ if (now - this.state.lastActiveTime > 3e4) {
309
+ this.state.lastActiveTime = now;
310
+ }
311
+ setTimeout(() => {
312
+ this.state.interactionThrottled = false;
313
+ }, 1e3);
314
+ };
315
+ const interactionEvents = ["click", "keydown", "scroll"];
316
+ interactionEvents.forEach((event) => {
317
+ document.addEventListener(event, handleUserInteraction, {
318
+ passive: true,
319
+ capture: false
320
+ });
321
+ });
322
+ this.eventHandlers = [
323
+ () => window.removeEventListener("beforeunload", handleBeforeUnload),
324
+ () => window.removeEventListener("pagehide", handlePageHide),
325
+ () => document.removeEventListener("astro:before-swap", handleAstroBeforeSwap),
326
+ () => document.removeEventListener("astro:after-swap", handleAstroAfterSwap),
327
+ () => document.removeEventListener("visibilitychange", handleVisibilityChange),
328
+ ...interactionEvents.map(
329
+ (event) => () => document.removeEventListener(event, handleUserInteraction)
330
+ )
331
+ ];
332
+ }
333
+ handleInitialPageLoad() {
334
+ if (this.state.isPageTracked || this.state.initialLoadHandled) {
335
+ return;
336
+ }
337
+ this.state.initialLoadHandled = true;
338
+ this.trackPageVisit();
339
+ }
340
+ trackPageVisit() {
341
+ trackPageEvent("pageView", this.pageData, this.state, this.apiEndpoint, this.debugLog);
342
+ }
343
+ cleanup() {
344
+ this.eventHandlers.forEach((cleanup) => cleanup());
345
+ this.eventHandlers = [];
346
+ this.initialized = false;
347
+ }
348
+ };
349
+ __publicField(_AnalyticsSingleton, "instance", null);
350
+ let AnalyticsSingleton = _AnalyticsSingleton;
351
+ function Analytics({
352
+ apiEndpoint = "/api/track-visitor"
353
+ }) {
354
+ useEffect(() => {
355
+ const analytics = AnalyticsSingleton.getInstance(apiEndpoint);
356
+ analytics.init();
357
+ return () => {
358
+ };
359
+ }, [apiEndpoint]);
360
+ return null;
361
+ }
362
+ const AttachmentIcon = forwardRef(
363
+ (props, ref) => {
364
+ const { extName, ...rest } = props;
365
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref, ...rest, children: extName && extName === ".pdf" ? /* @__PURE__ */ jsxRuntimeExports.jsx(
366
+ "svg",
367
+ {
368
+ fill: "currentColor",
369
+ viewBox: "0 0 1024 1024",
370
+ version: "1.1",
371
+ xmlns: "http://www.w3.org/2000/svg",
372
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M905.185809 178.844158C898.576738 172.685485 891.19337 165.824412 883.21687 158.436127 860.422682 137.322863 837.434925 116.207791 815.697647 96.487895 813.243072 94.261877 813.243072 94.261877 810.786411 92.037081 781.783552 65.781062 757.590948 44.376502 739.713617 29.293612 729.254178 20.469111 721.020606 13.860686 714.970549 9.501727 710.955023 6.608611 707.690543 4.524745 704.47155 2.998714 700.417679 1.07689 696.638044-0.094029 691.307277 0.005928 677.045677 0.273349 665.6 11.769337 665.6 26.182727L665.6 77.352844 665.6 128.522961 665.6 230.863194 665.6 256.448252 691.2 256.448252 896 256.448252 870.4 230.863194 870.4 998.414942 896 972.829884 230.381436 972.829884C187.90385 972.829884 153.6 938.623723 153.6 896.20663L153.6 26.182727 128 51.767786 588.8 51.767786C602.93849 51.767786 614.4 40.312965 614.4 26.182727 614.4 12.05249 602.93849 0.597669 588.8 0.597669L128 0.597669 102.4 0.597669 102.4 26.182727 102.4 896.20663C102.4 966.91021 159.652833 1024 230.381436 1024L896 1024 921.6 1024 921.6 998.414942 921.6 230.863194 921.6 205.278135 896 205.278135 691.2 205.278135 716.8 230.863194 716.8 128.522961 716.8 77.352844 716.8 26.182727C716.8 39.813762 705.748075 50.91427 692.267725 51.167041 687.705707 51.252584 685.069822 50.435995 682.52845 49.231204 682.259458 49.103682 683.344977 49.796618 685.029451 51.010252 689.779394 54.432502 697.145822 60.34494 706.686383 68.394196 724.009052 83.009121 747.816448 104.072869 776.413589 129.961594 778.850014 132.168064 778.850014 132.168064 781.285216 134.376514 802.876774 153.964212 825.739479 174.96442 848.413564 195.966437 856.350957 203.3185 863.697005 210.144893 870.269888 216.269843 874.209847 219.941299 877.019309 222.565641 878.499674 223.951409 888.81866 233.610931 905.019017 233.081212 914.684179 222.768247 924.349344 212.455283 923.819315 196.264383 913.500326 186.604861 911.981323 185.182945 909.155025 182.542876 905.185809 178.844158ZM102.4 461.128719 0 461.128719 0 896.074709 512 896.074709 1024 896.074709 1024 461.128719 153.6 461.128719 153.6 460.531049 102.4 460.531049 102.4 461.128719ZM208.2 711 208.2 819.2 157.6 819.2 157.6 528 269 528C301.533495 528 327.366571 536.466581 346.5 553.4 365.633429 570.333419 375.2 592.733195 375.2 620.6 375.2 649.133476 365.833427 671.333254 347.1 687.2 328.366573 703.066746 302.133502 711 268.4 711L208.2 711ZM208.2 670.4 269 670.4C287.00009 670.4 300.733286 666.166709 310.2 657.7 319.666714 649.233291 324.4 637.000079 324.4 621 324.4 605.266588 319.600047 592.700047 310 583.3 300.399951 573.899953 287.200083 569.066669 270.4 568.8L208.2 568.8 208.2 670.4ZM419.4 819.2 419.4 528 505.4 528C531.133461 528 553.966566 533.733276 573.9 545.2 593.833434 556.666724 609.266611 572.933229 620.2 594 631.133389 615.066771 636.6 639.199863 636.6 666.4L636.6 681C636.6 708.600139 631.100055 732.866562 620.1 753.8 609.099945 774.733438 593.433436 790.866609 573.1 802.2 552.766564 813.533391 529.466799 819.2 503.2 819.2L419.4 819.2ZM470 568.8 470 778.8 503 778.8C529.533466 778.8 549.89993 770.500083 564.1 753.9 578.30007 737.299917 585.533331 713.466822 585.8 682.4L585.8 666.2C585.8 634.599842 578.933402 610.46675 565.2 593.8 551.466598 577.13325 531.533463 568.8 505.4 568.8L470 568.8ZM854.8 695.8 737.6 695.8 737.6 819.2 687 819.2 687 528 872 528 872 568.8 737.6 568.8 737.6 655.4 854.8 655.4 854.8 695.8Z" })
373
+ }
374
+ ) : extName && (extName === ".xls" || extName === ".xlsx") ? /* @__PURE__ */ jsxRuntimeExports.jsxs(
375
+ "svg",
376
+ {
377
+ fill: "currentColor",
378
+ viewBox: "0 0 1024 1024",
379
+ version: "1.1",
380
+ xmlns: "http://www.w3.org/2000/svg",
381
+ children: [
382
+ /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M810.18 949.8H213.821c-20.551 0-37.271-16.649-37.271-37.1V111.3c0-20.45 16.72-37.1 37.271-37.1h395.27v143.74c0 52.25 46.97 94.77 104.71 94.77h133.65V912.7c0 20.451-16.72 37.1-37.27 37.1zM678.9 118.68l130.85 130.85H713.8c-19.25 0-34.9-14.169-34.9-31.59v-99.26z m168.551 55.41l-99.89-99.89L673.36 0H213.82C152.16 0 102 49.93 102 111.3v801.4c0 61.371 50.16 111.3 111.821 111.3h596.36C871.84 1024 922 974.071 922 912.7V248.64l-74.55-74.55z" }),
383
+ /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M810.18 949.8H213.821c-20.551 0-37.271-16.649-37.271-37.1V111.3c0-20.45 16.72-37.1 37.271-37.1h395.27v143.74c0 52.25 46.97 94.77 104.71 94.77h133.65V912.7c0 20.451-16.72 37.1-37.27 37.1zM678.9 118.68l130.85 130.85H713.8c-19.25 0-34.9-14.169-34.9-31.59v-99.26z m168.551 55.41l-99.89-99.89L673.36 0H213.82C152.16 0 102 49.93 102 111.3v801.4c0 61.371 50.16 111.3 111.821 111.3h596.36C871.84 1024 922 974.071 922 912.7V248.64l-74.55-74.55z" }),
384
+ /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M559.714 579.272L668.11 404.855a0.2 0.2 0 0 0-0.17-0.305h-89.12a0.2 0.2 0 0 0-0.174 0.102l-67.604 120.3-70.265-120.303a0.2 0.2 0 0 0-0.173-0.1h-85.779a0.2 0.2 0 0 0-0.168 0.308L461.02 571.401 347.653 746.24a0.2 0.2 0 0 0 0.168 0.309h88.007a0.2 0.2 0 0 0 0.17-0.095l74.362-120.51 75.153 120.51a0.2 0.2 0 0 0 0.17 0.095h89.835a0.2 0.2 0 0 0 0.164-0.314L559.714 579.272z" })
385
+ ]
386
+ }
387
+ ) : extName && (extName === ".doc" || extName === ".docx") ? /* @__PURE__ */ jsxRuntimeExports.jsx(
388
+ "svg",
389
+ {
390
+ fill: "currentColor",
391
+ viewBox: "0 0 1024 1024",
392
+ version: "1.1",
393
+ xmlns: "http://www.w3.org/2000/svg",
394
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M854.6 288.6L639.4 73.4c-6-6-14.1-9.4-22.6-9.4H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V311.3c0-8.5-3.4-16.7-9.4-22.7zM790.2 326H602V137.8L790.2 326z m1.8 562H232V136h302v216c0 23.2 18.8 42 42 42h216v494zM528.1 472h-32.2c-5.5 0-10.3 3.7-11.6 9.1L434.6 680l-46.1-198.7c-1.3-5.4-6.1-9.3-11.7-9.3h-35.4c-1.1 0-2.1 0.1-3.1 0.4-6.4 1.7-10.2 8.3-8.5 14.7l74.2 276c1.4 5.2 6.2 8.9 11.6 8.9h32c5.4 0 10.2-3.6 11.6-8.9l52.8-197 52.8 197c1.4 5.2 6.2 8.9 11.6 8.9h31.8c5.4 0 10.2-3.6 11.6-8.9l74.4-276c0.3-1 0.4-2.1 0.4-3.1 0-6.6-5.4-12-12-12H647c-5.6 0-10.4 3.9-11.7 9.3l-45.8 199.1-49.8-199.3c-1.3-5.4-6.1-9.1-11.6-9.1z" })
395
+ }
396
+ ) : /* @__PURE__ */ jsxRuntimeExports.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
397
+ "path",
398
+ {
399
+ fill: "currentColor",
400
+ d: "M14 11a3 3 0 0 1-3-3V4H7a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2h9a2 2 0 0 0 2-2v-8zm-2-3a2 2 0 0 0 2 2h3.59L12 4.41zM7 3h5l7 7v9a3 3 0 0 1-3 3H7a3 3 0 0 1-3-3V6a3 3 0 0 1 3-3"
401
+ }
402
+ ) }) });
403
+ }
404
+ );
405
+ const Icon = forwardRef((props, ref) => {
406
+ const { icon, ...rest } = props;
407
+ if (!icon) {
408
+ return null;
409
+ }
410
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(Icon$1, { ref, ...rest, icon });
411
+ });
412
+ const iconList = {
413
+ linkedin: {
414
+ title: "LinkedIn",
415
+ path: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M6.5 21.5h-5v-13h5v13zM4 6.5C2.5 6.5 1.5 5.3 1.5 4s1-2.4 2.5-2.4c1.6 0 2.5 1 2.6 2.5 0 1.4-1 2.5-2.6 2.5zm11.5 6c-1 0-2 1-2 2v7h-5v-13h5V10s1.6-1.5 4-1.5c3 0 5 2.2 5 6.3v6.7h-5v-7c0-1-1-2-2-2z" }),
416
+ color: "#0073b1",
417
+ url: (l, t, ti) => `https://www.linkedin.com/sharing/share-offsite/?url=${encodeURIComponent(l)}&title=${encodeURIComponent(ti || "")}&summary=${encodeURIComponent(t || "")}`
418
+ },
419
+ facebook: {
420
+ title: "Facebook",
421
+ path: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M24 12a12 12 0 10-13.9 11.9v-8.4h-3V12h3V9.4c0-3 1.8-4.7 4.6-4.7l2.6.2v3h-1.5c-1.5 0-2 .9-2 1.8V12h3.4l-.5 3.5h-2.8v8.4A12 12 0 0024 12z" }),
422
+ color: "#0076FB",
423
+ url: (l) => `https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(l)}`
424
+ },
425
+ twitter: {
426
+ title: "X",
427
+ path: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z" }),
428
+ color: "#0F1419",
429
+ url: (l, t) => `https://twitter.com/intent/tweet?text=${t}&url=${encodeURIComponent(l)}`
430
+ },
431
+ whatsapp: {
432
+ title: "WhatsApp",
433
+ path: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M17.5 14.4l-2-1c-.3 0-.5-.1-.7.2l-1 1.1c-.1.2-.3.3-.6.1s-1.3-.5-2.4-1.5a9 9 0 01-1.7-2c-.1-.3 0-.5.2-.6l.4-.6c.2-.1.2-.3.3-.5v-.5L9 7c-.2-.6-.4-.5-.6-.5h-.6c-.2 0-.5 0-.8.4-.2.3-1 1-1 2.5s1 2.8 1.2 3c.2.2 2.1 3.2 5.1 4.5l1.7.6a4 4 0 001.9.2c.5-.1 1.7-.8 2-1.5.2-.6.2-1.2.1-1.4l-.5-.3M12 21.8a9.9 9.9 0 01-5-1.4l-.4-.2-3.7 1 1-3.7-.2-.3a9.9 9.9 0 01-1.5-5.3 9.9 9.9 0 0116.8-7 9.8 9.8 0 013 7 9.9 9.9 0 01-10 9.9m8.4-18.3A11.8 11.8 0 0012.1 0 12 12 0 001.8 17.8L0 24l6.4-1.6a11.9 11.9 0 005.6 1.4 12 12 0 0012-11.9 11.8 11.8 0 00-3.5-8.4z" }),
434
+ color: "#25D366",
435
+ url: (l, t) => `https://api.whatsapp.com/send?text=${encodeURIComponent(t || "")} ${encodeURIComponent(l)}`
436
+ },
437
+ reddit: {
438
+ title: "Reddit",
439
+ path: /* @__PURE__ */ jsxRuntimeExports.jsx("path", { d: "M12 0A12 12 0 000 12a12 12 0 0012 12 12 12 0 0012-12A12 12 0 0012 0zm5.01 4.74c.69 0 1.25.56 1.25 1.25a1.25 1.25 0 01-2.5.06l-2.6-.55-.8 3.75c1.83.07 3.48.63 4.68 1.49.3-.31.73-.5 1.2-.5.97 0 1.76.8 1.76 1.76 0 .72-.43 1.33-1.01 1.61a3.11 3.11 0 01.04.52c0 2.7-3.13 4.87-7 4.87-3.88 0-7-2.17-7-4.87 0-.18 0-.36.04-.53A1.75 1.75 0 014.03 12a1.75 1.75 0 012.96-1.26 8.52 8.52 0 014.74-1.5l.89-4.17a.34.34 0 01.14-.2.35.35 0 01.24-.04l2.9.62a1.21 1.21 0 011.11-.7zM9.25 12a1.25 1.25 0 101.25 1.25c0-.69-.56-1.25-1.25-1.25zm5.5 0a1.25 1.25 0 000 2.5 1.25 1.25 0 000-2.5zm-5.47 3.99a.33.33 0 00-.23.1.33.33 0 000 .46c.84.84 2.49.91 2.96.91.48 0 2.1-.06 2.96-.91a.36.36 0 00.03-.47.33.33 0 00-.46 0c-.55.54-1.68.73-2.51.73-.83 0-1.98-.2-2.51-.73a.33.33 0 00-.24-.1z" }),
440
+ color: "#FF4500",
441
+ url: (l, t) => `https://www.reddit.com/submit?url=${encodeURIComponent(l)}&title=${encodeURIComponent(t || "")}`
442
+ }
443
+ // telegram: {
444
+ // title: "Telegram",
445
+ // path: (
446
+ // <path d="M23.91 3.79L20.3 20.84c-.25 1.21-.98 1.5-2 .94l-5.5-4.07-2.66 2.57c-.3.3-.55.56-1.1.56-.72 0-.6-.27-.84-.95L6.3 13.7.85 12c-1.18-.35-1.19-1.16.26-1.75l21.26-8.2c.97-.43 1.9.24 1.53 1.73z" />
447
+ // ),
448
+ // color: "#0088CC",
449
+ // url: (l, t) => `https://telegram.me/share/msg?url=${encodeURIComponent(l)}&text=${encodeURIComponent(t || "")}`,
450
+ // },
451
+ // pinterest: {
452
+ // title: "Pinterest",
453
+ // path: (
454
+ // <path d="M0 12C0 17.123 3.211 21.497 7.73 23.218C7.62 22.281 7.503 20.736 7.755 19.652C7.972 18.72 9.156 13.714 9.156 13.714C9.156 13.714 8.799 12.999 8.799 11.94C8.799 10.28 9.761 9.04 10.96 9.04C11.98 9.04 12.472 9.805 12.472 10.722C12.472 11.747 11.819 13.279 11.482 14.7C11.201 15.889 12.079 16.859 13.251 16.859C15.374 16.859 17.007 14.62 17.007 11.388C17.007 8.527 14.951 6.528 12.016 6.528C8.618 6.528 6.623 9.077 6.623 11.712C6.623 12.739 7.018 13.839 7.512 14.438C7.55412 14.4832 7.58387 14.5386 7.59841 14.5986C7.61295 14.6587 7.61177 14.7215 7.595 14.781C7.504 15.159 7.302 15.97 7.263 16.136C7.21 16.354 7.09 16.401 6.863 16.295C5.371 15.601 4.439 13.42 4.439 11.668C4.439 7.899 7.176 4.439 12.331 4.439C16.475 4.439 19.696 7.392 19.696 11.338C19.696 15.455 17.101 18.769 13.497 18.769C12.286 18.769 11.149 18.139 10.759 17.396C10.759 17.396 10.16 19.678 10.015 20.236C9.733 21.32 8.951 22.692 8.466 23.471C9.584 23.815 10.77 24 12 24C18.627 24 24 18.627 24 12C24 5.373 18.627 0 12 0C5.373 0 0 5.373 0 12Z" />
455
+ // ),
456
+ // color: "#c8232c",
457
+ // url: (l) => `http://pinterest.com/pin/create/link/?url=${encodeURIComponent(l)}`,
458
+ // },
459
+ // email: {
460
+ // title: "Email",
461
+ // path: (
462
+ // <path d="M20 4H4a2 2 0 00-2 2v12c0 1.1.9 2 2 2h16a2 2 0 002-2V6a2 2 0 00-2-2zm0 4l-8 5-8-5V6l8 5 8-5v2z" />
463
+ // ),
464
+ // color: "#E53E3E",
465
+ // url: (l, t) => `mailto:?body=${encodeURIComponent(l)}&subject=${encodeURIComponent(t || "")}`,
466
+ // },
467
+ };
468
+ function getPageDetails() {
469
+ var _a;
470
+ if (typeof window === "undefined") {
471
+ return null;
472
+ }
473
+ const details = {
474
+ url: (_a = window == null ? void 0 : window.location) == null ? void 0 : _a.href,
475
+ title: (document == null ? void 0 : document.title) || "null",
476
+ description: "null"
477
+ // 默认为空字符串
478
+ };
479
+ const descriptionMetaTag = document.querySelector('meta[name="description"]');
480
+ if (descriptionMetaTag) {
481
+ details.description = descriptionMetaTag.content;
482
+ }
483
+ return details;
484
+ }
485
+ const Share = forwardRef(
486
+ (props, ref) => {
487
+ const { className, classNames, ...rest } = props;
488
+ const [socialList, setSolicalList] = useState();
489
+ const details = getPageDetails();
490
+ useEffect(() => {
491
+ setSolicalList(iconList);
492
+ }, [props.socials]);
493
+ const generateLink = (key) => {
494
+ const social = iconList[key];
495
+ if (!social)
496
+ return "#";
497
+ return social.url(
498
+ (details == null ? void 0 : details.url) || "",
499
+ details == null ? void 0 : details.title,
500
+ details == null ? void 0 : details.description
501
+ );
502
+ };
503
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref, className: clsx("flex items-center", className), ...rest, children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex space-x-3", children: Object.keys(socialList || {}).map((key) => /* @__PURE__ */ jsxRuntimeExports.jsx(
504
+ "a",
505
+ {
506
+ href: generateLink(key),
507
+ target: "_blank",
508
+ rel: "noopener noreferrer",
509
+ title: `Share on ${iconList[key].title}`,
510
+ className: clsx(
511
+ "flex h-6 w-6 items-center justify-center ",
512
+ classNames == null ? void 0 : classNames.item
513
+ ),
514
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(
515
+ "svg",
516
+ {
517
+ className: clsx("w-5 h-5", classNames == null ? void 0 : classNames.itemIcon),
518
+ fill: "currentColor",
519
+ viewBox: "0 0 24 24",
520
+ focusable: "false",
521
+ "aria-hidden": "true",
522
+ children: iconList[key].path
523
+ }
524
+ )
525
+ },
526
+ key
527
+ )) }) });
528
+ }
529
+ );
530
+ const defaultThreshold = 10;
531
+ function Scroller(props) {
532
+ const { threshold = defaultThreshold } = props;
533
+ const ref = useRef(null);
534
+ const [win, setWin] = useState(null);
535
+ useEffect(() => {
536
+ if (ref.current) {
537
+ setWin(ref.current.ownerDocument.defaultView);
538
+ }
539
+ }, []);
540
+ const onScroll = useCallback(() => {
541
+ if (!win)
542
+ return;
543
+ const scrolled = win.scrollY > threshold;
544
+ const doc = win.document;
545
+ if (scrolled) {
546
+ doc.body.classList.add("scrolled");
547
+ } else {
548
+ doc.body.classList.remove("scrolled");
549
+ }
550
+ }, [threshold, win]);
551
+ useEffect(() => {
552
+ if (!win)
553
+ return;
554
+ win.addEventListener("scroll", onScroll);
555
+ return () => win.removeEventListener("scroll", onScroll);
556
+ }, [onScroll, win]);
557
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref, style: { display: "none" } });
558
+ }
559
+ const SearchInput = forwardRef(
560
+ (props, ref) => {
561
+ const { children, ...rest } = props;
562
+ const [keyword, setKeyword] = useState();
563
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
564
+ "input",
565
+ {
566
+ ref,
567
+ name: "q",
568
+ value: keyword,
569
+ onChange: (e) => setKeyword(e.target.value),
570
+ ...rest
571
+ }
572
+ );
573
+ }
574
+ );
575
+ const topIcon = () => /* @__PURE__ */ jsxRuntimeExports.jsx(
576
+ "svg",
577
+ {
578
+ className: "h-6 w-6",
579
+ width: "1.5rem",
580
+ height: "1.5rem",
581
+ fill: "none",
582
+ viewBox: "0 0 24 24",
583
+ stroke: "currentColor",
584
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(
585
+ "path",
586
+ {
587
+ strokeLinecap: "round",
588
+ strokeLinejoin: "round",
589
+ strokeWidth: 2,
590
+ d: "M5 15l7-7 7 7"
591
+ }
592
+ )
593
+ }
594
+ );
595
+ const ToTop = forwardRef((props, ref) => {
596
+ const { className, svg, ...rest } = props;
597
+ const [win, setWin] = useState(null);
598
+ const innerRef = useRef(null);
599
+ useEffect(() => {
600
+ if (!innerRef.current)
601
+ return;
602
+ const currentWin = innerRef.current.ownerDocument.defaultView;
603
+ setWin(currentWin);
604
+ if (ref && typeof ref === "object") {
605
+ ref.current = innerRef.current;
606
+ }
607
+ }, [ref]);
608
+ const handleClick = () => {
609
+ if (win) {
610
+ win.scrollTo({ top: 0, behavior: "smooth" });
611
+ } else if (typeof window !== "undefined") {
612
+ window.scrollTo({ top: 0, behavior: "smooth" });
613
+ }
614
+ };
615
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
616
+ "div",
617
+ {
618
+ ref: innerRef,
619
+ className: clsx(
620
+ "fixed bottom-4 right-4 hidden user-select-none shadow-lg scrolled:flex cursor-pointer transition duration-300 ease-in-out z-50",
621
+ className
622
+ ),
623
+ ...rest,
624
+ onClick: handleClick,
625
+ children: svg ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "contents", dangerouslySetInnerHTML: { __html: svg } }) : topIcon()
626
+ }
627
+ );
628
+ });
629
+ function BackgroundVideoPlayer(props) {
630
+ const { poster, src, className, ...restProps } = props;
631
+ const videoRef = useRef(null);
632
+ useEffect(() => {
633
+ if (videoRef.current) {
634
+ const video = videoRef.current;
635
+ video.play().catch((error) => {
636
+ console.log("自动播放失败:", error);
637
+ });
638
+ }
639
+ }, []);
640
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
641
+ "video",
642
+ {
643
+ ref: videoRef,
644
+ autoPlay: true,
645
+ loop: true,
646
+ muted: true,
647
+ playsInline: true,
648
+ poster,
649
+ className,
650
+ preload: "metadata",
651
+ src,
652
+ ...restProps
653
+ }
654
+ );
655
+ }
656
+ function Bulletin(props) {
657
+ const { className, ...rest } = props;
658
+ const [bulletin, setBulletin] = useState(null);
659
+ useEffect(() => {
660
+ fetch("/api/get-bulletin").then((res) => res.json()).then((res) => {
661
+ if (res.success) {
662
+ setBulletin(res.data);
663
+ }
664
+ }).catch((err) => {
665
+ console.error("Failed to fetch bulletin", err);
666
+ });
667
+ }, []);
668
+ console.log("====>bulletin", bulletin);
669
+ if (!bulletin)
670
+ return null;
671
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className, ...rest, children: bulletin.content });
672
+ }
673
+ export {
674
+ Analytics,
675
+ AttachmentIcon,
676
+ BackgroundVideoPlayer,
677
+ Bulletin,
678
+ Icon,
679
+ R as ReactModalTrigger,
680
+ Scroller,
681
+ SearchInput,
682
+ Share,
683
+ ToTop,
684
+ defaultThreshold,
685
+ topIcon
686
+ };
687
+ //# sourceMappingURL=ui.mjs.map