@squoosh-kit/resize 0.0.25 → 0.0.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. package/dist/bridge.browser.mjs +3 -3
  2. package/dist/bridge.browser.mjs.map +4 -4
  3. package/dist/bridge.bun.js +3 -3
  4. package/dist/bridge.bun.js.map +4 -4
  5. package/dist/bridge.d.ts +1 -1
  6. package/dist/bridge.d.ts.map +1 -1
  7. package/dist/bridge.node.cjs +2 -2
  8. package/dist/bridge.node.cjs.map +4 -4
  9. package/dist/bridge.node.mjs +3 -3
  10. package/dist/bridge.node.mjs.map +4 -4
  11. package/dist/chunk-5vdxd0v3.js +4 -0
  12. package/dist/chunk-5vdxd0v3.js.map +10 -0
  13. package/dist/chunk-8y42hv65.js +5 -0
  14. package/dist/chunk-8y42hv65.js.map +9 -0
  15. package/dist/chunk-bhj61bkd.js +4 -0
  16. package/dist/chunk-bhj61bkd.js.map +9 -0
  17. package/dist/chunk-c6cx0d7q.js +4 -0
  18. package/dist/chunk-c6cx0d7q.js.map +9 -0
  19. package/dist/chunk-gw29pvyv.js +3 -0
  20. package/dist/chunk-gw29pvyv.js.map +10 -0
  21. package/dist/chunk-q0apy7nk.js +5 -0
  22. package/dist/chunk-q0apy7nk.js.map +10 -0
  23. package/dist/chunk-szbj3b6y.js +4 -0
  24. package/dist/chunk-szbj3b6y.js.map +10 -0
  25. package/dist/index.browser.mjs +2 -2
  26. package/dist/index.browser.mjs.map +3 -3
  27. package/dist/index.bun.js +2 -2
  28. package/dist/index.bun.js.map +3 -3
  29. package/dist/index.d.ts +30 -1
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/index.node.cjs +2 -2
  32. package/dist/index.node.cjs.map +3 -3
  33. package/dist/index.node.mjs +2 -2
  34. package/dist/index.node.mjs.map +3 -3
  35. package/dist/resize.worker.browser.mjs +2 -2
  36. package/dist/resize.worker.browser.mjs.map +4 -4
  37. package/dist/resize.worker.bun.js +2 -2
  38. package/dist/resize.worker.bun.js.map +4 -4
  39. package/dist/resize.worker.d.ts.map +1 -1
  40. package/dist/resize.worker.node.cjs +2 -2
  41. package/dist/resize.worker.node.cjs.map +4 -4
  42. package/dist/resize.worker.node.mjs +2 -2
  43. package/dist/resize.worker.node.mjs.map +4 -4
  44. package/dist/validators.browser.mjs +4 -0
  45. package/dist/validators.browser.mjs.map +10 -0
  46. package/dist/validators.bun.js +5 -0
  47. package/dist/validators.bun.js.map +10 -0
  48. package/dist/validators.d.ts +8 -0
  49. package/dist/validators.d.ts.map +1 -0
  50. package/dist/validators.node.cjs +3 -0
  51. package/dist/validators.node.cjs.map +10 -0
  52. package/dist/validators.node.mjs +4 -0
  53. package/dist/validators.node.mjs.map +10 -0
  54. package/package.json +2 -2
  55. package/dist/chunk-6qec3cgc.js +0 -5
  56. package/dist/chunk-6qec3cgc.js.map +0 -10
  57. package/dist/chunk-cg8pk3a2.js +0 -3
  58. package/dist/chunk-cg8pk3a2.js.map +0 -10
  59. package/dist/chunk-dfj7cgx8.js +0 -4
  60. package/dist/chunk-dfj7cgx8.js.map +0 -10
  61. package/dist/chunk-xrd0djzj.js +0 -4
  62. package/dist/chunk-xrd0djzj.js.map +0 -10
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["node:url"],
4
+ "sourcesContent": [
5
+ "var{URL,URLSearchParams}=globalThis;function util_isString(arg){return typeof arg===\"string\"}function util_isObject(arg){return typeof arg===\"object\"&&arg!==null}function util_isNull(arg){return arg===null}function util_isNullOrUndefined(arg){return arg==null}function Url(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var protocolPattern=/^([a-z0-9.+-]+:)/i,portPattern=/:[0-9]*$/,simplePathPattern=/^(\\/\\/?(?!\\/)[^\\?\\s]*)(\\?[^\\s]*)?$/,delims=[\"<\",\">\",'\"',\"`\",\" \",\"\\r\",`\n`,\"\\t\"],unwise=[\"{\",\"}\",\"|\",\"\\\\\",\"^\",\"`\"].concat(delims),autoEscape=[\"'\"].concat(unwise),nonHostChars=[\"%\",\"/\",\"?\",\";\",\"#\"].concat(autoEscape),hostEndingChars=[\"/\",\"?\",\"#\"],hostnameMaxLen=255,hostnamePartPattern=/^[+a-z0-9A-Z_-]{0,63}$/,hostnamePartStart=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,unsafeProtocol={javascript:!0,\"javascript:\":!0},hostlessProtocol={javascript:!0,\"javascript:\":!0},slashedProtocol={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,\"http:\":!0,\"https:\":!0,\"ftp:\":!0,\"gopher:\":!0,\"file:\":!0},querystring={parse(str){var decode=decodeURIComponent;return(str+\"\").replace(/\\+/g,\" \").split(\"&\").filter(Boolean).reduce(function(obj,item,index){var ref=item.split(\"=\"),key=decode(ref[0]||\"\"),val=decode(ref[1]||\"\"),prev=obj[key];return obj[key]=prev===void 0?val:[].concat(prev,val),obj},{})},stringify(obj){var encode=encodeURIComponent;return Object.keys(obj||{}).reduce(function(arr,key){return[].concat(obj[key]).forEach(function(v){arr.push(encode(key)+\"=\"+encode(v))}),arr},[]).join(\"&\").replace(/\\s/g,\"+\")}};function urlParse(url,parseQueryString,slashesDenoteHost){if(url&&util_isObject(url)&&url instanceof Url)return url;var u=new Url;return u.parse(url,parseQueryString,slashesDenoteHost),u}Url.prototype.parse=function(url,parseQueryString,slashesDenoteHost){if(!util_isString(url))throw new TypeError(\"Parameter 'url' must be a string, not \"+typeof url);var queryIndex=url.indexOf(\"?\"),splitter=queryIndex!==-1&&queryIndex<url.indexOf(\"#\")?\"?\":\"#\",uSplit=url.split(splitter),slashRegex=/\\\\/g;uSplit[0]=uSplit[0].replace(slashRegex,\"/\"),url=uSplit.join(splitter);var rest=url;if(rest=rest.trim(),!slashesDenoteHost&&url.split(\"#\").length===1){var simplePath=simplePathPattern.exec(rest);if(simplePath){if(this.path=rest,this.href=rest,this.pathname=simplePath[1],simplePath[2])if(this.search=simplePath[2],parseQueryString)this.query=querystring.parse(this.search.substr(1));else this.query=this.search.substr(1);else if(parseQueryString)this.search=\"\",this.query={};return this}}var proto=protocolPattern.exec(rest);if(proto){proto=proto[0];var lowerProto=proto.toLowerCase();this.protocol=lowerProto,rest=rest.substr(proto.length)}if(slashesDenoteHost||proto||rest.match(/^\\/\\/[^@\\/]+@[^@\\/]+/)){var slashes=rest.substr(0,2)===\"//\";if(slashes&&!(proto&&hostlessProtocol[proto]))rest=rest.substr(2),this.slashes=!0}if(!hostlessProtocol[proto]&&(slashes||proto&&!slashedProtocol[proto])){var hostEnd=-1;for(var i=0;i<hostEndingChars.length;i++){var hec=rest.indexOf(hostEndingChars[i]);if(hec!==-1&&(hostEnd===-1||hec<hostEnd))hostEnd=hec}var auth,atSign;if(hostEnd===-1)atSign=rest.lastIndexOf(\"@\");else atSign=rest.lastIndexOf(\"@\",hostEnd);if(atSign!==-1)auth=rest.slice(0,atSign),rest=rest.slice(atSign+1),this.auth=decodeURIComponent(auth);hostEnd=-1;for(var i=0;i<nonHostChars.length;i++){var hec=rest.indexOf(nonHostChars[i]);if(hec!==-1&&(hostEnd===-1||hec<hostEnd))hostEnd=hec}if(hostEnd===-1)hostEnd=rest.length;this.host=rest.slice(0,hostEnd),rest=rest.slice(hostEnd),this.parseHost(),this.hostname=this.hostname||\"\";var ipv6Hostname=this.hostname[0]===\"[\"&&this.hostname[this.hostname.length-1]===\"]\";if(!ipv6Hostname){var hostparts=this.hostname.split(/\\./);for(var i=0,l=hostparts.length;i<l;i++){var part=hostparts[i];if(!part)continue;if(!part.match(hostnamePartPattern)){var newpart=\"\";for(var j=0,k=part.length;j<k;j++)if(part.charCodeAt(j)>127)newpart+=\"x\";else newpart+=part[j];if(!newpart.match(hostnamePartPattern)){var validParts=hostparts.slice(0,i),notHost=hostparts.slice(i+1),bit=part.match(hostnamePartStart);if(bit)validParts.push(bit[1]),notHost.unshift(bit[2]);if(notHost.length)rest=\"/\"+notHost.join(\".\")+rest;this.hostname=validParts.join(\".\");break}}}}if(this.hostname.length>hostnameMaxLen)this.hostname=\"\";else this.hostname=this.hostname.toLowerCase();if(!ipv6Hostname)this.hostname=new URL(`https://${this.hostname}`).hostname;var p=this.port?\":\"+this.port:\"\",h=this.hostname||\"\";if(this.host=h+p,this.href+=this.host,ipv6Hostname){if(this.hostname=this.hostname.substr(1,this.hostname.length-2),rest[0]!==\"/\")rest=\"/\"+rest}}if(!unsafeProtocol[lowerProto])for(var i=0,l=autoEscape.length;i<l;i++){var ae=autoEscape[i];if(rest.indexOf(ae)===-1)continue;var esc=encodeURIComponent(ae);if(esc===ae)esc=escape(ae);rest=rest.split(ae).join(esc)}var hash=rest.indexOf(\"#\");if(hash!==-1)this.hash=rest.substr(hash),rest=rest.slice(0,hash);var qm=rest.indexOf(\"?\");if(qm!==-1){if(this.search=rest.substr(qm),this.query=rest.substr(qm+1),parseQueryString)this.query=querystring.parse(this.query);rest=rest.slice(0,qm)}else if(parseQueryString)this.search=\"\",this.query={};if(rest)this.pathname=rest;if(slashedProtocol[lowerProto]&&this.hostname&&!this.pathname)this.pathname=\"/\";if(this.pathname||this.search){var p=this.pathname||\"\",s=this.search||\"\";this.path=p+s}return this.href=this.format(),this};function urlFormat(obj){if(util_isString(obj))obj=urlParse(obj);if(!(obj instanceof Url))return Url.prototype.format.call(obj);return obj.format()}Url.prototype.format=function(){var auth=this.auth||\"\";if(auth)auth=encodeURIComponent(auth),auth=auth.replace(/%3A/i,\":\"),auth+=\"@\";var protocol=this.protocol||\"\",pathname=this.pathname||\"\",hash=this.hash||\"\",host=!1,query=\"\";if(this.host)host=auth+this.host;else if(this.hostname){if(host=auth+(this.hostname.indexOf(\":\")===-1?this.hostname:\"[\"+this.hostname+\"]\"),this.port)host+=\":\"+this.port}if(this.query&&util_isObject(this.query)&&Object.keys(this.query).length)query=querystring.stringify(this.query);var search=this.search||query&&\"?\"+query||\"\";if(protocol&&protocol.substr(-1)!==\":\")protocol+=\":\";if(this.slashes||(!protocol||slashedProtocol[protocol])&&host!==!1){if(host=\"//\"+(host||\"\"),pathname&&pathname.charAt(0)!==\"/\")pathname=\"/\"+pathname}else if(!host)host=\"\";if(hash&&hash.charAt(0)!==\"#\")hash=\"#\"+hash;if(search&&search.charAt(0)!==\"?\")search=\"?\"+search;return pathname=pathname.replace(/[?#]/g,function(match){return encodeURIComponent(match)}),search=search.replace(\"#\",\"%23\"),protocol+host+pathname+search+hash};function urlResolve(source,relative){return urlParse(source,!1,!0).resolve(relative)}Url.prototype.resolve=function(relative){return this.resolveObject(urlParse(relative,!1,!0)).format()};function urlResolveObject(source,relative){if(!source)return relative;return urlParse(source,!1,!0).resolveObject(relative)}Url.prototype.resolveObject=function(relative){if(util_isString(relative)){var rel=new Url;rel.parse(relative,!1,!0),relative=rel}var result=new Url,tkeys=Object.keys(this);for(var tk=0;tk<tkeys.length;tk++){var tkey=tkeys[tk];result[tkey]=this[tkey]}if(result.hash=relative.hash,relative.href===\"\")return result.href=result.format(),result;if(relative.slashes&&!relative.protocol){var rkeys=Object.keys(relative);for(var rk=0;rk<rkeys.length;rk++){var rkey=rkeys[rk];if(rkey!==\"protocol\")result[rkey]=relative[rkey]}if(slashedProtocol[result.protocol]&&result.hostname&&!result.pathname)result.path=result.pathname=\"/\";return result.href=result.format(),result}if(relative.protocol&&relative.protocol!==result.protocol){if(!slashedProtocol[relative.protocol]){var keys=Object.keys(relative);for(var v=0;v<keys.length;v++){var k=keys[v];result[k]=relative[k]}return result.href=result.format(),result}if(result.protocol=relative.protocol,!relative.host&&!hostlessProtocol[relative.protocol]){var relPath=(relative.pathname||\"\").split(\"/\");while(relPath.length&&!(relative.host=relPath.shift()));if(!relative.host)relative.host=\"\";if(!relative.hostname)relative.hostname=\"\";if(relPath[0]!==\"\")relPath.unshift(\"\");if(relPath.length<2)relPath.unshift(\"\");result.pathname=relPath.join(\"/\")}else result.pathname=relative.pathname;if(result.search=relative.search,result.query=relative.query,result.host=relative.host||\"\",result.auth=relative.auth,result.hostname=relative.hostname||relative.host,result.port=relative.port,result.pathname||result.search){var p=result.pathname||\"\",s=result.search||\"\";result.path=p+s}return result.slashes=result.slashes||relative.slashes,result.href=result.format(),result}var isSourceAbs=result.pathname&&result.pathname.charAt(0)===\"/\",isRelAbs=relative.host||relative.pathname&&relative.pathname.charAt(0)===\"/\",mustEndAbs=isRelAbs||isSourceAbs||result.host&&relative.pathname,removeAllDots=mustEndAbs,srcPath=result.pathname&&result.pathname.split(\"/\")||[],relPath=relative.pathname&&relative.pathname.split(\"/\")||[],psychotic=result.protocol&&!slashedProtocol[result.protocol];if(psychotic){if(result.hostname=\"\",result.port=null,result.host)if(srcPath[0]===\"\")srcPath[0]=result.host;else srcPath.unshift(result.host);if(result.host=\"\",relative.protocol){if(relative.hostname=null,relative.port=null,relative.host)if(relPath[0]===\"\")relPath[0]=relative.host;else relPath.unshift(relative.host);relative.host=null}mustEndAbs=mustEndAbs&&(relPath[0]===\"\"||srcPath[0]===\"\")}if(isRelAbs)result.host=relative.host||relative.host===\"\"?relative.host:result.host,result.hostname=relative.hostname||relative.hostname===\"\"?relative.hostname:result.hostname,result.search=relative.search,result.query=relative.query,srcPath=relPath;else if(relPath.length){if(!srcPath)srcPath=[];srcPath.pop(),srcPath=srcPath.concat(relPath),result.search=relative.search,result.query=relative.query}else if(!util_isNullOrUndefined(relative.search)){if(psychotic){result.hostname=result.host=srcPath.shift();var authInHost=result.host&&result.host.indexOf(\"@\")>0?result.host.split(\"@\"):!1;if(authInHost)result.auth=authInHost.shift(),result.host=result.hostname=authInHost.shift()}if(result.search=relative.search,result.query=relative.query,!util_isNull(result.pathname)||!util_isNull(result.search))result.path=(result.pathname?result.pathname:\"\")+(result.search?result.search:\"\");return result.href=result.format(),result}if(!srcPath.length){if(result.pathname=null,result.search)result.path=\"/\"+result.search;else result.path=null;return result.href=result.format(),result}var last=srcPath.slice(-1)[0],hasTrailingSlash=(result.host||relative.host||srcPath.length>1)&&(last===\".\"||last===\"..\")||last===\"\",up=0;for(var i=srcPath.length;i>=0;i--)if(last=srcPath[i],last===\".\")srcPath.splice(i,1);else if(last===\"..\")srcPath.splice(i,1),up++;else if(up)srcPath.splice(i,1),up--;if(!mustEndAbs&&!removeAllDots)for(;up--;up)srcPath.unshift(\"..\");if(mustEndAbs&&srcPath[0]!==\"\"&&(!srcPath[0]||srcPath[0].charAt(0)!==\"/\"))srcPath.unshift(\"\");if(hasTrailingSlash&&srcPath.join(\"/\").substr(-1)!==\"/\")srcPath.push(\"\");var isAbsolute=srcPath[0]===\"\"||srcPath[0]&&srcPath[0].charAt(0)===\"/\";if(psychotic){result.hostname=result.host=isAbsolute?\"\":srcPath.length?srcPath.shift():\"\";var authInHost=result.host&&result.host.indexOf(\"@\")>0?result.host.split(\"@\"):!1;if(authInHost)result.auth=authInHost.shift(),result.host=result.hostname=authInHost.shift()}if(mustEndAbs=mustEndAbs||result.host&&srcPath.length,mustEndAbs&&!isAbsolute)srcPath.unshift(\"\");if(!srcPath.length)result.pathname=null,result.path=null;else result.pathname=srcPath.join(\"/\");if(!util_isNull(result.pathname)||!util_isNull(result.search))result.path=(result.pathname?result.pathname:\"\")+(result.search?result.search:\"\");return result.auth=relative.auth||result.auth,result.slashes=result.slashes||relative.slashes,result.href=result.format(),result};Url.prototype.parseHost=function(){var host=this.host,port=portPattern.exec(host);if(port){if(port=port[0],port!==\":\")this.port=port.substr(1);host=host.substr(0,host.length-port.length)}if(host)this.hostname=host};var url_default={parse:urlParse,resolve:urlResolve,resolveObject:urlResolveObject,format:urlFormat,Url,URL,URLSearchParams};export{urlResolveObject as resolveObject,urlResolve as resolve,urlParse as parse,urlFormat as format,url_default as default,Url,URLSearchParams,URL};"
6
+ ],
7
+ "mappings": "4BAAA,IAAI,MAAI,mBAAiB,WAAW,SAAS,CAAa,CAAC,EAAI,CAAC,OAAO,OAAO,IAAM,SAAS,SAAS,CAAa,CAAC,EAAI,CAAC,OAAO,OAAO,IAAM,UAAU,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,EAAO,MAAM,EAAO,SAAS,EAAO,SAAS,KAAK,EAAO,OAAO,EAAO,OAAO,IAAI,OAAO,EAAO,KAAK,EAAS,MAAM,EAAO,KAAK,EAAO,QAAQ,EAAO,SAAS,EAAS,QAAQ,EAAO,KAAK,EAAO,OAAO,EAAE,GAAQ,EAAI,UAAU,UAAU,QAAQ,EAAE,CAAC,IAAI,EAAK,KAAK,KAAK,EAAK,EAAY,KAAK,CAAI,EAAE,GAAG,EAAK,CAAC,GAAG,EAAK,EAAK,GAAG,IAAO,IAAI,KAAK,KAAK,EAAK,OAAO,CAAC,EAAE,EAAK,EAAK,OAAO,EAAE,EAAK,OAAO,EAAK,MAAM,EAAE,GAAG,EAAK,KAAK,SAAS,GAAM,IAAI,GAAY,CAAC,MAAM,EAAS,QAAQ,GAAW,cAAc,GAAiB,OAAO,GAAU,MAAI,MAAI,iBAAe",
8
+ "debugId": "A51CEBA1D864A1DF64756E2164756E21",
9
+ "names": []
10
+ }
@@ -0,0 +1,5 @@
1
+ // @bun
2
+ var g=Object.create;var{getPrototypeOf:h,defineProperty:e,getOwnPropertyNames:i}=Object;var j=Object.prototype.hasOwnProperty;var k=(a,f,b)=>{b=a!=null?g(h(a)):{};let c=f||!a||!a.__esModule?e(b,"default",{value:a,enumerable:!0}):b;for(let d of i(a))if(!j.call(c,d))e(c,d,{get:()=>a[d],enumerable:!0});return c};var l=import.meta.require;
3
+ export{k as d,l as e};
4
+
5
+ //# debugId=A9A34199A0D9BFB964756E2164756E21
@@ -0,0 +1,9 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [
5
+ ],
6
+ "mappings": "",
7
+ "debugId": "A9A34199A0D9BFB964756E2164756E21",
8
+ "names": []
9
+ }
@@ -0,0 +1,4 @@
1
+ var g=Object.create;var{getPrototypeOf:h,defineProperty:f,getOwnPropertyNames:i}=Object;var j=Object.prototype.hasOwnProperty;var k=(a,c,b)=>{b=a!=null?g(h(a)):{};let d=c||!a||!a.__esModule?f(b,"default",{value:a,enumerable:!0}):b;for(let e of i(a))if(!j.call(d,e))f(d,e,{get:()=>a[e],enumerable:!0});return d};var l=((a)=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(a,{get:(c,b)=>(typeof require<"u"?require:c)[b]}):a)(function(a){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+a+'" is not supported')});
2
+ export{k as d,l as e};
3
+
4
+ //# debugId=DD012EC9AF92EB4264756E2164756E21
@@ -0,0 +1,9 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [
5
+ ],
6
+ "mappings": "",
7
+ "debugId": "DD012EC9AF92EB4264756E2164756E21",
8
+ "names": []
9
+ }
@@ -0,0 +1,4 @@
1
+ import{createRequire as k}from"node:module";var g=Object.create;var{getPrototypeOf:h,defineProperty:e,getOwnPropertyNames:i}=Object;var j=Object.prototype.hasOwnProperty;var l=(a,f,b)=>{b=a!=null?g(h(a)):{};let c=f||!a||!a.__esModule?e(b,"default",{value:a,enumerable:!0}):b;for(let d of i(a))if(!j.call(c,d))e(c,d,{get:()=>a[d],enumerable:!0});return c};var n=k(import.meta.url);
2
+ export{l as d,n as e};
3
+
4
+ //# debugId=F652FC5CA4201BB864756E2164756E21
@@ -0,0 +1,9 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [
5
+ ],
6
+ "mappings": "",
7
+ "debugId": "F652FC5CA4201BB864756E2164756E21",
8
+ "names": []
9
+ }
@@ -0,0 +1,3 @@
1
+ function H(F){if(!F||typeof F!=="object")throw TypeError("image must be an object");let D=F;if(!("data"in D))throw TypeError("image.data is required");let{data:E}=D;if(!(E instanceof Uint8Array||E instanceof Uint8ClampedArray))throw TypeError("image.data must be Uint8Array or Uint8ClampedArray");if(!("width"in D)||!("height"in D))throw TypeError("image.width and image.height are required");let{width:l,height:q}=D;if(typeof l!=="number"||!Number.isInteger(l)||l<=0)throw RangeError(`image.width must be a positive integer, got ${l}`);if(typeof q!=="number"||!Number.isInteger(q)||q<=0)throw RangeError(`image.height must be a positive integer, got ${q}`);let G=l*q*4;if(E.length<G)throw RangeError(`image.data too small: ${E.length} bytes, expected at least ${G} bytes for ${l}x${q} RGBA image`)}
2
+
3
+ //# debugId=09889CC44937212964756E2164756E21
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../runtime/src/validators.ts"],
4
+ "sourcesContent": [
5
+ "import type { ImageInput } from './types.js';\n\nexport function validateArrayBuffer(\n buffer: unknown\n): asserts buffer is ArrayBuffer {\n // Check if SharedArrayBuffer is defined in the current environment before using it\n if (\n typeof SharedArrayBuffer !== 'undefined' &&\n buffer instanceof SharedArrayBuffer\n ) {\n throw new Error(\n 'SharedArrayBuffer is not supported. ' +\n 'Use regular ArrayBuffer or Uint8Array instead.'\n );\n }\n\n if (!(buffer instanceof ArrayBuffer)) {\n throw new TypeError('image.data.buffer must be an ArrayBuffer');\n }\n}\n\nexport function validateImageInput(\n image: unknown\n): asserts image is ImageInput {\n if (!image || typeof image !== 'object') {\n throw new TypeError('image must be an object');\n }\n\n const imageObj = image as Record<string, unknown>;\n\n if (!('data' in imageObj)) {\n throw new TypeError('image.data is required');\n }\n\n const { data } = imageObj;\n if (!(data instanceof Uint8Array || data instanceof Uint8ClampedArray)) {\n throw new TypeError('image.data must be Uint8Array or Uint8ClampedArray');\n }\n\n if (!('width' in imageObj) || !('height' in imageObj)) {\n throw new TypeError('image.width and image.height are required');\n }\n\n const { width, height } = imageObj;\n\n if (typeof width !== 'number' || !Number.isInteger(width) || width <= 0) {\n throw new RangeError(\n `image.width must be a positive integer, got ${width}`\n );\n }\n\n if (typeof height !== 'number' || !Number.isInteger(height) || height <= 0) {\n throw new RangeError(\n `image.height must be a positive integer, got ${height}`\n );\n }\n\n const expectedSize = width * height * 4;\n if (data.length < expectedSize) {\n throw new RangeError(\n `image.data too small: ${data.length} bytes, expected at least ${expectedSize} bytes for ${width}x${height} RGBA image`\n );\n }\n}\n"
6
+ ],
7
+ "mappings": "AAqBO,SAAS,CAAkB,CAChC,EAC6B,CAC7B,GAAI,CAAC,GAAS,OAAO,IAAU,SAC7B,MAAU,UAAU,yBAAyB,EAG/C,IAAM,EAAW,EAEjB,GAAI,EAAE,SAAU,GACd,MAAU,UAAU,wBAAwB,EAG9C,IAAQ,QAAS,EACjB,GAAI,EAAE,aAAgB,YAAc,aAAgB,mBAClD,MAAU,UAAU,oDAAoD,EAG1E,GAAI,EAAE,UAAW,IAAa,EAAE,WAAY,GAC1C,MAAU,UAAU,2CAA2C,EAGjE,IAAQ,QAAO,UAAW,EAE1B,GAAI,OAAO,IAAU,UAAY,CAAC,OAAO,UAAU,CAAK,GAAK,GAAS,EACpE,MAAU,WACR,+CAA+C,GACjD,EAGF,GAAI,OAAO,IAAW,UAAY,CAAC,OAAO,UAAU,CAAM,GAAK,GAAU,EACvE,MAAU,WACR,gDAAgD,GAClD,EAGF,IAAM,EAAe,EAAQ,EAAS,EACtC,GAAI,EAAK,OAAS,EAChB,MAAU,WACR,yBAAyB,EAAK,mCAAmC,eAA0B,KAAS,cACtG",
8
+ "debugId": "09889CC44937212964756E2164756E21",
9
+ "names": []
10
+ }
@@ -0,0 +1,5 @@
1
+ // @bun
2
+ function H(F){if(!F||typeof F!=="object")throw TypeError("image must be an object");let D=F;if(!("data"in D))throw TypeError("image.data is required");let{data:E}=D;if(!(E instanceof Uint8Array||E instanceof Uint8ClampedArray))throw TypeError("image.data must be Uint8Array or Uint8ClampedArray");if(!("width"in D)||!("height"in D))throw TypeError("image.width and image.height are required");let{width:l,height:q}=D;if(typeof l!=="number"||!Number.isInteger(l)||l<=0)throw RangeError(`image.width must be a positive integer, got ${l}`);if(typeof q!=="number"||!Number.isInteger(q)||q<=0)throw RangeError(`image.height must be a positive integer, got ${q}`);let G=l*q*4;if(E.length<G)throw RangeError(`image.data too small: ${E.length} bytes, expected at least ${G} bytes for ${l}x${q} RGBA image`)}
3
+ export{H as b};
4
+
5
+ //# debugId=7AE3A24486B7640E64756E2164756E21
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../runtime/src/validators.ts"],
4
+ "sourcesContent": [
5
+ "import type { ImageInput } from './types.js';\n\nexport function validateArrayBuffer(\n buffer: unknown\n): asserts buffer is ArrayBuffer {\n // Check if SharedArrayBuffer is defined in the current environment before using it\n if (\n typeof SharedArrayBuffer !== 'undefined' &&\n buffer instanceof SharedArrayBuffer\n ) {\n throw new Error(\n 'SharedArrayBuffer is not supported. ' +\n 'Use regular ArrayBuffer or Uint8Array instead.'\n );\n }\n\n if (!(buffer instanceof ArrayBuffer)) {\n throw new TypeError('image.data.buffer must be an ArrayBuffer');\n }\n}\n\nexport function validateImageInput(\n image: unknown\n): asserts image is ImageInput {\n if (!image || typeof image !== 'object') {\n throw new TypeError('image must be an object');\n }\n\n const imageObj = image as Record<string, unknown>;\n\n if (!('data' in imageObj)) {\n throw new TypeError('image.data is required');\n }\n\n const { data } = imageObj;\n if (!(data instanceof Uint8Array || data instanceof Uint8ClampedArray)) {\n throw new TypeError('image.data must be Uint8Array or Uint8ClampedArray');\n }\n\n if (!('width' in imageObj) || !('height' in imageObj)) {\n throw new TypeError('image.width and image.height are required');\n }\n\n const { width, height } = imageObj;\n\n if (typeof width !== 'number' || !Number.isInteger(width) || width <= 0) {\n throw new RangeError(\n `image.width must be a positive integer, got ${width}`\n );\n }\n\n if (typeof height !== 'number' || !Number.isInteger(height) || height <= 0) {\n throw new RangeError(\n `image.height must be a positive integer, got ${height}`\n );\n }\n\n const expectedSize = width * height * 4;\n if (data.length < expectedSize) {\n throw new RangeError(\n `image.data too small: ${data.length} bytes, expected at least ${expectedSize} bytes for ${width}x${height} RGBA image`\n );\n }\n}\n"
6
+ ],
7
+ "mappings": ";AAqBO,SAAS,CAAkB,CAChC,EAC6B,CAC7B,GAAI,CAAC,GAAS,OAAO,IAAU,SAC7B,MAAU,UAAU,yBAAyB,EAG/C,IAAM,EAAW,EAEjB,GAAI,EAAE,SAAU,GACd,MAAU,UAAU,wBAAwB,EAG9C,IAAQ,QAAS,EACjB,GAAI,EAAE,aAAgB,YAAc,aAAgB,mBAClD,MAAU,UAAU,oDAAoD,EAG1E,GAAI,EAAE,UAAW,IAAa,EAAE,WAAY,GAC1C,MAAU,UAAU,2CAA2C,EAGjE,IAAQ,QAAO,UAAW,EAE1B,GAAI,OAAO,IAAU,UAAY,CAAC,OAAO,UAAU,CAAK,GAAK,GAAS,EACpE,MAAU,WACR,+CAA+C,GACjD,EAGF,GAAI,OAAO,IAAW,UAAY,CAAC,OAAO,UAAU,CAAM,GAAK,GAAU,EACvE,MAAU,WACR,gDAAgD,GAClD,EAGF,IAAM,EAAe,EAAQ,EAAS,EACtC,GAAI,EAAK,OAAS,EAChB,MAAU,WACR,yBAAyB,EAAK,mCAAmC,eAA0B,KAAS,cACtG",
8
+ "debugId": "7AE3A24486B7640E64756E2164756E21",
9
+ "names": []
10
+ }
@@ -0,0 +1,4 @@
1
+ function H(F){if(!F||typeof F!=="object")throw TypeError("image must be an object");let D=F;if(!("data"in D))throw TypeError("image.data is required");let{data:E}=D;if(!(E instanceof Uint8Array||E instanceof Uint8ClampedArray))throw TypeError("image.data must be Uint8Array or Uint8ClampedArray");if(!("width"in D)||!("height"in D))throw TypeError("image.width and image.height are required");let{width:l,height:q}=D;if(typeof l!=="number"||!Number.isInteger(l)||l<=0)throw RangeError(`image.width must be a positive integer, got ${l}`);if(typeof q!=="number"||!Number.isInteger(q)||q<=0)throw RangeError(`image.height must be a positive integer, got ${q}`);let G=l*q*4;if(E.length<G)throw RangeError(`image.data too small: ${E.length} bytes, expected at least ${G} bytes for ${l}x${q} RGBA image`)}
2
+ export{H as b};
3
+
4
+ //# debugId=BE7FDBD72E428B8E64756E2164756E21
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../runtime/src/validators.ts"],
4
+ "sourcesContent": [
5
+ "import type { ImageInput } from './types.js';\n\nexport function validateArrayBuffer(\n buffer: unknown\n): asserts buffer is ArrayBuffer {\n // Check if SharedArrayBuffer is defined in the current environment before using it\n if (\n typeof SharedArrayBuffer !== 'undefined' &&\n buffer instanceof SharedArrayBuffer\n ) {\n throw new Error(\n 'SharedArrayBuffer is not supported. ' +\n 'Use regular ArrayBuffer or Uint8Array instead.'\n );\n }\n\n if (!(buffer instanceof ArrayBuffer)) {\n throw new TypeError('image.data.buffer must be an ArrayBuffer');\n }\n}\n\nexport function validateImageInput(\n image: unknown\n): asserts image is ImageInput {\n if (!image || typeof image !== 'object') {\n throw new TypeError('image must be an object');\n }\n\n const imageObj = image as Record<string, unknown>;\n\n if (!('data' in imageObj)) {\n throw new TypeError('image.data is required');\n }\n\n const { data } = imageObj;\n if (!(data instanceof Uint8Array || data instanceof Uint8ClampedArray)) {\n throw new TypeError('image.data must be Uint8Array or Uint8ClampedArray');\n }\n\n if (!('width' in imageObj) || !('height' in imageObj)) {\n throw new TypeError('image.width and image.height are required');\n }\n\n const { width, height } = imageObj;\n\n if (typeof width !== 'number' || !Number.isInteger(width) || width <= 0) {\n throw new RangeError(\n `image.width must be a positive integer, got ${width}`\n );\n }\n\n if (typeof height !== 'number' || !Number.isInteger(height) || height <= 0) {\n throw new RangeError(\n `image.height must be a positive integer, got ${height}`\n );\n }\n\n const expectedSize = width * height * 4;\n if (data.length < expectedSize) {\n throw new RangeError(\n `image.data too small: ${data.length} bytes, expected at least ${expectedSize} bytes for ${width}x${height} RGBA image`\n );\n }\n}\n"
6
+ ],
7
+ "mappings": "AAqBO,SAAS,CAAkB,CAChC,EAC6B,CAC7B,GAAI,CAAC,GAAS,OAAO,IAAU,SAC7B,MAAU,UAAU,yBAAyB,EAG/C,IAAM,EAAW,EAEjB,GAAI,EAAE,SAAU,GACd,MAAU,UAAU,wBAAwB,EAG9C,IAAQ,QAAS,EACjB,GAAI,EAAE,aAAgB,YAAc,aAAgB,mBAClD,MAAU,UAAU,oDAAoD,EAG1E,GAAI,EAAE,UAAW,IAAa,EAAE,WAAY,GAC1C,MAAU,UAAU,2CAA2C,EAGjE,IAAQ,QAAO,UAAW,EAE1B,GAAI,OAAO,IAAU,UAAY,CAAC,OAAO,UAAU,CAAK,GAAK,GAAS,EACpE,MAAU,WACR,+CAA+C,GACjD,EAGF,GAAI,OAAO,IAAW,UAAY,CAAC,OAAO,UAAU,CAAM,GAAK,GAAU,EACvE,MAAU,WACR,gDAAgD,GAClD,EAGF,IAAM,EAAe,EAAQ,EAAS,EACtC,GAAI,EAAK,OAAS,EAChB,MAAU,WACR,yBAAyB,EAAK,mCAAmC,eAA0B,KAAS,cACtG",
8
+ "debugId": "BE7FDBD72E428B8E64756E2164756E21",
9
+ "names": []
10
+ }
@@ -1,3 +1,3 @@
1
- import{a as E}from"./bridge.browser.mjs";import"./chunk-xrd0djzj.js";var y=null;async function I(q,j,v){if(!y)y=E("worker");return y.resize(q,j,v)}function J(q="worker"){let j=E(q);return Object.assign((v,F,G)=>{return j.resize(v,F,G)},{terminate:async()=>{await j.terminate()}})}export{I as resize,J as createResizer};
1
+ import{a as G}from"./bridge.browser.mjs";import"./chunk-szbj3b6y.js";import"./chunk-bhj61bkd.js";var E=null,H;function P(v){H=v,E=null}async function Q(v,F,y){if(!E)E=G("worker",H);return E.resize(v,F,y)}function X(v="worker",F){let y=G(v,F);return Object.assign((J,K,M)=>{return y.resize(J,K,M)},{terminate:async()=>{await y.terminate()}})}export{Q as resize,X as createResizer,P as configureResizeWorker};
2
2
 
