window.GlemoPilot={ ROLES:['holder','buyer','compliance','rails','auditor'], request:s=>s.core.requests[0]||null, economy:s=>{const r=s.core.requests[0];return r?GlemoResale.economics(r.quantity,6,r.proposal?.priceCents||r.priceCents,r.agent,r.thirdPartyCents):null;}, buyer:(s,now)=>({verified:!!s.buyerReview&&Date.parse(s.buyerReview.validUntil)>Date.parse(now)}), formatMoney:(value,lang)=>{ if(!['number','string','bigint'].includes(typeof value)||typeof value==='number'&&!Number.isSafeInteger(value))throw Error('invalidNumber'); const amount=BigInt(value),absolute=amount<0n?-amount:amount,fraction=absolute%100n,whole=absolute/100n; const formatter=new Intl.NumberFormat({en:'en-US',pt:'pt-BR',es:'es-ES',fr:'fr-FR',ar:'ar-AE',zh:'zh-CN'}[lang]||'en-US',{style:'currency',currency:'USD',minimumFractionDigits:fraction?2:0,maximumFractionDigits:fraction?2:0}); return formatter.formatToParts(amount<0n?whole===0n?-0:-whole:whole).map(part=>part.type==='fraction'?fraction.toString().padStart(2,'0'):part.value).join(''); }, normalizeDecimal:(value,lang)=>{ const locale={en:'en-US',pt:'pt-BR',es:'es-ES',fr:'fr-FR',ar:'ar-AE',zh:'zh-CN'}[lang]||'en-US'; const formatter=new Intl.NumberFormat(locale,{useGrouping:false,...(lang==='ar'?{numberingSystem:'arab'}:{})}); let result=String(value); for(let n=0;n<10;n++)result=result.replaceAll(formatter.format(n),String(n)); const decimal=formatter.formatToParts(1.1).find(p=>p.type==='decimal')?.value||'.'; return result.replaceAll(decimal,'.'); } };