1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[729],{10780:(e,t,a)=>{"use strict";a.d(t,{Accordion:()=>s,AccordionContent:()=>c,AccordionItem:()=>o,AccordionTrigger:()=>d});var n=a(47808);a(71500);var r=a(95776),i=a(21696),l=a(57169);function s(e){let{...t}=e;return(0,n.jsx)(r.bL,{"data-slot":"accordion",...t})}function o(e){let{className:t,...a}=e;return(0,n.jsx)(r.q7,{"data-slot":"accordion-item",className:(0,l.cn)("border-b last:border-b-0",t),...a})}function d(e){let{className:t,children:a,...s}=e;return(0,n.jsx)(r.Y9,{className:"flex",children:(0,n.jsxs)(r.l9,{"data-slot":"accordion-trigger",className:(0,l.cn)("focus-visible:border-ring focus-visible:ring-ring/50 flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:ring-[3px] disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-180",t),...s,children:[a,(0,n.jsx)(i.A,{className:"text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200"})]})})}function c(e){let{className:t,children:a,...i}=e;return(0,n.jsx)(r.UC,{"data-slot":"accordion-content",className:"data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm",...i,children:(0,n.jsx)("div",{className:(0,l.cn)("pt-0 pb-4",t),children:a})})}},18355:(e,t,a)=>{"use strict";a.d(t,{c3:()=>i});var n=a(97326);function r(e,t){return(...e)=>{try{return t(...e)}catch{throw Error(void 0)}}}let i=r(0,n.c3);r(0,n.kc)},53252:(e,t,a)=>{"use strict";a.d(t,{default:()=>j});var n=a(47808),r=a(18355),i=a(71500);let l={webp:"image/webp",jpeg:"image/jpeg",png:"image/png"},s={webp:"webp",jpeg:"jpg",png:"png"};async function o(e){let t=(e.type||"").toLowerCase(),a=(e.name||"").toLowerCase();if("image/svg+xml"===t||a.endsWith(".svg"))return"svg";if(t.includes("icon")||a.endsWith(".ico"))return"ico";if(("image/gif"===t||a.endsWith(".gif"))&&await d(e))return"animated";if(e.size<=51200)try{var n;let t=await (n=e,new Promise(e=>{let t=URL.createObjectURL(n),a=new Image;a.onload=()=>{URL.revokeObjectURL(t),e({width:a.naturalWidth,height:a.naturalHeight})},a.onerror=()=>{URL.revokeObjectURL(t),e(null)},a.src=t}));if(t&&t.width<=800&&t.height<=800)return"small"}catch(e){}return null}async function d(e){try{let t=await e.arrayBuffer(),a=new Uint8Array(t,0,Math.min(t.byteLength,4096));return new TextDecoder("latin1").decode(a).includes("NETSCAPE2.0")}catch(e){return!1}}async function c(e){try{return await createImageBitmap(e,{imageOrientation:"from-image"})}catch(t){return new Promise((t,a)=>{let n=URL.createObjectURL(e),r=new Image;r.onload=()=>{URL.revokeObjectURL(n),t(r)},r.onerror=()=>{URL.revokeObjectURL(n),a(Error("Could not decode image"))},r.src=n})}}async function m(e,t){let a=await c(e);try{var n,r,i;let{width:o,height:d}="number"==typeof a.width&&a.width>0?{width:a.width,height:a.height}:{width:a.naturalWidth,height:a.naturalHeight};if(!o||!d)throw Error("Invalid image dimensions");let c=o,m=d;if(t.maxWidth&&o>t.maxWidth){let e=Math.min(t.maxWidth,2560)/o;c=Math.round(o*e),m=Math.round(d*e)}if(c>2560){let e=2560/c;c=2560,m=Math.round(m*e)}let u=document.createElement("canvas");u.width=c,u.height=m;let p=u.getContext("2d");if(!p)throw Error("Canvas 2D not supported");"jpeg"===t.format&&(p.fillStyle="#ffffff",p.fillRect(0,0,c,m)),p.drawImage(a,0,0,c,m);let x=l[t.format],h=await (n=u,r=x,i=t.quality/100,new Promise((e,t)=>{n.toBlob(a=>{a?e(a):t(Error("Canvas export failed"))},r,i)})),g=h.size,f=Math.max(0,e.size-g);return{name:function(e,t){let a=s[e.format],n=t.lastIndexOf("."),r=n>0?t.slice(0,n):t.replace(/\.[^.]+$/,"");return"".concat(r||"image",".").concat(a)}(t,e.name),originalSize:e.size,compressedSize:g,savedBytes:f,savedPercent:e.size>0?Math.round(f/e.size*100):0,width:c,height:m,mimeType:x,blob:h,previewUrl:URL.createObjectURL(h)}}finally{"close"in a&&a.close()}}async function u(e,t,a){let n=[],r=[];for(let i=0;i<e.length;i++){let l=e[i],s=await o(l);if(s)r.push({name:l.name,originalSize:l.size,reason:s});else try{n.push(await m(l,t))}catch(e){r.push({name:l.name,originalSize:l.size,reason:"unknown"})}null==a||a(i+1,e.length)}return{compressed:n,skipped:r}}function p(e){return e>=1048576?"".concat((e/1048576).toFixed(1)," MB"):e>=1024?"".concat(Math.round(e/1024)," KB"):"".concat(e," B")}async function x(e){arguments.length>1&&void 0!==arguments[1]&&arguments[1];let t=new(await a.e(469).then(a.t.bind(a,12469,23))).default;for(let a of e)t.file(a.name,a.blob);return t.generateAsync({type:"blob"})}function h(e,t){let a=URL.createObjectURL(e),n=document.createElement("a");n.href=a,n.download=t,document.body.appendChild(n),n.click(),n.remove(),setTimeout(()=>URL.revokeObjectURL(a),4e3)}
1function g(e){let{compressed:t,skipped:a,onDownloadZip:i,onRestart:l,loadingZip:s}=e,o=(0,r.c3)("pages.shopify-image-compressor"),d=function(e){let t=e.reduce((e,t)=>e+t.originalSize,0),a=e.reduce((e,t)=>e+t.compressedSize,0),n=Math.max(0,t-a);return{originalTotal:t,compressedTotal:a,savedBytes:n,savedPercent:t>0?Math.round(n/t*100):0,count:e.length}}(t);return(0,n.jsx)("div",{className:"rounded-xl border bg-card p-6",children:(0,n.jsxs)("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[(0,n.jsxs)("div",{className:"text-sm",children:[(0,n.jsx)("p",{className:"text-foreground font-semibold",children:o("tool.totalSaved",{size:p(d.savedBytes),percent:d.savedPercent})}),(0,n.jsxs)("p",{className:"text-muted-foreground mt-1",children:[t.length," images compressed",a.length>0&&" \xb7 ".concat(o("tool.skippedCount",{count:a.length}))]})]}),(0,n.jsxs)("div",{className:"flex flex-wrap gap-3",children:[(0,n.jsx)("button",{type:"button",onClick:i,disabled:s||0===t.length,className:"bg-primary text-primary-foreground hover:opacity-90 disabled:opacity-50 rounded-xl px-6 py-3 font-bold transition-opacity",children:o(s?"tool.loading":"tool.downloadAll")}),(0,n.jsx)("button",{type:"button",onClick:l,className:"border-border text-muted-foreground hover:bg-muted rounded-xl border px-6 py-3 font-semibold",children:o("tool.restart")})]})]})})}function f(e){let{item:t,onDownload:a}=e,l=(0,r.c3)("pages.shopify-image-compressor"),s=(0,i.useMemo)(()=>"pending"===t.kind||"done"===t.kind?t.data.previewUrl:null,[t]);if("skipped"===t.kind)return(0,n.jsx)("div",{className:"rounded-xl border border-dashed bg-muted/30 p-4 opacity-80",children:(0,n.jsxs)("div",{className:"flex items-center gap-4",children:[(0,n.jsx)("div",{className:"flex h-16 w-16 shrink-0 items-center justify-center rounded-lg bg-muted text-2xl",children:"â ï¸"}),(0,n.jsxs)("div",{className:"min-w-0",children:[(0,n.jsx)("p",{className:"truncate text-sm font-medium",children:t.data.name}),(0,n.jsx)("p",{className:"text-muted-foreground mt-0.5 text-xs",children:p(t.data.originalSize)}),(0,n.jsx)("p",{className:"mt-1 text-xs text-amber-500",children:l("skip.".concat(t.data.reason))})]})]})});let o="pending"===t.kind?t.data.file.name:t.data.name,d="pending"===t.kind?t.data.file.size:t.data.originalSize;return(0,n.jsx)("div",{className:"rounded-xl border p-4 transition-shadow hover:shadow-md",children:(0,n.jsxs)("div",{className:"flex items-start gap-4",children:[(0,n.jsxs)("div",{className:"relative h-16 w-16 shrink-0 overflow-hidden rounded-lg bg-muted",children:[s&&(0,n.jsx)("img",{src:s,alt:o,className:"h-full w-full object-cover"}),"done"===t.kind&&(0,n.jsx)("span",{className:"bg-green-500 text-primary-foreground absolute right-0 bottom-0 rounded-tl-md px-1 py-0.5 text-[10px] font-bold",children:l("card.saved",{percent:t.data.savedPercent})})]}),(0,n.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,n.jsx)("p",{className:"truncate text-sm font-medium",children:o}),(0,n.jsx)("div",{className:"mt-1 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground",children:"done"===t.kind?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("span",{children:[p(t.data.originalSize)," â ",p(t.data.compressedSize)]}),(0,n.jsxs)("span",{className:"text-green-500",children:["â",p(t.data.savedBytes)," (",t.data.savedPercent,"%)"]}),(0,n.jsxs)("span",{className:"text-muted-foreground/70",children:[t.data.width,"\xd7",t.data.height]})]}):(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("span",{children:p(d)}),(0,n.jsx)("span",{className:"text-muted-foreground/70",children:"pending"})]})}),"done"===t.kind&&a&&(0,n.jsx)("button",{type:"button",onClick:()=>a(t.data),className:"bg-primary text-primary-foreground hover:opacity-90 mt-2 rounded-lg px-3 py-1.5 text-xs font-semibold transition-opacity",children:l("card.download")})]})]})})}let b=["webp","jpeg","png"],v=[{value:"none",width:void 0},{value:"2048",width:2048},{value:"1600",width:1600},{value:"1000",width:1e3}];function j(){let e=(0,r.c3)("pages.shopify-image-compressor"),t=(0,i.useRef)(null),[a,l]=(0,i.useState)("idle"),[s,o]=(0,i.useState)([]),[d,c]=(0,i.useState)({}),[m,p]=(0,i.useState)({completed:0,total:0}),[j,y]=(0,i.useState)(!1),[w,N]=(0,i.useState)({format:"webp",quality:80,maxWidth:2048}),k=(0,i.useCallback)(e=>{o(Array.from(e).slice(0,20).map(e=>({id:"".concat(Date.now(),"-").concat(Math.random().toString(36).slice(2,9)),file:e,previewUrl:URL.createObjectURL(e)}))),c({}),p({completed:0,total:0}),l("loaded")},[]),C=(0,i.useCallback)(e=>{e.preventDefault(),e.dataTransfer.files.length&&k(e.dataTransfer.files)},[k]),U=(0,i.useCallback)(async()=>
1{if(0===s.length)return;l("compressing"),p({completed:0,total:s.length});let e=new Map(s.map(e=>[e.id,e.file])),{compressed:t,skipped:a}=await u(s.map(e=>e.file),w,(e,t)=>p({completed:e,total:t})),n={},r=0,i=0;for(let l of s){let s=e.get(l.id);r<t.length&&t[r].originalSize===s.size?(n[l.id]={kind:"done",data:t[r]},r++):i<a.length&&a[i].originalSize===s.size?(n[l.id]={kind:"skipped",data:a[i]},i++):i<a.length&&(n[l.id]={kind:"skipped",data:a[i]},i++)}c(n),l("done")},[s,w]),z=(0,i.useCallback)(e=>{h(e.blob,e.name)},[]),L=(0,i.useCallback)(async()=>{let e=s.map(e=>d[e.id]).filter(e=>(null==e?void 0:e.kind)==="done").map(e=>e.data);if(0!==e.length){y(!0);try{let t=await x(e);h(t,"shopify-compressed-images.zip")}finally{y(!1)}}},[s,d]),R=(0,i.useCallback)(()=>{s.forEach(e=>URL.revokeObjectURL(e.previewUrl)),Object.values(d).forEach(e=>{"done"===e.kind&&URL.revokeObjectURL(e.data.previewUrl)}),o([]),c({}),p({completed:0,total:0}),l("idle")},[s,d]),S=s.map(e=>d[e.id]).filter(e=>(null==e?void 0:e.kind)==="done").map(e=>e.data),O=s.map(e=>d[e.id]).filter(e=>(null==e?void 0:e.kind)==="skipped").map(e=>e.data),P="jpeg"===w.format&&s.some(e=>"image/png"===e.file.type);return(0,n.jsxs)("div",{id:"hero-section",className:"mx-auto max-w-5xl px-4 pt-20 pb-12 md:pt-28",children:[(0,n.jsxs)("div",{className:"mb-10 text-center",children:[(0,n.jsx)("h1",{className:"text-foreground text-3xl font-semibold tracking-tight md:text-5xl",children:e("tool.title")}),(0,n.jsx)("p",{className:"text-muted-foreground mt-4 text-balance text-lg",children:e("tool.subtitle")}),(0,n.jsx)("p",{className:"mt-3 text-sm text-muted-foreground/70",children:e("tool.privacy")})]}),"idle"===a&&(0,n.jsxs)("div",{onDragOver:e=>e.preventDefault(),onDrop:C,className:"border-border hover:border-blue-500/50 flex flex-col items-center justify-center rounded-2xl border-2 border-dashed p-12 text-center transition-colors",children:[(0,n.jsx)("div",{className:"mb-4 text-5xl",children:"\uD83D\uDDBCï¸"}),(0,n.jsx)("p",{className:"text-foreground mb-1 text-lg font-semibold",children:e("tool.dragDrop")}),(0,n.jsx)("p",{className:"text-muted-foreground mb-6 text-sm",children:e("tool.dragDropHint")}),(0,n.jsx)("button",{type:"button",onClick:()=>{var e;return null==(e=t.current)?void 0:e.click()},className:"bg-primary text-primary-foreground hover:opacity-90 rounded-xl px-8 py-3.5 font-bold shadow-lg transition-opacity",children:e("tool.dragDropHint")}),(0,n.jsx)("input",{ref:t,type:"file",accept:"image/jpeg,image/png,image/webp,image/avif,image/gif,image/svg+xml",multiple:!0,className:"hidden",onChange:e=>{e.target.files&&k(e.target.files),e.target.value=""}}),(0,n.jsx)("p",{className:"text-muted-foreground/60 mt-5 text-xs",children:e("tool.supportedFormats")})]}),"idle"!==a&&(0,n.jsxs)(n.Fragment,{children:[(0,n.jsxs)("div",{className:"border-border mb-6 grid gap-4 rounded-2xl border p-5 md:grid-cols-3",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"text-foreground mb-2 block text-sm font-medium",children:e("tool.format")}),(0,n.jsx)("select",{value:w.format,onChange:e=>N(t=>({...t,format:e.target.value})),className:"border-border bg-background w-full rounded-lg border px-3 py-2 text-sm",children:b.map(e=>(0,n.jsx)("option",{value:e,children:e.toUpperCase()},e))})]}),(0,n.jsxs)("div",{children:[(0,n.jsxs)("label",{className:"text-foreground mb-2 block text-sm font-medium",children:[e("tool.quality"),(0,n.jsxs)("span",{className:"text-muted-foreground ml-2 text-xs",children:["(",w.quality,")"]})]}),(0,n.jsx)("input",{type:"range",min:1,max:100,value:w.quality,onChange:e=>N(t=>({...t,quality:Number(e.target.value)})),className:"w-full accent-blue-500"}),(0,n.jsx)("p",{className:"text-muted-foreground mt-1 text-xs",children:e("tool.qualityHint")})]}),(0,n.jsxs)("div",{children:[(0,n.jsx)("label",{className:"text-foreground mb-2 block text-sm font-medium",children:e("tool.resize")}),(0,n.jsx)("select",{value:void 0===w.maxWidth?"none":String(w.maxWidth),onChange:e=>{let t=v.find(t=>t.value===e.target.value);N(e=>({...e,maxWidth:null==t?void 0:t.width}))},className:"border-border bg-background w-full rounded-lg border px-3 py-2 text-sm",children:v.map(t=>(0,n.jsx)("option",{value:t.value,children:"none"===t.value?e("tool.resizeNone"):"2048"===t.value?e("tool.resize2048"):"1600"===t.value?e("tool.resize1600"):e("tool.resize1000")},t.value))})]})]}),P&&(0,n.jsxs)("div",{className:"border-amber-500/30 bg-amber-500/10 text-amber-600 dar
1k:text-amber-400 mb-6 rounded-xl border p-4 text-sm",children:["â ï¸ ",e("warnings.jpegTransparency")]}),"compressing"===a&&(0,n.jsxs)("div",{className:"bg-card rounded-2xl border p-6",children:[(0,n.jsxs)("div",{className:"mb-2 flex items-center justify-between text-sm",children:[(0,n.jsxs)("span",{children:[e("tool.compressing")," ",m.completed,"/",m.total]}),(0,n.jsxs)("span",{children:[m.total>0?Math.round(m.completed/m.total*100):0,"%"]})]}),(0,n.jsx)("div",{className:"bg-muted h-2.5 w-full overflow-hidden rounded-full",children:(0,n.jsx)("div",{className:"bg-blue-500 h-full rounded-full transition-all duration-300",style:{width:"".concat(m.total>0?m.completed/m.total*100:0,"%")}})})]}),(0,n.jsx)("div",{className:"mb-6 grid gap-3 md:grid-cols-2",children:s.map(e=>{let t=d[e.id],a=t?"done"===t.kind?{kind:"done",data:t.data}:{kind:"skipped",data:t.data}:{kind:"pending",data:e};return(0,n.jsx)(f,{item:a,onDownload:z},e.id)})}),"loaded"===a&&(0,n.jsxs)("div",{className:"text-center",children:[(0,n.jsx)("button",{type:"button",onClick:U,className:"bg-primary text-primary-foreground hover:opacity-90 rounded-xl px-10 py-4 text-lg font-bold shadow-lg transition-opacity",children:e("tool.compressBtn")}),(0,n.jsx)("p",{className:"text-muted-foreground/60 mt-3 text-xs",children:e("tool.batchHint")})]}),"done"===a&&(0,n.jsx)(g,{compressed:S,skipped:O,onDownloadZip:L,onRestart:R,loadingZip:j})]})]})}},57169:(e,t,a)=>{"use strict";a.d(t,{cn:()=>i});var n=a(57305),r=a(43753);function i(){for(var e=arguments.length,t=Array(e),a=0;a<e;a++)t[a]=arguments[a];return(0,r.QP)((0,n.$)(t))}},63526:(e,t,a)=>{Promise.resolve().then(a.bind(a,5963)),Promise.resolve().then(a.t.bind(a,95784,23)),Promise.resolve().then(a.bind(a,53252)),Promise.resolve().then(a.bind(a,10780)),Promise.resolve().then(a.bind(a,72100))},72100:(e,t,a)=>{"use strict";a.d(t,{ScrollAnimation:()=>o});var n=a(47808),r=a(71500),i=a(40116),l=a(22977),s=a(24309);function o(e){let{children:t,className:a="",delay:o=0,direction:d="up",stagger:c=!1}=e,m=(0,r.useRef)(null),u=(0,i.W)(m,{once:!0,margin:"-50px"});if((0,l.I)())return(0,n.jsx)("div",{ref:m,className:a,children:t});let p=()=>{switch(d){case"up":default:return{y:30,x:0};case"down":return{y:-30,x:0};case"left":return{x:30,y:0};case"right":return{x:-30,y:0}}},x={hidden:{...p()},visible:{x:0,y:0,transition:{staggerChildren:.1,delayChildren:o,duration:.6,ease:[.22,1,.36,1]}}},h={hidden:{...p()},visible:{x:0,y:0,transition:{duration:.6,ease:[.22,1,.36,1]}}};return c?(0,n.jsx)(s.P.div,{ref:m,variants:x,initial:"hidden",animate:u?"visible":"hidden",className:a,children:r.Children.map(t,e=>(0,n.jsx)(s.P.div,{variants:h,children:e}))}):(0,n.jsx)(s.P.div,{ref:m,initial:{...p()},animate:u?{x:0,y:0}:{...p()},transition:{duration:.6,delay:o,ease:[.22,1,.36,1]},className:a,children:t})}}},e=>{e.O(0,[69,403,14,883,714,358],()=>e(e.s=63526)),_N_E=e.O()}]);
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.