3
- //# debugId=A8725929192B476864756E2164756E21
3
+ //# debugId=A8CB0914A9ED894564756E2164756E21
@@ -2,9 +2,9 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
4
  "sourcesContent": [
5
- "/**\n * @squoosh-kit/resize public API\n */\n\nimport type { ImageInput } from '@squoosh-kit/runtime';\nimport { createBridge } from './bridge';\nimport type { ResizeOptions } from './types';\n\nexport type { ImageInput, ResizeOptions };\n\n// Global bridge instance for reuse\nlet globalClientBridge: ReturnType<typeof createBridge> | null = null;\n\n/**\n * A resizable image processor that can be reused for multiple operations.\n * Can be terminated to clean up associated resources (especially workers).\n */\nexport type ResizerFactory = ((\n imageData: ImageInput,\n options: ResizeOptions,\n signal?: AbortSignal\n) => Promise<ImageInput>) & {\n /**\n * Terminates the resizer and cleans up resources.\n * Important for worker mode to prevent memory leaks.\n *\n * @example\n * const resizer = createResizer('worker');\n * try {\n * const result = await resizer(imageData, options);\n * } finally {\n * await resizer.terminate();\n * }\n */\n terminate(): Promise<void>;\n};\n\n/**\n * Resizes an image. Uses worker mode for UI responsiveness.\n *\n * @param imageData - The image data to resize.\n * @param options - Resize options.\n * @param signal - (Optional) AbortSignal to cancel the resizing operation.\n * If provided, you can cancel the operation by calling\n * `controller.abort()` on the associated AbortController.\n * If not provided, the operation cannot be cancelled.\n * @returns A Promise resolving to the resized image data.\n *\n * @example\n * // With cancellation support\n * const controller = new AbortController();\n * const result = await resize(imageData, { width: 800 }, controller.signal);\n * setTimeout(() => controller.abort(), 5000);\n *\n * @example\n * // Without cancellation (operation cannot be stopped)\n * const result = await resize(imageData, { width: 800 });\n */\nexport async function resize(\n imageData: ImageInput,\n options: ResizeOptions,\n signal?: AbortSignal\n): Promise<ImageInput> {\n // Use worker mode for UI responsiveness - prevents blocking the main thread\n if (!globalClientBridge) {\n globalClientBridge = createBridge('worker');\n }\n\n return globalClientBridge.resize(imageData, options, signal);\n}\n\n/**\n * Creates a reusable resizer function for a specific execution mode.\n *\n * @param mode - The execution mode, either 'worker' or 'client'.\n * @returns A function that resizes an image with optional AbortSignal.\n */\nexport function createResizer(\n mode: 'worker' | 'client' = 'worker'\n): ResizerFactory {\n const bridge = createBridge(mode);\n\n return Object.assign(\n (imageData: ImageInput, options: ResizeOptions, signal?: AbortSignal) => {\n return bridge.resize(imageData, options, signal);\n },\n {\n terminate: async () => {\n await bridge.terminate();\n },\n }\n );\n}\n"
5
+ "/**\n * @squoosh-kit/resize public API\n */\n\nimport type { ImageInput } from '@squoosh-kit/runtime';\nimport { createBridge } from './bridge';\nimport type { ResizeOptions } from './types';\n\nexport type { ImageInput, ResizeOptions };\n\n// Global bridge instance for reuse\nlet globalClientBridge: ReturnType<typeof createBridge> | null = null;\nlet globalCustomWorkerUrl: string | undefined;\n\n/**\n * A resizable image processor that can be reused for multiple operations.\n * Can be terminated to clean up associated resources (especially workers).\n */\nexport type ResizerFactory = ((\n imageData: ImageInput,\n options: ResizeOptions,\n signal?: AbortSignal\n) => Promise<ImageInput>) & {\n /**\n * Terminates the resizer and cleans up resources.\n * Important for worker mode to prevent memory leaks.\n *\n * @example\n * const resizer = createResizer('worker');\n * try {\n * const result = await resizer(imageData, options);\n * } finally {\n * await resizer.terminate();\n * }\n */\n terminate(): Promise<void>;\n};\n\n/**\n * Configure the global resize worker URL. Call this before using the resize function\n * in environments like Vite where the worker path needs to be explicitly resolved.\n *\n * @param workerUrl - The absolute URL to the resize worker file.\n * In Vite apps, use: new URL('@squoosh-kit/resize/dist/resize.worker.browser.mjs', import.meta.url).href\n *\n * @example\n * import { configureResizeWorker, resize } from '@squoosh-kit/resize';\n *\n * // In your Vite app initialization:\n * configureResizeWorker(\n * new URL('@squoosh-kit/resize/dist/resize.worker.browser.mjs', import.meta.url).href\n * );\n *\n * // Then use resize normally:\n * const result = await resize(imageData, { width: 800 });\n */\nexport function configureResizeWorker(workerUrl: string): void {\n globalCustomWorkerUrl = workerUrl;\n // Reset the bridge so it uses the new worker URL on next call\n globalClientBridge = null;\n}\n\n/**\n * Resizes an image. Uses worker mode for UI responsiveness.\n *\n * @param imageData - The image data to resize.\n * @param options - Resize options.\n * @param signal - (Optional) AbortSignal to cancel the resizing operation.\n * If provided, you can cancel the operation by calling\n * `controller.abort()` on the associated AbortController.\n * If not provided, the operation cannot be cancelled.\n * @returns A Promise resolving to the resized image data.\n *\n * @example\n * // With cancellation support\n * const controller = new AbortController();\n * const result = await resize(imageData, { width: 800 }, controller.signal);\n * setTimeout(() => controller.abort(), 5000);\n *\n * @example\n * // Without cancellation (operation cannot be stopped)\n * const result = await resize(imageData, { width: 800 });\n */\nexport async function resize(\n imageData: ImageInput,\n options: ResizeOptions,\n signal?: AbortSignal\n): Promise<ImageInput> {\n // Use worker mode for UI responsiveness - prevents blocking the main thread\n if (!globalClientBridge) {\n globalClientBridge = createBridge('worker', globalCustomWorkerUrl);\n }\n\n return globalClientBridge.resize(imageData, options, signal);\n}\n\n/**\n * Creates a reusable resizer function for a specific execution mode.\n *\n * @param mode - The execution mode, either 'worker' or 'client'.\n * @param customWorkerUrl - (Optional) Custom URL for the worker file in 'worker' mode.\n * @returns A function that resizes an image with optional AbortSignal.\n *\n * @example\n * // In a Vite app with custom worker URL:\n * const resizer = createResizer(\n * 'worker',\n * new URL('@squoosh-kit/resize/dist/resize.worker.browser.mjs', import.meta.url).href\n * );\n * const result = await resizer(imageData, { width: 800 });\n * await resizer.terminate();\n */\nexport function createResizer(\n mode: 'worker' | 'client' = 'worker',\n customWorkerUrl?: string\n): ResizerFactory {\n const bridge = createBridge(mode, customWorkerUrl);\n\n return Object.assign(\n (imageData: ImageInput, options: ResizeOptions, signal?: AbortSignal) => {\n return bridge.resize(imageData, options, signal);\n },\n {\n terminate: async () => {\n await bridge.terminate();\n },\n }\n );\n}\n"
6
6
  ],
