PageSourceSearch

https://thefluxtrain.com/_nuxt/0sE3x2do.js

js thefluxtrain.com collected 2026-10-07 20:13:26 UTC 81,877 bytes, 41 lines download raw bytes

1import{d as S,f as nt,aA as v,L as f,ax as P,c as W,aU as X,N as t,bJ as Vt,ao as B,M as H,aB as $,aE as lt,aD as h,F as qt,a8 as Kt,an as Zt,K as Yt,ay as Qt,I as C,c7 as Jt,aG as Re,aH as $e,bB as et,bX as tt,bf as eo,bF as to,n as oo}from"./Dx8NNHmV.js";import{_ as ao}from"./Dxk_W9_h.js";import{_ as so}from"./Cii0jyuN.js";import{A as no}from"./B45CXZG-.js";import{T as lo}from"./B2jZRxkv.js";import{_ as io}from"./DlAUqK2U.js";import"./Z8uBjA1f.js";import"./CFOp7w1W.js";import"./BvzuBD3k.js";import"./u8Y1t0iR.js";import"./Bg1Ya47c.js";import"./CxMJvyLn.js";import"./Cw9HF3yx.js";import"./CrrGeNQU.js";import"./C65AGUD7.js";import"./Bm4mc-yX.js";import"./BZrWr4mv.js";import"./BjLBLW-G.js";import"./9aRPTW-S.js";async function ro(r,i){try{const[a,c]=await Promise.all([ot(r),ot(i)]),x=co(c,a.naturalHeight),m=uo(a,x),_=await go(m),T=at(r.name),U=at(i.name),G=`${T}_${U}.png`;return URL.revokeObjectURL(a.src),URL.revokeObjectURL(c.src),{name:G,blob:_}}catch(a){throw console.error("Error creating stitched image:",a),a}}function it(r,i,a){if(r.whiteBackgroundInfo)return r.whiteBackgroundInfo;if(!r.element)return{isWhiteBackground:!1,whitePercentage:0};performance.now();const c=document.createElement("canvas"),x=c.getContext("2d");if(!x)return{isWhiteBackground:!1,whitePercentage:0};const m=r.element;c.width=m.naturalWidth,c.height=m.naturalHeight,x.drawImage(m,0,0);const T=x.getImageData(0,0,c.width,c.height).data;let U=0;const G=c.width*c.height;for(let A=0;A<T.length;A+=4){const N=T[A],Q=T[A+1],E=T[A+2];N>=i&&Q>=i&&E>=i&&U++}const K=U/G*100,Z=K>=a*100;performance.now();const y={isWhiteBackground:Z,whitePercentage:K};return r.whiteBackgroundInfo=y,y}function ot(r){return new Promise((i,a)=>{const c=new Image;c.onload=()=>i(c),c.onerror=a,c.src=URL.createObjectURL(r)})}function co(r,i){const a=document.createElement("canvas"),c=a.getContext("2d"),x=r.naturalWidth/r.naturalHeight,m=i*x;return a.width=m,a.height=i,c.drawImage(r,0,0,m,i),a}function uo(r,i){const a=document.createElement("canvas"),c=a.getContext("2d"),x="naturalWidth"in r?r.naturalWidth:r.width,m="naturalHeight"in r?r.naturalHeight:r.height,_="naturalWidth"in i?i.naturalWidth:i.width,T="naturalHeight"in i?i.naturalHeight:i.height;return a.width=x+_,a.height=Math.max(m,T),c.drawImage(r,0,0),c.drawImage(i,x,0),a}function go(r){return new Promise(i=>{r.toBlob(a=>i(a),"image/png")})}function at(r){return r.split(".").slice(0,-1).join(".")}const mo=0,fo=1,rt=.3,He=245,vo=S({totalProcessingTime:0,pixelProcessingTime:0,cacheHits:0,cacheMisses:0,comparisonsProcessed:0,imagesProcessed:0,facesDetected:0,personGroupsCreated:0,gpuComparisons:0,cpuComparisons:0,gpuPreloadTime:0,gpuTextureCount:0}),po=S({isProcessing:!1,currentBatch:0,totalBatches:0,processedComparisons:0,totalComparisons:0,canCancel:!1}),ho=S({imageReading:0,imageScaling:0,faceDetection:0,globalFaceGrouping:0,faceSimilarityCalculation:0,pixelSimilarityCalculation:0,weightedSimilarityCalculation:0,whiteBackgroundDetection:0,totalProcessing:0});function ct(){return{performanceMetrics:vo,processingState:po,processTiming:ho}}const{performanceMetrics:ke,processTiming:xo}=ct(),se=S({pixelData:new Map,canvasCache:new Map,processedImages:new Set}),Y=S({textures:new Map,preloadedImages:new Set,maxCacheSize:50}),L=S({gl:null,program:null,vertexBuffer:null,textureCache:new Map,framebuffer:null,initialized:!1,maxTextureSize:0,supported:!1}),dt=S(!1),bo=S(null);function Ce(r){if(se.value.canvasCache.has(r.id))return se.value.canvasCache.get(r.id);const i=document.createElement("canvas"),a=i.getContext("2d");if(!a)throw new Error("Failed to get canvas context");const c=r.scaledElement||r.element;if(!c)throw new Error("No image element available");const x=200;let m=c.naturalWidth,_=c.naturalHeight;return(m>x||_>x)&&(m>_?(m=x,_=c.naturalHeight*x/c.naturalWidth):(_=x,m=c.naturalWidth*x/c.naturalHeight)),i.width=m,i.height=_,a.drawImage(c,0,0,m,_),se.value.canvasCache.set(r.id,i),i}function ut(r){if(se.value.pixelData.has(r.id))return se.value.pixelData.get(r.id);const i=Ce(r),a=i.getContext("2d");if(!a)throw new Error("Failed to get canvas context");const c=a.getImageData(0,0,i.width,i.height);return se.value.pixelData.set(r.id,c),se.value.processedImages.add(r.id),c}function yo(){se.value.pixelData.clear(),se.value.canvasCache.clear(),se.value.processedImages.clear()}async function gt(r){if(!L.value.initialized||!L.value.gl)return!1;const i=L.value.gl,a=r.id;if(Y.value.preloadedImages.has(a))return!0;try{const c=Ce(r),x=c.getContext("2d");if(!x)return!1;const m=x.getImageData(0,0,c.width,c.height),_=i.createTexture();if(!_)return!1;if(i.bindTexture(i.TEXTURE_2D,_),i.texImage2D(i.TEXTURE_2D,0,i.RGBA,i.RGBA,i.UNSIGNED_BYTE,m),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),Y.value.textures.set(a,{texture:_,width:c.width,height:c.height,data:new Uint8Array(m.data)}),Y.value.preloadedImages.add(a),Y.value.textures.size>Y.value.maxCacheSize){const T=Y.value.textures.keys().next().value;if(T){const U=Y.value.textures.get(T);U&&i.deleteTexture(U.texture),Y.value.textures.delete(T),Y.value.preloadedImages.delete(T)}}return!0}catch(c){return console.error(`Failed to preload image ${a} to GPU:`,c),!1}}const wo=`
2  attribute vec2 a_position;
3  attribute vec2 a_texCoord;
4  varying vec2 v_texCoord;
5  
6  void main() {
7    gl_Position = vec4(a_position, 0.0, 1.0);
8    v_texCoord = a_texCoord;
9  }
10`,_o=`
11  precision mediump float;
12  
13  uniform sampler2D u_image1;
14  uniform sampler2D u_image2;
15  uniform vec2 u_resolution;
16  uniform float u_whiteThreshold;
17  
18  varying vec2 v_texCoord;
19  
20  void main() {
21    vec4 color1 = texture2D(u_image1, v_texCoord);
22    vec4 color2 = texture2D(u_image2, v_texCoord);
23    
24    // Check if both pixels are white (above threshold)
25    bool isWhite1 = color1.r >= u_whiteThreshold && color1.g >= u_whiteThreshold && color1.b >= u_whiteThreshold;
26    bool isWhite2 = color2.r >= u_whiteThreshold && color2.g >= u_whiteThreshold && color2.b >= u_whiteThreshold;
27    
28    // Skip white pixels by setting alpha to 0
29    if (isWhite1 && isWhite2) {
30      gl_FragColor = vec4(0.0, 0.0, 0.0, 0.0);
31    } else {
32      // Calculate absolute difference for each channel
33      float diffR = abs(color1.r - color2.r);
34      float diffG = abs(color1.g - color2.g);
35      float diffB = abs(color1.b - color2.b);
36      
37      // Store difference in RGB, valid pixel flag in alpha
38      gl_FragColor = vec4(diffR, diffG, diffB, 1.0);
39    }
40  }
41`;function st(r,i,a){const c=r.createShader(i);return c?(r.shaderSource(c,a),r.compileShader(c),r.getShaderParameter(c,r.COMPILE_STATUS)?c:(console.error(r.getShaderInfoLog(c)),r.deleteShader(c),null)):null}function Io(r,i,a){const c=r.createProgram();return c?(r.attachShader(c,i),r.attachShader(c,a),r.linkProgram(c),r.getProgramParameter(c,r.LINK_STATUS)?c:(console.error(r.getProgramInfoLog(c)),r.deleteProgram(c),null)):null}function Po(){if(!dt.value)return console.warn("GPU not available for pixel comparison"),!1;try{const r=document.createElement("canvas"),i=r.getContext("webgl")||r.getContext("experimental-webgl");if(!i)return console.warn("WebGL not supported for pixel comparison"),!1;const a=st(i,i.VERTEX_SHADER,wo),c=st(i,i.FRAGMENT_SHADER,_o);if(!a||!c)return console.error("Failed to create shaders"),!1;const x=Io(i,a,c);if(!x)return console.error("Failed to create program"),!1;const m=i.createBuffer();i.bindBuffer(i.ARRAY_BUFFER,m);const _=new Float32Array([-1,-1,0,0,1,-1,1,0,-1,1,0,1,1,1,1,1]);i.bufferData(i.ARRAY_BUFFER,_,i.STATIC_DRAW);const T=i.createFramebuffer(),U=i.getParameter(i.MAX_TEXTURE_SIZE);return L.value={gl:i,program:x,vertexBuffer:m,textureCache:new Map,framebuffer:T,initialized:!0,maxTextureSize:U,supported:!0},console.log(`GPU pixel comparison initialized. Max texture size: ${U}x${U}`),!0}catch(r){return console.error("Failed to initialize GPU pixel comparison:",r),!1}}function ko(r,i){if(!L.value.initialized||!L.value.gl)return null;const a=L.value.gl,c=r.id,x=i.id;if(!Y.value.preloadedImages.has(c)||!Y.value.preloadedImages.has(x))return null;try{const m=Y.value.textures.get(c),_=Y.value.textures.get(x);if(!m||!_)return null;const T=Math.min(m.width,_.width),U=Math.min(m.height,_.height),G=a.createTexture();a.bindTexture(a.TEXTURE_2D,G),a.texImage2D(a.TEXTURE_2D,0,a.RGBA,T,U,0,a.RGBA,a.UNSIGNED_BYTE,null),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR),a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR),a.bindFramebuffer(a.FRAMEBUFFER,L.value.framebuffer),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_2D,G,0),a.viewport(0,0,T,U),a.useProgram(L.value.program);const K=a.getUniformLocation(L.value.program,"u_resolution"),Z=a.getUniformLocation(L.value.program,"u_whiteThreshold");a.uniform2f(K,T,U),a.uniform1f(Z,He/255),a.activeTexture(a.TEXTURE0),a.bindTexture(a.TEXTURE_2D,m.texture),a.uniform1i(a.getUniformLocation(L.value.program,"u_image1"),0),a.activeTexture(a.TEXTURE1),a.bindTexture(a.TEXTURE_2D,_.texture),a.uniform1i(a.getUniformLocation(L.value.program,"u_image2"),1),a.bindBuffer(a.ARRAY_BUFFER,L.value.vertexBuffer);const y=a.getAttribLocation(L.value.program,"a_position"),A=a.getAttribLocation(L.value.program,"a_texCoord");a.enableVertexAttribArray(y),a.enableVertexAttribArray(A),a.vertexAttribPointer(y,2,a.FLOAT,!1,16,0),a.vertexAttribPointer(A,2,a.FLOAT,!1,16,8),a.drawArrays(a.TRIANGLE_STRIP,0,4);const N=new Uint8Array(T*U*4);a.readPixels(0,0,T,U,a.RGBA,a.UNSIGNED_BYTE,N);let Q=0,E=0;const I=T*U;for(let M=0;M<N.length;M+=4)if(N[M+3]/255>0){const k=N[M]/255,V=N[M+1]/255,R=N[M+2]/255;Q+=k+V+R,E++}return a.deleteTexture(G),a.bindFramebuffer(a.FRAMEBUFFER,null),E===0?{difference:0,validPixelCount:E,totalPixelCount:I}:{difference:Q/(E*3),validPixelCount:E,totalPixelCount:I}}catch(m){return console.error("GPU pixel comparison failed:",m),null}}function Co(r,i){if(L.value.initialized&&L.value.supported){const a=ko(r,i);if(a!==null)return ke.value.gpuComparisons++,a}return ke.value.cpuComparisons++,To(r,i)}function To(r,i){const a=Ce(r),c=Ce(i),x=a.width/a.height,m=c.width/c.height;if(Math.abs(x-m)/Math.max(x,m)>.1)return null;let U,G;a.width*a.height>c.width*c.height?(U=c.width,G=c.height):(U=a.width,G=a.height);const K=document.createElement("canvas"),Z=document.createElement("canvas"),y=K.getContext("2d"),A=Z.getContext("2d");if(!y||!A)return null;K.width=U,K.height=G,Z.width=U,Z.height=G,y.drawImage(a,0,0,U,G),A.drawImage(c,0,0,U,G);const N=y.getImageData(0,0,U,G),Q=A.getImageData(0,0,U,G),E=N.data,I=Q.data;let w=0,M=0;const b=U*G;for(let V=0;V<E.length;V+=4){const R=E[V],ee=E[V+1],J=E[V+2],he=I[V],ue=I[V+1],ie=I[V+2];if(R===255&&ee===255&&J===255&&(he===255&&ue===255&&ie===255))continue;const re=R/255,oe=ee/255,_e=J/255,ne=he/255,Te=ue/255,De=ie/255;w+=Math.abs(re-ne)+Math.abs(oe-Te)+Math.abs(_e-De),M++}return M===0?{difference:0,validPixelCount:M,totalPixelCount:b}:{difference:w/(M*3),validPixelCount:M,totalPixelCount:b}}async function mt(r){if(!L.value.initialized){console.warn("GPU pixel comparison not initialized");return}console.log(`Preloading ${r.length} images to GPU...`);const i=performance.now(),a=10;let c=0;for(let m=0;m<r.length;m+=a){const _=r.slice(m,m+a);await Promise.all(_.map(async T=>{await gt(T)&&c++})),m+a<r.length&&await new Promise(T=>setTimeout(T,0))}const x=performance.now()-i;ke.value.gpuPreloadTime=x,ke.value.gpuTextureCount=Y.value.textures.size,console.log(`GPU preloading completed: ${c}/${r.length} images in ${x.toFixed(2)}ms`),console.log(`GPU textures cached: ${ke.value.gpuTextureCount}`)}async function Do(r){console.log(`Caching pixel data for ${r.length} images...`);const i=performance.now();if(L.value.initialized&&L.value.supported)console.log("Using GPU preloading for pixel data..."),await mt(r);else{console.log("GPU preloading not available, using CPU caching...");const c=5;for(let x=0;x<r.length;x+=c){const m=r.slice(x,x+c);await Promise.all(m.map(async _=>{if(!se.value.processedImages.has(_.id))try{ut(_)}catch(T){console.warn(`Failed to cache pixel data for ${_.file.name}:`,T)}})),x+c<r.length&&await new Promise(_=>setTimeout(_,0))}}const a=performance.now()-i;console.log(`Pixel data caching completed in ${a.toFixed(2)}ms`)}async function Fo(r){console.log(`Detecting white background for ${r.length} images...`);const i=10;for(let a=0;a<r.length;a+=i){const c=r.slice(a,a+i);await Promise.all(c.map(async x=>
41{if(!x.whiteBackgroundInfo)try{x.whiteBackgroundInfo=it(x,He,rt)}catch(m){console.warn(`Failed to detect white background for ${x.file.name}:`,m)}})),a+i<r.length&&await new Promise(x=>setTimeout(x,0))}}async function So(r,i=512){const a=performance.now();return new Promise((c,x)=>{const m=new Image;m.onload=()=>{const _=Math.min(i/m.naturalWidth,i/m.naturalHeight,1),T=Math.round(m.naturalWidth*_),U=Math.round(m.naturalHeight*_),G=document.createElement("canvas");G.width=T,G.height=U;const K=G.getContext("2d");if(!K)return x(new Error("Failed to get canvas context"));K.drawImage(m,0,0,T,U);const Z=G.toDataURL("image/png"),y=new Image;y.onload=()=>{const A=performance.now();xo.value.imageScaling+=A-a,c({url:Z,element:y})},y.onerror=x,y.src=Z},m.onerror=x,m.src=URL.createObjectURL(r)})}function Eo(){return{pixelDataCache:se,gpuPixelComparison:L,gpuPixelDataCache:Y,hasGPU:dt,gpuInfo:bo,getOrCreateCanvas:Ce,getOrCreatePixelData:ut,clearPixelDataCache:yo,preloadImageToGPU:gt,initializeGPUPixelComparison:Po,calculatePixelDifference:Co,preloadAllImagesToGPU:mt,cacheAllPixelData:Do,detectWhiteBackgroundForAllImages:Fo,createScaledImage:So}}const ft=S(new Map),Uo=S(new Map),Ro=S([]),$o=S(new Map),Ao=S(1);function Bo(){const r=[],i=[];return ft.value.forEach(a=>{(a.whiteBackgroundInfo||it(a,He,rt)).isWhiteBackground?r.push(a):i.push(a)}),{whiteBackgroundImages:r,nonWhiteBackgroundImages:i}}function Go(){return{uploadedImages:ft,personGroups:Uo,allFaces:Ro,globalFaceIdentities:$o,personCounter:Ao,separateImagesByBackground:Bo}}const zo={class:"bg-white rounded-lg shadow-md p-3 mb-4"},Mo={class:"relative z-10 flex flex-col items-center justify-center py-4 px-3 text-center"},No={class:"flex flex-wrap gap-2 justify-center"},Lo={class:"flex items-center gap-2"},jo={class:"mt-1 text-gray-600"},Wo={key:0},Ho={key:1},Oo={key:0,class:"mt-1 text-gray-500 text-xs"},Xo={key:1,class:"mt-1 text-blue-600 text-xs"},Vo={key:2,class:"mt-1 text-orange-600 text-xs"},qo={key:1,class:"mt-4 p-4 bg-blue-50 rounded-lg"},Ko={class:"max-w-4xl mx-auto"},Zo={class:"text-sm text-blue-700 space-y-3"},Yo={class:"flex justify-center"},Qo={key:2,class:"mt-4 p-4 bg-gray-50 rounded-lg"},Jo={class:"max-w-4xl mx-auto"},ea={class:"text-sm text-gray-700 space-y-3"},ta={key:0},oa={key:1},aa={key:2,class:"font-medium text-blue-700"},sa={key:3,class:"text-sm text-gray-600"},na=nt({__name:"KontextUpload",props:{processingStatus:{default:"idle"},hasGPU:{type:Boolean,default:!1},gpuInfo:{default:null},gpuPixelComparison:{default:null},errorMessage:{default:""}},emits:["upload","clear"],setup(r,{emit:i}){const a=r,c=i,x=S(!1),m=S(null),_=S(null),T=W(()=>a.processingStatus==="idle");function U(){m.value&&m.value.click()}function G(){console.log("Additional file input triggered"),_.value?_.value.click():console.error("Additional file input ref not found")}function K(E){const I=E.target.files;if(!I||I.length===0)return;const w=Array.from(I).sort((M,b)=>M.name.localeCompare(b.name));c("upload",w)}function Z(E){const I=E.target.files;if(!I||I.length===0)return;const w=Array.from(I).sort((M,b)=>M.name.localeCompare(b.name));c("upload",w)}function y(E){E.preventDefault(),E.stopPropagation(),x.value=!0}function A(E){E.preventDefault(),E.stopPropagation(),x.value=!1}function N(E){E.preventDefault(),E.stopPropagation(),x.value=!0}function Q(E){E.preventDefault(),E.stopPropagation(),x.value=!1;const I=E.dataTransfer?.files;if(I&&I.length>0){const w=Array.from(I).sort((M,b)=>M.name.localeCompare(b.name));c("upload",w)}}return(E,I)=>{const w=lt;return f(),v("div",zo,[T.value?(f(),v("div",{key:0,class:X(["relative overflow-hidden bg-gradient-to-br from-blue-50 to-indigo-50 rounded-lg shadow-sm p-3",{"ring-1 ring-blue-300 bg-blue-50":x.value}]),onDragenter:y,onDragleave:A,onDragover:N,onDrop:Q},[I[2]||(I[2]=t("div",{class:"absolute inset-0 border-2 border-dashed border-blue-300 rounded-lg pointer-events-none"},null,-1)),t("div",Mo,[I[1]||(I[1]=Vt('<div class="mb-2 bg-blue-100 p-1.5 rounded-full"><svg class="w-5 h-5 text-blue-500" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"></path></svg></div>
41<h2 class="text-base font-bold text-gray-800 mb-1"> Upload Multiple Images </h2><p class="text-gray-600 mb-2 text-xs max-w-sm"> Drag and drop your image files here, or click to browse </p><div class="flex flex-wrap justify-center gap-1 mb-2"><span class="px-1 py-0.5 bg-blue-100 text-blue-700 rounded-full text-xs font-medium">.jpg</span><span class="px-1 py-0.5 bg-blue-100 text-blue-700 rounded-full text-xs font-medium">.jpeg</span><span class="px-1 py-0.5 bg-blue-100 text-blue-700 rounded-full text-xs font-medium">.png</span><span class="px-1 py-0.5 bg-blue-100 text-blue-700 rounded-full text-xs font-medium">.webp</span></div>',4)),t("div",No,[B(w,{color:"primary",variant:"solid",size:"sm",icon:"i-heroicons-cloud-arrow-up",onClick:U},{default:H(()=>[...I[0]||(I[0]=[$(" Select Image Files ",-1)])]),_:1})]),t("input",{ref_key:"fileInput",ref:m,type:"file",multiple:"",accept:"image/png, image/jpeg, image/jpg, image/webp",class:"hidden",onChange:K},null,544),t("div",{class:X(["mt-3 p-2 rounded-lg text-xs",r.hasGPU?"bg-green-50 border border-green-200":"bg-amber-50 border border-amber-200"])},[t("div",Lo,[t("div",{class:X(["w-2 h-2 rounded-full",r.hasGPU?"bg-green-500":"bg-amber-500"])},null,2),t("span",{class:X(["font-medium",r.hasGPU?"text-green-700":"text-amber-700"])},h(r.hasGPU?"GPU Detected":"No GPU Detected"),3)]),t("div",jo,[r.hasGPU?(f(),v("span",Wo,"✅ Face detection, white background detection, and pixel similarity grouping enabled")):(f(),v("span",Ho,"⚠️ Only basic image processing available (face detection, white background detection, and pixel similarity grouping disabled)"))]),r.gpuInfo?(f(),v("div",Oo,h(r.gpuInfo.name)+" ("+h(r.gpuInfo.vendor)+") ",1)):P("",!0),r.hasGPU&&r.gpuPixelComparison?.initialized?(f(),v("div",Xo," 🚀 GPU-accelerated pixel comparison enabled ")):P("",!0),r.hasGPU&&!r.gpuPixelComparison?.initialized?(f(),v("div",Vo," ⚠️ GPU pixel comparison not available (falling back to CPU) ")):P("",!0)],2)])],34)):P("",!0),!T.value&&r.processingStatus==="complete"?(f(),v("div",qo,[t("div",Ko,[I[5]||(I[5]=t("h3",{class:"text-lg font-semibold text-blue-800 mb-3"},"Add More Images",-1)),t("div",Zo,[I[4]||(I[4]=t("p",null,' You can add more images to your library without reprocessing the existing ones. New images will appear in the "Not added" tab and can be organized into your groups. ',-1)),t("div",Yo,[B(w,{color:"primary",variant:"solid",size:"sm",icon:"i-heroicons-plus",onClick:G},{default:H(()=>[...I[3]||(I[3]=[$(" Add More Images ",-1)])]),_:1}),t("input",{ref_key:"additionalFileInput",ref:_,type:"file",multiple:"",accept:"image/png, image/jpeg, image/jpg, image/webp",class:"hidden",onChange:Z},null,544)])])])])):P("",!0),T.value?(f(),v("div",Qo,[t("div",Jo,[I[11]||(I[11]=t("h3",{class:"text-lg font-semibold text-gray-800 mb-3"}," About This Tool ",-1)),t("div",ea,[I[8]||(I[8]=t("p",null," Use this free tool to create training dataset for Flux dev Kontext images. You can create image pairs for start and end images or image triplets to add a reference image for character, person, or object. ",-1)),I[9]||(I[9]=t("p",null,[t("strong",null,"Upload Options:")],-1)),I[10]||(I[10]=t("ul",{class:"list-disc list-inside space-y-1 ml-4"},[t("li",null,[t("strong",null,"Select Image Files:"),$(" Choose individual image files from anywhere on your computer")])],-1)),r.hasGPU?(f(),v("p",ta," It automatically groups the images based on similarity and face recognition. After grouping, images are automatically sorted by the number of people they contain - images with fewer people are assigned to 'start' and images with more people are assigned to 'end'. These groups are not perfect, so so you can improve the grouping using the intuitive drag-and-drop UI. ")):(f(),v("p",oa,[...I[6]||(I[6]=[t("span",{class:"text-amber-600 font-medium"},"⚠️ GPU Required:",-1),$(" This tool requires a GPU for advanced features like face detection, white background detection, and pixel similarity grouping. Without a GPU, only basic image processing is available. ",-1)])])),r.hasGPU?(f(),v("p",aa," 💡 This tool should save 10-30 minutes of boring work for every 100 images. ")):P("",!0),r.hasGPU?(f(),v("p",sa,[...I[7]||(I[7]=[t("strong",null,"New:",-1),$(" Automatic sorting by peo
41ple count and global exchange button for quick start/end swapping. ",-1)])])):P("",!0)])])])):P("",!0)])}}}),la=Object.assign(na,{__name:"ToolsKontextUpload"}),ia={key:0,class:"bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded mb-4"},ra={key:1,class:"fixed inset-0 bg-blue-500 bg-opacity-20 border-4 border-dashed border-blue-500 z-50 flex items-center justify-center pointer-events-none"},ca={key:2,class:"flex items-center justify-between p-3 bg-blue-50 rounded-lg"},da={class:"flex items-center gap-3"},ua={class:"text-sm font-semibold text-gray-800"},ga={class:"text-xs text-gray-600"},ma={class:"flex items-center gap-2"},fa={class:"w-20 bg-gray-200 rounded-full h-1.5 overflow-hidden"},va={class:"text-xs font-medium text-gray-700"},pa={key:3,class:"flex items-center justify-between p-3 bg-green-50 rounded-lg animate-fade-in"},ha={class:"flex items-center gap-4"},xa={class:"flex gap-3 text-xs"},ba={class:"text-center"},ya={class:"font-bold text-blue-600"},wa={class:"text-center"},_a={class:"font-bold text-green-600"},Ia={class:"text-center"},Pa={class:"font-bold text-purple-600"},ka={class:"text-center"},Ca={class:"font-bold text-orange-600"},Ta={key:0,class:"flex gap-3 text-xs border-l border-gray-300 pl-3"},Da={class:"text-center"},Fa={class:"font-bold text-emerald-600"},Sa={class:"text-center"},Ea={class:"font-bold text-gray-600"},Ua={key:4,class:"mb-6"},Ra={class:"border-b border-gray-200"},$a={class:"-mb-px flex space-x-8"},Aa={key:5},Ba={key:0,class:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4 max-h-[70vh] overflow-y-auto"},Ga=["data-image-id"],za={class:"relative"},Ma=["src","alt"],Na={class:"p-3"},La={class:"text-sm font-medium text-gray-900 truncate"},ja={class:"text-xs text-gray-500"},Wa={key:0,class:"text-xs text-gray-400"},Ha={key:1,class:"bg-white rounded-lg shadow-md p-6"},Oa={class:"space-y-6"},Xa={key:0},Va={class:"bg-blue-50 rounded-lg p-4 mb-4"},qa={class:"grid grid-cols-1 md:grid-cols-2 gap-4"},Ka={class:"text-2xl font-bold text-blue-600"},Za={class:"text-2xl font-bold text-green-600"},Ya={class:"space-y-3"},Qa={class:"flex justify-between items-center p-3 bg-gray-50 rounded border"},Ja={class:"text-right"},es={class:"text-sm font-bold text-gray-800"},ts={class:"text-xs text-gray-500"},os={class:"flex justify-between items-center p-3 bg-gray-50 rounded border"},as={class:"text-right"},ss={class:"text-sm font-bold text-gray-800"},ns={class:"text-xs text-gray-500"},ls={class:"flex justify-between items-center p-3 bg-gray-50 rounded border"},is={class:"text-right"},rs={class:"text-sm font-bold text-gray-800"},cs={class:"text-xs text-gray-500"},ds={class:"flex justify-between items-center p-3 bg-gray-50 rounded border"},us={class:"text-right"},gs={class:"text-sm font-bold text-gray-800"},ms={class:"text-xs text-gray-500"},fs={class:"flex justify-between items-center p-3 bg-gray-50 rounded border"},vs={class:"text-right"},ps={class:"text-sm font-bold text-gray-800"},hs={class:"text-xs text-gray-500"},xs={class:"mt-4 p-3 bg-yellow-50 rounded border"},bs={class:"grid grid-cols-2 gap-4 text-xs"},ys={class:"font-medium text-gray-800 ml-1"},ws={class:"font-medium text-gray-800 ml-1"},_s={class:"font-medium text-gray-800 ml-1"},Is={class:"font-medium text-gray-800 ml-1"},Ps={class:"font-medium text-gray-800 ml-1"},ks={key:2},Cs={key:0,class:"mb-4 bg-white rounded-lg shadow-md p-4"},Ts={class:"flex items-center justify-between"},Ds={class:"text-sm text-gray-600"},Fs={key:0,class:"text-xs text-blue-600 mt-1"},Ss={key:1,class:"text-xs text-gray-500 mt-1"},Es={class:"flex items-center gap-3"},Us={key:0,class:"flex items-center gap-2"},Rs={class:"text-sm text-gray-600"},$s={key:1,class:"text-xs text-amber-600 mt-1"},As={key:1,class:"flex h-[70vh]"},Bs={class:"w-7/12 overflow-y-auto pr-4",style:{"scroll-behavior":"smooth"}},Gs={class:"space-y-4"},zs={class:"grid gap-4"},Ms={class:"bg-white p-3 border-b border-gray-200"},Ns={class:"flex items-center justify-between"},Ls={class:"flex-1"},js={class:"flex items-center gap-3"},Ws={class:"flex-1 max-w-xs"},Hs=["onUpdate:modelValue"],Os={class:"text-base font-semibold text-gray-800 whitespace-nowrap"},Xs={class:"flex items-center gap-3"},Vs={class:"text-center"},qs={class:"text-lg font-bold text-blue-600"},Ks={class:"text-xs text-gray-500"},Zs={class:"p-4"},Ys={class:"grid gap-4",style:{"grid-template-columns":"1fr 1fr 0.6fr"}},Qs={class:"relative group"},Js=["onDragover","onDrop"],en={key:0},tn=["src","alt"],on={class:"absolute inset-0 flex items-center justify-between opacity-0 group-hover:opacity-100 transition-opacity duration-200 pointer-events-none px-2"},an={key:1,class:"w-full h-40 bg-gray-100 border-2 border-dashed border-gray-300 rounded flex flex-col items-center justify-center hover:border-blue-400 transition-colors duration-150"},sn={key:0,class:"absolute top-2 right-2 bg-blue-500 text-white text-xs px-1 py-1 rounded"},nn={class:"mt-2 text-sm text-gray-700 truncate font-medium"},ln={key:1,class:"text-xs text-gray-500"},rn={key:2,class:"text-xs text-blue-600 font-medium"},cn={class:"relative group"},dn=["onDragover","onDrop"],un={key:0},gn=["src","alt"],mn={class:"absolute inset-0 flex items-center justify-between opacity-0 group-hover:opacity-100 transition-opacity duration-200 pointer-events-none px-2"},fn={key:1,class:"w-full h-40 bg-gray-100 border-2 border-dashed border-gray-300 rounded flex flex-col items-center justify-center hover:border-green-400 transition-colors duration-150"},vn={class:"mt-2 text-sm text-gray-700 truncate font-medium"}
41,pn={key:0,class:"text-xs text-gray-500"},hn={key:1,class:"text-xs text-green-600 font-medium"},xn={class:"relative group"},bn=["onDragover","onDrop"],yn={key:0},wn=["src","alt"],_n={class:"absolute inset-0 flex items-center justify-between opacity-0 group-hover:opacity-100 transition-opacity duration-200 pointer-events-none px-2"},In={key:1,class:"w-full h-40 bg-gray-100 border-2 border-dashed border-gray-300 rounded flex flex-col items-center justify-center hover:border-emerald-400 transition-colors duration-150"},Pn={class:"mt-2 text-sm text-gray-700 truncate font-medium"},kn={key:0,class:"text-xs text-gray-500"},Cn={key:1,class:"text-xs text-emerald-600 font-medium"},Tn={key:2,class:"text-xs text-blue-600 font-medium"},Dn={key:0,class:"mt-4"},Fn={class:"grid grid-cols-2 md:grid-cols-3 lg:grid-cols-4 gap-3"},Sn=["onDragstart"],En=["src","alt"],Un={class:"p-2"},Rn={class:"text-xs font-medium text-gray-800 truncate"},$n={class:"text-xs text-gray-600 mt-1"},An={class:"text-green-600"},Bn={class:"text-blue-600 font-medium"},Gn={key:0,class:"text-center text-xs text-gray-500 mt-2"},zn={class:"w-5/12 bg-gray-50 border-l border-gray-200 overflow-y-auto",style:{"scroll-behavior":"smooth","max-height":"70vh"}},Mn={class:"sticky top-0 bg-gray-50 border-b border-gray-200 p-4 z-10"},Nn={class:"mb-3"},Ln={class:"flex space-x-1 mt-3"},jn={class:"bg-white bg-opacity-20 px-1.5 py-0.5 rounded text-xs"},Wn={class:"bg-white bg-opacity-20 px-1.5 py-0.5 rounded text-xs"},Hn={class:"text-xs text-gray-500 mt-2"},On={class:"p-4"},Xn={key:0,class:"grid grid-cols-3 gap-2"},Vn=["onDragstart"],qn={class:"aspect-square"},Kn=["src","alt"],Zn={key:0,class:"absolute top-1 left-1 bg-gray-600 text-white rounded-full px-1.5 py-0.5 text-xs font-medium"},Yn=["onClick"],Qn={key:2,class:"absolute top-1 right-6 bg-green-500 text-white rounded-full w-4 h-4 flex items-center justify-center"},Jn={class:"absolute bottom-0 left-0 right-0 bg-gradient-to-t from-black to-transparent"},el={class:"text-xs opacity-75 text-white"},tl={key:0,class:"ml-1"},ol={key:1,class:"text-center py-8 text-gray-500"},al={key:0},sl={key:1},nl={key:2,class:"text-center py-8 text-gray-500"},ll={key:6,class:"text-center py-8"},il={class:"mt-2 text-gray-600"},rl={key:0,class:"mt-1 text-sm text-amber-600"},cl={class:"space-y-4"},dl={key:0,class:"mt-1 text-sm text-red-600"},ul={class:"bg-blue-50 p-3 rounded-lg"},gl={class:"flex items-start gap-2"},ml={class:"text-sm text-blue-800"},fl={class:"text-xs space-y-1"},vl={class:"flex justify-end gap-3"},pl=6,hl=nt({__name:"kontext-data-formatter",setup(r){let i=null;const{hasGPU:a,gpuInfo:c,clearPixelDataCache:x,gpuPixelComparison:m,gpuPixelDataCache:_,initializeGPUPixelComparison:T,calculatePixelDifference:U,cacheAllPixelData:G,detectWhiteBackgroundForAllImages:K,createScaledImage:Z}=Eo(),{uploadedImages:y,allFaces:A,personGroups:N,globalFaceIdentities:Q,personCounter:E,separateImagesByBackground:I}=Go(),{performanceMetrics:w,processingState:M,processTiming:b}=ct(),k=S([]),V=S(!1),R=S("idle"),ee=S(""),J=S("images"),he=S(""),ue=S(0),ie=S(!1),ge=S(0),we=S(!1),re=S(""),oe=S(""),_e=S(null),ne=S(null),Te=S(!1),De=S(0),me=S("not-added"),ce=W(()=>a.value),xe=W(()=>a.value);let de=null;async function vt(){console.log(`Calculating similarities for ${le.value.length} non-white background images...`);const o=performance.now();await G(le.value);const e=Je(le.value),n=[];for(let d=0;d<le.value.length;d++){for(let p=d+1;p<le.value.length;p++){const l=le.value[d],u=le.value[p],g=Fe(l,e),F=Fe(u,e);if(g===F&&g!=="uncategorized")continue;const q=Dt(l,u),O=Ft(l,u),te=mo*q+fo*O;n.push({image1:l,image2:u,weightedSimilarity:te,faceSimilarity:q,pixelSimilarity:O})}d%10===0&&await new Promise(p=>setTimeout(p,0))}const s=performance.now()-o;return console.log(`Batch similarity calculation completed in ${s.toFixed(2)}ms`),n}function Fe(o,e){return e.start.includes(o)?"start":e.end.includes(o)?"end":e.reference.includes(o)?"reference":"uncategorized"}const Ae=W(()=>y.value.size),pt=W(()=>A.value.length),ht=W(()=>N.value.size),xt=W(()=>k.value.filter(o=>o.pixelDifference!==null).length),Oe=W(()=>Ae.value===0?0:M.value.isProcessing&&R.value==="comparing"?M.value.totalComparisons>0?M.value.processedComparisons/M.value.totalComparisons*100:0:ue.value/Ae.value*100);qt(async()=>{try{console.log("Detecting GPU...");const o=await detectGPU();a.value=o.hasGPU,c.value=o.gpuInfo,a.value?(console.log("Initializing GPU pixel comparison..."),T()?console.log("GPU pixel comparison initialized successfully"):console.warn("Failed to initialize GPU pixel comparison, falling back to CPU"),console.log("GPU detected, loading face-api.js library..."),i=await Kt(()=>import("./CD9jNrC-.js"),[],import.meta.url),console.log("Face-api.js library loaded, loading models..."),await Promise.all([i.nets.ssdMobilenetv1.loadFromUri("/models"),i.nets.faceLandmark68Net.loadFromUri("/models"),i.nets.faceRecognitionNet.loadFromUri("/models"),i.nets.ageGenderNet.loadFromUri("/models")]),V.value=!0,console.log("Face-api models loaded successfully")):(console.log("No GPU detected, skipping face-api model loading and GPU pixel comparison"),V.value=!0,ee.value="No GPU detected. Face detection, white background detection, and pixel similarity grouping are disabled. Only basic image processing is available.")}catch(o){console.error("Failed to load face-api models",o),ee.value="Failed to load face-api models. Make sure the models directory contains all required files including age-gender model.",R.value="error"}});function Be(o){o.url&&(URL.revokeObjectURL(o.url),o.url=""),o.scaledUrl&&(URL.revokeObjectURL(o.scaledUrl),o.scaledUrl=""),o.element=null,o.canvas=null,o.scaledElement=null}async function bt(){if(!ce.value||A.value.length===0)return;console.log(`Processing ${A.value.length}
41 faces efficiently...`);const o=performance.now();Q.value.clear(),E.value=1,N.value.clear();const e=.6,n=20,s=new Set;for(const l of A.value){if(s.has(l.id))continue;const u=`Person ${E.value++}`;l.globalPersonId=u,l.personId=u,Q.value.set(l.id,u),s.add(l.id);const g={personId:u,faces:[l],imageIds:new Set([l.imageId])};l.matchConfidence=100,l.distanceToGroup=0;for(const F of A.value){if(s.has(F.id))continue;if(!i)throw new Error("Face-api.js not loaded");const q=i.euclideanDistance(l.descriptor,F.descriptor);if(q<e){const O=Math.max(0,Math.round((1-q/e)*100));O>=n&&(!l.gender||!F.gender||l.gender===F.gender)&&(F.globalPersonId=u,F.personId=u,F.distanceToGroup=q,F.matchConfidence=O,Q.value.set(F.id,u),g.faces.push(F),g.imageIds.add(F.imageId),s.add(F.id))}}N.value.set(u,g)}const d=performance.now()-o;console.log(`Efficient face processing completed in ${d.toFixed(2)}ms`),console.log(`Assigned ${E.value-1} global person identities`);const p=new Map;A.value.forEach(l=>{l.globalPersonId&&p.set(l.globalPersonId,(p.get(l.globalPersonId)||0)+1)})}async function yt(o){const e=y.value.get(o);if(!e||e.processed)return;performance.now();const n=e.scaledElement;if(n){if(await new Promise(s=>{n.complete?s(!0):n.onload=s}),e.element=n,ce.value){if(e.faces=[],e.detections=[],!i)throw new Error("Face-api.js not loaded");const s=await i.detectAllFaces(n).withFaceLandmarks().withFaceDescriptors().withAgeAndGender();e.detections=s,s.forEach((d,p)=>{const l=`${o}_face_${p}`,u={x:d.detection.box.x,y:d.detection.box.y,width:d.detection.box.width,height:d.detection.box.height},g={id:l,imageId:o,descriptor:d.descriptor,detection:d.detection,boundingBox:u,gender:d.gender,genderConfidence:d.genderProbability};e.faces.push(g),A.value.push(g)})}else e.detections=[],e.faces=[];e.processed=!0}}
41function Xe(){if(y.value.forEach(e=>Be(e)),y.value.clear(),N.value.clear(),k.value=[],A.value=[],Q.value.clear(),E.value=1,R.value="idle",ue.value=0,he.value="",J.value="images",M.value={isProcessing:!1,currentBatch:0,totalBatches:0,processedComparisons:0,totalComparisons:0,canCancel:!1},Se.value=[],le.value=[],m.value.initialized&&m.value.gl){const e=m.value.gl;_.value.textures.forEach(n=>{e.deleteTexture(n.texture)}),_.value.textures.clear(),_.value.preloadedImages.clear(),console.log("GPU resources cleared")}x();const o=document.querySelector('input[type="file"]');o&&(o.value="")}function Ie(o){if(!ce.value)return[];const e=y.value.get(o);if(!e)return[];const n=new Set;return e.faces.forEach(s=>{s.globalPersonId&&n.add(s.globalPersonId)}),Array.from(n)}function wt(){k.value.forEach(o=>{const e=D.value(o,1),n=D.value(o,2);if(e&&n){o.slot1ImageId=n,o.slot2ImageId=e;const s=o.image1Id,d=o.image1Name;o.image1Id=o.image2Id,o.image1Name=o.image2Name,o.image2Id=s,o.image2Name=d}})}function Ve(o,e){if(_e.value=e,Te.value=!0,De.value=performance.now(),o.dataTransfer){o.dataTransfer.effectAllowed="move",o.dataTransfer.setData("text/plain",e);const n=new Image;n.src="data:image/gif;base64,R0lGODlhAQABAIAAAAUEBAAAACwAAAAAAQABAAACAkQBADs=",o.dataTransfer.setDragImage(n,0,0)}}function Ge(o,e,n){o.preventDefault(),o.dataTransfer&&(o.dataTransfer.dropEffect="move"),de&&clearTimeout(de),de=setTimeout(()=>{ne.value={groupIndex:e,slotNumber:n}},10)}function ze(){de&&clearTimeout(de),de=setTimeout(()=>{ne.value=null},50)}function Me(o,e,n){o.preventDefault();const s=performance.now();console.log(`Drop operation took: ${s-De.value}ms`);const d=o.dataTransfer?.getData("text/plain")||_e.value;d&&oo(()=>{_t(e,n,d),_e.value=null,ne.value=null,Te.value=!1,de&&(clearTimeout(de),de=null)})}function _t(o,e,n){const s=k.value;if(o>=s.length)return;const d=s[o],p=y.value.get(n)?.file.name||"";e===1?(d.slot1ImageId=n,d.slot1Removed=!1,d.image1Id=n,d.image1Name=p):e===2?(d.slot2ImageId=n,d.slot2Removed=!1,d.image2Id=n,d.image2Name=p):e===3&&(d.slot3ImageId=n,d.slot3Removed=!1),k.value=[...s]}function Ne(o,e){const n=k.value;if(o>=n.length)return;const s=n[o];e===1?(s.slot1ImageId=void 0,s.slot1Removed=!0,s.image1Name=y.value.get(s.image1Id)?.file.name||""):e===2?(s.slot2ImageId=void 0,s.slot2Removed=!0,s.image2Name=y.value.get(s.image2Id)?.file.name||""):e===3&&(s.slot3ImageId=void 0,s.slot3Removed=!0),k.value=[...n]}function It(o){const e=k.value;o>=e.length||(e.splice(o,1),k.value=[...e])}function qe(o,e){const n=k.value;if(o>=n.length||e<=1)return;const s=n[o],d=D.value(s,e),p=D.value(s,e-1);d&&(e===2?(s.slot2ImageId=p||void 0,s.slot2Removed=!p,s.slot1ImageId=d,s.slot1Removed=!1,s.image1Id=d,s.image1Name=y.value.get(d)?.file.name||"",p&&(s.image2Id=p,s.image2Name=y.value.get(p)?.file.name||"")):e===3&&(s.slot3ImageId=p||void 0,s.slot3Removed=!p,s.slot2ImageId=d,s.slot2Removed=!1,s.image2Id=d,s.image2Name=y.value.get(d)?.file.name||""),k.value=[...n])}function Ke(o,e){const n=k.value;if(o>=n.length||e>=3)return;const s=n[o],d=D.value(s,e),p=D.value(s,e+1);d&&(e===1?(s.slot1ImageId=p||void 0,s.slot1Removed=!p,s.slot2ImageId=d,s.slot2Removed=!1,s.image1Id=p||s.image1Id,s.image1Name=y.value.get(p||s.image1Id)?.file.name||"",s.image2Id=d,s.image2Name=y.value.get(d)?.file.name||""):e===2&&(s.slot2ImageId=p||void 0,s.slot2Removed=!p,s.slot3ImageId=d,s.slot3Removed=!1,s.image2Id=p||s.image2Id,s.image2Name=y.value.get(p||s.image2Id)?.file.name||""),k.value=[...n])}const D=W(()=>(o,e)=>e===1?o.slot1Removed?null:o.slot1ImageId||o.image1Id:e===2?o.slot2Removed?null:o.slot2ImageId||o.image2Id:e===3?o.slot3Removed?null:o.slot3ImageId||o.matchingWhiteBackgroundImages?.[0]?.imageId:null),be=W(()=>(o,e)=>{const n=D.value(o,e);return n&&y.value.get(n)?.file.name||""}),Ze=W(()=>o=>!o.matchingWhiteBackgroundImages||o.matchingWhiteBackgroundImages.length===0?0:o.matchingWhiteBackgroundImages[0].confidence),fe=W(()=>(o,e)=>e===1?!!o.slot1ImageId:e===2?!!o.slot2ImageId:e===3?!!o.slot3ImageId:!1),Se=S([]),le=S([]),Pe=W(()=>{const o=new Set;return k.value.forEach(e=>{const n=D.value(e,1),s=D.value(e,2),d=D.value(e,3);n&&o.add(n),s&&o.add(s),d&&o.add(d)}),o}),Ee=W(()=>{const o=Array.from(y.value.entries()),e=Pe.value;return me.value==="not-added"?o.filter(([n])=>!e.has(n)):o.filter(([n])=>e.has(n))}),Pt=W(()=>Se.value.length),kt=W(()=>le.value.length),Ct=W(()=>{const o=Pe.value;return Array.from(y.value.keys()).filter(e=>!o.has(e)).length}),Tt=W(()=>Pe.value.size),Ue=W(()=>{if(k.value.length===0)return!1;for(const o of k.value){const e=!!D.value(o,1),n=!!D.value(o,2),s=!!D.value(o,3);if(!e||!n||!s)return!1}return!0});async function Ye(o){if(k.value.length===0){ee.value="No image groups available for download";return}if(!(o&&!Gt(o))){ie.value=!0,ge.value=0;try{const e=[];let n=0;const s=o?At(o):"image_groups";
41for(let g=0;g<k.value.length;g++){const F=k.value[g],q=(g+1).toString().padStart(3,"0");for(let O=1;O<=3;O++){const te=D.value(F,O);if(te){const ve=y.value.get(te);if(ve&&ve.file){let z="";O===1?z="start":O===2?z="end":O===3&&(z="reference");const j=`${s}_${q}.png`,ae=`${z}/${j}`;e.push({name:ae,input:ve.file})}}}if(F.instruction&&F.instruction.trim()){const O=`${s}_${q}_instructions.txt`,te=F.instruction.trim();e.push({name:`instructions/${O}`,input:new Blob([te],{type:"text/plain"})})}n++,ge.value=n/k.value.length*50}console.log("Processing stitched images...");const d=await zt(k.value,s);if(e.push(...d),ge.value=50+d.length/k.value.length*50,e.length===0){ee.value="No images found to download";return}const p=await no(e).blob(),l=URL.createObjectURL(p),u=document.createElement("a");u.href=l,u.download=`${s}.zip`,document.body.appendChild(u),u.click(),document.body.removeChild(u),URL.revokeObjectURL(l),ge.value=100,Qe(),console.log(`Successfully downloaded ${e.length} images in ZIP format as ${s}.zip`),console.log(`Including ${d.length} stitched images (start + reference side by side)`)}catch(e){console.error("Error creating ZIP file:",e),ee.value="Failed to create ZIP file: "+e.message}finally{ie.value=!1,ge.value=0}}}function Dt(o,e){if(!ce.value)return 0;const n=o.faces,s=e.faces;if(n.length===0&&s.length===0)return 1;if(n.length===0||s.length===0)return 0;const d=new Set(n.map(F=>F.globalPersonId).filter(Boolean)),p=new Set(s.map(F=>F.globalPersonId).filter(Boolean)),l=new Set;d.forEach(F=>{p.has(F)&&l.add(F)});const u=Math.max(d.size,p.size);return u>0?l.size/u:0}function Ft(o,e){if(!xe.value)return 0;performance.now();const n=U(o,e);return n===null?0:1-n.difference}function Le(o){if(!ce.value)return"";const e=y.value.get(o);if(!e)return"";const n=new Set;return e.faces.forEach(d=>{d.globalPersonId&&n.add(d.globalPersonId)}),Array.from(n).sort((d,p)=>{const l=parseInt(d.replace("Person ","")),u=parseInt(p.replace("Person ",""));return l-u}).join(", ")}async function St(){console.log("Calculating weighted similarities and creating triplets...");const o=performance.now();x();const e=await vt();e.sort((s,d)=>d.weightedSimilarity-s.weightedSimilarity),Et(e);const n=Ut(e);k.value=n,console.log(`Completed in ${(performance.now()-o).toFixed(2)}ms`)}function Et(o,e=5){console.log(`Calculated ${o.length} image comparisons`),console.log("Top similarities:"),o.slice(0,e).forEach((n,s)=>{console.log(`  ${s+1}. ${n.image1.file.name} ↔ ${n.image2.file.name}`),console.log(`     Weighted: ${(n.weightedSimilarity*100).toFixed(1)}%, Face: ${(n.faceSimilarity*100).toFixed(1)}%, Pixel: ${(n.pixelSimilarity*100).toFixed(1)}%`)})}function Ut(o){const e=new Set,n=[];for(const s of o){if(e.has(s.image1.id)||e.has(s.image2.id))continue;e.add(s.image1.id),e.add(s.image2.id);const d=Rt(s);n.push(d)}return n.sort((s,d)=>d.validPixelCount-s.validPixelCount)}function Rt(o){const e=[],n=Je([o.image1,o.image2]),s=Fe(o.image1,n),d=Fe(o.image2,n);let p,l,u,g;if(s==="start"||d==="start")s==="start"?(p=o.image1.id,l=o.image2.id,u=o.image1.file.name,g=o.image2.file.name):(p=o.image2.id,l=o.image1.id,u=o.image2.file.name,g=o.image1.file.name);else if(s==="end"||d==="end")s==="end"?(p=o.image2.id,l=o.image1.id,u=o.image2.file.name,g=o.image1.file.name):(p=o.image1.id,l=o.image2.id,u=o.image1.file.name,g=o.image2.file.name);else{const F=Ie(o.image1.id),q=Ie(o.image2.id);F.length<=q.length?(p=o.image1.id,l=o.image2.id,u=o.image1.file.name,g=o.image2.file.name):(p=o.image2.id,l=o.image1.id,u=o.image2.file.name,g=o.image1.file.name)}return{image1Id:p,image2Id:l,image1Name:u,image2Name:g,pixelDifference:1-o.weightedSimilarity,aspectRatio:o.image1.element?o.image1.element.naturalWidth/o.image1.element.naturalHeight:1,aspectRatioDifference:0,comparisonSize:{width:0,height:0},validPixelCount:Math.round(o.weightedSimilarity*100),totalPixelCount:100,whitePixelPercentage:0,matchingWhiteBackgroundImages:e,slot1ImageId:void 0,slot2ImageId:void 0,slot3ImageId:void 0,slot1Removed:!1,slot2Removed:!1,slot3Removed:!1,instruction:""}}function $t(){ce.value&&y.value.forEach(o=>{o.faces.length>0&&o.scaledUrl&&(o.url=o.scaledUrl)})}Zt(()=>{if(m.value.initialized&&m.value.gl){const o=m.value.gl;
41_.value.textures.forEach(e=>{o.deleteTexture(e.texture)}),_.value.textures.clear(),_.value.preloadedImages.clear(),m.value.program&&o.deleteProgram(m.value.program),m.value.vertexBuffer&&o.deleteBuffer(m.value.vertexBuffer),m.value.framebuffer&&o.deleteFramebuffer(m.value.framebuffer),console.log("GPU resources cleaned up on component unmount")}});function At(o){return o.trim().toLowerCase().replace(/[^a-z0-9\s]/g,"").replace(/\s+/g,"_").replace(/_+/g,"_").replace(/^_|_$/g,"")}function Bt(){if(k.value.length===0){ee.value="No image groups available for download";return}if(!Ue.value){ee.value="All slots must be filled before downloading";return}re.value="",oe.value="",we.value=!0}function Gt(o){return o.trim()?o.length>50?(oe.value="Download name must be 50 characters or less",!1):/^[a-zA-Z0-9\s_-]+$/.test(o)?(oe.value="",!0):(oe.value="Download name can only contain letters, numbers, spaces, hyphens, and underscores",!1):(oe.value="Download name is required",!1)}function Qe(){we.value=!1,re.value="",oe.value=""}async function zt(o,e){const n=[];for(let s=0;s<o.length;s++){const d=o[s],p=(s+1).toString().padStart(3,"0"),l=D.value(d,1),u=D.value(d,3);if(!l||!u){console.warn(`Skipping stitched image for group ${p}: missing start or reference image`);continue}const g=y.value.get(l),F=y.value.get(u);if(!g?.file||!F?.file){console.warn(`Skipping stitched image for group ${p}: missing file data`);continue}try{const{name:q,blob:O}=await ro(g.file,F.file),te=`${e}_${p}.png`,ve=new File([O],te,{type:"image/png"});n.push({name:`stitched/${te}`,input:ve}),console.log(`Created stitched image for group ${p}: ${te}`)}catch(q){console.error(`Error creating stitched image for group ${p}:`,q)}}return n}async function Mt(o){if(!o||o.length===0||!V.value)return;if(y.value.size>0&&R.value==="complete"){console.log(`Adding ${o.length} more images to existing library`),await je({target:{files:o}});return}console.log("Files sorted alphabetically to ensure consistent processing order"),console.log(`File order: ${o.map(z=>z.name).join(", ")}`);const n=performance.now();R.value="processing",ue.value=0,a.value||console.log("No GPU detected - skipping advanced processing features"),b.value={imageReading:0,imageScaling:0,faceDetection:0,globalFaceGrouping:0,faceSimilarityCalculation:0,pixelSimilarityCalculation:0,weightedSimilarityCalculation:0,whiteBackgroundDetection:0,totalProcessing:0},w.value={totalProcessingTime:0,pixelProcessingTime:0,cacheHits:0,cacheMisses:0,comparisonsProcessed:0,imagesProcessed:0,facesDetected:0,personGroupsCreated:0,gpuComparisons:0,cpuComparisons:0,gpuPreloadTime:0,gpuTextureCount:0},y.value.forEach(z=>Be(z)),y.value.clear(),N.value.clear(),k.value=[],A.value=[],Q.value.clear(),E.value=1,x(),console.log(`Starting image processing for ${o.length} images...`),a.value||console.log("⚠️ GPU not detected - face detection, white background detection, and pixel similarity grouping are disabled");const s=performance.now(),d=o.length;let p=[];for(let z=0;z<d;z++){const j=o[z],ae=`img_${Date.now()}_${z}`;p.push(Z(j,256).then(({url:pe,element:Ot})=>{const Xt={id:ae,file:j,url:URL.createObjectURL(j),element:null,canvas:null,detections:[],faces:[],processed:!1,scaledUrl:pe,scaledElement:Ot};y.value.set(ae,Xt)})),(p.length===pl||z===d-1)&&(await Promise.all(p),p=[],await new Promise(pe=>setTimeout(pe,0)))}const l=performance.now();b.value.imageReading=l-s,console.log(`Image reading and scaling completed in ${b.value.imageReading.toFixed(2)}ms`);const u=performance.now();let g=0;for(const[z,j]of Array.from(y.value.entries()))he.value=j.file.name,await yt(z),ue.value++,g+=j.faces.length,await new Promise(ae=>setTimeout(ae,0));const F=performance.now();if(b.value.faceDetection=F-u,w.value.imagesProcessed=y.value.size,w.value.facesDetected=g,console.log(`Face detection completed in ${b.value.faceDetection.toFixed(2)}ms (${g} faces detected)`),ce.value){const z=performance.now();R.value="grouping",await bt();const j=performance.now();b.value.globalFaceGrouping=j-z,w.value.personGroupsCreated=N.value.size,console.log(`Global face grouping completed in ${b.value.globalFaceGrouping.toFixed(2)}ms (${N.value.size} person groups created)`)}const q=performance.now();
41if(xe.value){await K(Array.from(y.value.values()));const{whiteBackgroundImages:z,nonWhiteBackgroundImages:j}=I();Se.value=z,le.value=j,$t();const ae=performance.now();b.value.whiteBackgroundDetection=ae-q,console.log(`White background detection completed in ${b.value.whiteBackgroundDetection.toFixed(2)}ms`)}else console.log("⚠️ Skipping white background detection (no GPU available)"),Se.value=[],le.value=Array.from(y.value.values());const O=performance.now();if(R.value="comparing",xe.value){const z=performance.now();await St();const j=performance.now();b.value.weightedSimilarityCalculation=j-z,console.log(`Weighted similarity calculation completed in ${b.value.weightedSimilarityCalculation.toFixed(2)}ms`)}else{console.log("⚠️ Skipping similarity calculations (no GPU available)");const z=Array.from(y.value.values());k.value=[];for(let j=0;j<z.length-1;j+=2){const ae=z[j],pe=z[j+1];ae&&pe&&k.value.push({image1Id:ae.id,image2Id:pe.id,image1Name:ae.file.name,image2Name:pe.file.name,pixelDifference:null,aspectRatio:1,aspectRatioDifference:0,comparisonSize:{width:0,height:0},validPixelCount:0,totalPixelCount:0,whitePixelPercentage:0,matchingWhiteBackgroundImages:[],slot1ImageId:void 0,slot2ImageId:void 0,slot3ImageId:void 0,slot1Removed:!1,slot2Removed:!1,slot3Removed:!1})}}const te=performance.now();b.value.faceSimilarityCalculation=te-O,console.log(`Total similarity calculations completed in ${b.value.faceSimilarityCalculation.toFixed(2)}ms`),R.value="complete",J.value="differences";const ve=performance.now();b.value.totalProcessing=ve-n,console.log("=== COMPREHENSIVE PROCESSING TIMING REPORT ==="),console.log(`Total Processing Time: ${b.value.totalProcessing.toFixed(2)}ms (${(b.value.totalProcessing/1e3).toFixed(2)}s)`),console.log("Breakdown by process:"),console.log(`  - Image Reading & Scaling: ${b.value.imageReading.toFixed(2)}ms (${(b.value.imageReading/b.value.totalProcessing*100).toFixed(1)}%)`),console.log(`  - Face Detection: ${b.value.faceDetection.toFixed(2)}ms (${(b.value.faceDetection/b.value.totalProcessing*100).toFixed(1)}%)`),console.log(`  - Global Face Grouping: ${b.value.globalFaceGrouping.toFixed(2)}ms (${(b.value.globalFaceGrouping/b.value.totalProcessing*100).toFixed(1)}%)`),console.log(`  - White Background Detection: ${b.value.whiteBackgroundDetection.toFixed(2)}ms (${(b.value.whiteBackgroundDetection/b.value.totalProcessing*100).toFixed(1)}%)`),console.log(`  - Similarity Calculations: ${b.value.faceSimilarityCalculation.toFixed(2)}ms (${(b.value.faceSimilarityCalculation/b.value.totalProcessing*100).toFixed(1)}%)`),console.log("Performance Metrics:"),console.log(`  - Images Processed: ${w.value.imagesProcessed}`),console.log(`  - Faces Detected: ${w.value.facesDetected}`),console.log(`  - Person Groups Created: ${w.value.personGroupsCreated}`),console.log(`  - Comparisons Processed: ${w.value.comparisonsProcessed}`),console.log(`  - Cache Hits: ${w.value.cacheHits}`),console.log(`  - Cache Misses: ${w.value.cacheMisses}`),console.log(`  - Cache Hit Rate: ${w.value.cacheHits+w.value.cacheMisses>0?(w.value.cacheHits/(w.value.cacheHits+w.value.cacheMisses)*100).toFixed(1):0}%`),console.log("GPU Performance Metrics:"),console.log(`  - GPU Comparisons: ${w.value.gpuComparisons}`),console.log(`  - CPU Comparisons: ${w.value.cpuComparisons}`),console.log(`  - GPU Preload Time: ${w.value.gpuPreloadTime.toFixed(2)}ms`),console.log(`  - GPU Textures Cached: ${w.value.gpuTextureCount}`),console.log(`  - GPU Usage: ${w.value.gpuComparisons+w.value.cpuComparisons>0?(w.value.gpuComparisons/(w.value.gpuComparisons+w.value.cpuComparisons)*100).toFixed(1):0}%`),console.log("===============================================")}function Je(o){const e={start:[],end:[],reference:[],uncategorized:[]};for(const n of o){const s=n.file.name.toLowerCase();s.includes(".start.")||s.includes("_start_")||s.includes("-start-")||s.includes(" start ")?e.start.push(n):s.includes(".end.")||s.includes("_end_")||s.includes("-end-")||s.includes(" end ")?e.end.push(n):s.includes(".reference.")||s.includes("_reference_")||s.includes("-reference-")||s.includes(" reference ")?e.reference.push(n):e.uncategorized.push(n)}return console.log("Image categorization:",{start:e.start.length,end:e.end.length,reference:e.reference.length,uncategorized:e.uncategorized.length}),e}function Nt(o){const e=y.value.get(o);if(e){Be(e),y.value.delete(o),A.value=A.value.filter(n=>n.imageId!==o);for(const[n,s]of N.value.entries())s.imageIds.delete(o),s.imageIds.size===0&&N.value.delete(n);k.value=k.value.filter(n=>!(n.image1Id===o||n.image2Id===o||n.slot1ImageId===o||n.slot2ImageId===o||n.slot3ImageId===o)),console.log(`Image ${e.file.name} deleted from library`)}}async function je(o){console.log("addMoreImages called with event:",o);const e=o.target.files;if(!e||!V.value)return;const n=Array.from(e).sort((d,p)=>d.name.localeCompare(p.name));console.log(`Adding ${n.length} more images to library without reprocessing`);for(let d=0;d<n.length;d++){const p=n[d],l=`img_${Date.now()}_${d}_additional`;try{const{url:u,element:g}=await Z(p,256),F={id:l,file:p,url:URL.createObjectURL(p),element:null,canvas:null,detections:[],faces:[],processed:!1,scaledUrl:u,scaledElement:g};y.value.set(l,F),console.log(`Added image: ${p.name}`)}catch(u){console.error(`Failed to add image ${p.name}:`,u)}}const s=o.target;s&&(s.value=""),console.log(`Successfully added ${n.length} images to library`)}const ye=S(!1),We=S(null);function Lt(o){R.value==="complete"&&o.dataTransfer?.types.includes("Files")&&o.dataTransfer.files.length>0&&(o.preventDefault(),o.stopPropagation(),ye.value=!0)}function jt(o){ye.value&&(o.preventDefault(),o.stopPropagation(),ye.value=!1)}function Wt(o){if(R.value!=="complete"||!ye.value)return;o.preventDefault(),o.stopPropagation(),ye.value=!1;const e=o.dataTransfer?.files;if(e&&e.length>0){const n=Array.from(e).filter(s=>s.type.startsWith("image/"));n.length>0&&(console.log(`Dropped ${n.length} images globally`),je({target:{files:n}}))}}function Ht(){console.log("Sidebar file input triggered"),We.value?We.value.click():console.error("Sidebar file input ref not found")}return(o,e)=>{const n=lt,s=ao,d=so,p=Qt;return f(),Yt(lo,{slug:"kontext-data-formatter","max-width":"6xl"},{default:H(()=>[B(p,null,{default:H(()=>[t("div",{class:"mx-auto font-sans rounded-xl border border-gray-200 bg-white p-4 text-gray-800",onDragover:Lt,onDragleave:jt,onDrop:Wt},[ee.value?(f(),v("div",ia,h(ee.value),1)):P("",!0),ye.value&&R.value==="complete"?(f(),v("div",ra,[...e[10]||(e[10]=[t("div",{class:"bg-white p-6 rounded-lg shadow-lg pointer-events-auto"},[t("div",{class:"text-center"},[t("div",{class:"text-6xl mb-4"},"📁"),t("h3",{class:"text-xl font-bold text-blue-800 mb-2"},"Drop Images Here"),t("p",{class:"text-blue-600"},"Add more images to your library"),t("p",{class:"text-sm text-gray-500 mt-2"},"Drag images from your computer to add them")])],-1)])])):P("",!0),B(la,{"processing-status":R.value,"has-g-p-u":C(a),"gpu-info":C(c),"gpu-pixel-comparison":C(m),"error-message":ee.value,onUpload:Mt,onClear:Xe},null,8,["processing-status","has-g-p-u","gpu-info","gpu-pixel-comparison","error-message"]),R.value==="processing"||R.value==="grouping"||R.value==="comparing"?(f
41(),v("div",ca,[t("div",da,[e[11]||(e[11]=t("div",{class:"w-6 h-6 border-2 border-blue-200 border-t-blue-600 rounded-full animate-spin"},null,-1)),t("div",null,[t("h3",ua,h(R.value==="processing"?"Processing Images":R.value==="grouping"?"Grouping Faces":R.value==="comparing"?"Calculating Differences":"Complete"),1),t("p",ga,h(R.value==="processing"?`Processing: ${he.value}`:"Please wait..."),1)])]),t("div",ma,[t("div",fa,[t("div",{class:"bg-gradient-to-r from-blue-500 to-indigo-600 h-full rounded-full transition-all duration-300 ease-out",style:Jt({width:`${R.value==="processing"?Oe.value:100}%`})},null,4)]),t("span",va,h(R.value==="processing"?Math.round(Oe.value):100)+"% ",1)])])):P("",!0),C(y).size>0&&R.value==="complete"?(f(),v("div",pa,[e[19]||(e[19]=t("div",{class:"flex items-center gap-3"},[t("div",{class:"bg-green-100 p-1.5 rounded-full"},[t("svg",{class:"w-4 h-4 text-green-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"})])]),t("div",null,[t("h2",{class:"text-sm font-bold text-gray-800"}," Images Processed Successfully! "),t("p",{class:"text-xs text-gray-600"}," Ready for review ")])],-1)),t("div",ha,[t("div",xa,[t("div",ba,[t("div",ya,h(Ae.value),1),e[12]||(e[12]=t("div",{class:"text-gray-500"}," Images ",-1))]),t("div",wa,[t("div",_a,h(pt.value),1),e[13]||(e[13]=t("div",{class:"text-gray-500"}," Faces ",-1))]),t("div",Ia,[t("div",Pa,h(ht.value),1),e[14]||(e[14]=t("div",{class:"text-gray-500"}," People ",-1))]),t("div",ka,[t("div",Ca,h(xt.value),1),e[15]||(e[15]=t("div",{class:"text-gray-500"}," Comparisons ",-1))])]),xe.value?(f(),v("div",Ta,[t("div",Da,[t("div",Fa,h(kt.value),1),e[16]||(e[16]=t("div",{class:"text-gray-500"}," Non-WB ",-1))]),t("div",Sa,[t("div",Ea,h(Pt.value),1),e[17]||(e[17]=t("div",{class:"text-gray-500"}," White BG ",-1))])])):P("",!0),B(n,{color:"gray",variant:"solid",size:"sm",icon:"i-heroicons-arrow-path",onClick:Xe},{default:H(()=>[...e[18]||(e[18]=[$(" Clear ",-1)])]),_:1})])])):P("",!0),R.value==="complete"?(f(),v("div",Ua,[t("div",Ra,[t("nav",$a,[B(n,{class:X([J.value==="images"?"border-blue-500 text-blue-600":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300","whitespace-nowrap py-2 px-1 border-b-2 font-medium text-sm"]),variant:"ghost",size:"sm",onClick:e[0]||(e[0]=l=>J.value="images")},{default:H(()=>[...e[20]||(e[20]=[$(" All Images ",-1)])]),_:1},8,["class"]),B(n,{class:X([J.value==="differences"?"border-blue-500 text-blue-600":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300","whitespace-nowrap py-2 px-1 border-b-2 font-medium text-sm"]),variant:"ghost",size:"sm",onClick:e[1]||(e[1]=l=>J.value="differences")},{default:H(()=>[...e[21]||(e[21]=[$(" Kontext triplets ",-1)])]),_:1},8,["class"]),B(n,{class:X([J.value==="stats"?"border-blue-500 text-blue-600":"border-transparent text-gray-500 hover:text-gray-700 hover:border-gray-300","whitespace-nowrap py-2 px-1 border-b-2 font-medium text-sm"]),variant:"ghost",size:"sm",onClick:e[2]||(e[2]=l=>J.value="stats")},{default:H(()=>[...e[22]||(e[22]=[$(" Statistics ",-1)])]),_:1},8,["class"])])])])):P("",!0),R.value==="complete"?(f(),v("div",Aa,[J.value==="images"?(f(),v("div",Ba,[(f(!0),v(Re,null,$e(C(y),([l,u])=>(f(),v("div",{key:l,class:"bg-white rounded-lg shadow-md overflow-hidden","data-image-id":l},[t("div",za,[t("img",{src:u.url,alt:u.file.name,class:"w-full h-48 object-cover"},null,8,Ma)]),t("div",Na,[t("p",La,h(u.file.name),1),t("p",ja,h(u.faces.length)+" faces detected ",1),xe.value?(f(),v("p",Wa,h(u.whiteBackgroundInfo?.isWhiteBackground?"White Background":"Non-White Background"),1)):P("",!0)])],8,Ga))),128))])):P("",!0),J.value==="stats"?(f(),v("div",Ha,[e[40]||(e[40]=t("h3",{class:"text-lg font-semibold text-gray-800 mb-4"}," Detailed Statistics ",-1)),t("div",Oa,[C(b).totalProcessing>0?(f(),v("div",Xa,[e[39]||(e[39]=t("h4",{class:"font-medium text-gray-700 mb-3"}," Performance Timing Analysis ",-1)),t("div",Va,[t("div",qa,[t("div",null,[t("div",Ka,h((C(b).totalProcessing/1e3).toFixed(2))+"s ",1),e[23]||(e[23]=t("div",{class:"text-sm text-blue-800"}," Total Processing Time ",-1)),e[24]||(e[24]=t("div",{class:"text-xs text-gray-500"}," Complete pipeline ",-1))]),t("div",null,[t("div",Za,h(C(w).imagesProcessed),1),e[25]||(e[25]=t("div",{class:"text-sm text-green-800"}," Images Processed ",-1)),e[26]||(e[26]=t("div",{class:"text-xs text-gray-500"}," With timing data ",-1))])])]),t("div",Ya,[e[38]||(e[38]=t("h5",{class:"text-sm font-medium text-gray-700 mb-2"}," Processing Breakdown: ",-1)),t("div",Qa,[e[27]||(e[27]=t("div",{class:"flex items-center gap-3"},[t("div",{class:"w-3 h-3 bg-blue-500 rounded-full"}),t("span",{class:"text-sm font-medium text-gray-700"},"Image Reading & Scaling")],-1)),t("div",Ja,[t("div",es,h(C(b).imageReading.toFixed(2))+"ms ",1),t("div",ts,h((C(b).imageReading/C(b).totalProcessing*100).toFixed(1))+"% of total ",1)])]),t("div",os,[e[28]||(e[28]=t("div",{class:"flex items-center gap-3"},[t("div",{class:"w-3 h-3 bg-green-500 rounded-full"}),t("span",{class:"text-sm font-medium text-gray-700"},"Face Detection")],-1)),t("div",as,[t("div",ss,h(C(b).faceDetection.toFixed(2))+"ms ",1),t("div",ns,h((C(b).faceDetection/C(b).totalProcessing*100).toFixed(1))+"% of total ",1)])]),t("div",ls,[e[29]||(e[29]=t("div",{class:"flex items-center gap-3"},[t("div",{class:"w-3 h-3 bg-purple-500 rounded-full"}),t("span",{class:"text-sm font-medium text-gray-700"},"Global Face Grouping")],-1)),t("div",is,[t("div",rs,h(C(b).globalFaceGrouping.toFixed(2))+"ms ",1),t("div",cs,h((C(b).globalFaceGrouping/C(b).totalProcessing*100).toFixed(1))+"% of total ",1)])]),t("div",ds,[e[30]||(e[30]=t("div",{class:"flex items-center gap-3"},[t("div",{class:"w-3 h-3 bg-emerald-500 rounded-full"}),t("span",{class:"text-sm font-medium text-gray-700"}
41,"White Background Detection")],-1)),t("div",us,[t("div",gs,h(C(b).whiteBackgroundDetection.toFixed(2))+"ms ",1),t("div",ms,h((C(b).whiteBackgroundDetection/C(b).totalProcessing*100).toFixed(1))+"% of total ",1)])]),t("div",fs,[e[31]||(e[31]=t("div",{class:"flex items-center gap-3"},[t("div",{class:"w-3 h-3 bg-orange-500 rounded-full"}),t("span",{class:"text-sm font-medium text-gray-700"},"Similarity Calculations")],-1)),t("div",vs,[t("div",ps,h(C(b).faceSimilarityCalculation.toFixed(2))+"ms ",1),t("div",hs,h((C(b).faceSimilarityCalculation/C(b).totalProcessing*100).toFixed(1))+"% of total ",1)])]),t("div",xs,[e[37]||(e[37]=t("h6",{class:"text-sm font-medium text-gray-700 mb-2"}," Performance Metrics: ",-1)),t("div",bs,[t("div",null,[e[32]||(e[32]=t("span",{class:"text-gray-600"},"Faces Detected:",-1)),t("span",ys,h(C(w).facesDetected),1)]),t("div",null,[e[33]||(e[33]=t("span",{class:"text-gray-600"},"Person Groups:",-1)),t("span",ws,h(C(w).personGroupsCreated),1)]),t("div",null,[e[34]||(e[34]=t("span",{class:"text-gray-600"},"Comparisons:",-1)),t("span",_s,h(C(w).comparisonsProcessed),1)]),t("div",null,[e[35]||(e[35]=t("span",{class:"text-gray-600"},"Cache Hit Rate:",-1)),t("span",Is,h(C(w).cacheHits+C(w).cacheMisses>0?(C(w).cacheHits/(C(w).cacheHits+C(w).cacheMisses)*100).toFixed(1):0)+"%",1)]),t("div",null,[e[36]||(e[36]=t("span",{class:"text-gray-600"},"Avg Time/Image:",-1)),t("span",Ps,h(C(w).imagesProcessed>0?(C(b).totalProcessing/C(w).imagesProcessed).toFixed(2):0)+"ms",1)])])])])])):P("",!0)])])):P("",!0),J.value==="differences"?(f(),v("div",ks,[k.value.length>0?(f(),v("div",Cs,[t("div",Ts,[t("div",null,[e[41]||(e[41]=t("h3",{class:"text-lg font-semibold text-gray-800"}," Image Groups ",-1)),t("p",Ds,h(k.value.length)+" groups with "+h(k.value.reduce((l,u)=>{let g=0;return D.value(u,1)&&g++,D.value(u,2)&&g++,D.value(u,3)&&g++,l+g},0))+" total images ",1),ce.value?(f(),v("p",Fs," 💡 Groups created based on weighted similarity (50% face + 50% pixel) - images with matching people and similar pixels are grouped together ")):xe.value?(f(),v("p",Ss," 💡 White background images are automatically filtered and only used for reference slots (Slot 3) ")):P("",!0)]),t("div",Es,[ie.value?(f(),v("div",Us,[e[42]||(e[42]=t("div",{class:"w-4 h-4 border-2 border-blue-200 border-t-blue-600 rounded-full animate-spin"},null,-1)),t("span",Rs,h(Math.round(ge.value))+"%",1)])):P("",!0),B(n,{color:"orange",variant:"solid",size:"sm",title:"Exchange start and end images in all groups",icon:"i-heroicons-arrow-path",onClick:wt},{default:H(()=>[...e[43]||(e[43]=[$(" Exchange Start/End ",-1)])]),_:1}),B(n,{disabled:ie.value||!Ue.value,color:"blue",variant:"solid",size:"sm",title:Ue.value?"Download all images organized in folders (start/end/reference) with instruction files":"All slots must be filled before downloading",icon:"i-heroicons-arrow-down-tray",onClick:Bt},{default:H(()=>[$(h(ie.value?"Creating ZIP...":"Download All Images"),1)]),_:1},8,["disabled","title"]),!Ue.value&&k.value.length>0?(f(),v("div",$s," ⚠️ All slots must be filled before downloading ")):P("",!0)])]),e[44]||(e[44]=t("div",{class:"mt-3 p-3 bg-blue-50 rounded-lg"},[t("div",{class:"flex items-start gap-3"},[t("svg",{class:"w-5 h-5 text-blue-600 mt-0.5 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})]),t("div",{class:"text-sm text-blue-800"},[t("p",{class:"font-medium mb-1"}," ZIP Structure: "),t("ul",{class:"text-xs space-y-1"},[t("li",null,[t("strong",null,"start/"),$(" - Images from Slot 1 (prefix_001.png, prefix_002.png, ...)")]),t("li",null,[t("strong",null,"end/"),$(" - Images from Slot 2 (prefix_001.png, prefix_002.png, ...)")]),t("li",null,[t("strong",null,"reference/"),$(" - Images from Slot 3 (prefix_001.png, prefix_002.png, ...)")]),t("li",null,[t("strong",null,"stitched/"),$(" - Stitched images (prefix_001.png, prefix_002.png, ...)")]),t("li",null,[t("strong",null,"instructions/"),$(" - Instruction text files (prefix_001_instructions.txt, prefix_002_instructions.txt, ...)")])]),t("p",{class:"text-xs mt-2 opacity-75"},[$(" Images with the same number across folders are from the same group. "),t("br"),t("span",{class:"font-medium"},"Example:"),$(' "My Project" → "my_project_001.png" '),t("br"),t("span",{class:"font-medium"},"Instructions:"),$(" Each group's instructions are saved as a separate text file ")])])])],-1))])):P("",!0),k.value.length>0?(f(),v("div",As,[t("div",Bs,[t("div",Gs,[t("div",zs,[(f(!0),v(Re,null,$e(k.value,(l,u)=>(f(),v("div",{key:`group-${u}-${l.image1Id}`,class:X(["bg-white rounded-lg shadow-md overflow-hidden border-l-4",{"border-green-400 bg-green-50":l.pixelDifference<.1,"border-yellow-400 bg-yellow-50":l.pixelDifference>=.1&&l.pixelDifference<.3,"border-red-400 bg-red-50":l.pixelDifference>=.3}])},[t("div",Ms,[t("div",Ns,[t("div",Ls,[t("div",js,[t("div",Ws,[et(t("input",{"onUpdate:modelValue":g=>l.instruction=g,type:"text",placeholder:"Add instructions for this group...",class:"w-full px-3 py-2 text-sm border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent",title:"Type instructions for this group"},null,8,Hs),[[tt,l.instruction]])]),t("h4",Os," Group #"+h(u+1),1)])]),t("div",Xs,[t("div",Vs,[t("span",qs,h((100-l.pixelDifference*100).toFixed(0))+"%",1),t("span",Ks,h(ce.value?"Weighted Similarity":"Similar"),1)]),B(n,{color:"red",variant:"solid",size:"xs",square:"",title:"Remove this entire group",icon:"i-heroicons-trash",onClick:g=>It(u)},null,8,["onClick"])])])]),t("div",Zs,[t("div",Ys,[t("div",Qs,[t("div",{class:X(["relative transition-all duration-150",{"ring-2 ring-blue-400 ring-opacity-75 scale-105":ne.value?.groupIndex===u&&ne.value?.slotNumber===1}]),onDragover:g=>Ge(g,u,1),onDragleave:ze,onDrop:g=>Me(g,u,1)},[D.value(l,1)?(f(),v("div",en,[t("img",{src:C(y).get(D.value(l,1)||"")?.url,alt:be.value(l,1),class:X(["w-full object-cover rounded border-2 transition-all duration-150",{"border-green-300":l.pixelDifference<.1,"border-yellow-300":l.pixelDifference>=.1&&l.pixelDifference<.3,"border-red-300":l.pixelDifference>=.3,"border-blue-400":fe.value(l,1)}]),loading:"lazy"},null,10,tn),t("div",on,[B(n,{color:"gray",variant:"solid",size:"xs",square:"",class:"pointer-events-auto cursor-not-allowed w-6 h-6 flex items-center justify-center",title:"Cannot move left (first slot)",disabled:"",icon:"i-heroicons-chevron-left"}),B(n,{color:"blue",variant:"solid",size:"xs",square:"",class:"pointer-events-auto w-6 h-6 flex items-center justify-center",title:"Move image to slot 2",icon:"i-heroicons-chevron-right",onClick:g=>Ke(u,1)},null,8,["onClick"])]),B(n,{color:"red",variant:"solid",size:"xs",square:"",class:"absolute top-1 right-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200 w-
415 h-5 flex items-center justify-center",title:"Remove image from this slot",icon:"i-heroicons-x-mark",onClick:g=>Ne(u,1)},null,8,["onClick"])])):(f(),v("div",an,[...e[45]||(e[45]=[t("svg",{class:"w-8 h-8 text-gray-400 mb-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})],-1),t("div",{class:"text-gray-500 text-xs text-center"}," Drop image here ",-1)])]))],42,Js),fe.value(l,1)?(f(),v("div",sn," Custom ")):P("",!0),t("div",nn,h(be.value(l,1)||"Empty Slot"),1),D.value(l,1)?(f(),v("div",ln," People: "+h(Ie(D.value(l,1)||"").join(", ")||"None"),1)):P("",!0),D.value(l,1)?(f(),v("div",rn,h(Le(D.value(l,1)||"")||"No people detected"),1)):P("",!0),e[46]||(e[46]=t("div",{class:"mt-2 bg-blue-600 text-white text-xs px-2 py-1 rounded font-medium text-center"}," Start ",-1))]),t("div",cn,[t("div",{class:X(["relative transition-all duration-150",{"ring-2 ring-green-400 ring-opacity-75 scale-105":ne.value?.groupIndex===u&&ne.value?.slotNumber===2}]),onDragover:g=>Ge(g,u,2),onDragleave:ze,onDrop:g=>Me(g,u,2)},[D.value(l,2)?(f(),v("div",un,[t("img",{src:C(y).get(D.value(l,2)||"")?.url,alt:be.value(l,2),class:X(["w-full object-cover rounded border-2 transition-all duration-150",{"border-green-300":l.pixelDifference<.1,"border-yellow-300":l.pixelDifference>=.1&&l.pixelDifference<.3,"border-red-300":l.pixelDifference>=.3,"border-green-400":fe.value(l,2)}]),loading:"lazy"},null,10,gn),t("div",mn,[B(n,{color:"green",variant:"solid",size:"xs",square:"",class:"pointer-events-auto w-6 h-6 flex items-center justify-center",title:"Move image to slot 1",icon:"i-heroicons-chevron-left",onClick:g=>qe(u,2)},null,8,["onClick"]),B(n,{color:"green",variant:"solid",size:"xs",square:"",class:"pointer-events-auto w-6 h-6 flex items-center justify-center",title:"Move image to slot 3",icon:"i-heroicons-chevron-right",onClick:g=>Ke(u,2)},null,8,["onClick"])]),B(n,{color:"red",variant:"solid",size:"xs",square:"",class:"absolute top-1 right-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200 w-
415 h-5 flex items-center justify-center",title:"Remove image from this slot",icon:"i-heroicons-x-mark",onClick:g=>Ne(u,2)},null,8,["onClick"])])):(f(),v("div",fn,[...e[47]||(e[47]=[t("svg",{class:"w-8 h-8 text-gray-400 mb-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})],-1),t("div",{class:"text-gray-500 text-xs text-center"}," Drop image here ",-1)])]))],42,dn),t("div",vn,h(be.value(l,2)||"Empty Slot"),1),D.value(l,2)?(f(),v("div",pn," People: "+h(Ie(D.value(l,2)||"").join(", ")||"None"),1)):P("",!0),D.value(l,2)?(f(),v("div",hn,h(Le(D.value(l,2)||"")||"No people detected"),1)):P("",!0),e[48]||(e[48]=t("div",{class:"mt-2 bg-green-600 text-white text-xs px-2 py-1 rounded font-medium text-center"}," End ",-1))]),t("div",xn,[t("div",{class:X(["relative transition-all duration-150",{"ring-2 ring-emerald-400 ring-opacity-75 scale-105":ne.value?.groupIndex===u&&ne.value?.slotNumber===3}]),onDragover:g=>Ge(g,u,3),onDragleave:ze,onDrop:g=>Me(g,u,3)},[D.value(l,3)?(f(),v("div",yn,[t("img",{src:C(y).get(D.value(l,3)||"")?.url,alt:be.value(l,3),class:X(["w-full object-cover rounded border-2 transition-all duration-150",{"border-emerald-300":!fe.value(l,3),"border-emerald-400":fe.value(l,3)}]),loading:"lazy"},null,10,wn),t("div",_n,[B(n,{color:"emerald",variant:"solid",size:"xs",square:"",class:"pointer-events-auto w-6 h-6 flex items-center justify-center",title:"Move image to slot 2",icon:"i-heroicons-chevron-left",onClick:g=>qe(u,3)},null,8,["onClick"]),B(n,{color:"gray",variant:"solid",size:"xs",square:"",class:"pointer-events-auto cursor-not-allowed w-6 h-6 flex items-center justify-center",title:"Cannot move right (last slot)",disabled:"",icon:"i-heroicons-chevron-right"})]),B(n,{icon:"i-heroicons-x-mark",color:"red",variant:"solid",size:"xs",square:"",class:"absolute top-1 right-1 opacity-0 group-hover:opacity-100 transition-opacity duration-200 w-
415 h-5 flex items-center justify-center",title:"Remove image from this slot",onClick:g=>Ne(u,3)},null,8,["onClick"])])):(f(),v("div",In,[...e[49]||(e[49]=[t("svg",{class:"w-8 h-8 text-gray-400 mb-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 6v6m0 0v6m0-6h6m-6 0H6"})],-1),t("div",{class:"text-gray-500 text-xs text-center"}," Drop image here ",-1)])]))],42,bn),t("div",Pn,h(be.value(l,3)||"Empty Slot"),1),D.value(l,3)?(f(),v("div",kn," People: "+h(Ie(D.value(l,3)||"").join(", ")||"None"),1)):P("",!0),D.value(l,3)?(f(),v("div",Cn,h(Le(D.value(l,3)||"")||"No people detected"),1)):P("",!0),D.value(l,3)&&!fe.value(l,3)&&Ze.value(l)>0?(f(),v("div",Tn," Face match: "+h((Ze.value(l)*100).toFixed(1))+"% ",1)):P("",!0),e[50]||(e[50]=t("div",{class:"mt-2 bg-emerald-600 text-white text-xs px-2 py-1 rounded font-medium text-center"}," Reference ",-1))])]),l.matchingWhiteBackgroundImages&&l.matchingWhiteBackgroundImages.length>1&&!fe.value(l,3)?(f(),v("div",Dn,[e[51]||(e[51]=t("h6",{class:"text-sm font-medium text-gray-700 mb-2"}," Additional White Background Matches (sorted by face match score): ",-1)),t("div",Fn,[(f(!0),v(Re,null,$e(l.matchingWhiteBackgroundImages.slice(1,12),g=>(f(),v("div",{key:g.imageId,class:"bg-green-50 rounded border border-green-200 overflow-hidden cursor-move transition-transform duration-150 hover:scale-105",draggable:"true",onDragstart:F=>Ve(F,g.imageId)},[t("img",{src:C(y).get(g.imageId)?.url,alt:g.imageName,class:"w-full h-12 object-cover",loading:"lazy"},null,8,En),t("div",Un,[t("div",Rn,h(g.imageName),1),t("div",$n,[t("div",null,h(g.whiteBackgroundPercentage.toFixed(1))+"% white",1),t("div",An,h(g.matchingPersons.join(", ")),1),t("div",Bn,h((g.confidence*100).toFixed(1))+"% match ",1)])])],40,Sn))),128))]),l.matchingWhiteBackgroundImages.length>12?(f(),v("div",Gn," + "+h(l.matchingWhiteBackgroundImages.length-12)+" more matches ",1)):P("",!0)])):P("",!0)])],2))),128))])])]),t("div",zn,[t("div",Mn,[e[55]||(e[55]=t("h3",{class:"text-lg font-semibold text-gray-800 mb-2"}
41,"Image Library",-1)),e[56]||(e[56]=t("p",{class:"text-sm text-gray-600"},"Drag images from here to organize your groups",-1)),t("div",Nn,[B(n,{color:"blue",variant:"solid",size:"sm",icon:"i-heroicons-plus",class:"w-full",onClick:Ht},{default:H(()=>[...e[52]||(e[52]=[$(" Add More Images ",-1)])]),_:1}),t("input",{ref_key:"sidebarFileInput",ref:We,type:"file",multiple:"",accept:"image/*",class:"hidden",onChange:je},null,544)]),t("div",Ln,[B(n,{class:X([me.value==="not-added"?"bg-blue-600 text-white hover:bg-blue-700":"bg-gray-200 text-gray-700 hover:bg-gray-300","px-3 py-1.5 rounded-lg text-sm font-medium transition-colors duration-200 flex items-center gap-1"]),variant:"ghost",size:"sm",onClick:e[3]||(e[3]=l=>me.value="not-added")},{default:H(()=>[e[53]||(e[53]=t("span",null,"Not added",-1)),t("span",jn,h(Ct.value),1)]),_:1},8,["class"]),B(n,{class:X([me.value==="added"?"bg-blue-600 text-white hover:bg-blue-700":"bg-gray-200 text-gray-700 hover:bg-gray-300","px-3 py-1.5 rounded-lg text-sm font-medium transition-colors duration-200 flex items-center gap-1"]),variant:"ghost",size:"sm",onClick:e[4]||(e[4]=l=>me.value="added")},{default:H(()=>[e[54]||(e[54]=t("span",null,"Added",-1)),t("span",Wn,h(Tt.value),1)]),_:1},8,["class"])]),t("div",Hn,h(Ee.value.length)+" images in current view ",1)]),t("div",On,[Ee.value.length>0?(f(),v("div",Xn,[(f(!0),v(Re,null,$e(Ee.value,([l,u])=>(f(),v("div",{key:`lib-${l}`,class:X(["relative group cursor-move bg-white rounded-lg shadow-sm overflow-hidden border-2 border-transparent hover:border-blue-300 transition-all duration-150",{"border-emerald-300":u.whiteBackgroundInfo?.isWhiteBackground,"border-gray-300":!u.whiteBackgroundInfo?.isWhiteBackground}]),draggable:"true",onDragstart:g=>Ve(g,l)},[t("div",qn,[t("img",{src:u.url,alt:u.file.name,class:"w-full h-full object-cover",loading:"lazy"},null,8,Kn)]),u.whiteBackgroundInfo?.isWhiteBackground?(f(),v("div",Zn," WB ")):P("",!0),me.value==="not-added"&&!Pe.value.has(l)?(f(),v("div",{key:1,class:"absolute top-1 right-1 bg-red-500 text-white rounded-full w-5 h-5 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity duration-200 cursor-pointer hover:bg-red-600",onClick:eo(g=>Nt(l),["stop"]),title:"Delete image"},[...e[57]||(e[57]=[t("svg",{class:"w-3 h-3",fill:"currentColor",viewBox:"0 0 20 20"},[t("path",{"fill-rule":"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z","clip-rule":"evenodd"})],-1)])],8,Yn)):P("",!0),e[59]||(e[59]=t("div",{class:"absolute top-1 right-6 bg-blue-500 text-white rounded-full w-4 h-4 flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity duration-200"},[t("svg",{class:"w-2 h-2",fill:"currentColor",viewBox:"0 0 20 20"},[t("path",{d:"M10 6L6 10l4 4 4-4-4-4z"})])],-1)),Pe.value.has(l)?(f(),v("div",Qn,[...e[58]||(e[58]=[t("svg",{class:"w-2 h-2",fill:"currentColor",viewBox:"0 0 20 20"},[t("path",{d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z"})],-1)])])):P("",!0),t("div",Jn,[t("div",el,[$(h(u.faces.length)+" faces ",1),u.whiteBackgroundInfo?.isWhiteBackground?(f(),v("span",tl,"• WB")):P("",!0)])])],42,Vn))),128))])):P("",!0),Ee.value.length===0?(f(),v("div",ol,[e[60]||(e[60]=t("svg",{class:"mx-auto h-12 w-12 text-gray-400 mb-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})],-1)),me.value==="not-added"?(f(),v("p",al," No unassigned images available. ")):(f(),v("p",sl," No images have been added to groups yet. ")),e[61]||(e[61]=t("p",{class:"text-sm mt-1"}," Drag images to the groups on the left to organize them. ",-1))])):P("",!0)])])])):(f(),v("div",nl,[...e[62]||(e[62]=[t("svg",{class:"mx-auto h-12 w-12 text-gray-400 mb-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z"})],-1),t("p",null,"No pixel comparisons available.",-1),t("p",{class:"text-sm mt-1"}," Upload multiple images with matching aspect ratios to see pixel-wise differences. ",-1)])]))])):P("",!0)])):P("",!0),V.value?P("",!0):(f(),v("div",ll,[e[63]||(e[63]=t("div",{class:"inline-block animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600"},null,-1)),t("p",il,h(C(a)?"Loading face recognition models...":"Detecting GPU and initializing..."),1),!C(a)&&V.value?(f(),v("p",rl," No GPU detected - advanced features disabled ")):P("",!0)])),B(d,{modelValue:we.value,"onUpdate:modelValue":e[9]||(e[9]=l=>we.value=l),ui:{width:"sm:max-w-md"}},{default:H(()=>[B(s,null,{header:H(()=>[...e[64]||(e[64]=[t("div",{class:"flex items-center gap-3"},[t("div",{class:"bg-blue-100 p-2 rounded-full"},[t("svg",{class:"w-5 h-5 text-blue-600",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"})])]),t("div",null,[t("h3",{class:"text-lg font-semibold text-gray-900"}," Download Images "),t("p",{class:"text-sm text-gray-500"}," Enter a name for your download ")])],-1)])]),footer:H(()=>[t("div",vl,[B(n,{color:"gray",variant:"solid",size:"sm",onClick:Qe},{default:H(()=>[...e[75]||(e[75]=[$(" Cancel ",-1)])]),_:1}),B(n,{disabled:ie.value||!re.value.trim(),color:"blue",variant:"solid",size:"sm",icon:"i-heroicons-arrow-down-tray",onClick:e[8]||(e[8]=l=>Ye(re.value))},{default:H(()=>[$(h(ie.value?"Creating ZIP...":"Download"),1)]),_:1},8,["disabled"])])]),default:H(()=>[t("div",cl,[t("div",null,[e[65]||(e[65]=t("label",{for:"download-name",class:"block text-sm font-medium text-gray-700 mb-2"}," Download Name ",-1)),et(t("input",{id:"download-name","onUpdate:modelValue":e[5]||(e[5]=l=>re.value=l),type:"text",placeholder:"e.g., My Project, character_training, etc.",class:X(["w-full px-3 py-2 border border-gray-300 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500",{"border-red-300 focus:ring-red-500 focus:border-red-500":oe.value}]),onKeyup:e[6]||(e[6]=to(l=>
41Ye(re.value),["enter"])),onInput:e[7]||(e[7]=l=>oe.value="")},null,34),[[tt,re.value]]),oe.value?(f(),v("div",dl,h(oe.value),1)):P("",!0),e[66]||(e[66]=t("div",{class:"mt-1 text-xs text-gray-500"},[$(" This name will be used for the ZIP file and as a prefix for all images. "),t("br"),t("span",{class:"font-medium"},"Example:"),$(' "My Project" → "my_project_001.png" ')],-1))]),t("div",ul,[t("div",gl,[e[74]||(e[74]=t("svg",{class:"w-4 h-4 text-blue-600 mt-0.5 flex-shrink-0",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24"},[t("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"})],-1)),t("div",ml,[e[73]||(e[73]=t("p",{class:"font-medium mb-1"}," Download will include: ",-1)),t("ul",fl,[t("li",null,[e[67]||(e[67]=$("• ",-1)),t("strong",null,h(k.value.length),1),e[68]||(e[68]=$(" image groups",-1))]),t("li",null,[e[69]||(e[69]=$("• ",-1)),t("strong",null,h(k.value.length*3),1),e[70]||(e[70]=$(" total images",-1))]),e[71]||(e[71]=t("li",null,"• Organized in start/end/reference folders",-1)),e[72]||(e[72]=t("li",null,"• Instruction text files for each group (if provided)",-1))])])])])])]),_:1})]),_:1},8,["modelValue"])],32)]),_:1})]),_:1})}}}),Gl=io(hl,[["__scopeId","data-v-244ee165"]]);export{Gl 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.