alran 0.9.0 → 1.0.1

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 (127) hide show
  1. package/ALRAN_TOOLS_NOTICES.md +11 -0
  2. package/README.md +11 -16
  3. package/assets/agents/alran/skills/alran-code-product/SKILL.md +3 -3
  4. package/assets/agents/alran/skills/alran-code-product/references/account-models.md +19 -16
  5. package/chunks/{account-commands-JZ6NXTTK.js → account-commands-GW7N3MYC.js} +1 -1
  6. package/chunks/{anthropic-MN33DP4E.js → anthropic-63VE6MAE.js} +1 -1
  7. package/chunks/{application-ITGAJ4HC.js → application-WPPTE6LU.js} +1 -1
  8. package/chunks/{auth-command-V3RVPLZO.js → auth-command-36RMNQZW.js} +1 -1
  9. package/chunks/azure-openai-responses-OIP3KVKJ.js +2 -0
  10. package/chunks/chunk-2K5H5GA7.js +2 -0
  11. package/chunks/chunk-3GGKARES.js +2 -0
  12. package/chunks/chunk-5RIMHTEU.js +207 -0
  13. package/chunks/{chunk-EYK25HWR.js → chunk-5Y76VFHY.js} +1 -1
  14. package/chunks/{chunk-QIN5ZBE2.js → chunk-6DOVXX7W.js} +1 -1
  15. package/chunks/{chunk-E3GLGDGC.js → chunk-6PFI65C6.js} +1 -1
  16. package/chunks/{chunk-4PDIO3M6.js → chunk-6UXSIWCB.js} +1 -1
  17. package/chunks/{chunk-OQNU3VPS.js → chunk-C6LAAFG2.js} +2 -2
  18. package/chunks/{chunk-33CNY6GP.js → chunk-CUG7F2FN.js} +1 -1
  19. package/chunks/chunk-DFMYLGVU.js +249 -0
  20. package/chunks/{chunk-IIE366LR.js → chunk-G5MOGPZ3.js} +490 -485
  21. package/chunks/{chunk-FC4M2B7E.js → chunk-IC6A323Q.js} +1 -1
  22. package/chunks/{chunk-4X22UJQH.js → chunk-IN2Z5SSJ.js} +1 -1
  23. package/chunks/chunk-JSTSFMGK.js +70 -0
  24. package/chunks/{chunk-WWNUAU4P.js → chunk-LCC45PCZ.js} +1 -1
  25. package/chunks/{chunk-7QLAXRD2.js → chunk-MPQ6G7LH.js} +254 -254
  26. package/chunks/{chunk-FUERW2DW.js → chunk-MUXNNOSQ.js} +1 -1
  27. package/chunks/{chunk-44VPC5LA.js → chunk-NBONSNQZ.js} +1 -1
  28. package/chunks/chunk-NMKRNU5O.js +2 -0
  29. package/chunks/chunk-NVPGGFT3.js +2 -0
  30. package/chunks/chunk-NZXJAHTO.js +9 -0
  31. package/chunks/{chunk-6255CZPL.js → chunk-PCL2CVVE.js} +1 -1
  32. package/chunks/chunk-PXH4SBCS.js +3 -0
  33. package/chunks/chunk-RLJVY75P.js +28 -0
  34. package/chunks/{chunk-WYANV3IX.js → chunk-RLND4AYL.js} +1 -1
  35. package/chunks/chunk-TJC4LPRQ.js +2 -0
  36. package/chunks/chunk-U4PFHJ7Z.js +27 -0
  37. package/chunks/chunk-V2SB4U4D.js +2 -0
  38. package/chunks/chunk-VGKKKM2W.js +6 -0
  39. package/chunks/{chunk-XFCC2CI2.js → chunk-VUISZDXX.js} +1 -1
  40. package/chunks/chunk-XVGPB7TW.js +21 -0
  41. package/chunks/{chunk-CJM7ZJ6W.js → chunk-ZDI22NOK.js} +1 -1
  42. package/chunks/{data-dir-LDVKDCJ2.js → data-dir-OEPRRIOO.js} +1 -1
  43. package/chunks/{dist-2BRD4JFU.js → dist-VKYZJYR6.js} +1 -1
  44. package/chunks/{dist-EXKHRFQO.js → dist-WGTMUM3E.js} +1 -1
  45. package/chunks/{ffi-OUPK6AY6.js → ffi-EFLUAAVX.js} +1 -1
  46. package/chunks/{ffi-M5UP5J6C.js → ffi-QKKA5HYI.js} +1 -1
  47. package/chunks/{google-UJAPMFAB.js → google-RCR46TTQ.js} +1 -1
  48. package/chunks/{google-vertex-VLSF55PW.js → google-vertex-Y26T7YYR.js} +1 -1
  49. package/chunks/{install-source-JTIUC4G4.js → install-source-63OVVBMK.js} +1 -1
  50. package/chunks/launcher-2UG3JPYF.js +63 -0
  51. package/chunks/lifecycle-5IPJRP2V.js +2 -0
  52. package/chunks/{main-TQGGRHTS.js → main-7SGOQBHZ.js} +2 -2
  53. package/chunks/{mistral-ZJZUEF2X.js → mistral-NEBDKUEI.js} +1 -1
  54. package/chunks/{module-6F3E5H7Y-BN7QWGYB.js → module-6F3E5H7Y-FIMLNSCK.js} +1 -1
  55. package/chunks/{module-asyncify-R6PWJ6ZV-P4FWSBAY.js → module-asyncify-R6PWJ6ZV-Q2HJ3NOC.js} +1 -1
  56. package/chunks/{multipart-parser-L6M455MS.js → multipart-parser-JVSLI2CL.js} +1 -1
  57. package/chunks/{network-proxy-U72JCK2I.js → network-proxy-AJO7ZW3O.js} +1 -1
  58. package/chunks/openai-codex-responses-L2CIGCKO.js +2 -0
  59. package/chunks/openai-completions-C4PHW6MD.js +2 -0
  60. package/chunks/openai-responses-5NVFOW4Y.js +2 -0
  61. package/chunks/{openrouter-G2EHY5BD.js → openrouter-BKUGQT7Z.js} +1 -1
  62. package/chunks/{otel-OHXIZ666.js → otel-DRJM2PIX.js} +1 -1
  63. package/chunks/plugin-command-CIDTOPNB.js +2 -0
  64. package/chunks/provider-command-UZ7KQFAC.js +2 -0
  65. package/chunks/run-acp-command-AKDLHKMR.js +59 -0
  66. package/chunks/{run-exec-command-5ADSQR2Z.js → run-exec-command-UXTPS7LC.js} +1 -1
  67. package/chunks/{skills-command-XXXEZAG6.js → skills-command-57TF53NO.js} +1 -1
  68. package/chunks/src-5PSNGHHD.js +2 -0
  69. package/chunks/{src-IBHIRTD7.js → src-YZ26EVSY.js} +1 -1
  70. package/chunks/telemetry-3NXMCOVD.js +2 -0
  71. package/chunks/{telemetry-command-COQG2AKK.js → telemetry-command-CMDERYNN.js} +1 -1
  72. package/chunks/{tools-WDBB2JKV.js → tools-CRJR35HS.js} +1 -1
  73. package/chunks/{undici-TUGHZJSA.js → undici-O4OQVZ6I.js} +1 -1
  74. package/chunks/{update-NB6OD572.js → update-ACFAGV6F.js} +1 -1
  75. package/cli.js +2 -3
  76. package/embedded/alran-tools/cli.mjs +1 -5
  77. package/embedded/alran-tools/manifest.json +1 -1
  78. package/image-preview-worker.js +1 -1
  79. package/matrix-mcp-stdio.js +1 -1
  80. package/package.json +1 -1
  81. package/quickjs-worker.js +1 -1
  82. package/chunks/azure-openai-responses-OWHMUNKC.js +0 -2
  83. package/chunks/chunk-C3CMJAAV.js +0 -3
  84. package/chunks/chunk-ENHOPPS7.js +0 -16
  85. package/chunks/chunk-FSNYOJPJ.js +0 -2
  86. package/chunks/chunk-FXOH6TEQ.js +0 -21
  87. package/chunks/chunk-GRXX6I72.js +0 -2
  88. package/chunks/chunk-GSYHBK5Q.js +0 -6
  89. package/chunks/chunk-IWK7PZP7.js +0 -207
  90. package/chunks/chunk-KCLRJQ53.js +0 -59
  91. package/chunks/chunk-M7GW4VMR.js +0 -27
  92. package/chunks/chunk-QFUV5PX6.js +0 -2
  93. package/chunks/chunk-TW23QKAD.js +0 -3
  94. package/chunks/chunk-U7U3DJHF.js +0 -2
  95. package/chunks/chunk-WTAJMYF2.js +0 -249
  96. package/chunks/chunk-YLQXZBEL.js +0 -2
  97. package/chunks/chunk-Z6BHCXKT.js +0 -25
  98. package/chunks/chunk-Z6HBNJCA.js +0 -8
  99. package/chunks/launcher-FCZ3EDBF.js +0 -61
  100. package/chunks/lifecycle-GY435YMF.js +0 -2
  101. package/chunks/openai-codex-responses-FPCDNRL5.js +0 -2
  102. package/chunks/openai-completions-D32YW6KL.js +0 -2
  103. package/chunks/openai-responses-ZCGSENM4.js +0 -2
  104. package/chunks/plugin-command-OSAFHS7C.js +0 -2
  105. package/chunks/provider-command-SKTCHD4E.js +0 -2
  106. package/chunks/run-acp-command-SG2BDMFJ.js +0 -2
  107. package/chunks/src-DNIDEMVV.js +0 -2
  108. package/chunks/telemetry-J7ZLGF5X.js +0 -2
  109. /package/chunks/{chunk-EOR6EDNR.js → chunk-2AYWJZ72.js} +0 -0
  110. /package/chunks/{chunk-YPV2X2RG.js → chunk-4XP5XUIZ.js} +0 -0
  111. /package/chunks/{chunk-NWB7LFOK.js → chunk-5DQTVSQV.js} +0 -0
  112. /package/chunks/{chunk-OIQ336YE.js → chunk-EJN3SE5B.js} +0 -0
  113. /package/chunks/{chunk-A7GMJNA2.js → chunk-K5DTFR6D.js} +0 -0
  114. /package/chunks/{chunk-ZQOALVGL.js → chunk-R44C5DM6.js} +0 -0
  115. /package/chunks/{chunk-PNXZWSWT.js → chunk-UJCAE7SG.js} +0 -0
  116. /package/chunks/{chunk-J3KCPYZT.js → chunk-W5ZOLW7T.js} +0 -0
  117. /package/chunks/{chunk-XAGZ6ZEU.js → chunk-XLVABFJC.js} +0 -0
  118. /package/chunks/{chunk-N5SVBCUB.js → chunk-XSEU4WQD.js} +0 -0
  119. /package/chunks/{chunk-CSOUJVKM.js → chunk-Z5HOCNTZ.js} +0 -0
  120. /package/chunks/{emscripten-module-ZS3PMSDF.js → emscripten-module-3WGSFZYF.js} +0 -0
  121. /package/chunks/{emscripten-module-XPTEOIWW.js → emscripten-module-74WUXTHL.js} +0 -0
  122. /package/chunks/{emscripten-module-WYNDFH3N.js → emscripten-module-MCN4Y3N4.js} +0 -0
  123. /package/chunks/{emscripten-module-RD6P2XH5.js → emscripten-module-NEAT5LGD.js} +0 -0
  124. /package/chunks/{ffi-ORLOPBB3.js → ffi-JIGPPPF7.js} +0 -0
  125. /package/chunks/{ffi-IO7WZQNG.js → ffi-RLX77WFG.js} +0 -0
  126. /package/chunks/{pdfjs-SHZAF7PF.js → pdfjs-2UOWBGC2.js} +0 -0
  127. /package/chunks/{photon_rs-C52RL4CI.js → photon_rs-MVWYTYTO.js} +0 -0
