Files
chinese-family-tree-2/.next/static/chunks/b26e4de20959e343.js
T
freedakgmail 3b0d8255f6 0.0.8.1
2025-11-23 19:38:51 +08:00

1 line
4.9 KiB
JavaScript

(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,12039,e=>{"use strict";var t=e.i(36792),s=e.i(56422),r=e.i(69744);let a=(0,s.cva)("relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current",{variants:{variant:{default:"bg-card text-card-foreground",destructive:"text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90"}},defaultVariants:{variant:"default"}});function i({className:e,variant:s,...i}){return(0,t.jsx)("div",{"data-slot":"alert",role:"alert",className:(0,r.cn)(a({variant:s}),e),...i})}function n({className:e,...s}){return(0,t.jsx)("div",{"data-slot":"alert-title",className:(0,r.cn)("col-start-2 line-clamp-1 min-h-4 font-medium tracking-tight",e),...s})}function l({className:e,...s}){return(0,t.jsx)("div",{"data-slot":"alert-description",className:(0,r.cn)("text-muted-foreground col-start-2 grid justify-items-start gap-1 text-sm [&_p]:leading-relaxed",e),...s})}e.s(["Alert",()=>i,"AlertDescription",()=>l,"AlertTitle",()=>n])},6315,e=>{"use strict";let t=(0,e.i(27706).default)("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);e.s(["default",()=>t])},41610,e=>{"use strict";var t=e.i(6315);e.s(["X",()=>t.default])},42864,e=>{"use strict";let t=(0,e.i(27706).default)("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);e.s(["Download",()=>t],42864)},85367,e=>{"use strict";var t=e.i(36792),s=e.i(34346),r=e.i(9991),a=e.i(10743),i=e.i(42864),n=e.i(41610);let l=(0,e.i(27706).default)("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);var o=e.i(12039);function d(){let[e,d]=(0,s.useState)(null),[c,u]=(0,s.useState)(!1),[m,v]=(0,s.useState)(!1),[p,h]=(0,s.useState)(!1);(0,s.useEffect)(()=>{{let e=window.matchMedia("(display-mode: standalone)").matches,t=!0===window.navigator.standalone;if(e||t)return void v(!0)}let e=e=>{e.preventDefault(),d(e),u(!0),setTimeout(()=>{localStorage.getItem("pwa-install-prompt-seen")||h(!0)},3e4)},t=()=>{v(!0),h(!1),u(!1)};return window.addEventListener("beforeinstallprompt",e),window.addEventListener("appinstalled",t),()=>{window.removeEventListener("beforeinstallprompt",e),window.removeEventListener("appinstalled",t)}},[]);let g=async()=>{if(!e)return;e.prompt();let{outcome:t}=await e.userChoice;"accepted"===t?console.log("用户接受了安装"):console.log("用户拒绝了安装"),d(null),h(!1),localStorage.setItem("pwa-install-prompt-seen","true")};return m||!c?null:(0,t.jsxs)(t.Fragment,{children:[p&&(0,t.jsx)("div",{className:"fixed bottom-4 right-4 z-50 max-w-sm animate-in slide-in-from-bottom-5",children:(0,t.jsxs)(a.Card,{className:"shadow-lg border-2 border-primary",children:[(0,t.jsxs)(a.CardHeader,{className:"pb-3",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(l,{className:"h-5 w-5 text-primary"}),(0,t.jsx)(a.CardTitle,{className:"text-base",children:"安装应用"})]}),(0,t.jsx)(r.Button,{variant:"ghost",size:"icon",className:"h-6 w-6",onClick:()=>{h(!1),localStorage.setItem("pwa-install-prompt-seen","true")},children:(0,t.jsx)(n.X,{className:"h-4 w-4"})})]}),(0,t.jsx)(a.CardDescription,{className:"text-xs",children:"将家谱应用添加到主屏幕,随时随地访问"})]}),(0,t.jsx)(a.CardContent,{className:"pt-0",children:(0,t.jsxs)(r.Button,{onClick:g,className:"w-full",size:"sm",children:[(0,t.jsx)(i.Download,{className:"mr-2 h-4 w-4"}),"立即安装"]})})]})}),!p&&(0,t.jsxs)(o.Alert,{className:"cursor-pointer hover:bg-muted/50 transition-colors",onClick:g,children:[(0,t.jsx)(i.Download,{className:"h-4 w-4"}),(0,t.jsxs)(o.AlertDescription,{className:"flex items-center justify-between",children:[(0,t.jsx)("span",{children:"将应用安装到设备"}),(0,t.jsx)(r.Button,{size:"sm",variant:"outline",children:"安装"})]})]})]})}function c({children:e}){return(0,s.useEffect)(()=>{!function(){if(!("serviceWorker"in navigator))return console.log("Service Worker 不被支持");let e=()=>{navigator.serviceWorker.register("/sw.js").then(e=>{e.addEventListener("updatefound",()=>{let t=e.installing;t&&t.addEventListener("statechange",()=>{"installed"===t.state&&navigator.serviceWorker.controller})})}).catch(e=>{console.error("Service Worker 注册失败:",e)})};"complete"===document.readyState?e():window.addEventListener("load",e)}()},[]),(0,t.jsxs)(t.Fragment,{children:[e,(0,t.jsx)(d,{})]})}e.s(["PWAProvider",()=>c],85367)},21483,e=>{"use strict";var t=e.i(36792),s=e.i(87830);function r({children:e}){return(0,t.jsx)(s.SessionProvider,{children:e})}e.s(["SessionProvider",()=>r])}]);