7
- "mappings": "2EAWA,FAAI,EAA6D,KA+CjE,eAAsB,CAAM,CAC1B,EACA,EACA,EACqB,CAErB,GAAI,CAAC,EACH,EAAqB,EAAa,QAAQ,EAG5C,OAAO,EAAmB,OAAO,EAAW,EAAS,CAAM,EAStD,SAAS,CAAa,CAC3B,EAA4B,SACZ,CAChB,IAAM,EAAS,EAAa,CAAI,EAEhC,OAAO,OAAO,OACZ,CAAC,EAAuB,EAAwB,IAAyB,CACvE,OAAO,EAAO,OAAO,EAAW,EAAS,CAAM,GAEjD,CACE,UAAW,SAAY,CACrB,MAAM,EAAO,UAAU,EAE3B,CACF",
8
- "debugId": "A8725929192B476864756E2164756E21",
7
+ "mappings": "6GAWA,FAAI,JAA6D,KAC7D,EA4CG,SAAS,CAAqB,CAAC,EAAyB,CAC7D,EAAwB,EAExB,EAAqB,KAwBvB,eAAsB,CAAM,CAC1B,EACA,EACA,EACqB,CAErB,GAAI,CAAC,EACH,EAAqB,EAAa,SAAU,CAAqB,EAGnE,OAAO,EAAmB,OAAO,EAAW,EAAS,CAAM,EAmBtD,SAAS,CAAa,CAC3B,EAA4B,SAC5B,EACgB,CAChB,IAAM,EAAS,EAAa,EAAM,CAAe,EAEjD,OAAO,OAAO,OACZ,CAAC,EAAuB,EAAwB,IAAyB,CACvE,OAAO,EAAO,OAAO,EAAW,EAAS,CAAM,GAEjD,CACE,UAAW,SAAY,CACrB,MAAM,EAAO,UAAU,EAE3B,CACF",
8
+ "debugId": "A8CB0914A9ED894564756E2164756E21",
9
9
  "names": []
10
10
  }
