All-Resources/[phone]/codem-phone/ui/dist/js/CameraApp.BM0kSDCw.js
2026-04-14 17:41:39 +02:00

2 lines
17 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

var x=(q,N,n)=>new Promise((G,i)=>{var j=o=>{try{L(n.next(o))}catch(y){i(y)}},M=o=>{try{L(n.throw(o))}catch(y){i(y)}},L=o=>o.done?G(o.value):Promise.resolve(o.value).then(j,M);L((n=n.apply(q,N)).next())});import{s as Ce,w as ee,r as u,o as xe,e as ye,f,i as s,v as A,x as I,T as te,k as r,U as ae,F as Y,m as H,g as Z,l as P,u as be,h as m,t as w,Q as le}from"./vendor-vue.CmaRnji1.js";import"./swiper.tg5sgs8j.js";import{_ as Ee,dr as Se,a as Pe,u as Te,f as c,G as ke,i as T,du as Re}from"./index.CjrDwa0W.js";import"./vendor.DSdF8huI.js";const Ae={class:"w-full rounded-[44em] overflow-hidden h-full"},Ie={class:"w-full h-full relative"},Me={key:0,class:"absolute w-full h-full z-50 flex items-center justify-center bg-black/90"},Le={key:0,class:"w-full h-full flex flex-col items-center justify-center"},Oe={class:"text-white text-[12em] font-['SFPRO'] font-[400] mt-[1em] px-[5em]"},Fe={key:1,class:"w-full h-full flex flex-col items-center justify-center"},Ne={class:"text-white text-[12em] font-['SFPRO'] font-[400] mt-[1em] px-[5em]"},je={key:2,class:"w-full h-full flex flex-col items-center justify-center"},De={class:"text-[#E53E3E] text-[12em] font-['SFPRO'] font-[400] mt-[1em] px-[5em]"},ze={class:"w-full h-[90em] flex items-end bg-black/80 absolute top-0 left-0 right-0 z-10"},Ue={class:"w-full h-[29em] mb-[15em] flex justify-between items-center"},Ve=["src"],Ze={class:"h-full flex-1 flex items-center justify-center overflow-hidden"},Ge=["src"],$e={key:0,class:"absolute top-[100em] left-1/2 transform -translate-x-1/2 z-30 flex items-center gap-[4em] bg-red-600/90 px-[7em] py-[3em] rounded-full"},Be={class:"text-white text-[9em] font-['SFPRO'] font-[400] mt-[0.05em]"},Ye={class:"absolute bottom-[130em] left-1/2 transform translate-x-[-40%] z-20 flex gap-1"},He=["onClick"],qe={class:"w-full h-[112em] bg-black/80 absolute bottom-0 left-0 right-0 z-10"},Je={class:"w-full h-[50em] flex items-center justify-center px-[20em]"},Qe={class:"w-full h-full flex items-center justify-center"},Ke={class:"w-full h-[41em] flex items-center justify-between px-[25em] mt-[4em]"},We=["src"],Xe={key:1,class:"w-full h-full relative bg-black rounded-full"},et=["src"],tt={class:"absolute inset-0 flex items-center justify-center pointer-events-none"},at={class:"w-[35em] h-[35em] rounded-full flex items-center justify-center group-hover:scale-110 transition-transform duration-200"},lt=["src"],st=["src"],ot=["src"],nt=["src"],rt=["src"],it={__name:"CameraApp",setup(q){const N=Se(),{t:n}=Pe(),G=be(),i=Te(),{RotatePhone:j,PlayerTalking:M}=Ce(i);ee(j,t=>{d.value&&d.value.setRotatePhone(t)});const L=()=>{G.push("/photos")};let o=null;const y=u(0),O=u(1),E=u(null),$=u(null),D=u(!1),g=u(!1),v=u(null),_=u(!1),z=u("photo"),d=u(null),k=u(!1),R=u(0);let p=null;const B=[{label:".5",value:.5},{label:"1x",value:1},{label:"2",value:2},{label:"5",value:5}],b=u(1),J=[{name:"Normal",value:"Normal"},{name:"DMT_flight",value:"Flight"},{name:"DeathFailFranklinIn",value:"Lin"},{name:"DeadlineNeon",value:"Neon"},{name:"DeathFailMPIn",value:"Pin"},{name:"InchPurple",value:"Purple"},{name:"CrossLine",value:"Cross"}],U=[{name:"landscape",label:"cameraApp.landscape"},{name:"camera",label:"cameraApp.cameraMode"},{name:"video",label:"cameraApp.videoMode"}],se=t=>{E.value=t},oe=t=>{y.value=t.activeIndex,c("SET_FILTER",{filter:J[y.value].name})},ne=()=>{E.value&&E.value.slidePrev()},re=()=>{E.value&&E.value.slideNext()},ie=t=>{$.value=t,t.slideTo(O.value,0)},ue=(t,l)=>{const a=t.clickedIndex;if(a!=null){if(d.value.isRecording()){d.value.stopRecording(),k.value=!1,p&&(clearInterval(p),p=null),R.value=0,o&&(o.cleanup(),o=null),c("REMOVE_PEERID");return}O.value=a,D.value=U[a].name==="video",t.slideTo(a,300);const e=U[a].name==="landscape";i.RotatePhone=e}};ee(M,t=>{o?o.muteLocalAudio(!t):console.log("⚠️ Camera - Recorder not initialized yet")});const h=u(null),ce=t=>{const l=Math.floor(t/3600),a=Math.floor(t%3600/60),e=t%60;return l>0?`${l.toString().padStart(2,"0")}:${a.toString().padStart(2,"0")}:${e.toString().padStart(2,"0")}`:`${a.toString().padStart(2,"0")}:${e.toString().padStart(2,"0")}`},Q=()=>x(this,null,function*(){if(!d.value){i.TriggerNotification({appname:"camera",header:n("cameraApp.camera"),message:n("cameraApp.cameraNotReady")});return}if(!D.value){i.TriggerNotification({appname:"camera",header:n("cameraApp.camera"),message:n("cameraApp.notInVideoMode")});return}if(d.value.isRecording()){d.value.stopRecording(),k.value=!1,p&&(clearInterval(p),p=null),R.value=0,o&&(o.cleanup(),o=null),c("REMOVE_PEERID");return}try{o=new Re,yield o.initialize();const l=yield o.getLocalMicrophone(),a=yield o.initializePeer();console.log("🎤 Camera - PlayerTalking:",M.value),M.value?(console.log("🔊 Camera - Unmuting microphone (talking)"),o.muteLocalAudio(!1)):(console.log("🔇 Camera - Muting microphone (not talking)"),o.muteLocalAudio(!0));const e=o.getControlledAudioStream();e&&d.value.setAudioStream(e),(yield o.startRecording())&&setTimeout(()=>{c("SET_VOICE_PEER_ID",{peerId:a})},1e3)}catch(l){console.warn("Could not get microphone:",l),i.TriggerNotification({appname:"camera",header:n("cameraApp.camera"),message:n("cameraApp.microphoneDenied")})}d.value.startRecording()?(k.value=!0,R.value=0,p=setInterval(()=>{R.value++},1e3)):(i.TriggerNotification({appname:"camera",header:n("cameraApp.camera"),message:n("cameraApp.recordingFailed")}),o&&(o.cleanup(),o=null))}),K=()=>x(this,null,function*(){var t,l;if(!d.value||!h.value){i.TriggerNotification({appname:"camera",header:n("cameraApp.camera"),message:n("cameraApp.cameraNotReady")});return}if((t=i.settings)!=null&&t.silentMode)console.log("[CameraApp] Silent mode is ON, skipping sound");else{const a=((l=i.settings)==null?void 0:l.volume)||80;c("PLAY_CAMERA_SHUTTER_SYNC",{volume:a}).then(e=>{console.log("[CameraApp] Shutter sound callback response:",e)}).catch(e=>{console.error("[CameraApp] Shutter sound error:",e)})}de();try{const a=yield fe(),e=yield me(),S=yield ve(a,e);yield pe(S,e.size)}catch(a){he(a)}}),de=()=>{g.value=!0,z.value="photo",v.value=null,_.value=!1},fe=()=>x(this,null,function*(){const t=yield c("getPresignedUrl",{mediaType:"picture"});if(!t.success)throw new Error(n(`${t.message}`));return t.presignedUrl}),me=()=>x(this,null,function*(){let t=h.value;if(j.value){const a=document.createElement("canvas"),e=a.getContext("2d");a.width=h.value.height,a.height=h.value.width,e.translate(a.width/2,a.height/2),e.rotate(-Math.PI/2),e.drawImage(h.value,-h.value.width/2,-h.value.height/2,h.value.width,h.value.height),t=a}const l=yield new Promise(a=>{t.toBlob(a,"image/png",1)});if(!l)throw new Error("Fotoğraf oluşturulamadı");return l}),ve=(t,l)=>x(this,null,function*(){const a=new FormData;a.append("file",l,"photo.png"),a.append("metadata",JSON.stringify({name:"Phone Photo",description:"Photo taken from phone app",timestamp:Date.now()}));const e=yield fetch(t,{method:"POST",body:a});if(!e.ok){const S=yield e.text();throw new Error(`Yükleme başarısız: ${e.status} - ${S}`)}return yield e.json()}),pe=(t,l)=>x(this,null,function*(){var e;if(!((e=t.data)!=null&&e.url))throw new Error("Yükleme sonucunda URL bulunamadı");const a=yield c("UPLOAD_PHOTO",{url:t.data.url,size:(l/1024).toFixed(2),mimeType:"image/png"});if(!a.success)throw new Error(a.error||"Sunucuda kayıt hatası");C.value=t.data.url,N.UploadPhoto(a.data),_.value=!0,setTimeout(()=>{_.value=!1,g.value=!1},2e3)}),he=t=>{v.value=t.message||"Yükleme başarısız",setTimeout(()=>{v.value=null,g.value=!1},3e3)},ge=()=>{g.value=!1,v.value=null,_.value=!1},we=()=>{c("TOGGLE_FLIP",{})},V=u(!1),_e=t=>{if(V.value||b.value===t)return;V.value=!0,b.value=t;const l=B[t].value;c("SET_CAMERA_ZOOM",{zoom:l}),setTimeout(()=>{V.value=!1},300)},C=u(null);xe(()=>x(this,null,function*(){c("OPEN_CAMERA",{}),c("SET_FILTER",{filter:"Normal"});let t=yield c("GET_LAST_MEDIA",{});t&&t.success?C.value=t.data:C.value=null,i.RotatePhone=!1,h.value&&(d.value=new ke(h.value,()=>{g.value=!0,z.value="video",v.value=null,_.value=!1},(l,a,e,S)=>x(this,null,function*(){var X;if(k.value=!1,p&&(clearInterval(p),p=null),R.value=0,l)try{if((X=e==null?void 0:e.data)!=null&&X.url){const F=yield c("UPLOAD_PHOTO",{url:e.data.url,size:(S/1024).toFixed(2),mimeType:"video/webm"});if(!F.success)throw new Error(F.error||"Sunucuda video kaydı başarısız");C.value=e.data.url,N.UploadPhoto(F.data)}_.value=!0,setTimeout(()=>{_.value=!1,g.value=!1},2e3)}catch(F){v.value=F.message||"Video kaydetme başarısız",setTimeout(()=>{v.value=null,g.value=!1},3e3)}else v.value=a||"Video yükleme başarısız",setTimeout(()=>{v.value=null,g.value=!1},3e3)})),d.value.startCanvas()),window.addEventListener("message",W)}));const W=t=>{const l=t.data;if(l.action==="UPDATE_FILTER")y.value=l.filterIndex,E.value&&E.value.slideTo(l.filterIndex,300);else if(l.action!=="CAMERA_FLIPPED"){if(l.action==="UPDATE_MODE")O.value=l.modeIndex,D.value=U[l.modeIndex].name==="video",$.value&&$.value.slideTo(l.modeIndex,300);else if(l.action==="TRIGGER_PHOTO")K();else if(l.action==="TRIGGER_VIDEO_RECORD")Q();else if(l.action==="SET_ROTATE_PHONE")i.RotatePhone=l.rotate;else if(l.action==="UPDATE_ZOOM"){const a=B.findIndex(e=>e.value===l.zoom);a!==-1&&(b.value=a)}}};return ye(()=>x(this,null,function*(){c("REMOVE_PEERID"),c("CLOSE_CAMERA",{}),c("SET_FILTER",{filter:"Normal"}),d.value&&(d.value.destroy(),d.value=null),p&&(clearInterval(p),p=null),o&&(o.cleanup(),o=null),i.RotatePhone=!1,window.removeEventListener("message",W)})),(t,l)=>(m(),f("div",Ae,[s("div",Ie,[A(te,{name:"fade"},{default:I(()=>[g.value||v.value||_.value?(m(),f("div",Me,[g.value&&!v.value&&!_.value?(m(),f("div",Le,[l[0]||(l[0]=s("div",{class:"w-16 h-16 border-2 border-white/20 border-t-white rounded-full animate-spin"},null,-1)),s("h3",Oe,w(z.value==="video"?r(n)("cameraApp.video"):r(n)("cameraApp.photo"))+" "+w(r(n)("general.uploading")),1)])):_.value?(m(),f("div",Fe,[l[1]||(l[1]=s("div",{class:"w-16 h-16 border-2 border-white/20 border-t-white rounded-full animate-spin"},null,-1)),s("h3",Ne,w(z.value==="video"?r(n)("cameraApp.video"):r(n)("cameraApp.photo"))+" "+w(r(n)("cameraApp.uploadSuccess")),1)])):v.value?(m(),f("div",je,[l[2]||(l[2]=s("svg",{class:"h-[6%]",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg"},[s("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M2.57213 2.57116C3.22302 1.92029 4.27828 1.92029 4.92917 2.57116L37.4291 35.0712C38.08 35.722 38.08 36.7773 37.4291 37.4282C36.7783 38.079 35.723 38.079 35.0722 37.4282L2.57213 4.92819C1.92127 4.27731 1.92127 3.22204 2.57213 2.57116Z",fill:"#E53E3E"}),s("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M34.2234 34.2247C34.404 34.0438 34.5777 33.8562 34.7439 33.6617C36.0102 32.1788 36.5642 30.3882 36.8272 28.2237C37.0827 26.1198 37.0827 23.4577 37.0827 20.1092C37.0827 16.7605 37.0827 13.8808 36.8272 11.777C36.5642 9.61248 36.0102 7.82189 34.7439 6.33904C34.4117 5.95018 34.0495 5.58801 33.6607 5.25589C32.1779 3.98943 30.3872 3.43543 28.2227 3.17251C26.1189 2.91694 23.4567 2.91696 20.1082 2.91699C16.7595 2.91696 13.8799 2.91694 11.776 3.17251C9.6115 3.43543 7.82092 3.98943 6.33807 5.25589C6.14358 5.42199 5.95577 5.59563 5.77507 5.77634L34.2234 34.2247ZM3.61012 9.50396C3.40863 10.2117 3.26977 10.9682 3.17153 11.777C2.91597 13.8808 2.91598 16.7605 2.91602 20.109C2.91598 23.4577 2.91597 26.1198 3.17153 28.2237C3.43445 30.3882 3.98845 32.1788 5.25492 33.6617C5.58703 34.0505 5.9492 34.4127 6.33807 34.7448C7.82092 36.0112 9.6115 36.5652 11.776 36.8282C13.8799 37.0837 16.542 37.0837 19.8905 37.0837C23.2392 37.0837 26.1189 37.0837 28.2227 36.8282C29.0315 36.73 29.788 36.591 30.4957 36.3895L27.7172 33.611C25.8472 33.8267 23.412 33.8295 19.9995 33.8295C16.5176 33.8295 14.0533 33.8267 12.1685 33.5977C10.3216 33.3733 9.25073 32.9528 8.45152 32.2702C8.19227 32.0487 7.95082 31.8073 7.7294 31.548C7.0468 30.7488 6.62625 29.678 6.4019 27.831C6.3159 27.123 6.2618 26.3332 6.22778 25.4385L12.4489 19.2173C12.597 19.0692 12.7588 18.9382 12.9315 18.8253L3.61012 9.50396ZM23.7493 12.5003C23.7493 11.3497 24.682 10.417 25.8327 10.417C26.9834 10.417 27.916 11.3497 27.916 12.5003C27.916 13.6509 26.9834 14.5837 25.8327 14.5837C24.682 14.5837 23.7493 13.6509 23.7493 12.5003ZM32.2697 31.548C32.1588 31.6778 32.043 31.803 31.9225 31.9235L24.5827 24.5837L26.6157 22.5507C27.1815 21.9847 27.9492 21.6667 28.7495 21.6667C29.5498 21.6667 30.3175 21.9847 30.8833 22.5507L33.7712 25.4385C33.7372 26.3332 33.6832 27.123 33.5972 27.831C33.3727 29.678 32.9522 30.7488 32.2697 31.548Z",fill:"#E53E3E"})],-1)),s("h3",De,w(v.value),1),s("button",{onClick:ge,class:"px-6 py-2 bg-red-500/20 hover:bg-red-500/30 text-red-500 rounded-lg font-['SFPRO'] text-sm transition-colors"},w(r(n)("general.close")),1)])):Z("",!0)])):Z("",!0)]),_:1}),s("div",ze,[s("div",Ue,[s("div",{class:"w-[40em] h-full flex items-center justify-center cursor-pointer",onClick:ne},[s("img",{src:r(T)["settings/leftarrow.svg"],class:"h-[35%] rotate-180 opacity-60 hover:opacity-100 transition-opacity",alt:"Previous"},null,8,Ve)]),s("div",Ze,[A(r(ae),{"slides-per-view":4.4,"centered-slides":!0,"space-between":0,onSwiper:se,onSlideChange:oe,class:"w-full h-full"},{default:I(()=>[(m(),f(Y,null,H(J,(a,e)=>A(r(le),{key:e,class:"flex items-center justify-center max-w-[90em]"},{default:I(()=>[s("div",{class:P([y.value===e?"bg-white/10":"","h-full inline-flex items-center rounded-full justify-center px-[5em] w-full overflow-hidden"])},[s("span",{class:P(["text-[9em] font-['SFPRO'] font-[400] transition-all duration-300 truncate text-center whitespace-nowrap overflow-hidden text-ellipsis max-w-full block",y.value===e?"text-[#E5A23E] opacity-100 scale-110":"text-white/25"])},w(a.value),3)],2)]),_:2},1024)),64))]),_:1})]),s("div",{class:"w-[40em] h-full flex items-center justify-center cursor-pointer",onClick:re},[s("img",{src:r(T)["settings/leftarrow.svg"],class:"h-[35%] opacity-60 hover:opacity-100 transition-opacity",alt:"Next"},null,8,Ge)])])]),s("canvas",{ref_key:"gameCanvas",ref:h,width:500,height:800,class:"game-canvas rotate-90"},null,512),A(te,{name:"fade"},{default:I(()=>[k.value?(m(),f("div",$e,[s("span",Be,w(ce(R.value)),1)])):Z("",!0)]),_:1}),s("div",Ye,[(m(),f(Y,null,H(B,(a,e)=>s("div",{key:e,onClick:S=>_e(e),class:P(["w-[25em] h-[25em] rounded-full flex items-center justify-center cursor-pointer transition-all duration-300 ease-out",{"bg-[#00000099] scale-95":b.value===e,"bg-transparent scale-90":b.value!==e,"pointer-events-none":V.value}])},[s("span",{class:P(["text-[9em] font-['SFPRO'] font-[500] transition-all duration-300 ease-out",{"text-[#E5A23E] scale-95":b.value===e,"text-white/60 scale-80":b.value!==e}])},w(a.value)+w(b.value===e?"x":""),3)],10,He)),64))]),s("div",qe,[s("div",Je,[A(r(ae),{"slides-per-view":3,"space-between":20,"centered-slides":!0,loop:!1,"watch-slides-progress":!0,onSwiper:ie,onClick:ue,class:"w-full h-full"},{default:I(()=>[(m(),f(Y,null,H(U,(a,e)=>A(r(le),{key:e,class:"h-full flex items-center justify-center cursor-pointer"},{default:I(()=>[s("div",Qe,[s("div",{class:P([O.value===e?"bg-white/10 rounded-full py-[6em]":"","w-full py-[6em] rounded-full inline-flex items-center justify-center"])},[s("span",{class:P(["text-[9em] font-['SFPRO'] font-[400] transition-all duration-300 text-center",O.value===e?"text-[#E5A23E] opacity-100 mt-[.1em] scale-110 font-[400]":"text-white/60 scale-100"])},w(r(n)(a.label)),3)],2)])]),_:2},1024)),64))]),_:1})]),s("div",Ke,[s("div",{onClick:L,class:"h-full aspect-square anim-hover-1 cursor-pointer rounded-full"},[C.value&&!r(i).isVideo(C.value)?(m(),f("img",{key:0,src:C.value,class:"w-full h-full rounded-full object-cover object-center border-2 border-white",alt:"Logo"},null,8,We)):C.value&&r(i).isVideo(C.value)?(m(),f("div",Xe,[s("video",{class:"w-full h-full object-cover rounded-full border-2 border-white",src:C.value,preload:"metadata",muted:""},"Your browser does not support the video tag.",8,et),s("div",tt,[s("div",at,[s("img",{src:r(T)["photos/play.svg"],class:"h-[80%]",alt:""},null,8,lt)])])])):Z("",!0)]),D.value?(m(),f("div",{key:1,onClick:Q,class:"h-full aspect-square anim-hover-1 rounded-full flex items-center justify-center cursor-pointer relative"},[k.value?(m(),f("img",{key:"recording",src:r(T)["camera/recording.svg"],class:"w-full h-full rounded-full absolute",alt:"Recording"},null,8,nt)):(m(),f("img",{key:"videostart",src:r(T)["camera/videostart.svg"],class:"w-full h-full rounded-full absolute",alt:"Video"},null,8,ot))])):(m(),f("div",{key:0,class:P(["h-full aspect-square rounded-full flex items-center anim-hover-1 justify-center cursor-pointer",{"opacity-50 pointer-events-none":g.value}]),onClick:K},[s("img",{src:r(T)["camera/photobutton.svg"],class:"w-full h-full rounded-full",alt:"Capture"},null,8,st)],2)),s("div",{onClick:we,class:"h-full aspect-square rounded-full bg-black/60 shadow-[0px_4px_88px_0px_rgba(0,0,0,1.00)] outline outline-1 outline-white/30 flex cursor-pointer anim-hover-1 items-center justify-center"},[s("img",{src:r(T)["camera/rotate.svg"],class:"h-[45%]",alt:"Rotate Camera"},null,8,rt)])])])])]))}},vt=Ee(it,[["__scopeId","data-v-4df4bf1e"]]);export{vt as default};