1import{J as ce,K as ue,an as de,O as me,N as fe,r as m,o as U,c as ve,i as pe,S as W,a as A,G as o,H as f,D as he,t as F,C as l,a1 as we,a5 as ge,E as H,y as xe,aq as ye,x as X,a4 as _e,ae as Me,b as C,aw as Ce,as as Ie,A as be,n as Ae,_ as ke}from"#entry";import{u as Se,T as Te}from"./5nYfxCvg.js";import{T as Re}from"./Cq54pEI-.js";import{B as De}from"./BJZlwWaz.js";import{N as Ee}from"./DuPs3Fd8.js";import{G as Pe}from"./BXLB-F7p.js";import{E as Ve,a as $}from"./CrFoN066.js";import{u as Be}from"./BOaHvrgt.js";import{u as Ne}from"./9v-N5e3b.js";import"./DH3R62Yr.js";import"./FaDr1iyu.js";import"./BCHaitK1.js";import"./BC9Pa7jE.js";const Le={class:"flex items-start justify-start max-w-full overflow-x-hidden"},Ge={class:"w-[524px] max-w-[524px] min-w-[524px] pt-[20px] pe-[10px] min-h-screen-100 max-h-screen-100 overflow-y-auto no-scrollbar"},Ue={class:"tool-desc"},We=["inert"],Fe={class:"step-hints flex gap-[20px] mb-[12px]"},He={class:"flex items-center gap-[10px] mt-[14px] flex-wrap"},Xe={class:"rigt-detl grow relative min-h-screen-nav max-h-screen-nav overflow-y-auto no-scrollbar"},$e={key:0,class:"rslt-wrap w-full relative"},je={class:"w-full flex flex-col gap-y-[20px]"},Oe={class:"btn-area w-full flex-dflt justify-end mt-9"},Ye=ce({__name:"arw-view",setup(qe){const k=Se(),V=Re["arw-view"];ue({title:V});const{post:j}=Be(),{hasEnghCrdtClnt:O,loadInitList:Y,dnldZip:q,deltAll:z,calcCrdtCost:J}=de(),{showToast:S}=me(),K=fe(),v=m(null),b=m(null),g=m(!1),c=m(!1);let p=0;U(()=>{p++});const d=m(null),h=m(!1),i=m(null),r=m([]),{subscribePendings:B}=Ne(),Z=ve(()=>!c.value&&g.value&&!!d.value);pe(async()=>{document.documentElement.classList.add("overflow-y-hidden"),await T()});async function T(){r.value=[];const a=await Y(Ve.ARW_VIEW,{includePending:!0});a&&a.code===W.Success&&(r.value=a.rslt,B(r))}async function Q(){const a=r.value?.filter(e=>e.mdiaUrl).map(e=>e.mdiaId);a&&a.length>0?await q(a,"arw-view"):S("No downloadable images yet")}function ee(){const a=r.value.map(e=>e.mdiaId);a&&a.length>0&&z(a,async()=>{await T()})}U(()=>{document.documentElement.classList.remove("overflow-y-hidden")});function N(a,e,t){const n=15*D(),s=t.x-e.x,w=t.y-e.y,u=Math.atan2(w,s);a.beginPath(),a.moveTo(e.x,e.y),a.lineTo(t.x,t.y),a.lineTo(t.x-n*Math.cos(u-Math.PI/6),t.y-n*Math.sin(u-Math.PI/6)),a.moveTo(t.x,t.y),a.lineTo(t.x-n*Math.cos(u+Math.PI/6),t.y-n*Math.sin(u+Math.PI/6)),a.stroke()}function I(a){const e=v.value,t=e?.getContext("2d"),n=b.value;if(!e||!t||!n)return;t.clearRect(0,0,e.width,e.height),t.drawImage(n,0,0,e.width,e.height);const s=d.value;t.strokeStyle="#ef4444",t.lineWidth=3*D(),s&&N(t,s.from,s.to)}function R(a){const e=v.value,t=e.getBoundingClientRect(),n=e.width/t.width,s=e.height/t.height;return{x:(a.clientX-t.left)*n,y:(a.clientY-t.top)*s}}function D(){const a=v.value;if(!a)return 1;const e=a.getBoundingClientRect();return e.width>0?a.width/e.width:1}function te(a){if(c.value)return;const e=++p;c.value=!0;const t=new FileReader;t.onerror=()=>{e===p&&(c.value=!1)},t.onload=n=>{if(e!==p)return;const s=new Image;s.onerror=()=>{e===p&&(c.value=!1)},s.onload=()=>{e===p&&(c.value=!1,d.value=null,b.value=s,g.value=!0,Ce(()=>{const w=v.value;if(!w)return;const u=2048;let x=s.width,y=s.height;if(x>u||y>u){const G=Math.min(u/x,u/y);x=Math.round(x*G),y=Math.round(y*G)}w.width=x,w.height=y;const E=484,P=500;let _=x,M=y;_>E&&(M=Math.round(M*E/_),_=E),M>P&&(_=Math.round(_*P/M),M=P),w.style.width=`${_}px`,w.style.height=`${M}px`,I()}))},s.src=n.target?.result},t.readAsDataURL(a)}function ae(){d.value=null,I()}
1function L(){p++,c.value=!1,g.value=!1,b.value=null,d.value=null,h.value=!1,i.value=null}function ne(a){g.value&&(h.value=!0,i.value=R(a))}function se(a){if(!h.value||!i.value)return;const e=R(a);I();const n=v.value.getContext("2d");n.strokeStyle="#f87171",n.lineWidth=3*D(),N(n,i.value,e)}function le(a){if(!h.value||!i.value)return;const e=R(a);Math.sqrt((e.x-i.value.x)**2+(e.y-i.value.y)**2)>10&&(d.value={from:i.value,to:e}),h.value=!1,i.value=null,I()}function oe(){h.value&&(h.value=!1,i.value=null,I())}async function ie(){k.value||O(Ie.IMAGE,$.arwViewCrdt,1)&&K.confirm("Generate a new camera perspective?",async()=>{if(k.value)return;const e=v.value.toDataURL("image/jpeg",.9).split(",")[1];try{const t=await j(be.GNRT_IMG_ARW_VIEW,{srcBase64:e,mimeType:"image/jpeg"});if(t.code===W.Success&&t.rslt){const{docId:n}=t.rslt;r.value.unshift({mdiaId:n,stat:Ae.Starting,mdiaUrl:null,rgstAt:Date.now()}),B(r)}else S("Failed to generate image. Please try again.")}catch(t){console.error("[ARW-VIEW][E]",t),S("Failed to generate image. Please try again.")}})}async function re(){await T()}return(a,e)=>{const t=ge,n=ye;return C(),A("section",Le,[o("div",Ge,[o("h1",null,F(l(V)),1),o("p",Ue,F(a.$t("tool.arwView.desc")),1),f(Te,{class:"mt-[30px]",label:a.$t("tool.arwView.upldHint"),"preview-url":l(g)?l(b)?.src:null,accept:"image/*",busy:l(c),onFile:te,onClear:L},null,8,["label","preview-url","busy"]),l(g)?(C(),A("div",{key:0,inert:l(c),class:"canvas-area mt-[20px]"},[o("div",Fe,[o("div",{class:we(["step-badge",l(d)?"step-done":"step-todo"])},[f(t,{name:l(d)?"lucide:check-circle-2":"lucide:circle-dashed",class:"w-[14px] h-[14px]"},null,8,["name"]),e[0]||(e[0]=o("span",null,"Draw arrow direction",-1))],2)]),o("canvas",{ref_key:"canvasRef",ref:v,class:"canvas-el rounded-lg cursor-crosshair",onMousedown:ne,onMousemove:se,onMouseup:le,onMouseleave:oe},null,544),o("div",He,[o("button",{class:"tool-btn",onClick:ae},[f(t,{name:"tabler:trash-x",class:"w-[15px] h-[15px]"}),e[1]||(e[1]=H(" Clear Arrow ",-1))]),o("button",{class:"tool-btn ml-auto",onClick:L},[f(t,{name:"lucide:image-plus",class:"w-[15px] h-[15px]"}),e[2]||(e[2]=H(" New Image ",-1))])])],8,We)):he("",!0),f(De,{"gtm-gnrt":"",class:"mt-[40px]",dsab:l(k)||!l(Z),"crdt-cost":l(J)(l($).arwViewCrdt,1),onOnSbmt:ie},null,8,["dsab","crdt-cost"])]),o("div",Xe,[f(n,null,{default:xe(()=>[l(r)&&l(r).length>0?(C(),A("div",$e,[o("div",je,[(C(!0),A(_e,null,Me(l(r),s=>(C(),X(Pe,{key:s.mdiaId,item:s,"tool-name":"arw-view",onOnChng:re},null,8,["item"]))),128))]),o("div",Oe,[f(t,{name:"material-symbols:download-rounded",class:"w-[23px] h-[23px]",onClick:Q}),f(t,{name:"tabler:trash-x",class:"ml-[20px] w-[20px] h-[20px]",onClick:ee})])])):(C(),X(Ee,{key:1,clas:"pos-abs-center"}))]),_:1})])])}}}),rt=ke(Ye,[["__scopeId","data-v-943c8fcb"]]);export{rt 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.