package/dist/index.bun.js CHANGED
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{a as E}from"./bridge.bun.js";import"./chunk-6qec3cgc.js";var y=null;async function I(q,j,v){if(!y)y=E("worker");return y.resize(q,j,v)}function J(q="worker"){let j=E(q);return Object.assign((v,F,G)=>{return j.resize(v,F,G)},{terminate:async()=>{await j.terminate()}})}export{I as resize,J as createResizer};
2
+ import{a as G}from"./bridge.bun.js";import"./chunk-q0apy7nk.js";import"./chunk-8y42hv65.js";var E=null,H;function P(v){H=v,E=null}async function Q(v,F,y){if(!E)E=G("worker",H);return E.resize(v,F,y)}function X(v="worker",F){let y=G(v,F);return Object.assign((J,K,M)=>{return y.resize(J,K,M)},{terminate:async()=>{await y.terminate()}})}export{Q as resize,X as createResizer,P as configureResizeWorker};
3
3
 
4
- //# debugId=1DF93200EB2539BE64756E2164756E21
4
+ //# debugId=45B78DB4C08FB64364756E2164756E21
@@ -2,9 +2,9 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
4
  "sourcesContent": [
5
- "/**\n * @squoosh-kit/resize public API\n */\n\nimport type { ImageInput } from '@squoosh-kit/runtime';\nimport { createBridge } from './bridge';\nimport type { ResizeOptions } from './types';\n\nexport type { ImageInput, ResizeOptions };\n\n// Global bridge instance for reuse\nlet globalClientBridge: ReturnType<typeof createBridge> | null = null;\n\n/**\n * A resizable image processor that can be reused for multiple operations.\n * Can be terminated to clean up associated resources (especially workers).\n */\nexport type ResizerFactory = ((\n imageData: ImageInput,\n options: ResizeOptions,\n signal?: AbortSignal\n) => Promise<ImageInput>) & {\n /**\n * Terminates the resizer and cleans up resources.\n * Important for worker mode to prevent memory leaks.\n *\n * @example\n * const resizer = createResizer('worker');\n * try {\n * const result = await resizer(imageData, options);\n * } finally {\n * await resizer.terminate();\n * }\n */\n terminate(): Promise<void>;\n};\n\n/**\n * Resizes an image. Uses worker mode for UI responsiveness.\n *\n * @param imageData - The image data to resize.\n * @param options - Resize options.\n * @param signal - (Optional) AbortSignal to cancel the resizing operation.\n * If provided, you can cancel the operation by calling\n * `controller.abort()` on the associated AbortController.\n * If not provided, the operation cannot be cancelled.\n * @returns A Promise resolving to the resized image data.\n *\n * @example\n * // With cancellation support\n * const controller = new AbortController();\n * const result = await resize(imageData, { width: 800 }, controller.signal);\n * setTimeout(() => controller.abort(), 5000);\n *\n * @example\n * // Without cancellation (operation cannot be stopped)\n * const result = await resize(imageData, { width: 800 });\n */\nexport async function resize(\n imageData: ImageInput,\n options: ResizeOptions,\n signal?: AbortSignal\n): Promise<ImageInput> {\n // Use worker mode for UI responsiveness - prevents blocking the main thread\n if (!globalClientBridge) {\n globalClientBridge = createBridge('worker');\n }\n\n return globalClientBridge.resize(imageData, options, signal);\n}\n\n/**\n * Creates a reusable resizer function for a specific execution mode.\n *\n * @param mode - The execution mode, either 'worker' or 'client'.\n * @returns A function that resizes an image with optional AbortSignal.\n */\nexport function createResizer(\n mode: 'worker' | 'client' = 'worker'\n): ResizerFactory {\n const bridge = createBridge(mode);\n\n return Object.assign(\n (imageData: ImageInput, options: ResizeOptions, signal?: AbortSignal) => {\n return bridge.resize(imageData, options, signal);\n },\n {\n terminate: async () => {\n await bridge.terminate();\n },\n }\n );\n}\n"
5
+ "/**\n * @squoosh-kit/resize public API\n */\n\nimport type { ImageInput } from '@squoosh-kit/runtime';\nimport { createBridge } from './bridge';\nimport type { ResizeOptions } from './types';\n\nexport type { ImageInput, ResizeOptions };\n\n// Global bridge instance for reuse\nlet globalClientBridge: ReturnType<typeof createBridge> | null = null;\nlet globalCustomWorkerUrl: string | undefined;\n\n/**\n * A resizable image processor that can be reused for multiple operations.\n * Can be terminated to clean up associated resources (especially workers).\n */\nexport type ResizerFactory = ((\n imageData: ImageInput,\n options: ResizeOptions,\n signal?: AbortSignal\n) => Promise<ImageInput>) & {\n /**\n * Terminates the resizer and cleans up resources.\n * Important for worker mode to prevent memory leaks.\n *\n * @example\n * const resizer = createResizer('worker');\n * try {\n * const result = await resizer(imageData, options);\n * } finally {\n * await resizer.terminate();\n * }\n */\n terminate(): Promise<void>;\n};\n\n/**\n * Configure the global resize worker URL. Call this before using the resize function\n * in environments like Vite where the worker path needs to be explicitly resolved.\n *\n * @param workerUrl - The absolute URL to the resize worker file.\n * In Vite apps, use: new URL('@squoosh-kit/resize/dist/resize.worker.browser.mjs', import.meta.url).href\n *\n * @example\n * import { configureResizeWorker, resize } from '@squoosh-kit/resize';\n *\n * // In your Vite app initialization:\n * configureResizeWorker(\n * new URL('@squoosh-kit/resize/dist/resize.worker.browser.mjs', import.meta.url).href\n * );\n *\n * // Then use resize normally:\n * const result = await resize(imageData, { width: 800 });\n */\nexport function configureResizeWorker(workerUrl: string): void {\n globalCustomWorkerUrl = workerUrl;\n // Reset the bridge so it uses the new worker URL on next call\n globalClientBridge = null;\n}\n\n/**\n * Resizes an image. Uses worker mode for UI responsiveness.\n *\n * @param imageData - The image data to resize.\n * @param options - Resize options.\n * @param signal - (Optional) AbortSignal to cancel the resizing operation.\n * If provided, you can cancel the operation by calling\n * `controller.abort()` on the associated AbortController.\n * If not provided, the operation cannot be cancelled.\n * @returns A Promise resolving to the resized image data.\n *\n * @example\n * // With cancellation support\n * const controller = new AbortController();\n * const result = await resize(imageData, { width: 800 }, controller.signal);\n * setTimeout(() => controller.abort(), 5000);\n *\n * @example\n * // Without cancellation (operation cannot be stopped)\n * const result = await resize(imageData, { width: 800 });\n */\nexport async function resize(\n imageData: ImageInput,\n options: ResizeOptions,\n signal?: AbortSignal\n): Promise<ImageInput> {\n // Use worker mode for UI responsiveness - prevents blocking the main thread\n if (!globalClientBridge) {\n globalClientBridge = createBridge('worker', globalCustomWorkerUrl);\n }\n\n return globalClientBridge.resize(imageData, options, signal);\n}\n\n/**\n * Creates a reusable resizer function for a specific execution mode.\n *\n * @param mode - The execution mode, either 'worker' or 'client'.\n * @param customWorkerUrl - (Optional) Custom URL for the worker file in 'worker' mode.\n * @returns A function that resizes an image with optional AbortSignal.\n *\n * @example\n * // In a Vite app with custom worker URL:\n * const resizer = createResizer(\n * 'worker',\n * new URL('@squoosh-kit/resize/dist/resize.worker.browser.mjs', import.meta.url).href\n * );\n * const result = await resizer(imageData, { width: 800 });\n * await resizer.terminate();\n */\nexport function createResizer(\n mode: 'worker' | 'client' = 'worker',\n customWorkerUrl?: string\n): ResizerFactory {\n const bridge = createBridge(mode, customWorkerUrl);\n\n return Object.assign(\n (imageData: ImageInput, options: ResizeOptions, signal?: AbortSignal) => {\n return bridge.resize(imageData, options, signal);\n },\n {\n terminate: async () => {\n await bridge.terminate();\n },\n }\n );\n}\n"
6
6
  ],
7
- "mappings": ";sEAWA,FAAI,EAA6D,KA+CjE,eAAsB,CAAM,CAC1B,EACA,EACA,EACqB,CAErB,GAAI,CAAC,EACH,EAAqB,EAAa,QAAQ,EAG5C,OAAO,EAAmB,OAAO,EAAW,EAAS,CAAM,EAStD,SAAS,CAAa,CAC3B,EAA4B,SACZ,CAChB,IAAM,EAAS,EAAa,CAAI,EAEhC,OAAO,OAAO,OACZ,CAAC,EAAuB,EAAwB,IAAyB,CACvE,OAAO,EAAO,OAAO,EAAW,EAAS,CAAM,GAEjD,CACE,UAAW,SAAY,CACrB,MAAM,EAAO,UAAU,EAE3B,CACF",
8
- "debugId": "1DF93200EB2539BE64756E2164756E21",
7
+ "mappings": ";wGAWA,FAAI,JAA6D,KAC7D,EA4CG,SAAS,CAAqB,CAAC,EAAyB,CAC7D,EAAwB,EAExB,EAAqB,KAwBvB,eAAsB,CAAM,CAC1B,EACA,EACA,EACqB,CAErB,GAAI,CAAC,EACH,EAAqB,EAAa,SAAU,CAAqB,EAGnE,OAAO,EAAmB,OAAO,EAAW,EAAS,CAAM,EAmBtD,SAAS,CAAa,CAC3B,EAA4B,SAC5B,EACgB,CAChB,IAAM,EAAS,EAAa,EAAM,CAAe,EAEjD,OAAO,OAAO,OACZ,CAAC,EAAuB,EAAwB,IAAyB,CACvE,OAAO,EAAO,OAAO,EAAW,EAAS,CAAM,GAEjD,CACE,UAAW,SAAY,CACrB,MAAM,EAAO,UAAU,EAE3B,CACF",
8
+ "debugId": "45B78DB4C08FB64364756E2164756E21",
9
9
  "names": []
10
10
  }