@@ -1,2 +1,2 @@
1
1
  import { createRequire as __alran_cR } from "module"; import { basename as __alran_basename, dirname as __alran_dirname, join as __alran_join } from "path"; import { fileURLToPath as __alran_fileURLToPath, pathToFileURL as __alran_pathToFileURL } from "url"; const __alran_tuiCurrentModuleDir = __alran_dirname(__alran_fileURLToPath(import.meta.url)); const __alran_tuiPackageRoot = __alran_basename(__alran_tuiCurrentModuleDir) === "chunks" ? __alran_dirname(__alran_tuiCurrentModuleDir) : __alran_tuiCurrentModuleDir; const __alran_tuiPackageEntryUrl = __alran_pathToFileURL(__alran_join(__alran_tuiPackageRoot, "cli.js")).href; const require = __alran_cR(__alran_tuiPackageEntryUrl); const __dirname = __alran_tuiPackageRoot;
2
- import{Worker as ne}from"node:worker_threads";function H(e,n){if(n+8>e.length)return 1;const t=e[n]<<8|e[n+1];const r=t===18761;const i=a=>{if(r)return e[a]|e[a+1]<<8;return e[a]<<8|e[a+1]};const d=a=>{if(r)return e[a]|e[a+1]<<8|e[a+2]<<16|e[a+3]<<24;return(e[a]<<24|e[a+1]<<16|e[a+2]<<8|e[a+3])>>>0};const s=d(n+4);const o=n+s;if(o+2>e.length)return 1;const c=i(o);for(let a=0;a<c;a++){const f=o+2+a*12;if(f+12>e.length)return 1;if(i(f)===274){const u=i(f+8);return u>=1&&u<=8?u:1}}return 1}function v(e){let n=2;while(n<e.length-1){if(e[n]!==255)return-1;const t=e[n+1];if(t===255){n++;continue}if(t===225){if(n+4>=e.length)return-1;const i=n+4;if(i+6>e.length)return-1;if(!F(e,i))return-1;return i+6}if(n+4>e.length)return-1;const r=e[n+2]<<8|e[n+3];n+=2+r}return-1}function C(e){let n=12;while(n+8<=e.length){const t=String.fromCharCode(e[n],e[n+1],e[n+2],e[n+3]);const r=e[n+4]|e[n+5]<<8|e[n+6]<<16|e[n+7]<<24;const i=n+8;if(t==="EXIF"){if(i+r>e.length)return-1;const d=r>=6&&F(e,i)?i+6:i;return d}n=i+r+r%2}return-1}function F(e,n){return e[n]===69&&e[n+1]===120&&e[n+2]===105&&e[n+3]===102&&e[n+4]===0&&e[n+5]===0}function q(e){let n=-1;if(e.length>=2&&e[0]===255&&e[1]===216){n=v(e)}else if(e.length>=12&&e[0]===82&&e[1]===73&&e[2]===70&&e[3]===70&&e[8]===87&&e[9]===69&&e[10]===66&&e[11]===80){n=C(e)}if(n===-1)return 1;return H(e,n)}function R(e,n,t){const r=n.get_width();const i=n.get_height();const d=n.get_raw_pixels();const s=new Uint8Array(d.length);for(let o=0;o<i;o++){for(let c=0;c<r;c++){const a=(o*r+c)*4;const f=t(c,o,r,i)*4;s[f]=d[a];s[f+1]=d[a+1];s[f+2]=d[a+2];s[f+3]=d[a+3]}}return new e.PhotonImage(s,i,r)}function W(e,n,t){const r=q(t);if(r===1)return n;switch(r){case 2:e.fliph(n);return n;case 3:e.fliph(n);e.flipv(n);return n;case 4:e.flipv(n);return n;case 5:{const i=R(e,n,(d,s,o,c)=>d*c+(c-1-s));e.fliph(i);return i}case 6:return R(e,n,(i,d,s,o)=>i*o+(o-1-d));case 7:{const i=R(e,n,(d,s,o,c)=>(o-1-d)*c+s);e.fliph(i);return i}case 8:return R(e,n,(i,d,s,o)=>(s-1-i)*o+d);default:return n}}function k(e,n){const t=Buffer.from(e.buffer,e.byteOffset,e.byteLength);switch(n){case"image/png":return N(t);case"image/jpeg":return $(t);case"image/gif":return G(t);case"image/webp":return J(t);default:return void 0}}function N(e){if(e.length<24||!e.subarray(0,8).equals(Buffer.from("89504e470d0a1a0a","hex"))||e.readUInt32BE(8)!==13||e.toString("ascii",12,16)!=="IHDR"){return void 0}return{width:e.readUInt32BE(16),height:e.readUInt32BE(20)}}function $(e){if(e.length<4||e[0]!==255||e[1]!==216)return void 0;const n=new Set([192,193,194,195,197,198,199,201,202,203,205,206,207]);let t=2;while(t+8<e.length){if(e[t]!==255){t+=1;continue}while(t<e.length&&e[t]===255)t+=1;const r=e[t];if(r===void 0||r===218||r===217)return void 0;if(n.has(r)){if(t+7>=e.length||e.readUInt16BE(t+1)<8)return void 0;return{width:e.readUInt16BE(t+6),height:e.readUInt16BE(t+4)}}if(r===1||r===216||r>=208&&r<=215){t+=1;continue}if(t+2>=e.length)return void 0;const i=e.readUInt16BE(t+1);if(i<2)return void 0;t+=i+1}return void 0}function G(e){if(e.length<10)return void 0;const n=e.toString("ascii",0,6);if(n!=="GIF87a"&&n!=="GIF89a")return void 0;return{width:e.readUInt16LE(6),height:e.readUInt16LE(8)}}function J(e){if(e.length<30||e.toString("ascii",0,4)!=="RIFF"||e.toString("ascii",8,12)!=="WEBP"){return void 0}const n=e.toString("ascii",12,16);if(n==="VP8 "){if(!e.subarray(23,26).equals(Buffer.from([157,1,42])))return void 0;return{width:e.readUInt16LE(26)&16383,height:e.readUInt16LE(28)&16383}}if(n==="VP8L"){if(e[20]!==47)return void 0;const t=e.readUInt32LE(21);return{width:(t&16383)+1,height:(t>>14&16383)+1}}if(n==="VP8X"){return{width:e.readUIntLE(24,3)+1,height:e.readUIntLE(27,3)+1}}return void 0}import{createRequire as Q}from"module";import*as l from"path";import{fileURLToPath as B}from"url";var V=Q(__alran_tuiPackageEntryUrl);var x=V("fs");var I="photon_rs_bg.wasm";var w=null;var z=null;function O(e){return typeof e==="object"&&e!==null&&"PhotonImage"in e&&typeof e.PhotonImage==="function"}function X(e){if(O(e)){return e}if(typeof e==="object"&&e!==null&&"default"in e&&O(e.default)){return e.default}return null}function Y(e){if(typeof e==="string"){return e}if(e instanceof URL){return B(e)}return null}function K(){const e=l.dirname(process.execPath);const n=l.dirname(B(__alran_tuiPackageEntryUrl));return[l.join(n,I),l.join(e,I),l.join(e,"photon",I),l.join(process.cwd(),I)]}function Z(){const e=x.readFileSync.bind(x);const n=K();const t=x;const r=((...i)=>{const[d,s]=i;const o=Y(d);if(o?.endsWith(I)){try{return e(...i)}catch(c){const a=c;if(a?.code&&a.code!=="ENOENT"){throw c}for(const f of n){if(!x.existsSync(f)){continue}if(s===void 0){return e(f)}return e(f,s)}throw c}}return e(...i)});try{t.readFileSync=r}catch{Object.defineProperty(x,"readFileSync",{value:r,writable:true,configurable:true})}return()=>{try{t.readFileSync=e}catch{Object.defineProperty(x,"readFileSync",{value:e,writable:true,configurable:true})}}}async function A(){if(w){return w}if(z){return z}z=(async()=>{const e=Z();try{w=X(await import("./photon_rs-C52RL4CI.js"));return w}catch{w=null;return w}finally{e()}})();return z}var E=class extends Error{constructor(){super("Image processing runtime is unavailable");this.name="ImageProcessorUnavailableError"}};var b=4.5*1024*1024;var ee={maxWidth:2e3,maxHeight:2e3,maxBytes:b,jpegQuality:80};function D(e,n){const t=Buffer.from(e).toString("base64");return{data:t,encodedSize:Buffer.byteLength(t,"utf-8"),mimeType:n}}async function M(e,n,t){const r={...ee,...t};const i=Math.ceil(e.byteLength/3)*4;const d=await A();if(!d){const o=k(e,n);if(o&&o.width>0&&o.height>0&&o.width<=r.maxWidth&&o.height<=r.maxHeight&&i<r.maxBytes){return{data:Buffer.from(e).toString("base64"),mimeType:n,originalWidth:o.width,originalHeight:o.height,width:o.width,height:o.height,wasResized:false}}throw new E}let s;try{let _=function(S,y,P){const g=d.resize(s,S,y,d.SamplingFilter.Lanczos3);try{const U=[D(g.get_bytes(),"image/png")];for(const j of P){U.push(D(g.get_bytes_jpeg(j),"image/jpeg"))}return U}finally{g.free()}};const o=d.PhotonImage.new_from_byteslice(e);s=W(d,o,e);if(s!==o)o.free();const c=s.get_width();const a=s.get_height();const f=n.split("/")[1]??"png";if(c<=r.maxWidth&&a<=r.maxHeight&&i<r.maxBytes){return{data:Buffer.from(e).toString("base64"),mimeType:n||`image/${f}`,originalWidth:c,originalHeight:a,width:c,height:a,wasResized:false}}let u=c;let p=a;if(u>r.maxWidth){p=Math.round(p*r.maxWidth/u);u=r.maxWidth}if(p>r.maxHeight){u=Math.round(u*r.maxHeight/p);p=r.maxHeight}const T=Array.from(new Set([r.jpegQuality,85,70,55,40]));let h=u;let m=p;while(true){const S=_(h,m,T);for(const g of S){if(g.encodedSize<r.maxBytes){return{data:g.data,mimeType:g.mimeType,originalWidth:c,originalHeight:a,width:h,height:m,wasResized:true}}}if(h===1&&m===1){break}const y=h===1?1:Math.max(1,Math.floor(h*.75));const P=m===1?1:Math.max(1,Math.floor(m*.75));if(y===h&&P===m){break}h=y;m=P}return null}catch{return null}finally{if(s){s.free()}}}function te(e){return new Uint8Array(e)}function re(e){return e!==null&&typeof e==="object"}function ie(e){return new ne(e)}async function L(e,n,t,r){const i=ie(e);try{const d=te(n);return await new Promise((s,o)=>{let c=false;const a=u=>{if(c)return;c=true;s(u)};const f=u=>{if(c)return;c=true;o(u)};i.once("message",u=>{if(!re(u)){f(new Error("Invalid image resize worker response"));return}if(u.error){f(new Error(u.error));return}a(u.result??null)});i.once("error",f);i.once("exit",u=>{if(!c){f(new Error(`Image resize worker exited with code ${u}`))}});i.postMessage({inputBytes:d,mimeType:t,options:r},[d.buffer])})}finally{void i.terminate().catch(()=>void 0)}}async function pe(e,n,t){const r=__alran_tuiPackageEntryUrl.endsWith(".ts");const i=new URL(r?"./image-resize-worker.ts":"./image-resize-worker.js",__alran_tuiPackageEntryUrl);if(typeof process.versions.bun==="string"){try{return await L("./src/utils/image-resize-worker.ts",e,n,t)}catch{}}try{return await L(i,e,n,t)}catch{return M(e,n,t)}}function xe(e){if(!e.wasResized){return void 0}const n=e.originalWidth/e.width;return`[Image: original ${e.originalWidth}x${e.originalHeight}, displayed at ${e.width}x${e.height}. Multiply coordinates by ${n.toFixed(2)} to map to original image.]`}export{E as a,pe as b,xe as c};
2
+ import{Worker as ne}from"node:worker_threads";function H(e,n){if(n+8>e.length)return 1;const t=e[n]<<8|e[n+1];const r=t===18761;const i=a=>{if(r)return e[a]|e[a+1]<<8;return e[a]<<8|e[a+1]};const d=a=>{if(r)return e[a]|e[a+1]<<8|e[a+2]<<16|e[a+3]<<24;return(e[a]<<24|e[a+1]<<16|e[a+2]<<8|e[a+3])>>>0};const s=d(n+4);const o=n+s;if(o+2>e.length)return 1;const c=i(o);for(let a=0;a<c;a++){const f=o+2+a*12;if(f+12>e.length)return 1;if(i(f)===274){const u=i(f+8);return u>=1&&u<=8?u:1}}return 1}function v(e){let n=2;while(n<e.length-1){if(e[n]!==255)return-1;const t=e[n+1];if(t===255){n++;continue}if(t===225){if(n+4>=e.length)return-1;const i=n+4;if(i+6>e.length)return-1;if(!F(e,i))return-1;return i+6}if(n+4>e.length)return-1;const r=e[n+2]<<8|e[n+3];n+=2+r}return-1}function C(e){let n=12;while(n+8<=e.length){const t=String.fromCharCode(e[n],e[n+1],e[n+2],e[n+3]);const r=e[n+4]|e[n+5]<<8|e[n+6]<<16|e[n+7]<<24;const i=n+8;if(t==="EXIF"){if(i+r>e.length)return-1;const d=r>=6&&F(e,i)?i+6:i;return d}n=i+r+r%2}return-1}function F(e,n){return e[n]===69&&e[n+1]===120&&e[n+2]===105&&e[n+3]===102&&e[n+4]===0&&e[n+5]===0}function q(e){let n=-1;if(e.length>=2&&e[0]===255&&e[1]===216){n=v(e)}else if(e.length>=12&&e[0]===82&&e[1]===73&&e[2]===70&&e[3]===70&&e[8]===87&&e[9]===69&&e[10]===66&&e[11]===80){n=C(e)}if(n===-1)return 1;return H(e,n)}function R(e,n,t){const r=n.get_width();const i=n.get_height();const d=n.get_raw_pixels();const s=new Uint8Array(d.length);for(let o=0;o<i;o++){for(let c=0;c<r;c++){const a=(o*r+c)*4;const f=t(c,o,r,i)*4;s[f]=d[a];s[f+1]=d[a+1];s[f+2]=d[a+2];s[f+3]=d[a+3]}}return new e.PhotonImage(s,i,r)}function W(e,n,t){const r=q(t);if(r===1)return n;switch(r){case 2:e.fliph(n);return n;case 3:e.fliph(n);e.flipv(n);return n;case 4:e.flipv(n);return n;case 5:{const i=R(e,n,(d,s,o,c)=>d*c+(c-1-s));e.fliph(i);return i}case 6:return R(e,n,(i,d,s,o)=>i*o+(o-1-d));case 7:{const i=R(e,n,(d,s,o,c)=>(o-1-d)*c+s);e.fliph(i);return i}case 8:return R(e,n,(i,d,s,o)=>(s-1-i)*o+d);default:return n}}function k(e,n){const t=Buffer.from(e.buffer,e.byteOffset,e.byteLength);switch(n){case"image/png":return N(t);case"image/jpeg":return $(t);case"image/gif":return G(t);case"image/webp":return J(t);default:return void 0}}function N(e){if(e.length<24||!e.subarray(0,8).equals(Buffer.from("89504e470d0a1a0a","hex"))||e.readUInt32BE(8)!==13||e.toString("ascii",12,16)!=="IHDR"){return void 0}return{width:e.readUInt32BE(16),height:e.readUInt32BE(20)}}function $(e){if(e.length<4||e[0]!==255||e[1]!==216)return void 0;const n=new Set([192,193,194,195,197,198,199,201,202,203,205,206,207]);let t=2;while(t+8<e.length){if(e[t]!==255){t+=1;continue}while(t<e.length&&e[t]===255)t+=1;const r=e[t];if(r===void 0||r===218||r===217)return void 0;if(n.has(r)){if(t+7>=e.length||e.readUInt16BE(t+1)<8)return void 0;return{width:e.readUInt16BE(t+6),height:e.readUInt16BE(t+4)}}if(r===1||r===216||r>=208&&r<=215){t+=1;continue}if(t+2>=e.length)return void 0;const i=e.readUInt16BE(t+1);if(i<2)return void 0;t+=i+1}return void 0}function G(e){if(e.length<10)return void 0;const n=e.toString("ascii",0,6);if(n!=="GIF87a"&&n!=="GIF89a")return void 0;return{width:e.readUInt16LE(6),height:e.readUInt16LE(8)}}function J(e){if(e.length<30||e.toString("ascii",0,4)!=="RIFF"||e.toString("ascii",8,12)!=="WEBP"){return void 0}const n=e.toString("ascii",12,16);if(n==="VP8 "){if(!e.subarray(23,26).equals(Buffer.from([157,1,42])))return void 0;return{width:e.readUInt16LE(26)&16383,height:e.readUInt16LE(28)&16383}}if(n==="VP8L"){if(e[20]!==47)return void 0;const t=e.readUInt32LE(21);return{width:(t&16383)+1,height:(t>>14&16383)+1}}if(n==="VP8X"){return{width:e.readUIntLE(24,3)+1,height:e.readUIntLE(27,3)+1}}return void 0}import{createRequire as Q}from"module";import*as l from"path";import{fileURLToPath as B}from"url";var V=Q(__alran_tuiPackageEntryUrl);var x=V("fs");var I="photon_rs_bg.wasm";var w=null;var z=null;function O(e){return typeof e==="object"&&e!==null&&"PhotonImage"in e&&typeof e.PhotonImage==="function"}function X(e){if(O(e)){return e}if(typeof e==="object"&&e!==null&&"default"in e&&O(e.default)){return e.default}return null}function Y(e){if(typeof e==="string"){return e}if(e instanceof URL){return B(e)}return null}function K(){const e=l.dirname(process.execPath);const n=l.dirname(B(__alran_tuiPackageEntryUrl));return[l.join(n,I),l.join(e,I),l.join(e,"photon",I),l.join(process.cwd(),I)]}function Z(){const e=x.readFileSync.bind(x);const n=K();const t=x;const r=((...i)=>{const[d,s]=i;const o=Y(d);if(o?.endsWith(I)){try{return e(...i)}catch(c){const a=c;if(a?.code&&a.code!=="ENOENT"){throw c}for(const f of n){if(!x.existsSync(f)){continue}if(s===void 0){return e(f)}return e(f,s)}throw c}}return e(...i)});try{t.readFileSync=r}catch{Object.defineProperty(x,"readFileSync",{value:r,writable:true,configurable:true})}return()=>{try{t.readFileSync=e}catch{Object.defineProperty(x,"readFileSync",{value:e,writable:true,configurable:true})}}}async function A(){if(w){return w}if(z){return z}z=(async()=>{const e=Z();try{w=X(await import("./photon_rs-MVWYTYTO.js"));return w}catch{w=null;return w}finally{e()}})();return z}var E=class extends Error{constructor(){super("Image processing runtime is unavailable");this.name="ImageProcessorUnavailableError"}};var b=4.5*1024*1024;var ee={maxWidth:2e3,maxHeight:2e3,maxBytes:b,jpegQuality:80};function D(e,n){const t=Buffer.from(e).toString("base64");return{data:t,encodedSize:Buffer.byteLength(t,"utf-8"),mimeType:n}}async function M(e,n,t){const r={...ee,...t};const i=Math.ceil(e.byteLength/3)*4;const d=await A();if(!d){const o=k(e,n);if(o&&o.width>0&&o.height>0&&o.width<=r.maxWidth&&o.height<=r.maxHeight&&i<r.maxBytes){return{data:Buffer.from(e).toString("base64"),mimeType:n,originalWidth:o.width,originalHeight:o.height,width:o.width,height:o.height,wasResized:false}}throw new E}let s;try{let _=function(S,y,P){const g=d.resize(s,S,y,d.SamplingFilter.Lanczos3);try{const U=[D(g.get_bytes(),"image/png")];for(const j of P){U.push(D(g.get_bytes_jpeg(j),"image/jpeg"))}return U}finally{g.free()}};const o=d.PhotonImage.new_from_byteslice(e);s=W(d,o,e);if(s!==o)o.free();const c=s.get_width();const a=s.get_height();const f=n.split("/")[1]??"png";if(c<=r.maxWidth&&a<=r.maxHeight&&i<r.maxBytes){return{data:Buffer.from(e).toString("base64"),mimeType:n||`image/${f}`,originalWidth:c,originalHeight:a,width:c,height:a,wasResized:false}}let u=c;let p=a;if(u>r.maxWidth){p=Math.round(p*r.maxWidth/u);u=r.maxWidth}if(p>r.maxHeight){u=Math.round(u*r.maxHeight/p);p=r.maxHeight}const T=Array.from(new Set([r.jpegQuality,85,70,55,40]));let h=u;let m=p;while(true){const S=_(h,m,T);for(const g of S){if(g.encodedSize<r.maxBytes){return{data:g.data,mimeType:g.mimeType,originalWidth:c,originalHeight:a,width:h,height:m,wasResized:true}}}if(h===1&&m===1){break}const y=h===1?1:Math.max(1,Math.floor(h*.75));const P=m===1?1:Math.max(1,Math.floor(m*.75));if(y===h&&P===m){break}h=y;m=P}return null}catch{return null}finally{if(s){s.free()}}}function te(e){return new Uint8Array(e)}function re(e){return e!==null&&typeof e==="object"}function ie(e){return new ne(e)}async function L(e,n,t,r){const i=ie(e);try{const d=te(n);return await new Promise((s,o)=>{let c=false;const a=u=>{if(c)return;c=true;s(u)};const f=u=>{if(c)return;c=true;o(u)};i.once("message",u=>{if(!re(u)){f(new Error("Invalid image resize worker response"));return}if(u.error){f(new Error(u.error));return}a(u.result??null)});i.once("error",f);i.once("exit",u=>{if(!c){f(new Error(`Image resize worker exited with code ${u}`))}});i.postMessage({inputBytes:d,mimeType:t,options:r},[d.buffer])})}finally{void i.terminate().catch(()=>void 0)}}async function pe(e,n,t){const r=__alran_tuiPackageEntryUrl.endsWith(".ts");const i=new URL(r?"./image-resize-worker.ts":"./image-resize-worker.js",__alran_tuiPackageEntryUrl);if(typeof process.versions.bun==="string"){try{return await L("./src/utils/image-resize-worker.ts",e,n,t)}catch{}}try{return await L(i,e,n,t)}catch{return M(e,n,t)}}function xe(e){if(!e.wasResized){return void 0}const n=e.originalWidth/e.width;return`[Image: original ${e.originalWidth}x${e.originalHeight}, displayed at ${e.width}x${e.height}. Multiply coordinates by ${n.toFixed(2)} to map to original image.]`}export{E as a,pe as b,xe as c};
@@ -1,5 +1,5 @@
1
1
  import { createRequire as __alran_cR } from "module"; import { basename as __alran_basename, dirname as __alran_dirname, join as __alran_join } from "path"; import { fileURLToPath as __alran_fileURLToPath, pathToFileURL as __alran_pathToFileURL } from "url"; const __alran_tuiCurrentModuleDir = __alran_dirname(__alran_fileURLToPath(import.meta.url)); const __alran_tuiPackageRoot = __alran_basename(__alran_tuiCurrentModuleDir) === "chunks" ? __alran_dirname(__alran_tuiCurrentModuleDir) : __alran_tuiCurrentModuleDir; const __alran_tuiPackageEntryUrl = __alran_pathToFileURL(__alran_join(__alran_tuiPackageRoot, "cli.js")).href; const require = __alran_cR(__alran_tuiPackageEntryUrl); const __dirname = __alran_tuiPackageRoot;
