PageSourceSearch

https://htmlto.link/_next/static/chunks/4546-fe2bf08d5b248d26.js

js htmlto.link collected 2026-09-24 12:30:32 UTC 13,718 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4546],{44546:(e,t,r)=>{r.d(t,{default:()=>j});var s=r(95155),a=r(9803),l=r(67033),n=r(92571),i=r(98500),d=r.n(i),o=r(73321),c=r(12115),u=r(38434),x=r(86985),m=r(23181),f=r(78615);function b({className:e}){return(0,s.jsx)("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",className:e,children:(0,s.jsx)("path",{d:"M12 0C5.37 0 0 5.37 0 12c0 5.3 3.438 9.8 8.205 11.387.6.113.82-.26.82-.577 0-.285-.01-1.04-.016-2.04-3.338.726-4.042-1.61-4.042-1.61-.546-1.387-1.333-1.757-1.333-1.757-1.09-.745.083-.73.083-.73 1.205.085 1.84 1.238 1.84 1.238 1.07 1.835 2.807 1.305 3.492.998.108-.775.418-1.305.76-1.605-2.665-.303-5.466-1.332-5.466-5.93 0-1.31.468-2.382 1.236-3.22-.124-.303-.536-1.523.117-3.176 0 0 1.008-.322 3.3 1.23a11.5 11.5 0 0 1 3.003-.404c1.02.005 2.047.138 3.003.404 2.29-1.552 3.297-1.23 3.297-1.23.655 1.653.243 2.873.12 3.176.77.838 1.235 1.91 1.235 3.22 0 4.61-2.807 5.624-5.48 5.92.43.37.814 1.102.814 2.222 0 1.606-.015 2.902-.015 3.297 0 .32.216.694.825.576C20.565 21.796 24 17.297 24 12 24 5.37 18.627 0 12 0z"})})}let p=["美食","历史","自然","亲子","购物","综合"];function h(){try{localStorage.removeItem(f.ut)}catch{}}function g(e,t){if(!e||!/^\d+$/.test(e.trim()))return t;let r=Number(e.trim());return!Number.isSafeInteger(r)||r<1||r>7?t:r}function y(e,t){if(!e||!/^\d+$/.test(e.trim()))return t;let r=Number(e.trim());return!Number.isSafeInteger(r)||r<1||r>10?t:r}function v(e,t){let r=(e||"").trim();return p.includes(r)?r:t}function j({variant:e="default",campaignBadge:t=!1,submitMode:r="api"}){let i="festive"===e,w="string"==typeof t&&t.trim()?t.trim():t?"限时活动":"",N=(0,o.useRouter)(),S=(0,o.useSearchParams)(),[I,k]=(0,c.useState)(""),[A,C]=(0,c.useState)(""),[T,$]=(0,c.useState)(3),[_,E]=(0,c.useState)(2),[z,P]=(0,c.useState)("综合"),[R,L]=(0,c.useState)(!1),[O,J]=(0,c.useState)(null),[U,D]=(0,c.useState)(!1),[G,M]=(0,c.useState)(!1),[F,B]=(0,c.useState)(!1),[q,V]=(0,c.useState)(!1),H=(0,c.useRef)(!1),{isLoggedIn:K,checkAuth:Q}=(0,m.n)();(0,c.useEffect)(()=>{Q().finally(()=>B(!0))},[Q]),(0,c.useEffect)(()=>{let e=function(){try{let e=localStorage.getItem(f.ut);if(!e)return null;let t=JSON.parse(e);if(!t||"string"!=typeof t.publicId||!t.publicId||"string"!=typeof t.viewToken||!t.viewToken||"string"!=typeof t.status||"number"!=typeof t.createdAt)return null;return{publicId:t.publicId,viewToken:t.viewToken,status:t.status,createdAt:t.createdAt}}catch{return null}}();e&&(0,f.GE)(e.status)?J(e):e&&h(),D(!0)},[]),(0,c.useEffect)(()=>{if("api"!==r)return void M(!0);let e=(S.get("origin")||"").trim().slice(0,64),t=(S.get("destination")||"").trim().slice(0,64),s=g(S.get("days"),3),a=y(S.get("partySize"),2),l=v(S.get("preference"),"综合");e&&k(e),t&&C(t),$(s),E(a),P(l),M(!0)},[S,r]);let W=(0,c.useMemo)(()=>{if(!O)return null;let e=new URLSearchParams({publicId:O.publicId,viewToken:O.viewToken});return`/travel/status?${e.toString()}`},[O]),X=(0,c.useCallback)(()=>{h(),J(null)},[]),Y=!!(O&&(0,f.GE)(O.status)),Z=R||Y,ee=(0,c.useCallback)(()=>{(0,u.Ay)("请先登录后再生成行程"),V(!0)},[]),et=(0,c.useCallback)(async e=>{let t=e.destination.trim();if(!t)return u.Ay.error("请填写目的地"),!1;L(!0);try{let r=await fetch("/api/public/travel-itinerary",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({origin:e.origin.trim(),destination:t,days:e.days,partySize:e.partySize,preference:e.preference})}),s=await r.json().catch(()=>null);if(!r.ok||!s?.publicId||!s?.viewToken){if(s?.code==="JOB_IN_PROGRESS")return u.Ay.error("上一单还在生成,请稍后再试"),"string"==typeof s.publicId&&s.publicId&&O?.publicId===s.publicId&&W||"string"==typeof s.publicId&&s.publicId&&(0,u.Ay)("可打开进度页查看上一单",{icon:"\uD83E\uDDED"}),!1;let e=s?.code==="RATE_LIMITED"?"本小时提交次数过多,请稍后再试":s?.code==="INVALID_INPUT"?"请检查目的地、天数或偏好是否合法":"提交失败,请稍后再试";return u.Ay.error(e),!1}let a={publicId:s.publicId,viewToken:s.viewToken,status:s.status||"pending",createdAt:Date.now()};try{localStorage.setItem(f.ut,JSON.stringify(a))}catch{}J(a);try{sessionStorage.setItem(`travel-view-token:${s.publicId}`,s.viewToken)}catch{}u.Ay.success("已排队,正在跳转进度页…");let l=new URLSearchParams({publicId:s.publicId,viewToken:s.viewToken});return N.push(`/travel/status?${l.toString()}`),!0}catch{return u.Ay.error("网络异常,请检查后重试"),!1}finally{L(!1)}},[O?.publicId,N,W]),er=(0,c.useCallback)(()=>{let e=new URL(window.location.href);if(!e.searchParams.has("autostart"))return;e.searchParams.delete("autostart");let t=`${e.pathname}${e.search}${e.hash}`;N.replace(t)},[N]);(0,c.useEffect)(()=>
1{if("api"!==r||!G||!U||!F||H.current||"1"!==S.get("autostart"))return;let e=(S.get("destination")||"").trim();if(!e){H.current=!0,er();return}if(!K){H.current=!0,er(),ee();return}if(Y){H.current=!0,er(),u.Ay.error("上一单还在生成,请稍后再试");return}H.current=!0,er();let t=(S.get("origin")||"").trim().slice(0,64),s=g(S.get("days"),T),a=y(S.get("partySize"),_),l=v(S.get("preference"),z);et({origin:t,destination:e.slice(0,64),days:s,partySize:a,preference:l})},[U,F,Y,er,et,T,_,z,G,K,ee,S,r]);let es=async e=>{if(e.preventDefault(),Z)return;if(!K)return void ee();let t=A.trim();if(!t)return void u.Ay.error("请填写目的地");if("redirect"===r){let e=new URLSearchParams,r=I.trim();r&&e.set("origin",r),e.set("destination",t),e.set("days",String(T)),e.set("partySize",String(_)),e.set("preference",z),e.set("autostart","1"),N.push(`/travel?${e.toString()}`);return}await et({origin:I,destination:t,days:T,partySize:_,preference:z})},ea=i?"w-full rounded-xl border-2 border-[#c81e1e]/25 bg-cream/40 py-2.5 pl-9 pr-3 text-sm font-medium text-text outline-none focus:border-[#c81e1e] focus:ring-2 focus:ring-[#f59e0b]/30 disabled:opacity-60":"w-full rounded-xl border-2 border-border bg-cream/40 py-2.5 pl-9 pr-3 text-sm font-medium text-text outline-none focus:border-primary disabled:opacity-60",el=i?"w-full rounded-xl border-2 border-[#c81e1e]/25 bg-cream/40 px-3 py-2.5 text-sm font-medium text-text outline-none focus:border-[#c81e1e] focus:ring-2 focus:ring-[#f59e0b]/30 disabled:opacity-60":"w-full rounded-xl border-2 border-border bg-cream/40 px-3 py-2.5 text-sm font-medium text-text outline-none focus:border-primary disabled:opacity-60",en=i?"border-[#c81e1e] bg-[#c81e1e]/10 text-[#c81e1e]":"border-primary bg-primary/10 text-primary",ei=i?"border-border bg-cream/40 text-text-muted hover:border-[#f59e0b]/60":"border-border bg-cream/40 text-text-muted hover:border-primary/40";return(0,s.jsxs)("section",{className:"mx-auto w-full max-w-3xl px-3 pb-6 sm:px-4","aria-labelledby":"travel-submit-heading",children:[(0,s.jsxs)("div",{className:`relative overflow-hidden ${i?"rounded-[1.75rem] border-3 border-[#c81e1e]/35 bg-gradient-to-br from-white via-[#fff8f5] to-[#fffbeb] p-5 shadow-clay-sm sm:p-6 md:p-7":"rounded-[1.75rem] border-3 border-border bg-white p-5 shadow-clay-sm sm:p-6 md:p-7"}`,children:[w?(0,s.jsx)("div",{className:"pointer-events-none absolute right-0 top-0 z-10","aria-label":w,children:(0,s.jsx)("span",{className:"inline-block rounded-bl-xl bg-[#dc2626] px-3 py-1.5 text-[11px] font-bold tracking-wide text-white shadow-sm sm:px-3.5 sm:text-xs",children:w})}):null,(0,s.jsxs)("div",{className:"text-left",children:[(0,s.jsxs)("p",{className:i?"inline-flex items-center gap-2 rounded-full border border-[#f59e0b]/50 bg-[#fef3c7]/80 px-3 py-1 text-xs font-bold tracking-wide text-[#c81e1e]":"inline-flex items-center gap-2 text-xs font-bold uppercase tracking-[0.16em] text-primary",children:[(0,s.jsx)(a.A,{className:"h-3.5 w-3.5","aria-hidden":"true"}),"行程助手"]}),(0,s.jsx)("h1",{id:"travel-submit-heading",className:"mt-2 text-xl font-bold text-text sm:text-2xl",children:"AI 行程一键生成"}),(0,s.jsx)("p",{className:"mt-2 max-w-2xl text-sm font-medium text-text-muted",children:i?"AI 行程规划:填写目的地即可开始;出发地可选(本地游可不填)。约 3–10 分钟生成可分享行程页。":"填写目的地即可开始;出发地可选(本地游可不填)。完整生成预计约 3–10 分钟。"})]}),Y&&W?(0,s.jsxs)("div",{className:"mt-4 flex flex-col gap-2 rounded-2xl border border-amber-200 bg-amber-50/80 px-4 py-3 text-left sm:flex-row sm:items-center sm:justify-between",children:[(0,s.jsx)("p",{className:"text-sm font-medium text-amber-900",children:"上一单生成中,请稍后再提交新行程。"}),(0,s.jsxs)("div",{className:"flex flex-wrap gap-2",children:[(0,s.jsx)(d(),{href:W,className:"inline-flex items-center justify-center rounded-xl border-2 border-amber-300 bg-white px-3 py-1.5 text-xs font-bold text-amber-900 hover:bg-amber-50",children:"查看进度"}),(0,s.jsx)("button",{type:"button",onClick:X,className:i?"inline-flex items-center justify-center rounded-xl border-2 border-border bg-cream/40 px-3 py-1.5 text-xs font-bold text-text-muted hover:border-[#c81e1e]/40":"inline-flex items-center justify-center rounded-xl border-2 border-border bg-cream/40 px-3 py-1.5 text-xs font-bold text-text-muted hover:border-primary/40",children:"忽略提示"})]})]}):null,(0,s.jsxs)("form",{onSubmit:es,className:"mt-5 grid gap-3 sm:grid-cols-2",children:[(0,s.jsxs)("label",{className:"flex flex-col gap-1.5 text-left",children:[(0,s.jsx)("span",{className:"text-xs font-bold text-text-muted",children:"出发地(可选)"}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)(l.A,{className:`pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 ${i?"text-[#c81e1e]/70":"text-text-muted"}`,"aria-hidden":"true"}),(0,s.jsx)("input",{value:I,onChange:e=>
1k(e.target.value),maxLength:64,disabled:Z,placeholder:"例如:上海(可留空)",className:ea})]})]}),(0,s.jsxs)("label",{className:"flex flex-col gap-1.5 text-left",children:[(0,s.jsx)("span",{className:"text-xs font-bold text-text-muted",children:"目的地"}),(0,s.jsxs)("div",{className:"relative",children:[(0,s.jsx)(l.A,{className:`pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 ${i?"text-[#c81e1e]/70":"text-text-muted"}`,"aria-hidden":"true"}),(0,s.jsx)("input",{value:A,onChange:e=>C(e.target.value),maxLength:64,required:!0,disabled:Z,placeholder:"例如:杭州",className:ea})]})]}),(0,s.jsxs)("label",{className:"flex flex-col gap-1.5 text-left",children:[(0,s.jsx)("span",{className:"text-xs font-bold text-text-muted",children:"天数"}),(0,s.jsx)("select",{value:T,onChange:e=>$(Number(e.target.value)),disabled:Z,className:el,children:[1,2,3,4,5,6,7].map(e=>(0,s.jsxs)("option",{value:e,children:[e," 天"]},e))})]}),(0,s.jsxs)("label",{className:"flex flex-col gap-1.5 text-left",children:[(0,s.jsx)("span",{className:"text-xs font-bold text-text-muted",children:"人数"}),(0,s.jsx)("select",{value:_,onChange:e=>E(Number(e.target.value)),disabled:Z,className:el,children:Array.from({length:10},(e,t)=>t+1).map(e=>(0,s.jsxs)("option",{value:e,children:[e," 人"]},e))})]}),(0,s.jsxs)("label",{className:"flex flex-col gap-1.5 text-left sm:col-span-2",children:[(0,s.jsx)("span",{className:"text-xs font-bold text-text-muted",children:"偏好"}),(0,s.jsx)("div",{className:"flex flex-wrap gap-2",children:p.map(e=>(0,s.jsx)("button",{type:"button",disabled:Z,onClick:()=>P(e),className:`rounded-full border-2 px-3 py-1.5 text-xs font-bold transition disabled:opacity-60 ${z===e?en:ei}`,children:e},e))})]}),(0,s.jsx)("div",{className:"flex items-end sm:col-span-2",children:(0,s.jsx)("button",{type:"submit",disabled:Z,className:i?"inline-flex min-h-11 w-full items-center justify-center gap-2 rounded-xl border-2 border-[#9f1239] bg-[#dc2626] px-4 text-sm font-bold text-white shadow-[0_4px_0_0_#9f1239] transition hover:bg-[#c81e1e] disabled:opacity-60":"btn-primary inline-flex min-h-11 w-full items-center justify-center gap-2 rounded-xl px-4 text-sm font-bold disabled:opacity-60",children:R?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(n.A,{className:"h-4 w-4 animate-spin","aria-hidden":"true"}),"提交中…"]}):Y?"上一单生成中":K?"redirect"===r?"生成行程":"生成行程页":"登录后生成"})})]}),(0,s.jsxs)("div",{className:"mt-4 flex flex-col gap-3 sm:flex-row sm:items-end sm:justify-between",children:[(0,s.jsx)("p",{className:"text-center text-xs font-medium text-text-muted sm:text-left",children:i?(0,s.jsxs)(s.Fragment,{children:["约 3–10 分钟生成可分享行程"," \xb7 ",(0,s.jsx)(d(),{href:"/travel",className:"font-bold text-[#c81e1e] underline-offset-2 hover:underline",children:"查看全部已生成"})]}):(0,s.jsxs)(s.Fragment,{children:["约 3–10 分钟生成可分享行程"," \xb7 ",(0,s.jsx)(d(),{href:"/travel",className:"font-bold text-primary underline-offset-2 hover:underline",children:"查看全部已生成"})]})}),(0,s.jsxs)("a",{href:"https://github.com/mater1996/travel-planning",target:"_blank",rel:"noopener noreferrer",className:`inline-flex items-center justify-center gap-1.5 self-end rounded-full border px-2.5 py-1 text-[11px] font-medium transition sm:self-auto ${i?"border-[#c81e1e]/25 bg-white/80 text-text-muted hover:border-[#c81e1e] hover:text-[#c81e1e]":"border-border bg-cream/40 text-text-muted hover:border-primary/40 hover:text-primary"}`,title:"Skill 来源:mater1996/travel-planning",children:[(0,s.jsx)(b,{className:"h-3.5 w-3.5"}),(0,s.jsx)("span",{children:"Skill 来源"})]})]})]}),(0,s.jsx)(x.A,{isOpen:q,onClose:()=>V(!1),locale:"zh",defaultMode:"login"})]})}},78615:(e,t,r)=>{function s(e){return"pending"===e||"running"===e}r.d(t,{GE:()=>s,ut:()=>a});let a="htmlto.travel.activeJob"}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.