package/dist/index.d.ts CHANGED
@@ -23,6 +23,25 @@ export type ResizerFactory = ((imageData: ImageInput, options: ResizeOptions, si
23
23
  */
24
24
  terminate(): Promise<void>;
25
25
  };
26
+ /**
27
+ * Configure the global resize worker URL. Call this before using the resize function
28
+ * in environments like Vite where the worker path needs to be explicitly resolved.
29
+ *
30
+ * @param workerUrl - The absolute URL to the resize worker file.
31
+ * In Vite apps, use: new URL('@squoosh-kit/resize/dist/resize.worker.browser.mjs', import.meta.url).href
32
+ *
33
+ * @example
34
+ * import { configureResizeWorker, resize } from '@squoosh-kit/resize';
35
+ *
36
+ * // In your Vite app initialization:
37
+ * configureResizeWorker(
38
+ * new URL('@squoosh-kit/resize/dist/resize.worker.browser.mjs', import.meta.url).href
39
+ * );
40
+ *
41
+ * // Then use resize normally:
42
+ * const result = await resize(imageData, { width: 800 });
43
+ */
44
+ export declare function configureResizeWorker(workerUrl: string): void;
26
45
  /**
27
46
  * Resizes an image. Uses worker mode for UI responsiveness.
28
47
  *
@@ -49,7 +68,17 @@ export declare function resize(imageData: ImageInput, options: ResizeOptions, si
49
68
  * Creates a reusable resizer function for a specific execution mode.
50
69
  *
51
70
  * @param mode - The execution mode, either 'worker' or 'client'.
71
+ * @param customWorkerUrl - (Optional) Custom URL for the worker file in 'worker' mode.
52
72
  * @returns A function that resizes an image with optional AbortSignal.
73
+ *
74
+ * @example
75
+ * // In a Vite app with custom worker URL:
76
+ * const resizer = createResizer(
77
+ * 'worker',
78
+ * new URL('@squoosh-kit/resize/dist/resize.worker.browser.mjs', import.meta.url).href
79
+ * );
80
+ * const result = await resizer(imageData, { width: 800 });
81
+ * await resizer.terminate();
53
82
  */
54
- export declare function createResizer(mode?: 'worker' | 'client'): ResizerFactory;
83
+ export declare function createResizer(mode?: 'worker' | 'client', customWorkerUrl?: string): ResizerFactory;
55
84
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,CAAC;AAK1C;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAC5B,SAAS,EAAE,UAAU,EACrB,OAAO,EAAE,aAAa,EACtB,MAAM,CAAC,EAAE,WAAW,KACjB,OAAO,CAAC,UAAU,CAAC,CAAC,GAAG;IAC1B;;;;;;;;;;;OAWG;IACH,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,MAAM,CAC1B,SAAS,EAAE,UAAU,EACrB,OAAO,EAAE,aAAa,EACtB,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,UAAU,CAAC,CAOrB;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,IAAI,GAAE,QAAQ,GAAG,QAAmB,GACnC,cAAc,CAahB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,CAAC;AAM1C;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,CAC5B,SAAS,EAAE,UAAU,EACrB,OAAO,EAAE,aAAa,EACtB,MAAM,CAAC,EAAE,WAAW,KACjB,OAAO,CAAC,UAAU,CAAC,CAAC,GAAG;IAC1B;;;;;;;;;;;OAWG;IACH,SAAS,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5B,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAI7D;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,MAAM,CAC1B,SAAS,EAAE,UAAU,EACrB,OAAO,EAAE,aAAa,EACtB,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,UAAU,CAAC,CAOrB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAC3B,IAAI,GAAE,QAAQ,GAAG,QAAmB,EACpC,eAAe,CAAC,EAAE,MAAM,GACvB,cAAc,CAahB"}
@@ -1,3 +1,3 @@
1
- var L={};I(L,{resize:()=>J,createResizer:()=>K});module.exports=H(L);var y=null;async function J(q,j,v){if(!y)y=E("worker");return y.resize(q,j,v)}function K(q="worker"){let j=E(q);return Object.assign((v,F,G)=>{return j.resize(v,F,G)},{terminate:async()=>{await j.terminate()}})}
1
+ var Z={};P(Z,{resize:()=>X,createResizer:()=>Y,configureResizeWorker:()=>Q});module.exports=N(Z);var E=null,H;function Q(v){H=v,E=null}async function X(v,F,y){if(!E)E=G("worker",H);return E.resize(v,F,y)}function Y(v="worker",F){let y=G(v,F);return Object.assign((J,K,M)=>{return y.resize(J,K,M)},{terminate:async()=>{await y.terminate()}})}
2
2
 
3
- //# debugId=1A7C87ECFBF883EF64756E2164756E21
3
+ //# debugId=85319A893BA043BB64756E2164756E21
@@ -2,9 +2,9 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
4
  "sourcesContent": [
5
- "/**\n * @squoosh-kit/resize public API\n */\n\nimport type { ImageInput } from '@squoosh-kit/runtime';\nimport { createBridge } from './bridge';\nimport type { ResizeOptions } from './types';\n\nexport type { ImageInput, ResizeOptions };\n\n// Global bridge instance for reuse\nlet globalClientBridge: ReturnType<typeof createBridge> | null = null;\n\n/**\n * A resizable image processor that can be reused for multiple operations.\n * Can be terminated to clean up associated resources (especially workers).\n */\nexport type ResizerFactory = ((\n imageData: ImageInput,\n options: ResizeOptions,\n signal?: AbortSignal\n) => Promise<ImageInput>) & {\n /**\n * Terminates the resizer and cleans up resources.\n * Important for worker mode to prevent memory leaks.\n *\n * @example\n * const resizer = createResizer('worker');\n * try {\n * const result = await resizer(imageData, options);\n * } finally {\n * await resizer.terminate();\n * }\n */\n terminate(): Promise<void>;\n};\n\n/**\n * Resizes an image. Uses worker mode for UI responsiveness.\n *\n * @param imageData - The image data to resize.\n * @param options - Resize options.\n * @param signal - (Optional) AbortSignal to cancel the resizing operation.\n * If provided, you can cancel the operation by calling\n * `controller.abort()` on the associated AbortController.\n * If not provided, the operation cannot be cancelled.\n * @returns A Promise resolving to the resized image data.\n *\n * @example\n * // With cancellation support\n * const controller = new AbortController();\n * const result = await resize(imageData, { width: 800 }, controller.signal);\n * setTimeout(() => controller.abort(), 5000);\n *\n * @example\n * // Without cancellation (operation cannot be stopped)\n * const result = await resize(imageData, { width: 800 });\n */\nexport async function resize(\n imageData: ImageInput,\n options: ResizeOptions,\n signal?: AbortSignal\n): Promise<ImageInput> {\n // Use worker mode for UI responsiveness - prevents blocking the main thread\n if (!globalClientBridge) {\n globalClientBridge = createBridge('worker');\n }\n\n return globalClientBridge.resize(imageData, options, signal);\n}\n\n/**\n * Creates a reusable resizer function for a specific execution mode.\n *\n * @param mode - The execution mode, either 'worker' or 'client'.\n * @returns A function that resizes an image with optional AbortSignal.\n */\nexport function createResizer(\n mode: 'worker' | 'client' = 'worker'\n): ResizerFactory {\n const bridge = createBridge(mode);\n\n return Object.assign(\n (imageData: ImageInput, options: ResizeOptions, signal?: AbortSignal) => {\n return bridge.resize(imageData, options, signal);\n },\n {\n terminate: async () => {\n await bridge.terminate();\n },\n }\n );\n}\n"
5
+ "/**\n * @squoosh-kit/resize public API\n */\n\nimport type { ImageInput } from '@squoosh-kit/runtime';\nimport { createBridge } from './bridge';\nimport type { ResizeOptions } from './types';\n\nexport type { ImageInput, ResizeOptions };\n\n// Global bridge instance for reuse\nlet globalClientBridge: ReturnType<typeof createBridge> | null = null;\nlet globalCustomWorkerUrl: string | undefined;\n\n/**\n * A resizable image processor that can be reused for multiple operations.\n * Can be terminated to clean up associated resources (especially workers).\n */\nexport type ResizerFactory = ((\n imageData: ImageInput,\n options: ResizeOptions,\n signal?: AbortSignal\n) => Promise<ImageInput>) & {\n /**\n * Terminates the resizer and cleans up resources.\n * Important for worker mode to prevent memory leaks.\n *\n * @example\n * const resizer = createResizer('worker');\n * try {\n * const result = await resizer(imageData, options);\n * } finally {\n * await resizer.terminate();\n * }\n */\n terminate(): Promise<void>;\n};\n\n/**\n * Configure the global resize worker URL. Call this before using the resize function\n * in environments like Vite where the worker path needs to be explicitly resolved.\n *\n * @param workerUrl - The absolute URL to the resize worker file.\n * In Vite apps, use: new URL('@squoosh-kit/resize/dist/resize.worker.browser.mjs', import.meta.url).href\n *\n * @example\n * import { configureResizeWorker, resize } from '@squoosh-kit/resize';\n *\n * // In your Vite app initialization:\n * configureResizeWorker(\n * new URL('@squoosh-kit/resize/dist/resize.worker.browser.mjs', import.meta.url).href\n * );\n *\n * // Then use resize normally:\n * const result = await resize(imageData, { width: 800 });\n */\nexport function configureResizeWorker(workerUrl: string): void {\n globalCustomWorkerUrl = workerUrl;\n // Reset the bridge so it uses the new worker URL on next call\n globalClientBridge = null;\n}\n\n/**\n * Resizes an image. Uses worker mode for UI responsiveness.\n *\n * @param imageData - The image data to resize.\n * @param options - Resize options.\n * @param signal - (Optional) AbortSignal to cancel the resizing operation.\n * If provided, you can cancel the operation by calling\n * `controller.abort()` on the associated AbortController.\n * If not provided, the operation cannot be cancelled.\n * @returns A Promise resolving to the resized image data.\n *\n * @example\n * // With cancellation support\n * const controller = new AbortController();\n * const result = await resize(imageData, { width: 800 }, controller.signal);\n * setTimeout(() => controller.abort(), 5000);\n *\n * @example\n * // Without cancellation (operation cannot be stopped)\n * const result = await resize(imageData, { width: 800 });\n */\nexport async function resize(\n imageData: ImageInput,\n options: ResizeOptions,\n signal?: AbortSignal\n): Promise<ImageInput> {\n // Use worker mode for UI responsiveness - prevents blocking the main thread\n if (!globalClientBridge) {\n globalClientBridge = createBridge('worker', globalCustomWorkerUrl);\n }\n\n return globalClientBridge.resize(imageData, options, signal);\n}\n\n/**\n * Creates a reusable resizer function for a specific execution mode.\n *\n * @param mode - The execution mode, either 'worker' or 'client'.\n * @param customWorkerUrl - (Optional) Custom URL for the worker file in 'worker' mode.\n * @returns A function that resizes an image with optional AbortSignal.\n *\n * @example\n * // In a Vite app with custom worker URL:\n * const resizer = createResizer(\n * 'worker',\n * new URL('@squoosh-kit/resize/dist/resize.worker.browser.mjs', import.meta.url).href\n * );\n * const result = await resizer(imageData, { width: 800 });\n * await resizer.terminate();\n */\nexport function createResizer(\n mode: 'worker' | 'client' = 'worker',\n customWorkerUrl?: string\n): ResizerFactory {\n const bridge = createBridge(mode, customWorkerUrl);\n\n return Object.assign(\n (imageData: ImageInput, options: ResizeOptions, signal?: AbortSignal) => {\n return bridge.resize(imageData, options, signal);\n },\n {\n terminate: async () => {\n await bridge.terminate();\n },\n }\n );\n}\n"
6
6
  ],
7
- "mappings": "qEAWA,IAAI,EAA6D,KA+CjE,eAAsB,CAAM,CAC1B,EACA,EACA,EACqB,CAErB,GAAI,CAAC,EACH,EAAqB,EAAa,QAAQ,EAG5C,OAAO,EAAmB,OAAO,EAAW,EAAS,CAAM,EAStD,SAAS,CAAa,CAC3B,EAA4B,SACZ,CAChB,IAAM,EAAS,EAAa,CAAI,EAEhC,OAAO,OAAO,OACZ,CAAC,EAAuB,EAAwB,IAAyB,CACvE,OAAO,EAAO,OAAO,EAAW,EAAS,CAAM,GAEjD,CACE,UAAW,SAAY,CACrB,MAAM,EAAO,UAAU,EAE3B,CACF",
8
- "debugId": "1A7C87ECFBF883EF64756E2164756E21",
7
+ "mappings": "iGAWA,IAAI,EAA6D,KAC7D,EA4CG,SAAS,CAAqB,CAAC,EAAyB,CAC7D,EAAwB,EAExB,EAAqB,KAwBvB,eAAsB,CAAM,CAC1B,EACA,EACA,EACqB,CAErB,GAAI,CAAC,EACH,EAAqB,EAAa,SAAU,CAAqB,EAGnE,OAAO,EAAmB,OAAO,EAAW,EAAS,CAAM,EAmBtD,SAAS,CAAa,CAC3B,EAA4B,SAC5B,EACgB,CAChB,IAAM,EAAS,EAAa,EAAM,CAAe,EAEjD,OAAO,OAAO,OACZ,CAAC,EAAuB,EAAwB,IAAyB,CACvE,OAAO,EAAO,OAAO,EAAW,EAAS,CAAM,GAEjD,CACE,UAAW,SAAY,CACrB,MAAM,EAAO,UAAU,EAE3B,CACF",
8
+ "debugId": "85319A893BA043BB64756E2164756E21",
9
9
  "names": []
10
10
  }
@@ -1,3 +1,3 @@
1
- import{a as E}from"./bridge.node.mjs";import"./chunk-dfj7cgx8.js";var y=null;async function I(q,j,v){if(!y)y=E("worker");return y.resize(q,j,v)}function J(q="worker"){let j=E(q);return Object.assign((v,F,G)=>{return j.resize(v,F,G)},{terminate:async()=>{await j.terminate()}})}export{I as resize,J as createResizer};
1
+ import{a as G}from"./bridge.node.mjs";import"./chunk-szbj3b6y.js";import"./chunk-c6cx0d7q.js";var E=null,H;function P(v){H=v,E=null}async function Q(v,F,y){if(!E)E=G("worker",H);return E.resize(v,F,y)}function X(v="worker",F){let y=G(v,F);return Object.assign((J,K,M)=>{return y.resize(J,K,M)},{terminate:async()=>{await y.terminate()}})}export{Q as resize,X as createResizer,P as configureResizeWorker};
2
2
 
3
- //# debugId=F7701D7DB05C39C764756E2164756E21
3
+ //# debugId=EC7EDF3CF360F2BB64756E2164756E21
@@ -2,9 +2,9 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
4
  "sourcesContent": [
5
- "/**\n * @squoosh-kit/resize public API\n */\n\nimport type { ImageInput } from '@squoosh-kit/runtime';\nimport { createBridge } from './bridge';\nimport type { ResizeOptions } from './types';\n\nexport type { ImageInput, ResizeOptions };\n\n// Global bridge instance for reuse\nlet globalClientBridge: ReturnType<typeof createBridge> | null = null;\n\n/**\n * A resizable image processor that can be reused for multiple operations.\n * Can be terminated to clean up associated resources (especially workers).\n */\nexport type ResizerFactory = ((\n imageData: ImageInput,\n options: ResizeOptions,\n signal?: AbortSignal\n) => Promise<ImageInput>) & {\n /**\n * Terminates the resizer and cleans up resources.\n * Important for worker mode to prevent memory leaks.\n *\n * @example\n * const resizer = createResizer('worker');\n * try {\n * const result = await resizer(imageData, options);\n * } finally {\n * await resizer.terminate();\n * }\n */\n terminate(): Promise<void>;\n};\n\n/**\n * Resizes an image. Uses worker mode for UI responsiveness.\n *\n * @param imageData - The image data to resize.\n * @param options - Resize options.\n * @param signal - (Optional) AbortSignal to cancel the resizing operation.\n * If provided, you can cancel the operation by calling\n * `controller.abort()` on the associated AbortController.\n * If not provided, the operation cannot be cancelled.\n * @returns A Promise resolving to the resized image data.\n *\n * @example\n * // With cancellation support\n * const controller = new AbortController();\n * const result = await resize(imageData, { width: 800 }, controller.signal);\n * setTimeout(() => controller.abort(), 5000);\n *\n * @example\n * // Without cancellation (operation cannot be stopped)\n * const result = await resize(imageData, { width: 800 });\n */\nexport async function resize(\n imageData: ImageInput,\n options: ResizeOptions,\n signal?: AbortSignal\n): Promise<ImageInput> {\n // Use worker mode for UI responsiveness - prevents blocking the main thread\n if (!globalClientBridge) {\n globalClientBridge = createBridge('worker');\n }\n\n return globalClientBridge.resize(imageData, options, signal);\n}\n\n/**\n * Creates a reusable resizer function for a specific execution mode.\n *\n * @param mode - The execution mode, either 'worker' or 'client'.\n * @returns A function that resizes an image with optional AbortSignal.\n */\nexport function createResizer(\n mode: 'worker' | 'client' = 'worker'\n): ResizerFactory {\n const bridge = createBridge(mode);\n\n return Object.assign(\n (imageData: ImageInput, options: ResizeOptions, signal?: AbortSignal) => {\n return bridge.resize(imageData, options, signal);\n },\n {\n terminate: async () => {\n await bridge.terminate();\n },\n }\n );\n}\n"
5
+ "/**\n * @squoosh-kit/resize public API\n */\n\nimport type { ImageInput } from '@squoosh-kit/runtime';\nimport { createBridge } from './bridge';\nimport type { ResizeOptions } from './types';\n\nexport type { ImageInput, ResizeOptions };\n\n// Global bridge instance for reuse\nlet globalClientBridge: ReturnType<typeof createBridge> | null = null;\nlet globalCustomWorkerUrl: string | undefined;\n\n/**\n * A resizable image processor that can be reused for multiple operations.\n * Can be terminated to clean up associated resources (especially workers).\n */\nexport type ResizerFactory = ((\n imageData: ImageInput,\n options: ResizeOptions,\n signal?: AbortSignal\n) => Promise<ImageInput>) & {\n /**\n * Terminates the resizer and cleans up resources.\n * Important for worker mode to prevent memory leaks.\n *\n * @example\n * const resizer = createResizer('worker');\n * try {\n * const result = await resizer(imageData, options);\n * } finally {\n * await resizer.terminate();\n * }\n */\n terminate(): Promise<void>;\n};\n\n/**\n * Configure the global resize worker URL. Call this before using the resize function\n * in environments like Vite where the worker path needs to be explicitly resolved.\n *\n * @param workerUrl - The absolute URL to the resize worker file.\n * In Vite apps, use: new URL('@squoosh-kit/resize/dist/resize.worker.browser.mjs', import.meta.url).href\n *\n * @example\n * import { configureResizeWorker, resize } from '@squoosh-kit/resize';\n *\n * // In your Vite app initialization:\n * configureResizeWorker(\n * new URL('@squoosh-kit/resize/dist/resize.worker.browser.mjs', import.meta.url).href\n * );\n *\n * // Then use resize normally:\n * const result = await resize(imageData, { width: 800 });\n */\nexport function configureResizeWorker(workerUrl: string): void {\n globalCustomWorkerUrl = workerUrl;\n // Reset the bridge so it uses the new worker URL on next call\n globalClientBridge = null;\n}\n\n/**\n * Resizes an image. Uses worker mode for UI responsiveness.\n *\n * @param imageData - The image data to resize.\n * @param options - Resize options.\n * @param signal - (Optional) AbortSignal to cancel the resizing operation.\n * If provided, you can cancel the operation by calling\n * `controller.abort()` on the associated AbortController.\n * If not provided, the operation cannot be cancelled.\n * @returns A Promise resolving to the resized image data.\n *\n * @example\n * // With cancellation support\n * const controller = new AbortController();\n * const result = await resize(imageData, { width: 800 }, controller.signal);\n * setTimeout(() => controller.abort(), 5000);\n *\n * @example\n * // Without cancellation (operation cannot be stopped)\n * const result = await resize(imageData, { width: 800 });\n */\nexport async function resize(\n imageData: ImageInput,\n options: ResizeOptions,\n signal?: AbortSignal\n): Promise<ImageInput> {\n // Use worker mode for UI responsiveness - prevents blocking the main thread\n if (!globalClientBridge) {\n globalClientBridge = createBridge('worker', globalCustomWorkerUrl);\n }\n\n return globalClientBridge.resize(imageData, options, signal);\n}\n\n/**\n * Creates a reusable resizer function for a specific execution mode.\n *\n * @param mode - The execution mode, either 'worker' or 'client'.\n * @param customWorkerUrl - (Optional) Custom URL for the worker file in 'worker' mode.\n * @returns A function that resizes an image with optional AbortSignal.\n *\n * @example\n * // In a Vite app with custom worker URL:\n * const resizer = createResizer(\n * 'worker',\n * new URL('@squoosh-kit/resize/dist/resize.worker.browser.mjs', import.meta.url).href\n * );\n * const result = await resizer(imageData, { width: 800 });\n * await resizer.terminate();\n */\nexport function createResizer(\n mode: 'worker' | 'client' = 'worker',\n customWorkerUrl?: string\n): ResizerFactory {\n const bridge = createBridge(mode, customWorkerUrl);\n\n return Object.assign(\n (imageData: ImageInput, options: ResizeOptions, signal?: AbortSignal) => {\n return bridge.resize(imageData, options, signal);\n },\n {\n terminate: async () => {\n await bridge.terminate();\n },\n }\n );\n}\n"
6
6
  ],