2
- import{r as N,s as j}from"./chunk-6255CZPL.js";import{a as V}from"./chunk-ZQOALVGL.js";import{e as $}from"./chunk-XQK7JM66.js";var k=$(V(),1);import{createHash as L,randomUUID as O}from"node:crypto";import{cpSync as ce,existsSync as l,mkdirSync as J,readdirSync as C,readFileSync as m,renameSync as q,rmSync as g,writeFileSync as A}from"node:fs";import s from"node:path";var P=".alran-update-pending.json";var _=".alran-active";var B=".alran-update-activator.json";var H=".alran-update-activation-status.json";var W=1;var D=1;var G=1;var Q=3e4;var K="ALRAN_UPDATE_PARENT_PID";function w(e,t=process.platform){const r=R(t);return t==="win32"?r.join(e,"node_modules"):r.join(e,"lib","node_modules")}function z(e,t,r=process.platform){const n=R(r);return n.join(w(e,r),...t.split("/"))}function X(e,t,r=process.platform){const n=R(r);const a=r==="win32"?["alran.cmd","alran.ps1"]:["alran"];const i=r==="win32"?"":"bin";return a.map(c=>{const o=n.join(e,i,c);return{activePath:o,stagedPath:n.join(t,i,c),backupPath:`${o}.alran-update-backup`}})}function ue(e,t,r=process.platform){const n=z(e,t,r);const a=s.join(n,"package.json");const i=JSON.parse(m(a,"utf8"));const c=T(i.bin,"alran");const o=T(i.bin,"alran-tools");if(i.name!==t||typeof i.version!=="string"||!c||!o){throw new Error(`Alran package metadata is invalid at ${a}.`)}return{packageRoot:n,version:i.version,binEntry:c,alranToolsBinEntry:o}}async function fe(e,t,r,n){await S(e,r,[s.join(t.packageRoot,...t.binEntry.split("/")),"--version"],"Alran",a=>a===n);await S(e,r,[s.join(t.packageRoot,...t.alranToolsBinEntry.split("/")),"--version"],"alran-tools",a=>a.length>0);await S(e,r,["--input-type=module","--eval",`
2
+ import{r as N,s as j}from"./chunk-PCL2CVVE.js";import{a as V}from"./chunk-R44C5DM6.js";import{e as $}from"./chunk-XQK7JM66.js";var k=$(V(),1);import{createHash as L,randomUUID as O}from"node:crypto";import{cpSync as ce,existsSync as l,mkdirSync as J,readdirSync as C,readFileSync as m,renameSync as q,rmSync as g,writeFileSync as A}from"node:fs";import s from"node:path";var P=".alran-update-pending.json";var _=".alran-active";var B=".alran-update-activator.json";var H=".alran-update-activation-status.json";var W=1;var D=1;var G=1;var Q=3e4;var K="ALRAN_UPDATE_PARENT_PID";function w(e,t=process.platform){const r=R(t);return t==="win32"?r.join(e,"node_modules"):r.join(e,"lib","node_modules")}function z(e,t,r=process.platform){const n=R(r);return n.join(w(e,r),...t.split("/"))}function X(e,t,r=process.platform){const n=R(r);const a=r==="win32"?["alran.cmd","alran.ps1"]:["alran"];const i=r==="win32"?"":"bin";return a.map(c=>{const o=n.join(e,i,c);return{activePath:o,stagedPath:n.join(t,i,c),backupPath:`${o}.alran-update-backup`}})}function ue(e,t,r=process.platform){const n=z(e,t,r);const a=s.join(n,"package.json");const i=JSON.parse(m(a,"utf8"));const c=T(i.bin,"alran");const o=T(i.bin,"alran-tools");if(i.name!==t||typeof i.version!=="string"||!c||!o){throw new Error(`Alran package metadata is invalid at ${a}.`)}return{packageRoot:n,version:i.version,binEntry:c,alranToolsBinEntry:o}}async function fe(e,t,r,n){await S(e,r,[s.join(t.packageRoot,...t.binEntry.split("/")),"--version"],"Alran",a=>a===n);await S(e,r,[s.join(t.packageRoot,...t.alranToolsBinEntry.split("/")),"--version"],"alran-tools",a=>a.length>0);await S(e,r,["--input-type=module","--eval",`
3
3
  import { createRequire } from 'node:module';
4
4
  const require = createRequire(process.argv[1]);
5
5
  const Database = require('better-sqlite3');