1import{d as he,Y as me,r as _,W as Z,x as V,e as u,g as e,j as f,A as se,t as n,E as y,k as h,$ as Q,F as B,D as F,n as i,f as d,y as ke,z as Se,v as $,a1 as De,a5 as Ue,U as Te,o as $e,ak as Ve,B as fe,R as pe,ab as ge,l as _e,c as Ce}from"./8EhAlHkq.js";import{S as Ne}from"./D4R_d620.js";import{b as Me,a as Ee,p as Re,r as Be}from"./D1rlm_zp.js";import"./BisfpjbF.js";/* empty css */const Fe={class:"w-full rounded-2xl border border-sky-200 bg-white p-4 shadow-[0_16px_40px_rgba(15,23,42,0.06)] md:p-5"},ze={class:"flex flex-col gap-2 lg:flex-row lg:items-start lg:justify-between"},Ge={class:"flex items-center gap-2"},He={class:"flex h-8 w-8 items-center justify-center rounded-lg bg-sky-100 text-sky-700"},Oe={class:"flex flex-wrap gap-2 text-xs"},je={class:"rounded-md border border-slate-200 bg-slate-50 px-2 py-1"},Ie={class:"rounded-md border border-slate-200 bg-slate-50 px-2 py-1"},Ke={class:"mt-4 grid grid-cols-1 gap-3 md:grid-cols-3 xl:grid-cols-[minmax(240px,1fr)_110px_110px] xl:items-end"},Le={class:"flex flex-col text-xs font-semibold text-slate-700"},qe=["label"],Ze=["value"],Je={class:"flex flex-col text-xs font-semibold text-slate-700"},Ye=["value"],We={class:"flex flex-col text-xs font-semibold text-slate-700"},Pe=["value"],Qe={class:"mt-4 grid grid-cols-1 gap-4 xl:grid-cols-2"},Xe={class:"mb-3 flex flex-col gap-2 sm:flex-row sm:items-start sm:justify-between"},et={class:"text-sm text-slate-800"},tt={class:"mt-0.5 text-[11px] text-slate-500"},at=["onClick"],rt={key:1,class:"mb-3 rounded-lg border border-blue-100 bg-blue-50 px-3 py-2 text-xs text-blue-800"},st=["disabled","onClick"],lt=["onClick"],ot=["onSubmit"],nt={class:"grid grid-cols-2 gap-2"},it={class:"col-span-2 flex flex-col text-[11px] font-semibold text-slate-700 sm:col-span-1"},dt=["onUpdate:modelValue"],ut={class:"col-span-2 flex flex-col text-[11px] font-semibold text-slate-700 sm:col-span-1"},pt=["onUpdate:modelValue"],mt={class:"flex flex-col text-[11px] font-semibold text-slate-700"},ct=["onUpdate:modelValue"],bt={class:"flex flex-col text-[11px] font-semibold text-slate-700"},xt=["onUpdate:modelValue"],vt={class:"flex flex-col text-[11px] font-semibold text-slate-700"},yt=["onUpdate:modelValue"],ft={class:"flex flex-col text-[11px] font-semibold text-slate-700"},gt=["onUpdate:modelValue"],_t={class:"flex flex-col text-[11px] font-semibold text-slate-700"},ht=["onUpdate:modelValue"],kt={class:"flex flex-col text-[11px] font-semibold text-slate-700"},wt=["onUpdate:modelValue"],At={class:"flex flex-col text-[11px] font-semibold text-slate-700"},St=["onUpdate:modelValue"],Dt={class:"flex flex-col text-[11px] font-semibold text-slate-700"},Ut=["onUpdate:modelValue"],Tt={class:"col-span-2 flex flex-col text-[11px] font-semibold text-slate-700"},$t=["onUpdate:modelValue"],Vt={key:0,class:"mb-0 mt-2 text-xs font-semibold text-rose-700"},Ct={key:3,class:"mb-3 rounded-lg border border-rose-200 bg-rose-50 px-3 py-2 text-xs text-rose-700"},Nt={key:4,class:"mb-3 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-xs text-amber-800"},Mt={key:5,class:"space-y-2"},Et={class:"flex items-start justify-between gap-3"},Rt={class:"flex min-w-0 items-center gap-2"},Bt=["src","alt"],Ft={class:"min-w-0"},zt={class:"truncate text-sm font-semibold text-slate-800"},Gt={class:"text-xs text-slate-500"},Ht={class:"shrink-0 text-right"},Ot={class:"text-sm font-bold text-emerald-700"},jt={class:"text-[10px] text-slate-400"},It={class:"mt-2 flex items-center justify-between gap-2"},Kt=["disabled","onClick"],Lt={key:0,class:"mt-5 border-t border-slate-200 pt-4"},qt={class:"space-y-2"},Zt={class:"text-xs text-slate-700"},Jt={class:"font-semibold"},Yt={class:"text-slate-500"},Wt={key:0,class:"mt-1 text-[10px] font-semibold text-amber-700"},Pt=["value","onInput"],Qt={class:"flex gap-2 lg:justify-end"},Xt=["href"],ea=["onClick"],ta={key:0,class:"mb-0 mt-2 text-xs text-emerald-700"},aa=he({__name:"TourFlightOptions",props:{modelValue:{},startDate:{},endDate:{},entryAirport:{},exitAirport:{}},emits:["update:modelValue"],setup(ce,{emit:J}){var ve;const p=ce,N=J,le=(ve=me())==null?void 0:ve.value,C=[{label:"Türkiye",airports:[{value:"ESB",label:"Ankara (ESB)"},{value:"IST",label:"İstanbul (IST)"},{value:"SAW",label:"İstanbul Sabiha Gökçen (SAW)"},{value:"ADB",label:"İzmir (ADB)"},{value:"AYT",label:"Antalya (AYT)"},{value:"COV",label:"Ãukurova / Adana (COV)"},{value:"GZT",label:"Gaziantep (GZT)"},{value:"KYA",label:"Konya (KYA)"},{value:"ASR",label:"Kayseri (ASR)"},{value:"TZX",label:"Trabzon (TZX)"},{value:"DIY",label:"Diyarbakır (DIY)"},{value:"ERZ",label:"Erzurum (ERZ)"}]},{label:"Almanya",airports:[{value:"FRA,MUC,BER,DUS,CGN,HAM,STR,HAJ,NUE",label:"Tüm büyük Almanya havalimanları"},{value:"FRA",label:"Frankfurt (FRA)"},{value:"MUC",label:"Münih (MUC)"},{value:"BER",label:"Berlin (BER)"},{value:"DUS",label:"Düsseldorf (DUS)"}
1,{value:"CGN",label:"Köln/Bonn (CGN)"},{value:"HAM",label:"Hamburg (HAM)"},{value:"STR",label:"Stuttgart (STR)"},{value:"HAJ",label:"Hannover (HAJ)"},{value:"NUE",label:"Nürnberg (NUE)"}]}],z=Array.from({length:24},(a,t)=>t),b=_("ESB"),w=_(6),S=_(18),k=_(null),j=Z({outbound:!1,return:!1}),A=Z({outbound:"",return:""}),D=_([]),G=_([]),g=_(""),M=Z({outbound:"",return:""}),U=Z({outbound:!1,return:!1}),T=Z({outbound:"",return:""}),E=()=>({airline:"",flightNumber:"",departureAirport:"",arrivalAirport:"",departureDate:"",departureTime:"",arrivalDate:"",arrivalTime:"",price:"",currency:"TRY",note:""}),m=Z({outbound:E(),return:E()}),R=V(()=>[{direction:"outbound",label:`${K.value} â ${Y(p.entryAirport)}`,date:p.startDate,actionLabel:`${K.value} çıkıÅlı gidiÅ uçuÅlarını ara`,flights:D.value,googleUrl:L("outbound")},{direction:"return",label:`${Y(p.exitAirport)} â ${K.value}`,date:p.endDate,actionLabel:`${Y(p.exitAirport)} çıkıÅlı dönüŠuçuÅlarını ara`,flights:G.value,googleUrl:L("return")}]),I=V(()=>C.flatMap(a=>a.airports).find(a=>a.value===b.value)),K=V(()=>{var a;return b.value.includes(",")?"Almanya":((a=I.value)==null?void 0:a.label.replace(/\s*\([A-Z]{3}\)$/,""))||b.value}),Y=a=>({JED:"Cidde",MED:"Medine"})[a]||a,X=a=>!!(b.value&&(a==="return"?p.endDate&&p.exitAirport:p.startDate&&p.entryAirport)&&w.value<=S.value),L=a=>{const t=a==="return";return Ee({origin:t?p.exitAirport:b.value,destination:t?b.value:p.entryAirport,date:String(t?p.endDate||"":p.startDate||""),departureHourFrom:w.value,departureHourTo:S.value})},q=a=>{const t=m[a],c=a==="return",r=String(c?p.endDate||"":p.startDate||""),s=b.value.includes(",")?"":b.value;t.departureAirport||(t.departureAirport=c?p.exitAirport:s),t.arrivalAirport||(t.arrivalAirport=c?s:p.entryAirport),t.departureDate||(t.departureDate=r),t.arrivalDate||(t.arrivalDate=r)},oe=a=>{U[a]=!U[a],T[a]="",U[a]&&q(a)},ee=a=>{const t=L(a);if(!t)return;const c=Math.min(1280,Math.max(760,window.screen.availWidth-120)),r=Math.min(900,Math.max(640,window.screen.availHeight-120)),s=Math.max(0,Math.round((window.screen.availWidth-c)/2)),P=Math.max(0,Math.round((window.screen.availHeight-r)/2)),re=window.open(t,`google-flights-${a}`,`popup=yes,width=${c},height=${r},left=${s},top=${P},resizable=yes,scrollbars=yes`);U[a]=!0,q(a),re?(re.focus(),M[a]="Google UçuÅlar yeni pencerede açıldı. Seçiminizi aÅaÄıdaki forma girerek kaydedebilirsiniz."):M[a]="Tarayıcı açılır pencereyi engelledi. Bu site için popup izni verip tekrar deneyin."},ne=a=>{const t=a.trim().replace(/\s/g,"").replace(/\.(?=\d{3}(?:\D|$))/g,"").replace(",",".");if(!t)return null;const c=Number(t);return Number.isFinite(c)&&c>=0?c:Number.NaN},o=a=>{const t=m[a];T[a]="";const c=t.departureAirport.toUpperCase(),r=t.arrivalAirport.toUpperCase(),s=t.flightNumber.toUpperCase(),P=`${t.departureDate} ${t.departureTime}`,re=`${t.arrivalDate} ${t.arrivalTime}`,de=Date.parse(`${t.departureDate}T${t.departureTime}:00`),ue=Date.parse(`${t.arrivalDate}T${t.arrivalTime}:00`),ye=ne(t.price);if(!/^[A-Z]{3}$/.test(c)||!/^[A-Z]{3}$/.test(r)){T[a]="KalkıŠve varıŠiçin üç harfli havalimanı kodu girin.";return}if(!s||Number.isNaN(de)||Number.isNaN(ue)){T[a]="UçuÅ numarası, tarih ve saat alanlarını doldurun.";return}if(ue<=de){T[a]="VarıŠzamanı kalkıŠzamanından sonra olmalıdır.";return}if(Number.isNaN(ye)){T[a]="Fiyatı yalnızca sayı olarak girin.";return}const Ae={id:["manual",a,s,P,c,r,Date.now()].join("|"),direction:a,airline:t.airline||s.replace(/\s*\d.*$/,"")||"Havayolu",flightNumber:s,departureAirport:c,arrivalAirport:r,departureAt:P,arrivalAt:re,durationMinutes:Math.round((ue-de)/6e4),price:ye,currency:t.currency,sourceUrl:L(a),checkedAt:new Date().toISOString(),extensions:["Google UçuÅlar üzerinden manuel eklendi"],note:t.note};N("update:modelValue",[...p.modelValue,Ae]),m[a]=E(),q(a),U[a]=!1,M[a]="Seçilen uçuÅ kaydedilen alternatiflere eklendi."},l=async a=>{const t=a==="return";return await $fetch("/api/admin/flight-options/search",{method:"POST",credentials:"same-origin",headers:le,body:{origin:t?p.exitAirport:b.value,destination:t?b.value:p.entryAirport,date:t?p.endDate:p.startDate,direction:a,departureHourFrom:w.value,departureHourTo:S.value}})},v=async a=>{var t;if(!(!X(a)||k.value!==null)){k.value=a,j[a]=!0,A[a]="",a==="return"?G.value=[]:D.value=[];try{const c=await l(a);a==="return"?G.value=c.flights||[]:D.value=c.flights||[]}catch(c){A[a]=((t=c==null?void 0:c.data)==null?void 0:t.statusMessage)||(c==null?void 0:c.statusMessage)||"UçuÅlar aranamadı."}finally{k.value=null}}},x=a=>{W(a)||N("update:modelValue",[...p.modelValue,{...a,note:""}])},H=a=>N("update:modelValue",p.modelValue.filter(t=>t.id!==a)),O=(a,t)=>N("update:modelValue",p.modelValue.map(c=>c.id===a?{...c,note:t}:c)),W=a=>p.modelValue.some(t=>t.id===a.id),te=a=>a.departureAt.slice(0,10)!==(a.direction==="return"?p.endDate:p.startDate),ie=async()=>{const a=p.modelValue.map(Me).join(` 2 3`);try{await navigator.clipboard.writeText(a),g.value="UçuÅ seçenekleri panoya kopyalandı."}catch{g.value="Kopyalama baÅarısız oldu; tarayıcı pano iznini kontrol edin."}},ae=a=>`${String(a).padStart(2,"0")}:00`,be=a=>{var t;return((t=String(a||"").match(/\d{1,2}:\d{2}/))==null?void 0:t[0])||"-"},we=a=>`${Math.floor(Number(a||0)/60)} sa ${Number(a||0)%60} dk`,xe=a=>
3a.price===null?"Fiyat yok":`${a.price.toLocaleString("tr-TR")} ${a.currency}`;return(a,t)=>{const c=ke("font-awesome-icon");return d(),u("section",Fe,[e("div",ze,[e("div",null,[e("div",Ge,[e("span",He,[se(c,{icon:"fa-solid fa-plane",class:"h-4 w-4"})]),t[3]||(t[3]=e("div",null,[e("h3",{class:"mb-0 text-base font-bold text-slate-800"},"Bireysel Katılım UçuÅları"),e("p",{class:"mb-0 text-xs text-slate-500"},"Türkiye veya Almanya'dan tura doÄrudan katılabilecek yolcular için.")],-1))])]),e("div",Oe,[e("span",je,"GidiÅ: "+n(a.startDate||"-")+" â "+n(a.entryAirport),1),e("span",Ie,"DönüÅ: "+n(a.endDate||"-")+" â "+n(a.exitAirport),1)])]),e("div",Ke,[e("label",Le,[t[4]||(t[4]=y(" KalkıŠhavalimanı ")),h(e("select",{"onUpdate:modelValue":t[0]||(t[0]=r=>b.value=r),class:"mt-1 rounded-lg border border-slate-300 p-2 text-sm font-normal text-slate-700"},[(d(),u(B,null,F(C,r=>e("optgroup",{key:r.label,label:r.label},[(d(!0),u(B,null,F(r.airports,s=>(d(),u("option",{key:s.value,value:s.value},n(s.label),9,Ze))),128))],8,qe)),64))],512),[[Q,b.value]])]),e("label",Je,[t[5]||(t[5]=y(" En erken ")),h(e("select",{"onUpdate:modelValue":t[1]||(t[1]=r=>w.value=r),class:"mt-1 rounded-lg border border-slate-300 p-2 text-sm font-normal"},[(d(!0),u(B,null,F(i(z),r=>(d(),u("option",{key:`from-${r}`,value:r},n(ae(r)),9,Ye))),128))],512),[[Q,w.value,void 0,{number:!0}]])]),e("label",We,[t[6]||(t[6]=y(" En geç ")),h(e("select",{"onUpdate:modelValue":t[2]||(t[2]=r=>S.value=r),class:"mt-1 rounded-lg border border-slate-300 p-2 text-sm font-normal"},[(d(!0),u(B,null,F(i(z),r=>(d(),u("option",{key:`to-${r}`,value:r},n(ae(r)),9,Pe))),128))],512),[[Q,S.value,void 0,{number:!0}]])])]),e("div",Qe,[(d(!0),u(B,null,F(R.value,r=>(d(),u("div",{key:r.direction,class:"rounded-xl border border-slate-200 bg-slate-50/70 p-3"},[e("div",Xe,[e("div",null,[e("strong",et,n(r.label),1),e("div",tt,n(r.date||"Tarih seçilmedi")+" · "+n(r.flights.length)+" direkt uçuÅ",1)])]),r.googleUrl?(d(),u("button",{key:0,type:"button",class:"mb-3 flex min-h-14 w-full items-center justify-center gap-3 rounded-xl border-2 border-blue-200 bg-white px-5 py-3 text-base font-bold text-blue-700 shadow-sm transition hover:border-blue-300 hover:bg-blue-50 hover:shadow-md",onClick:s=>ee(r.direction)},t[7]||(t[7]=[e("span",{class:"flex h-8 w-8 items-center justify-center rounded-full bg-blue-100 text-lg"},"G",-1),y(" Google UçuÅlar'da ara "),e("span",{"aria-hidden":"true"},"â",-1)]),8,at)):f("",!0),M[r.direction]?(d(),u("p",rt,n(M[r.direction]),1)):f("",!0),e("button",{type:"button",class:"mb-3 w-full rounded-lg bg-sky-600 px-4 py-2 text-sm font-semibold text-white transition hover:bg-sky-700 disabled:cursor-not-allowed disabled:opacity-60",disabled:k.value!==null||!X(r.direction),onClick:s=>v(r.direction)},n(k.value===r.direction?"UçuÅlar aranıyor...":`Sistemden ${r.actionLabel}`),9,st),e("button",{type:"button",class:"mb-3 w-full rounded-lg border border-slate-300 bg-white px-4 py-2 text-sm font-semibold text-slate-700 transition hover:bg-slate-100",onClick:s=>oe(r.direction)},n(U[r.direction]?"Seçilen uçuÅ formunu kapat":"Googleâdan seçtiÄim uçuÅu ekle"),9,lt),U[r.direction]?(d(),u("form",{key:2,class:"mb-3 rounded-xl border border-blue-200 bg-blue-50/60 p-3",onSubmit:Se(s=>o(r.direction),["prevent"])},[t[20]||(t[20]=e("p",{class:"mb-3 text-xs leading-5 text-slate-600"}," Google penceresinde seçtiÄiniz uçuÅun bilgilerini girin. Google farklı bir alan adı olduÄu için seçim bilgileri bu sayfaya otomatik okunamaz. ",-1)),e("div",nt,[e("label",it,[t[8]||(t[8]=y(" Havayolu ")),h(e("input",{"onUpdate:modelValue":s=>m[r.direction].airline=s,type:"text",class:"mt-1 rounded-md border border-slate-300 bg-white px-2 py-2 text-sm font-normal",placeholder:"Ãrn. AJet"},null,8,dt),[[$,m[r.direction].airline,void 0,{trim:!0}]])]),e("label",ut,[t[9]||(t[9]=y(" UçuÅ numarası ")),h(e("input",{"onUpdate:modelValue":s=>m[r.direction].flightNumber=s,required:"",type:"text",class:"mt-1 rounded-md border border-slate-300 bg-white px-2 py-2 text-sm font-normal uppercase",placeholder:"Ãrn. VF 123"},null,8,pt),[[$,m[r.direction].flightNumber,void 0,{trim:!0}]])]),e("label",mt,[t[10]||(t[10]=y(" KalkıŠ(IATA) ")),h(e("input",{"onUpdate:modelValue":s=>m[r.direction].departureAirport=s,required:"",maxlength:"3",type:"text",class:"mt-1 rounded-md border border-slate-300 bg-white px-2 py-2 text-sm font-normal uppercase",placeholder:"ESB"},null,8,ct),[[$,m[r.direction].departureAirport,void 0,{trim:!0}]])]),e("label",bt,[t[11]||(t[11]=y(" VarıŠ(IATA) ")),h(e("input",{"onUpdate:modelValue":s=>m[r.direction].arrivalAirport=s,required:"",maxlength:"3",type:"text",class:"mt-1 rounded-md border border-slate-300 bg-white px-2 py-2 text-sm font-normal uppercase",placeholder:"MED"},null,8,xt),[[$,m[r.direction].arrivalAirport,void 0,{trim:!0}]])]),e("label",vt,[t[12]||(t[12]=y(" KalkıŠtarihi ")),h(e("input",{"onUpdate:modelValue":s=>m[r.direction].departureDate=s,required:"",type:"date",class:"mt-1 rounded-md border border-slate-300 bg-white px-2 py-2 text-sm font-normal"},null,8,yt),[[$,m[r.direction].departureDate]])]),e("label",ft,[t[13]||(t[13]=y(" KalkıŠsaati ")),h(e("input",{"onUpdate:modelValue":s=>m[r.direction].departureTime=s,required:"",type:"time",class:"mt-1 rounded-md border border-slate-300 bg-white px-2 py-2 text-sm font-normal"},null,8,gt),[[$,m[r.direction].departureTime]])]),e("label",_t,[t[14]||(t[14]=y(" VarıŠtarihi ")),h(e("input",{"onUpdate:modelValue":s=>m[r.direction].arrivalDate=s,required:"",type:"date",class:"mt-1 rounded-md border border-slate-300 bg-white px-2 py-2 text-sm font-normal"},null,8,ht),[[$,m[r.direction].arrivalDate]])]),e("label",kt,[t[15]||(t[15]=y(" VarıŠsaati ")),h(e("input",{"onUpdate:modelValue":s=>m[r.direction].arrivalTime=s,required:"",type:"time",class:"mt-1 rounded-md border border-slate-300 bg-white px-2 py-2 text-sm font-normal"},null,8,wt),[[$,m[r.direction].arrivalTime]])]),e("label",At,[t[16]||(t[16]=y(" Fiyat (isteÄe baÄlı) ")),h(e("input",{"onUpdate:modelValue":s=>m[r.direction].price=s,inputmode:"decimal",type:"text",class:"mt-1 rounded-md border border-slate-300 bg-white px-2 py-2 text-sm font-normal",placeholder:"12500"},null,8,St),[[$,m[r.direction].price,void 0,{trim:!0}]])]),e("label",Dt,[t[18]||(t[18]=y(" Para birimi ")),h(e("select",{"onUpdate:modelValue":s=>m[r.direction].currency=s,class:"mt-1 rounded-md border border-slate-300 bg-white px-2 py-2 text-sm font-normal"},t[17]||(t[17]=[e("option",{value:"TRY"},"TRY",-1),e("option",{value:"EUR"},"EUR",-1),e("option",{value:"USD"},"USD",-1),e("option",{value:"SAR"},"SAR",-1)]),8,Ut),[[Q,m[r.direction].currency]])]),e("label",Tt,[t[19]||(t[19]=y(" Not (isteÄe baÄlı) ")),h(e("input",{"onUpdate:modelValue":s=>m[r.direction].note=s,type:"text",class:"mt-1 rounded-md border border-slate-300 bg-white px-2 py-2 text-sm font-normal",placeholder:"Bagaj, bilet sınıfı veya operasyon notu"},null,8,$t),[[$,m[r.direction].note,void 0,{trim:!0}]])])]),T[r.direction]?(d(),u("p",Vt,n(T[r.direction]),1)):f("",!0),t[21]||(t[21]=e("button",{type:"submit",class:"mt-3 w-full rounded-lg bg-emerald-600 px-4 py-2.5 text-sm font-bold text-white transition hover:bg-emerald-700"}," UçuÅu alternatiflere ekle ",-1))],40,ot)):f("",!0),A[r.direction]?(d(),u("p",Ct,n(A[r.direction]),1)):j[r.direction]&&!r.flights.length&&k.value!==r.direction?(d(),u("p",Nt," Bu yönde seçilen gün ve saat aralıÄında aktarmasız uçuÅ bulunamadı. ")):f("",!0),r.flights.length?(d(),u("div",Mt,[(d(!0),u(B,null,F(r.flights,s=>(d(),u("article",{key:s.id,class:"rounded-lg border border-slate-200 bg-white p-3"},[e("div",Et,[e("div",Rt,[s.airlineLogo?(d(),u("img",{key:0,src:s.airlineLogo,alt:s.airline,class:"h-7 w-7 rounded object-contain"},null,8,Bt)):f("",!0),e("div",Ft,[e("div",zt,n(s.airline)+" · "+n(s.flightNumber),1),e("div",Gt,n(s.departureAirport)+" "+n(be(s.departureAt))+" â "+n(s.arrivalAirport)+" "+n(be(s.arrivalAt)),1)])]),e("div",Ht,[e("div",Ot,n(xe(s)),1),e("div",jt,n(we(s.durationMinutes)),1)])]),e("div",It,[t[22]||(t[22]=e("span",{class:"rounded bg-emerald-50 px-2 py-1 text-[10px] font-semibold text-emerald-700"},"Direkt · gündüz",-1)),e("button",{type:"button",class:"rounded-md bg-emerald-600 px-2.5 py-1.5 text-xs font-semibold text-white hover:bg-emerald-700 disabled:opacity-50",disabled:W(s),onClick:P=>x(s)},n(W(s)?"Notlara alındı":"Notlara al"),9,Kt)])]))),128))])):f("",!0)]))),128))]),a.modelValue.length?(d(),u("div",Lt,[e("div",{class:"mb-2 flex items-center justify-between gap-2"},[t[23]||(t[23]=e("div",null,[e("h4",{class:"mb-0 text-sm font-bold text-slate-800"},"Kaydedilen alternatifler"),e("p",{class:"mb-0 text-[11px] text-slate-500"},"DeÄiÅiklikleri sayfadaki kaydet düÄmesiyle ilgili TU kaydına yazabilirsiniz.")],-1)),e("button",{type:"button",class:"rounded-md border border-sky-200 bg-sky-50 px-2.5 py-1.5 text-xs font-semibold text-sky-700 hover:bg-sky-100",onClick:ie},"WhatsApp metnini kopyala")]),e("div",qt,[(d(!0),u(B,null,F(a.modelValue,r=>(d(),u("div",{key:r.id,class:"grid grid-cols-1 gap-2 rounded-lg border border-slate-200 p-3 lg:grid-cols-[minmax(280px,1fr)_minmax(220px,1fr)_auto] lg:items-center"},[e("div",Zt,[e("div",Jt,n(r.direction==="return"?"DönüÅ":"GidiÅ")+" · "+n(r.flightNumber)+" · "+n(r.departureAirport)+" â "+n(r.arrivalAirport),1),e("div",Yt,n(r.departureAt)+" â "+n(r.arrivalAt)+" · "+n(xe(r)),1
3),te(r)?(d(),u("div",Wt,"Tur tarihi deÄiÅti; bu seçeneÄi yeniden kontrol edin.")):f("",!0)]),e("input",{value:r.note||"",type:"text",class:"rounded-md border border-slate-300 px-2 py-1.5 text-xs",placeholder:"MüÅteri veya operasyon notu",onInput:s=>O(r.id,s.target.value)},null,40,Pt),e("div",Qt,[r.sourceUrl?(d(),u("a",{key:0,href:r.sourceUrl,target:"_blank",rel:"noopener noreferrer",class:"rounded-md border border-slate-200 px-2 py-1 text-xs text-slate-600 hover:bg-slate-50"},"Google'da aç",8,Xt)):f("",!0),e("button",{type:"button",class:"rounded-md border border-rose-200 px-2 py-1 text-xs text-rose-600 hover:bg-rose-50",onClick:s=>H(r.id)},"Kaldır",8,ea)])]))),128))]),g.value?(d(),u("p",ta,n(g.value),1)):f("",!0)])):f("",!0),t[24]||(t[24]=e("p",{class:"mb-0 mt-3 text-[10px] text-slate-400"},"Fiyat ve müsaitlik deÄiÅebilir; müÅteriye iletmeden önce baÄlantıdan yeniden doÄrulayın.",-1))])}}}),ra={class:"main-wrapper min-h-screen bg-gray-200"},sa={key:0,class:"mb-10 bg-gray-200 py-10 md:mb-14 md:py-0"},la={class:"mx-2 max-w-screen-5xl sm:mx-auto"},oa={class:"md:flex"},na={class:"w-full shrink-0 px-2 py-6 md:w-48 md:px-2 md:py-10"},ia={class:"relative w-full pb-8 md:mx-5 md:mb-14 md:w-[calc(100%-258px)] md:py-10 xl:mx-8"},da={class:"rounded-xl bg-white p-4 shadow-sm md:p-6"},ua={class:"flex flex-wrap items-start justify-between gap-3 border-b border-slate-200 pb-4"},pa=["disabled"],ma={class:"mt-4 block text-xs font-semibold text-slate-700"},ca=["disabled"],ba=["value"],xa={key:0,class:"mb-0 mt-3 text-sm text-slate-500"},va={key:1,class:"mb-0 mt-3 rounded-lg border border-rose-200 bg-rose-50 px-3 py-2 text-sm text-rose-700"},ya={key:2,class:"mb-0 mt-3 rounded-lg border border-amber-200 bg-amber-50 px-3 py-2 text-sm text-amber-800"},fa={key:3,class:"mt-4 grid grid-cols-1 gap-3 rounded-xl border border-slate-200 bg-slate-50 p-3 text-sm md:grid-cols-3"},ga={class:"mt-1 font-semibold text-slate-700"},_a={class:"mt-1 text-slate-700"},ha={class:"mt-1 text-slate-700"},ka={key:1,class:"sticky bottom-3 z-20 mt-4 flex flex-wrap items-center justify-between gap-3 rounded-xl border border-slate-200 bg-white/95 p-4 shadow-lg backdrop-blur"},wa={class:"text-sm font-semibold text-slate-700"},Aa=["disabled"],Va=he({__name:"flight-search",setup(ce){const J=De(),p=Ce(),N=Ue(),le=Te(),C=_(!1),z=_(""),b=_([]),w=_(""),S=_(""),k=_([]),j=_("[]"),A=_(!1),D=_(""),G=_(!1),g=V(()=>b.value.find(o=>String(o.id)===S.value)||null),M=V(()=>{var o;return String(((o=g.value)==null?void 0:o.turs_StartDate)||"").slice(0,10)}),U=V(()=>{var o;return String(((o=g.value)==null?void 0:o.turs_EndDate)||"").slice(0,10)}),T=V(()=>{var o;return(((o=g.value)==null?void 0:o.next_turTransportation)||[]).map(l=>({...l,turs_CityStart:I(l.turs_CityStart),turs_CityEnd:I(l.turs_CityEnd)}))}),E=V(()=>Be(T.value)),m=V(()=>JSON.stringify(k.value)),R=V(()=>!!g.value&&m.value!==j.value);function I(o){return String(o&&typeof o=="object"?o.id||o.pdb_Id||"":o||"")}function K(o){const l=o.turs_title,v=typeof l=="object"&&l?l.tr||l.en||Object.values(l)[0]:l;return String(v||`Tur #${o.id}`).replace(/<[^>]*>/g,"").trim()}function Y(o){const l=String(o.turs_StartDate||"").slice(0,10),v=String(o.turs_EndDate||"").slice(0,10);return`${l} â ${v} · ${K(o)}`}function X(o){return`${JSON.stringify(o.turs_Cat||"")} ${JSON.stringify(o.pdb_categories||"")}`.toLocaleUpperCase("tr-TR")}function L(o){const v=(o.next_turTransportation||[]).some(H=>["3174","3175","3176"].includes(I(H.turs_CityStart))||["3174","3175","3176"].includes(I(H.turs_CityEnd))),x=X(o);return v||x.includes("UMRE")||x.includes("5YILDIZUMRE")||x.includes("VG91CKNHDEVNB3J5MTCZMJU1MZG0OAQQ")}function q(o){S.value=o,w.value=o;const l=b.value.find(v=>String(v.id)===o);k.value=Re(l==null?void 0:l.turs_flight_options),j.value=JSON.stringify(k.value),D.value="",le.replace({query:o?{...N.query,tour:o}:{...N.query,tour:void 0}})}function oe(){if(R.value&&!window.confirm("KaydedilmemiÅ uçuÅ seçenekleri silinecek. BaÅka tura geçilsin mi?")){w.value=S.value;return}q(w.value)}async function ee(){var o,l,v,x,H;C.value=!0,z.value="";try{const O=new Intl.DateTimeFormat("en-CA",{timeZone:"Europe/Istanbul",year:"numeric",month:"2-digit",day:"2-digit"}).format(new Date),W=await _e.get(`${p.public.apiBase}/rest/TourDates`,{params:{limit:250,offset:0,lang:"NONE",filter:JSON.stringify({status:["!=","3"],turs_StartDate:[">=",O]}),fields:"id,turs_title,turs_StartDate,turs_EndDate,turs_Cat,pdb_categories,turs_flight_options,next_turTransportation(id,pdb_sira,turs_Transporter,turs_CityStart,turs_CityEnd)",sort:["turs_StartDate,ASC"]},withCredentials:!0,headers:(o=me())==null?void 0:o.value});b.value=(((l=W.data)==null?void 0:l.formattedData)||[]).filter(L);const te=String(N.query.tour||S.value||""),ie=b.value.some(ae=>String(ae.id)===te)?te:String(((v=b.value[0])==null?void 0:v.id)||"");q(ie)}catch(O){z.value=((H=(x=O==null?void 0:O.response)==null?void 0:x.data)==null?void 0:H.message)||"Tur listesi yüklenemedi."}finally{C.value=!1}}async function ne(){var o,l,v;if(!(!g.value||A.value||!R.value)){A.value=!0,D.value="",G.value=!1;try{await _e.put(`${p.public.apiBase}/rest/TourDates/${g.value.id}`,{turs_flight_options:m.value},{withCredentials:!0,headers:(o=me())==null?void 0:o.value}),g.value.turs_flight_options=m.value,j.value=m.value,D.value="UçuÅ seçenekleri ilgili TU kaydına kaydedildi."}catch(x){G.value=!0,D.value=((v=(l=x==null?void 0:x.response)==null?void 0:l.data)==null?void 0:v.message)||"UçuÅ
3seçenekleri kaydedilemedi."}finally{A.value=!1}}}return $e(ee),Ve(()=>!R.value||!1||window.confirm("KaydedilmemiÅ uçuÅ seçenekleri var. Sayfadan ayrılmak istiyor musunuz?")),(o,l)=>{const v=ke("font-awesome-icon");return d(),u("div",ra,[i(J)&&i(J).id&&i(J).U_Admin==="on"?(d(),u("div",sa,[e("div",la,[e("div",oa,[e("div",na,[se(Ne,{part:"flight-search"})]),e("main",ia,[e("section",da,[e("div",ua,[l[3]||(l[3]=e("div",null,[e("h1",{class:"mb-0 text-xl font-semibold text-slate-800"},"Bilet Arama"),e("p",{class:"mb-0 mt-1 text-sm text-slate-500"},"Bir tur seçerek bireysel katılım için direkt gidiÅ ve dönüŠuçuÅlarını ayrı ayrı inceleyin.")],-1)),e("button",{type:"button",class:"rounded-md border border-slate-300 px-3 py-2 text-sm text-slate-600 hover:border-sky-400 hover:text-sky-600 disabled:opacity-50",disabled:i(C),onClick:ee},[se(v,{icon:"fa-solid fa-refresh",class:pe([i(C)?"animate-spin":"","mr-2"])},null,8,["class"]),l[2]||(l[2]=y("Turları yenile "))],8,pa)]),e("label",ma,[l[5]||(l[5]=y(" Tur seçimi ")),h(e("select",{"onUpdate:modelValue":l[0]||(l[0]=x=>ge(w)?w.value=x:null),class:"mt-1 h-11 w-full rounded-lg border border-slate-300 bg-white px-3 text-sm font-normal text-slate-700",disabled:i(C)||!i(b).length,onChange:oe},[l[4]||(l[4]=e("option",{value:""},"Tur seçin",-1)),(d(!0),u(B,null,F(i(b),x=>(d(),u("option",{key:x.id,value:String(x.id)},n(Y(x)),9,ba))),128))],40,ca),[[Q,i(w)]])]),i(C)?(d(),u("p",xa,[se(v,{icon:"fa-solid fa-spinner",class:"mr-2 animate-spin"}),l[6]||(l[6]=y("Turlar yükleniyor... "))])):i(z)?(d(),u("p",va,n(i(z)),1)):i(b).length?f("",!0):(d(),u("p",ya,"UçuÅ parkuru bulunan gelecek tarihli tur bulunamadı.")),i(g)?(d(),u("div",fa,[e("div",null,[l[7]||(l[7]=e("div",{class:"text-[11px] font-semibold uppercase tracking-wide text-slate-400"},"Seçilen tur",-1)),e("div",ga,n(K(i(g))),1)]),e("div",null,[l[8]||(l[8]=e("div",{class:"text-[11px] font-semibold uppercase tracking-wide text-slate-400"},"GidiÅ",-1)),e("div",_a,n(i(M))+" · "+n(i(E).entryAirport),1)]),e("div",null,[l[9]||(l[9]=e("div",{class:"text-[11px] font-semibold uppercase tracking-wide text-slate-400"},"DönüÅ",-1)),e("div",ha,n(i(U))+" · "+n(i(E).exitAirport),1)])])):f("",!0)]),i(g)?(d(),fe(aa,{key:String(i(g).id),modelValue:i(k),"onUpdate:modelValue":l[1]||(l[1]=x=>ge(k)?k.value=x:null),"start-date":i(M),"end-date":i(U),"entry-airport":i(E).entryAirport,"exit-airport":i(E).exitAirport,class:"mt-4"},null,8,["modelValue","start-date","end-date","entry-airport","exit-airport"])):f("",!0),i(g)?(d(),u("section",ka,[e("div",null,[e("div",wa,n(i(k).length)+" uçuÅ alternatifi",1),e("div",{class:pe(["text-xs",i(R)?"text-amber-700":"text-slate-400"])},n(i(R)?"KaydedilmemiÅ deÄiÅiklikler var.":"DeÄiÅiklik yok."),3)]),e("button",{type:"button",class:"rounded-lg bg-emerald-600 px-5 py-2.5 text-sm font-semibold text-white hover:bg-emerald-700 disabled:cursor-not-allowed disabled:opacity-50",disabled:i(A)||!i(R),onClick:ne},[i(A)?(d(),fe(v,{key:0,icon:"fa-solid fa-spinner",class:"mr-2 animate-spin"})):f("",!0),y(" "+n(i(A)?"Kaydediliyor...":"UçuÅ seçeneklerini kaydet"),1)],8,Aa)])):f("",!0),i(D)?(d(),u("p",{key:2,class:pe(["mt-3 rounded-lg px-3 py-2 text-sm",i(G)?"border border-rose-200 bg-rose-50 text-rose-700":"border border-emerald-200 bg-emerald-50 text-emerald-700"])},n(i(D)),3)):f("",!0)])])])])):f("",!0)])}}});export{Va as default};
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.