7
- "mappings": "wEAWA,FAAI,EAA6D,KA+CjE,eAAsB,CAAM,CAC1B,EACA,EACA,EACqB,CAErB,GAAI,CAAC,EACH,EAAqB,EAAa,QAAQ,EAG5C,OAAO,EAAmB,OAAO,EAAW,EAAS,CAAM,EAStD,SAAS,CAAa,CAC3B,EAA4B,SACZ,CAChB,IAAM,EAAS,EAAa,CAAI,EAEhC,OAAO,OAAO,OACZ,CAAC,EAAuB,EAAwB,IAAyB,CACvE,OAAO,EAAO,OAAO,EAAW,EAAS,CAAM,GAEjD,CACE,UAAW,SAAY,CACrB,MAAM,EAAO,UAAU,EAE3B,CACF",
8
- "debugId": "F7701D7DB05C39C764756E2164756E21",
7
+ "mappings": "0GAWA,FAAI,JAA6D,KAC7D,EA4CG,SAAS,CAAqB,CAAC,EAAyB,CAC7D,EAAwB,EAExB,EAAqB,KAwBvB,eAAsB,CAAM,CAC1B,EACA,EACA,EACqB,CAErB,GAAI,CAAC,EACH,EAAqB,EAAa,SAAU,CAAqB,EAGnE,OAAO,EAAmB,OAAO,EAAW,EAAS,CAAM,EAmBtD,SAAS,CAAa,CAC3B,EAA4B,SAC5B,EACgB,CAChB,IAAM,EAAS,EAAa,EAAM,CAAe,EAEjD,OAAO,OAAO,OACZ,CAAC,EAAuB,EAAwB,IAAyB,CACvE,OAAO,EAAO,OAAO,EAAW,EAAS,CAAM,GAEjD,CACE,UAAW,SAAY,CACrB,MAAM,EAAO,UAAU,EAE3B,CACF",
8
+ "debugId": "EC7EDF3CF360F2BB64756E2164756E21",
9
9
  "names": []
10
10
  }
@@ -1,3 +1,3 @@
1
- import{b as U,c as W,d as I,e as R}from"./chunk-xrd0djzj.js";async function B(j){try{if(typeof process<"u"&&process.versions?.node){let D=await import("fs/promises"),J=new URL(j,import.meta.url).pathname,K=await D.readFile(J);return K.buffer.slice(K.byteOffset,K.byteOffset+K.byteLength)}}catch(D){}try{let D=new URL(j,import.meta.url),G=await fetch(D);if(!G.ok)throw Error(`Failed to fetch WASM binary: ${G.status} ${G.statusText}`);return await G.arrayBuffer()}catch(D){throw Error(`Failed to load WASM binary from "${j}": ${D instanceof Error?D.message:String(D)}`)}}var Y,$=null;function v(){if($===null||$.buffer!==Y.memory.buffer)$=new Uint8Array(Y.memory.buffer);return $}var T=0;function M(j,D){let G=D(j.length*1);return v().set(j,G/1),T=j.length,G}var k=null;function A(){if(k===null||k.buffer!==Y.memory.buffer)k=new Int32Array(Y.memory.buffer);return k}var F=null;function P(){if(F===null||F.buffer!==Y.memory.buffer)F=new Uint8ClampedArray(Y.memory.buffer);return F}function f(j,D){return P().subarray(j/1,j/1+D)}function z(j,D,G,J,K,Q,X,V){try{let q=Y.__wbindgen_add_to_stack_pointer(-16);var L=M(j,Y.__wbindgen_malloc),E=T;Y.resize(q,L,E,D,G,J,K,Q,X,V);var O=A()[q/4+0],S=A()[q/4+1],b=f(O,S).slice();return Y.__wbindgen_free(O,S*1),b}finally{Y.__wbindgen_add_to_stack_pointer(16)}}async function w(j,D){if(typeof Response==="function"&&j instanceof Response){if(typeof WebAssembly.instantiateStreaming==="function")try{return await WebAssembly.instantiateStreaming(j,D)}catch(J){if(j.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",J);else throw J}let G=await j.arrayBuffer();return await WebAssembly.instantiate(G,D)}else{let G=await WebAssembly.instantiate(j,D);if(G instanceof WebAssembly.Instance)return{instance:G,module:j};else return G}}async function H(j){if(typeof j>"u")j=new URL("squoosh_resize_bg.wasm",import.meta.url);let D={};if(typeof j==="string"||typeof Request==="function"&&j instanceof Request||typeof URL==="function"&&j instanceof URL)j=fetch(j);let{instance:G,module:J}=await w(await j,D);return Y=G.exports,H.__wbindgen_wasm_module=J,Y}var x=H;var N=null,Z=null;async function y(){if(N)return;if(Z)return Z;return Z=(async()=>{try{let j=null,D=[new URL("./wasm/squoosh_resize_bg.wasm",import.meta.url).href,new URL("../wasm/squoosh_resize_bg.wasm",import.meta.url).href],G=null;for(let J of D)try{j=await B(J);break}catch(K){G=K instanceof Error?K:Error(String(K))}if(!j)throw G||Error("Could not load WASM binary from any path");try{await x(j)}catch(J){if(J instanceof Error&&(J.message.includes("SharedArrayBuffer")||J.message.includes("first argument must be"))){if(typeof SharedArrayBuffer>"u")globalThis.SharedArrayBuffer=ArrayBuffer;try{await x(j)}catch(K){throw Error(`WASM module initialization failed even with polyfill: ${K instanceof Error?K.message:String(K)}`)}}else throw J}N=z}catch(j){throw Z=null,Error(`Failed to initialize resize WASM module: ${j instanceof Error?j.message:String(j)}`)}})(),Z}async function C(j,D){if(I(j),R(D),await y(),!N)throw Error("Resize module not initialized");let{data:G,width:J,height:K}=j,Q=D.width??J,X=D.height??K;if(D.width&&!D.height)X=Math.max(1,Math.round(K*D.width/J));else if(D.height&&!D.width)Q=Math.max(1,Math.round(J*D.height/K));if(Q<1||X<1)throw RangeError(`Output dimensions must be at least 1x1, got ${Q}x${X}`);let V=G instanceof Uint8ClampedArray?new Uint8Array(G.buffer,G.byteOffset,G.length):new Uint8Array(G.buffer,G.byteOffset,G.length);return{data:N(V,J,K,Q,X,c(D),D.premultiply??!0,D.linearRGB??!0),width:Q,height:X}}async function h(j,D,G){if(G?.aborted)throw new DOMException("Aborted","AbortError");return C(j,D)}function c(j){return{triangular:0,catrom:1,mitchell:2,lanczos3:3}[j?.method??"lanczos3"]??3}if(typeof self<"u")self.onmessage=async(j)=>{let D=j.data;if(D?.type==="worker:ping"){self.postMessage({type:"worker:ready"});return}let{id:G,type:J,payload:K}=D,Q={id:G,ok:!1};try{if(J!=="resize:run")throw Error(`Unknown message type: ${J}`);let X=await C(K.image,K.options);Q.ok=!0,Q.data=X,self.postMessage(Q)}catch(X){Q.error=X instanceof Error?X.message:String(X),self.postMessage(Q)}};export{h as resizeClient};
1
+ import{b as C}from"./chunk-szbj3b6y.js";import{c as E}from"./validators.browser.mjs";import{d as B,e as T}from"./chunk-bhj61bkd.js";async function A(j){try{if(typeof process<"u"&&process.versions?.node){let D=await import("fs/promises"),J=/^(file:|https?:)/.test(j)?new URL(j):new URL(j,import.meta.url),K=J.protocol==="file:"?(await import("./chunk-5vdxd0v3.js")).fileURLToPath(J):J.pathname,Q=await D.readFile(K);return Q.buffer.slice(Q.byteOffset,Q.byteOffset+Q.byteLength)}}catch(D){}try{let D=/^(file:|https?:)/.test(j)?new URL(j):new URL(j,import.meta.url),G=await fetch(D);if(!G.ok)throw Error(`Failed to fetch WASM binary: ${G.status} ${G.statusText}`);return await G.arrayBuffer()}catch(D){throw Error(`Failed to load WASM binary from "${j}": ${D instanceof Error?D.message:String(D)}`)}}var Y,$=null;function M(){if($===null||$.buffer!==Y.memory.buffer)$=new Uint8Array(Y.memory.buffer);return $}var z=0;function v(j,D){let G=D(j.length*1);return M().set(j,G/1),z=j.length,G}var k=null;function R(){if(k===null||k.buffer!==Y.memory.buffer)k=new Int32Array(Y.memory.buffer);return k}var F=null;function f(){if(F===null||F.buffer!==Y.memory.buffer)F=new Uint8ClampedArray(Y.memory.buffer);return F}function w(j,D){return f().subarray(j/1,j/1+D)}function H(j,D,G,J,K,Q,X,N){try{let S=Y.__wbindgen_add_to_stack_pointer(-16);var q=v(j,Y.__wbindgen_malloc),W=z;Y.resize(S,q,W,D,G,J,K,Q,X,N);var O=R()[S/4+0],x=R()[S/4+1],U=w(O,x).slice();return Y.__wbindgen_free(O,x*1),U}finally{Y.__wbindgen_add_to_stack_pointer(16)}}async function P(j,D){if(typeof Response==="function"&&j instanceof Response){if(typeof WebAssembly.instantiateStreaming==="function")try{return await WebAssembly.instantiateStreaming(j,D)}catch(J){if(j.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",J);else throw J}let G=await j.arrayBuffer();return await WebAssembly.instantiate(G,D)}else{let G=await WebAssembly.instantiate(j,D);if(G instanceof WebAssembly.Instance)return{instance:G,module:j};else return G}}async function I(j){if(typeof j>"u")j=new URL("squoosh_resize_bg.wasm",import.meta.url);let D={};if(typeof j==="string"||typeof Request==="function"&&j instanceof Request||typeof URL==="function"&&j instanceof URL)j=fetch(j);let{instance:G,module:J}=await P(await j,D);return Y=G.exports,I.__wbindgen_wasm_module=J,Y}var V=I;var L=null,Z=null;async function y(){if(L)return;if(Z)return Z;return Z=(async()=>{try{let j=null,D=[new URL("./wasm/squoosh_resize_bg.wasm",import.meta.url).href,new URL("../wasm/squoosh_resize_bg.wasm",import.meta.url).href],G=null;for(let J of D)try{j=await A(J);break}catch(K){G=K instanceof Error?K:Error(String(K))}if(!j)throw G||Error("Could not load WASM binary from any path");try{await V(j)}catch(J){if(J instanceof Error&&(J.message.includes("SharedArrayBuffer")||J.message.includes("first argument must be"))){if(typeof SharedArrayBuffer>"u")globalThis.SharedArrayBuffer=ArrayBuffer;try{await V(j)}catch(K){throw Error(`WASM module initialization failed even with polyfill: ${K instanceof Error?K.message:String(K)}`)}}else throw J}L=H}catch(j){throw Z=null,Error(`Failed to initialize resize WASM module: ${j instanceof Error?j.message:String(j)}`)}})(),Z}async function b(j,D){if(C(j),E(D),await y(),!L)throw Error("Resize module not initialized");let{data:G,width:J,height:K}=j,Q=D.width??J,X=D.height??K;if(D.width&&!D.height)X=Math.max(1,Math.round(K*D.width/J));else if(D.height&&!D.width)Q=Math.max(1,Math.round(J*D.height/K));if(Q<1||X<1)throw RangeError(`Output dimensions must be at least 1x1, got ${Q}x${X}`);let N=G instanceof Uint8ClampedArray?new Uint8Array(G.buffer,G.byteOffset,G.length):new Uint8Array(G.buffer,G.byteOffset,G.length);return{data:L(N,J,K,Q,X,c(D),D.premultiply??!0,D.linearRGB??!0),width:Q,height:X}}async function l(j,D,G){if(G?.aborted)throw new DOMException("Aborted","AbortError");return b(j,D)}function c(j){return{triangular:0,catrom:1,mitchell:2,lanczos3:3}[j?.method??"lanczos3"]??3}if(typeof self<"u")self.onmessage=async(j)=>{let D=j.data;if(D?.type==="worker:ping"){self.postMessage({type:"worker:ready"});return}let{id:G,type:J,payload:K}=D,Q={id:G,ok:!1};try{if(J!=="resize:run")throw Error(`Unknown message type: ${J}`);let X=await b(K.image,K.options);Q.ok=!0,Q.data=X,self.postMessage(Q)}catch(X){Q.error=X instanceof Error?X.message:String(X),self.postMessage(Q)}};export{l as resizeClient};
2
2
 
3
- //# debugId=46601F45412E8F4C64756E2164756E21
3
+ //# debugId=FFF6041AE058784C64756E2164756E21
@@ -2,11 +2,11 @@
2
2
  "version": 3,
3
3
  "sources": ["../../runtime/src/wasm-loader.ts", "../wasm/squoosh_resize.js", "../src/resize.worker.ts"],
4
4
  "sourcesContent": [
5
- "/**\n * Load WASM binary from various sources with fallback strategies\n *\n * Supports:\n * - Node.js (fs/promises)\n * - Browsers (fetch)\n * - Workers (fetch)\n */\nexport async function loadWasmBinary(\n relativePath: string\n): Promise<ArrayBuffer> {\n try {\n // Strategy 1: Try Node.js fs first (most reliable)\n if (typeof process !== 'undefined' && process.versions?.node) {\n const fsModule = await import(/* @vite-ignore */ 'fs/promises');\n const fileUrl = new URL(relativePath, import.meta.url);\n const filePath = fileUrl.pathname;\n const buffer = await fsModule.readFile(filePath);\n return buffer.buffer.slice(\n buffer.byteOffset,\n buffer.byteOffset + buffer.byteLength\n );\n }\n } catch (e) {\n // Fall through to fetch strategy\n }\n\n // Strategy 2: Fallback to fetch (works in browsers and workers)\n try {\n const url = new URL(/* @vite-ignore */ relativePath, import.meta.url);\n const response = await fetch(url);\n if (!response.ok) {\n throw new Error(\n `Failed to fetch WASM binary: ${response.status} ${response.statusText}`\n );\n }\n return await response.arrayBuffer();\n } catch (error) {\n throw new Error(\n `Failed to load WASM binary from \"${relativePath}\": ${error instanceof Error ? error.message : String(error)}`\n );\n }\n}\n\n/**\n * Load WASM JavaScript module with fallback strategies\n *\n * Strategy 1: Static relative import (works everywhere)\n * Strategy 2: import.meta.resolve (Node.js 22+)\n * Strategy 3: URL-based import (browsers/workers)\n */\nexport async function loadWasmModule(\n modulePath: string\n): Promise<WebAssembly.Module> {\n // Strategy 1: Try direct static import\n try {\n return await import(/* @vite-ignore */ modulePath);\n } catch (e1) {\n // Continue to next strategy\n }\n\n // Strategy 2: Try import.meta.resolve (Node.js 22+)\n try {\n const resolvedPath = await import.meta.resolve(modulePath);\n return await import(/* @vite-ignore */ resolvedPath);\n } catch (e2) {\n // Continue to next strategy\n }\n\n // Strategy 3: Try URL-based import\n try {\n const url = new URL(/* @vite-ignore */ modulePath, import.meta.url);\n return await import(/* @vite-ignore */ url.href);\n } catch (e3) {\n throw new Error(\n `Failed to load WASM module from \"${modulePath}\". ` +\n `Ensure WASM files are in the expected location and the module can be resolved.`\n );\n }\n}\n",
5
+ "/**\n * Load WASM binary from various sources with fallback strategies\n *\n * Supports:\n * - Node.js (fs/promises)\n * - Browsers (fetch)\n * - Workers (fetch)\n */\nexport async function loadWasmBinary(\n relativePath: string\n): Promise<ArrayBuffer> {\n try {\n // Strategy 1: Try Node.js fs first (most reliable)\n if (typeof process !== 'undefined' && process.versions?.node) {\n const fsModule = await import(/* @vite-ignore */ 'fs/promises');\n // If caller provided an absolute URL, respect it; otherwise resolve relative to this module\n const isAbsoluteUrl = /^(file:|https?:)/.test(relativePath);\n const fileUrl = isAbsoluteUrl\n ? new URL(relativePath)\n : new URL(relativePath, import.meta.url);\n // Node fs expects a file path; convert only for file: URLs\n const filePath =\n fileUrl.protocol === 'file:'\n ? (await import('url')).fileURLToPath(fileUrl)\n : fileUrl.pathname;\n const buffer = await fsModule.readFile(filePath);\n\n return buffer.buffer.slice(\n buffer.byteOffset,\n buffer.byteOffset + buffer.byteLength\n );\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (e) {\n // Fall through to fetch strategy\n }\n\n // Strategy 2: Fallback to fetch (works in browsers and workers)\n try {\n const url = /^(file:|https?:)/.test(relativePath)\n ? new URL(/* @vite-ignore */ relativePath)\n : new URL(/* @vite-ignore */ relativePath, import.meta.url);\n const response = await fetch(url);\n\n if (!response.ok) {\n throw new Error(\n `Failed to fetch WASM binary: ${response.status} ${response.statusText}`\n );\n }\n\n return await response.arrayBuffer();\n } catch (error) {\n throw new Error(\n `Failed to load WASM binary from \"${relativePath}\": ${error instanceof Error ? error.message : String(error)}`\n );\n }\n}\n\n/**\n * Load WASM JavaScript module with fallback strategies\n *\n * Strategy 1: Static relative import (works everywhere)\n * Strategy 2: import.meta.resolve (Node.js 22+)\n * Strategy 3: URL-based import (browsers/workers)\n */\nexport async function loadWasmModule(\n modulePath: string\n): Promise<WebAssembly.Module> {\n // Strategy 1: Try direct static import\n try {\n return await import(/* @vite-ignore */ modulePath);\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (e1) {\n // Continue to next strategy\n }\n\n // Strategy 2: Try import.meta.resolve (Node.js 22+)\n try {\n const resolvedPath = await import.meta.resolve(modulePath);\n\n return await import(/* @vite-ignore */ resolvedPath);\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (e2) {\n // Continue to next strategy\n }\n\n // Strategy 3: Try URL-based import\n try {\n const url = new URL(/* @vite-ignore */ modulePath, import.meta.url);\n\n return await import(/* @vite-ignore */ url.href);\n\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (e3) {\n throw new Error(\n `Failed to load WASM module from \"${modulePath}\". ` +\n `Ensure WASM files are in the expected location and the module can be resolved.`\n );\n }\n}\n",
6
6
  "\nlet wasm;\n\nlet cachegetUint8Memory0 = null;\nfunction getUint8Memory0() {\n if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) {\n cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer);\n }\n return cachegetUint8Memory0;\n}\n\nlet WASM_VECTOR_LEN = 0;\n\nfunction passArray8ToWasm0(arg, malloc) {\n const ptr = malloc(arg.length * 1);\n getUint8Memory0().set(arg, ptr / 1);\n WASM_VECTOR_LEN = arg.length;\n return ptr;\n}\n\nlet cachegetInt32Memory0 = null;\nfunction getInt32Memory0() {\n if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) {\n cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer);\n }\n return cachegetInt32Memory0;\n}\n\nlet cachegetUint8ClampedMemory0 = null;\nfunction getUint8ClampedMemory0() {\n if (cachegetUint8ClampedMemory0 === null || cachegetUint8ClampedMemory0.buffer !== wasm.memory.buffer) {\n cachegetUint8ClampedMemory0 = new Uint8ClampedArray(wasm.memory.buffer);\n }\n return cachegetUint8ClampedMemory0;\n}\n\nfunction getClampedArrayU8FromWasm0(ptr, len) {\n return getUint8ClampedMemory0().subarray(ptr / 1, ptr / 1 + len);\n}\n/**\n* @param {Uint8Array} input_image\n* @param {number} input_width\n* @param {number} input_height\n* @param {number} output_width\n* @param {number} output_height\n* @param {number} typ_idx\n* @param {boolean} premultiply\n* @param {boolean} color_space_conversion\n* @returns {Uint8ClampedArray}\n*/\nexport function resize(input_image, input_width, input_height, output_width, output_height, typ_idx, premultiply, color_space_conversion) {\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n var ptr0 = passArray8ToWasm0(input_image, wasm.__wbindgen_malloc);\n var len0 = WASM_VECTOR_LEN;\n wasm.resize(retptr, ptr0, len0, input_width, input_height, output_width, output_height, typ_idx, premultiply, color_space_conversion);\n var r0 = getInt32Memory0()[retptr / 4 + 0];\n var r1 = getInt32Memory0()[retptr / 4 + 1];\n var v1 = getClampedArrayU8FromWasm0(r0, r1).slice();\n wasm.__wbindgen_free(r0, r1 * 1);\n return v1;\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n }\n}\n\nasync function load(module, imports) {\n if (typeof Response === 'function' && module instanceof Response) {\n if (typeof WebAssembly.instantiateStreaming === 'function') {\n try {\n return await WebAssembly.instantiateStreaming(module, imports);\n\n } catch (e) {\n if (module.headers.get('Content-Type') != 'application/wasm') {\n console.warn(\"`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n\", e);\n\n } else {\n throw e;\n }\n }\n }\n\n const bytes = await module.arrayBuffer();\n return await WebAssembly.instantiate(bytes, imports);\n\n } else {\n const instance = await WebAssembly.instantiate(module, imports);\n\n if (instance instanceof WebAssembly.Instance) {\n return { instance, module };\n\n } else {\n return instance;\n }\n }\n}\n\nasync function init(input) {\n if (typeof input === 'undefined') {\n input = new URL('squoosh_resize_bg.wasm', import.meta.url);\n }\n const imports = {};\n\n\n if (typeof input === 'string' || (typeof Request === 'function' && input instanceof Request) || (typeof URL === 'function' && input instanceof URL)) {\n input = fetch(input);\n }\n\n\n\n const { instance, module } = await load(await input, imports);\n\n wasm = instance.exports;\n init.__wbindgen_wasm_module = module;\n\n return wasm;\n}\n\nexport default init;\n\n",
7
- "/**\n * Resize processor - single-source worker/client implementation\n */\n\nimport {\n type WorkerRequest,\n type WorkerResponse,\n type ImageInput,\n loadWasmBinary,\n validateImageInput,\n validateResizeOptions,\n} from '@squoosh-kit/runtime';\nimport type { ResizeOptions } from './types';\nimport * as squoosh_resize_module from '../wasm/squoosh_resize';\n\n// Define the type locally to avoid module resolution issues with the linter\ntype SquooshWasmResize = (\n input_image: Uint8Array,\n input_width: number,\n input_height: number,\n output_width: number,\n output_height: number,\n typ_idx: number,\n premultiply: boolean,\n color_space_conversion: boolean\n) => Uint8ClampedArray;\n\nlet wasmResize: SquooshWasmResize | null = null;\nlet initPromise: Promise<void> | null = null;\n\nasync function init(): Promise<void> {\n if (wasmResize) {\n return;\n }\n\n if (initPromise) {\n return initPromise;\n }\n\n initPromise = (async () => {\n try {\n // Load WASM binary with robust fallback strategies\n // Try multiple paths to support both development (../wasm) and npm installed (./wasm) scenarios\n let wasmBuffer: ArrayBuffer | null = null;\n const pathsToTry = [\n new URL(\n /* @vite-ignore */ './wasm/squoosh_resize_bg.wasm',\n import.meta.url\n ).href,\n new URL(\n /* @vite-ignore */ '../wasm/squoosh_resize_bg.wasm',\n import.meta.url\n ).href,\n ];\n\n let lastError: Error | null = null;\n for (const path of pathsToTry) {\n try {\n wasmBuffer = await loadWasmBinary(path);\n break;\n } catch (error) {\n lastError = error instanceof Error ? error : new Error(String(error));\n // Continue to next path\n }\n }\n\n if (!wasmBuffer) {\n throw (\n lastError || new Error('Could not load WASM binary from any path')\n );\n }\n\n // Initialize WASM module with the binary buffer\n try {\n await squoosh_resize_module.default(wasmBuffer);\n } catch (initError: unknown) {\n // If initialization fails due to SharedArrayBuffer issues, try with polyfill\n if (\n initError instanceof Error &&\n (initError.message.includes('SharedArrayBuffer') ||\n initError.message.includes('first argument must be'))\n ) {\n // Apply polyfill and retry\n if (typeof SharedArrayBuffer === 'undefined') {\n (\n globalThis as unknown as Record<string, typeof ArrayBuffer>\n ).SharedArrayBuffer = ArrayBuffer;\n }\n // Reload the module with polyfill in place\n try {\n await squoosh_resize_module.default(wasmBuffer);\n } catch (retryError) {\n throw new Error(\n `WASM module initialization failed even with polyfill: ${retryError instanceof Error ? retryError.message : String(retryError)}`\n );\n }\n } else {\n throw initError;\n }\n }\n // After initialization, the module's exported resize function is ready to use\n wasmResize = squoosh_resize_module.resize as unknown as SquooshWasmResize;\n } catch (error) {\n initPromise = null;\n throw new Error(\n `Failed to initialize resize WASM module: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n })();\n\n return initPromise;\n}\n\nasync function _resizeCore(\n image: ImageInput,\n options: ResizeOptions\n): Promise<ImageInput> {\n validateImageInput(image);\n validateResizeOptions(options);\n\n await init();\n if (!wasmResize) {\n throw new Error('Resize module not initialized');\n }\n\n const { data, width: inputWidth, height: inputHeight } = image;\n\n let outputWidth = options.width ?? inputWidth;\n let outputHeight = options.height ?? inputHeight;\n\n if (options.width && !options.height) {\n outputHeight = Math.max(\n 1,\n Math.round((inputHeight * options.width) / inputWidth)\n );\n } else if (options.height && !options.width) {\n outputWidth = Math.max(\n 1,\n Math.round((inputWidth * options.height) / inputHeight)\n );\n }\n\n if (outputWidth < 1 || outputHeight < 1) {\n throw new RangeError(\n `Output dimensions must be at least 1x1, got ${outputWidth}x${outputHeight}`\n );\n }\n\n // Create a zero-copy Uint8Array view if needed\n // (don't copy the buffer - just create a view on the same memory)\n const dataArray =\n data instanceof Uint8ClampedArray\n ? new Uint8Array(data.buffer as ArrayBuffer, data.byteOffset, data.length)\n : new Uint8Array(\n data.buffer as ArrayBuffer,\n data.byteOffset,\n data.length\n );\n\n const result = wasmResize(\n dataArray,\n inputWidth,\n inputHeight,\n outputWidth,\n outputHeight,\n getResizeMethod(options),\n options.premultiply ?? true,\n options.linearRGB ?? true\n );\n\n return {\n data: result,\n width: outputWidth,\n height: outputHeight,\n };\n}\n\nexport async function resizeClient(\n image: ImageInput,\n options: ResizeOptions,\n signal?: AbortSignal\n): Promise<ImageInput> {\n if (signal?.aborted) {\n throw new DOMException('Aborted', 'AbortError');\n }\n return _resizeCore(image, options);\n}\n\n/**\n * Map ResizeOptions method to WASM typ_idx parameter\n * typ_idx values (from Squoosh):\n * 0: Triangular - fastest, lowest quality\n * 1: Catrom - medium quality and speed\n * 2: Mitchell - good balance (default)\n * 3: Lanczos3 - highest quality, slowest\n */\nfunction getResizeMethod(options?: ResizeOptions): number {\n const methodMap: Record<string, number> = {\n triangular: 0,\n catrom: 1,\n mitchell: 2,\n lanczos3: 3,\n };\n return methodMap[options?.method ?? 'lanczos3'] ?? 3;\n}\n\n/**\n * Worker message handler\n */\nif (typeof self !== 'undefined') {\n self.onmessage = async (event: MessageEvent) => {\n const data = event.data;\n\n // Handle worker ping for initialization\n if (data?.type === 'worker:ping') {\n self.postMessage({ type: 'worker:ready' });\n return;\n }\n\n const { id, type, payload } = data as WorkerRequest<{\n image: ImageInput;\n options: ResizeOptions;\n }>;\n\n const response: WorkerResponse<ImageInput> = { id, ok: false };\n\n try {\n if (type !== 'resize:run') {\n throw new Error(`Unknown message type: ${type}`);\n }\n\n const resultImage = await _resizeCore(payload.image, payload.options);\n\n response.ok = true;\n response.data = resultImage;\n\n // Post the response without transferring - the ImageInput with data will be cloned\n // Transfer is only used for incoming requests (image.data buffer from client)\n self.postMessage(response);\n } catch (error) {\n response.error = error instanceof Error ? error.message : String(error);\n self.postMessage(response);\n }\n };\n}\n"
7
+ "/**\n * Resize processor - single-source worker/client implementation\n */\n\nimport {\n type WorkerRequest,\n type WorkerResponse,\n type ImageInput,\n loadWasmBinary,\n validateImageInput,\n} from '@squoosh-kit/runtime';\nimport { validateResizeOptions } from './validators';\nimport type { ResizeOptions } from './types';\nimport * as squoosh_resize_module from '../wasm/squoosh_resize';\n\n// Define the type locally to avoid module resolution issues with the linter\ntype SquooshWasmResize = (\n input_image: Uint8Array,\n input_width: number,\n input_height: number,\n output_width: number,\n output_height: number,\n typ_idx: number,\n premultiply: boolean,\n color_space_conversion: boolean\n) => Uint8ClampedArray;\n\nlet wasmResize: SquooshWasmResize | null = null;\nlet initPromise: Promise<void> | null = null;\n\nasync function init(): Promise<void> {\n if (wasmResize) {\n return;\n }\n\n if (initPromise) {\n return initPromise;\n }\n\n initPromise = (async () => {\n try {\n // Load WASM binary with robust fallback strategies\n // Try multiple paths to support both development (../wasm) and npm installed (./wasm) scenarios\n let wasmBuffer: ArrayBuffer | null = null;\n const pathsToTry = [\n new URL(\n /* @vite-ignore */ './wasm/squoosh_resize_bg.wasm',\n import.meta.url\n ).href,\n new URL(\n /* @vite-ignore */ '../wasm/squoosh_resize_bg.wasm',\n import.meta.url\n ).href,\n ];\n\n let lastError: Error | null = null;\n for (const path of pathsToTry) {\n try {\n wasmBuffer = await loadWasmBinary(path);\n break;\n } catch (error) {\n lastError = error instanceof Error ? error : new Error(String(error));\n // Continue to next path\n }\n }\n\n if (!wasmBuffer) {\n throw (\n lastError || new Error('Could not load WASM binary from any path')\n );\n }\n\n // Initialize WASM module with the binary buffer\n try {\n await squoosh_resize_module.default(wasmBuffer);\n } catch (initError: unknown) {\n // If initialization fails due to SharedArrayBuffer issues, try with polyfill\n if (\n initError instanceof Error &&\n (initError.message.includes('SharedArrayBuffer') ||\n initError.message.includes('first argument must be'))\n ) {\n // Apply polyfill and retry\n if (typeof SharedArrayBuffer === 'undefined') {\n (\n globalThis as unknown as Record<string, typeof ArrayBuffer>\n ).SharedArrayBuffer = ArrayBuffer;\n }\n // Reload the module with polyfill in place\n try {\n await squoosh_resize_module.default(wasmBuffer);\n } catch (retryError) {\n throw new Error(\n `WASM module initialization failed even with polyfill: ${retryError instanceof Error ? retryError.message : String(retryError)}`\n );\n }\n } else {\n throw initError;\n }\n }\n // After initialization, the module's exported resize function is ready to use\n wasmResize = squoosh_resize_module.resize as unknown as SquooshWasmResize;\n } catch (error) {\n initPromise = null;\n throw new Error(\n `Failed to initialize resize WASM module: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n })();\n\n return initPromise;\n}\n\nasync function _resizeCore(\n image: ImageInput,\n options: ResizeOptions\n): Promise<ImageInput> {\n validateImageInput(image);\n validateResizeOptions(options);\n\n await init();\n if (!wasmResize) {\n throw new Error('Resize module not initialized');\n }\n\n const { data, width: inputWidth, height: inputHeight } = image;\n\n let outputWidth = options.width ?? inputWidth;\n let outputHeight = options.height ?? inputHeight;\n\n if (options.width && !options.height) {\n outputHeight = Math.max(\n 1,\n Math.round((inputHeight * options.width) / inputWidth)\n );\n } else if (options.height && !options.width) {\n outputWidth = Math.max(\n 1,\n Math.round((inputWidth * options.height) / inputHeight)\n );\n }\n\n if (outputWidth < 1 || outputHeight < 1) {\n throw new RangeError(\n `Output dimensions must be at least 1x1, got ${outputWidth}x${outputHeight}`\n );\n }\n\n // Create a zero-copy Uint8Array view if needed\n // (don't copy the buffer - just create a view on the same memory)\n const dataArray =\n data instanceof Uint8ClampedArray\n ? new Uint8Array(data.buffer as ArrayBuffer, data.byteOffset, data.length)\n : new Uint8Array(\n data.buffer as ArrayBuffer,\n data.byteOffset,\n data.length\n );\n\n const result = wasmResize(\n dataArray,\n inputWidth,\n inputHeight,\n outputWidth,\n outputHeight,\n getResizeMethod(options),\n options.premultiply ?? true,\n options.linearRGB ?? true\n );\n\n return {\n data: result,\n width: outputWidth,\n height: outputHeight,\n };\n}\n\nexport async function resizeClient(\n image: ImageInput,\n options: ResizeOptions,\n signal?: AbortSignal\n): Promise<ImageInput> {\n if (signal?.aborted) {\n throw new DOMException('Aborted', 'AbortError');\n }\n return _resizeCore(image, options);\n}\n\n/**\n * Map ResizeOptions method to WASM typ_idx parameter\n * typ_idx values (from Squoosh):\n * 0: Triangular - fastest, lowest quality\n * 1: Catrom - medium quality and speed\n * 2: Mitchell - good balance (default)\n * 3: Lanczos3 - highest quality, slowest\n */\nfunction getResizeMethod(options?: ResizeOptions): number {\n const methodMap: Record<string, number> = {\n triangular: 0,\n catrom: 1,\n mitchell: 2,\n lanczos3: 3,\n };\n return methodMap[options?.method ?? 'lanczos3'] ?? 3;\n}\n\n/**\n * Worker message handler\n */\nif (typeof self !== 'undefined') {\n self.onmessage = async (event: MessageEvent) => {\n const data = event.data;\n\n // Handle worker ping for initialization\n if (data?.type === 'worker:ping') {\n self.postMessage({ type: 'worker:ready' });\n return;\n }\n\n const { id, type, payload } = data as WorkerRequest<{\n image: ImageInput;\n options: ResizeOptions;\n }>;\n\n const response: WorkerResponse<ImageInput> = { id, ok: false };\n\n try {\n if (type !== 'resize:run') {\n throw new Error(`Unknown message type: ${type}`);\n }\n\n const resultImage = await _resizeCore(payload.image, payload.options);\n\n response.ok = true;\n response.data = resultImage;\n\n // Post the response without transferring - the ImageInput with data will be cloned\n // Transfer is only used for incoming requests (image.data buffer from client)\n self.postMessage(response);\n } catch (error) {\n response.error = error instanceof Error ? error.message : String(error);\n self.postMessage(response);\n }\n };\n}\n"
8
8
  ],
9
- "mappings": "6DAQA,eAAsB,CAAc,CAClC,EACsB,CACtB,GAAI,CAEF,GAAI,OAAO,QAAY,KAAe,QAA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,EACV,SAAU,CACZ,EACiB,GAAS,QAAU,aAAe,EAMrD,GAAI,OAAO,KAAS,IAClB,KAAK,UAAY,MAAO,IAAwB,CAC9C,IAAM,EAAO,EAAM,KAGnB,GAAI,GAAM,OAAS,cAAe,CAChC,KAAK,YAAY,CAAE,KAAM,cAAe,CAAC,EACzC,OAGF,IAAQ,KAAI,OAAM,WAAY,EAKxB,EAAuC,CAAE,KAAI,GAAI,EAAM,EAE7D,GAAI,CACF,GAAI,IAAS,aACX,MAAU,MAAM,yBAAyB,GAAM,EAGjD,IAAM,EAAc,MAAM,EAAY,EAAQ,MAAO,EAAQ,OAAO,EAEpE,EAAS,GAAK,GACd,EAAS,KAAO,EAIhB,KAAK,YAAY,CAAQ,EACzB,MAAO,EAAO,CACd,EAAS,MAAQ,aAAiB,MAAQ,EAAM,QAAU,OAAO,CAAK,EACtE,KAAK,YAAY,CAAQ",
10
+ "debugId": "FFF6041AE058784C64756E2164756E21",
11
11
  "names": []
12
12
  }
@@ -1,4 +1,4 @@
1
1
  // @bun
2
- import{b as U,c as W,d as I,e as R}from"./chunk-6qec3cgc.js";async function B(j){try{if(typeof process<"u"&&process.versions?.node){let D=await import("fs/promises"),J=new URL(j,import.meta.url).pathname,K=await D.readFile(J);return K.buffer.slice(K.byteOffset,K.byteOffset+K.byteLength)}}catch(D){}try{let D=new URL(j,import.meta.url),G=await fetch(D);if(!G.ok)throw Error(`Failed to fetch WASM binary: ${G.status} ${G.statusText}`);return await G.arrayBuffer()}catch(D){throw Error(`Failed to load WASM binary from "${j}": ${D instanceof Error?D.message:String(D)}`)}}var Y,$=null;function v(){if($===null||$.buffer!==Y.memory.buffer)$=new Uint8Array(Y.memory.buffer);return $}var T=0;function M(j,D){let G=D(j.length*1);return v().set(j,G/1),T=j.length,G}var k=null;function A(){if(k===null||k.buffer!==Y.memory.buffer)k=new Int32Array(Y.memory.buffer);return k}var F=null;function P(){if(F===null||F.buffer!==Y.memory.buffer)F=new Uint8ClampedArray(Y.memory.buffer);return F}function f(j,D){return P().subarray(j/1,j/1+D)}function z(j,D,G,J,K,Q,X,V){try{let q=Y.__wbindgen_add_to_stack_pointer(-16);var L=M(j,Y.__wbindgen_malloc),E=T;Y.resize(q,L,E,D,G,J,K,Q,X,V);var O=A()[q/4+0],S=A()[q/4+1],b=f(O,S).slice();return Y.__wbindgen_free(O,S*1),b}finally{Y.__wbindgen_add_to_stack_pointer(16)}}async function w(j,D){if(typeof Response==="function"&&j instanceof Response){if(typeof WebAssembly.instantiateStreaming==="function")try{return await WebAssembly.instantiateStreaming(j,D)}catch(J){if(j.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",J);else throw J}let G=await j.arrayBuffer();return await WebAssembly.instantiate(G,D)}else{let G=await WebAssembly.instantiate(j,D);if(G instanceof WebAssembly.Instance)return{instance:G,module:j};else return G}}async function H(j){if(typeof j>"u")j=new URL("squoosh_resize_bg.wasm",import.meta.url);let D={};if(typeof j==="string"||typeof Request==="function"&&j instanceof Request||typeof URL==="function"&&j instanceof URL)j=fetch(j);let{instance:G,module:J}=await w(await j,D);return Y=G.exports,H.__wbindgen_wasm_module=J,Y}var x=H;var N=null,Z=null;async function y(){if(N)return;if(Z)return Z;return Z=(async()=>{try{let j=null,D=[new URL("./wasm/squoosh_resize_bg.wasm",import.meta.url).href,new URL("../wasm/squoosh_resize_bg.wasm",import.meta.url).href],G=null;for(let J of D)try{j=await B(J);break}catch(K){G=K instanceof Error?K:Error(String(K))}if(!j)throw G||Error("Could not load WASM binary from any path");try{await x(j)}catch(J){if(J instanceof Error&&(J.message.includes("SharedArrayBuffer")||J.message.includes("first argument must be"))){if(typeof SharedArrayBuffer>"u")globalThis.SharedArrayBuffer=ArrayBuffer;try{await x(j)}catch(K){throw Error(`WASM module initialization failed even with polyfill: ${K instanceof Error?K.message:String(K)}`)}}else throw J}N=z}catch(j){throw Z=null,Error(`Failed to initialize resize WASM module: ${j instanceof Error?j.message:String(j)}`)}})(),Z}async function C(j,D){if(I(j),R(D),await y(),!N)throw Error("Resize module not initialized");let{data:G,width:J,height:K}=j,Q=D.width??J,X=D.height??K;if(D.width&&!D.height)X=Math.max(1,Math.round(K*D.width/J));else if(D.height&&!D.width)Q=Math.max(1,Math.round(J*D.height/K));if(Q<1||X<1)throw RangeError(`Output dimensions must be at least 1x1, got ${Q}x${X}`);let V=G instanceof Uint8ClampedArray?new Uint8Array(G.buffer,G.byteOffset,G.length):new Uint8Array(G.buffer,G.byteOffset,G.length);return{data:N(V,J,K,Q,X,c(D),D.premultiply??!0,D.linearRGB??!0),width:Q,height:X}}async function h(j,D,G){if(G?.aborted)throw new DOMException("Aborted","AbortError");return C(j,D)}function c(j){return{triangular:0,catrom:1,mitchell:2,lanczos3:3}[j?.method??"lanczos3"]??3}if(typeof self<"u")self.onmessage=async(j)=>{let D=j.data;if(D?.type==="worker:ping"){self.postMessage({type:"worker:ready"});return}let{id:G,type:J,payload:K}=D,Q={id:G,ok:!1};try{if(J!=="resize:run")throw Error(`Unknown message type: ${J}`);let X=await C(K.image,K.options);Q.ok=!0,Q.data=X,self.postMessage(Q)}catch(X){Q.error=X instanceof Error?X.message:String(X),self.postMessage(Q)}};export{h as resizeClient};
2
+ import{b as C}from"./chunk-q0apy7nk.js";import{c as E}from"./validators.bun.js";import{d as B,e as T}from"./chunk-8y42hv65.js";async function A(j){try{if(typeof process<"u"&&process.versions?.node){let D=await import("fs/promises"),J=/^(file:|https?:)/.test(j)?new URL(j):new URL(j,import.meta.url),K=J.protocol==="file:"?(await import("url")).fileURLToPath(J):J.pathname,Q=await D.readFile(K);return Q.buffer.slice(Q.byteOffset,Q.byteOffset+Q.byteLength)}}catch(D){}try{let D=/^(file:|https?:)/.test(j)?new URL(j):new URL(j,import.meta.url),G=await fetch(D);if(!G.ok)throw Error(`Failed to fetch WASM binary: ${G.status} ${G.statusText}`);return await G.arrayBuffer()}catch(D){throw Error(`Failed to load WASM binary from "${j}": ${D instanceof Error?D.message:String(D)}`)}}var Y,$=null;function M(){if($===null||$.buffer!==Y.memory.buffer)$=new Uint8Array(Y.memory.buffer);return $}var z=0;function v(j,D){let G=D(j.length*1);return M().set(j,G/1),z=j.length,G}var k=null;function R(){if(k===null||k.buffer!==Y.memory.buffer)k=new Int32Array(Y.memory.buffer);return k}var F=null;function f(){if(F===null||F.buffer!==Y.memory.buffer)F=new Uint8ClampedArray(Y.memory.buffer);return F}function w(j,D){return f().subarray(j/1,j/1+D)}function H(j,D,G,J,K,Q,X,N){try{let S=Y.__wbindgen_add_to_stack_pointer(-16);var q=v(j,Y.__wbindgen_malloc),W=z;Y.resize(S,q,W,D,G,J,K,Q,X,N);var O=R()[S/4+0],x=R()[S/4+1],U=w(O,x).slice();return Y.__wbindgen_free(O,x*1),U}finally{Y.__wbindgen_add_to_stack_pointer(16)}}async function P(j,D){if(typeof Response==="function"&&j instanceof Response){if(typeof WebAssembly.instantiateStreaming==="function")try{return await WebAssembly.instantiateStreaming(j,D)}catch(J){if(j.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",J);else throw J}let G=await j.arrayBuffer();return await WebAssembly.instantiate(G,D)}else{let G=await WebAssembly.instantiate(j,D);if(G instanceof WebAssembly.Instance)return{instance:G,module:j};else return G}}async function I(j){if(typeof j>"u")j=new URL("squoosh_resize_bg.wasm",import.meta.url);let D={};if(typeof j==="string"||typeof Request==="function"&&j instanceof Request||typeof URL==="function"&&j instanceof URL)j=fetch(j);let{instance:G,module:J}=await P(await j,D);return Y=G.exports,I.__wbindgen_wasm_module=J,Y}var V=I;var L=null,Z=null;async function y(){if(L)return;if(Z)return Z;return Z=(async()=>{try{let j=null,D=[new URL("./wasm/squoosh_resize_bg.wasm",import.meta.url).href,new URL("../wasm/squoosh_resize_bg.wasm",import.meta.url).href],G=null;for(let J of D)try{j=await A(J);break}catch(K){G=K instanceof Error?K:Error(String(K))}if(!j)throw G||Error("Could not load WASM binary from any path");try{await V(j)}catch(J){if(J instanceof Error&&(J.message.includes("SharedArrayBuffer")||J.message.includes("first argument must be"))){if(typeof SharedArrayBuffer>"u")globalThis.SharedArrayBuffer=ArrayBuffer;try{await V(j)}catch(K){throw Error(`WASM module initialization failed even with polyfill: ${K instanceof Error?K.message:String(K)}`)}}else throw J}L=H}catch(j){throw Z=null,Error(`Failed to initialize resize WASM module: ${j instanceof Error?j.message:String(j)}`)}})(),Z}async function b(j,D){if(C(j),E(D),await y(),!L)throw Error("Resize module not initialized");let{data:G,width:J,height:K}=j,Q=D.width??J,X=D.height??K;if(D.width&&!D.height)X=Math.max(1,Math.round(K*D.width/J));else if(D.height&&!D.width)Q=Math.max(1,Math.round(J*D.height/K));if(Q<1||X<1)throw RangeError(`Output dimensions must be at least 1x1, got ${Q}x${X}`);let N=G instanceof Uint8ClampedArray?new Uint8Array(G.buffer,G.byteOffset,G.length):new Uint8Array(G.buffer,G.byteOffset,G.length);return{data:L(N,J,K,Q,X,c(D),D.premultiply??!0,D.linearRGB??!0),width:Q,height:X}}async function l(j,D,G){if(G?.aborted)throw new DOMException("Aborted","AbortError");return b(j,D)}function c(j){return{triangular:0,catrom:1,mitchell:2,lanczos3:3}[j?.method??"lanczos3"]??3}if(typeof self<"u")self.onmessage=async(j)=>{let D=j.data;if(D?.type==="worker:ping"){self.postMessage({type:"worker:ready"});return}let{id:G,type:J,payload:K}=D,Q={id:G,ok:!1};try{if(J!=="resize:run")throw Error(`Unknown message type: ${J}`);let X=await b(K.image,K.options);Q.ok=!0,Q.data=X,self.postMessage(Q)}catch(X){Q.error=X instanceof Error?X.message:String(X),self.postMessage(Q)}};export{l as resizeClient};
3
3
 
4
- //# debugId=AB37651B1101F9E964756E2164756E21
4
+ //# debugId=E5EEDC5024197B9F64756E2164756E21