{
  "version": 3,
  "sources": ["/cdn/shop/t/4/assets/ims-users.js?bust=20260618"],
  "sourcesContent": ["(function(){\r\n  'use strict';\r\n  const db=()=>window.SM.DB, ui=()=>window.SM.UI, util=()=>window.SM.UTIL;\r\n\r\n  async function load(){\r\n    const content=document.getElementById('ims-users-content');\r\n    if(!content)return;\r\n    const showInactive = document.getElementById('ims-users-show-inactive')?.checked || false;\r\n    content.innerHTML=`<div class=\"ims__loading\"><i class=\"ti ti-loader-2 ims__spin\"></i></div>`;\r\n    const {data:users,error}=await db().select('users',{order:{col:'name'}});\r\n    if(error){content.innerHTML=`<div class=\"ims__coming-soon\"><i class=\"ti ti-user-cog\"></i><h3>Failed to load users</h3><p>${error.message}</p></div>`;return;}\r\n    const showInactiveToggle = document.getElementById('ims-users-show-inactive')?.checked || false;\r\n    const items=(users||[]).filter(u => showInactiveToggle || (u.is_active && !u.name?.startsWith('[Deleted]')));\r\n    // Only a Super Admin may edit, deactivate or delete a Super Admin.\r\n    const iAmSuper = window.SM.AUTH.isSuperAdmin();\r\n    const canManage = u => u.id!==window.SM.AUTH.user?.id && (iAmSuper || u.role!=='super_admin');\r\n    content.innerHTML=`\r\n      <div style=\"display:flex;justify-content:flex-end;align-items:center;gap:14px;margin-bottom:10px\">\r\n        ${window.SM.AUTH.isAdmin()?`<button class=\"ims__btn ims__btn--secondary ims__btn--sm\" onclick=\"window.IMS_USERS.showAuditLog()\" title=\"Who added, changed or deleted what, and when\"><i class=\"ti ti-list-search\"></i> Audit log</button>`:''}\r\n        <label style=\"display:flex;align-items:center;gap:8px;font-size:13px;color:var(--ims-text-muted);cursor:pointer\">\r\n          <input type=\"checkbox\" id=\"ims-users-show-inactive\" onchange=\"window.IMS_USERS.load()\">\r\n          Show deleted/inactive users\r\n        </label>\r\n      </div>\r\n      <div class=\"ims__card\">\r\n        <div class=\"ims__table-wrap\">\r\n          <table class=\"ims__table\">\r\n            <thead><tr><th>Name</th><th>Email</th><th>Role</th><th>Last login</th><th>Status</th><th></th></tr></thead>\r\n            <tbody>${items.map(u=>`<tr>\r\n              <td>\r\n                <div style=\"display:flex;align-items:center;gap:8px\">\r\n                  <div style=\"width:28px;height:28px;border-radius:50%;background:var(--ims-accent);display:flex;align-items:center;justify-content:center;font-size:11px;font-weight:700;color:#fff;flex-shrink:0\">${util().initials(u.name||u.email)}</div>\r\n                  <span style=\"font-weight:500\">${util().sanitize(u.name||'\u2014')}</span>\r\n                  ${u.id===window.SM.AUTH.user?.id?'<span class=\"ims__pill ims__pill--info\" style=\"font-size:10px\">You</span>':''}\r\n                </div>\r\n              </td>\r\n              <td style=\"font-size:12px\">${util().sanitize(u.email||'\u2014')}</td>\r\n              <td>\r\n                <span class=\"ims__pill ims__pill--${u.role==='super_admin'||u.role==='admin'?'info':u.role==='viewer'?'neutral':'accent'}\" style=\"font-size:11px\">${util().formatRole(u.role)}</span>\r\n                ${!['super_admin','admin'].includes(u.role) && (u.extra_permissions||[]).includes('add_customers') ? '<span class=\"ims__pill ims__pill--neutral\" style=\"font-size:10px;margin-left:4px\" title=\"Can add new customers\">+ Customers</span>' : ''}\r\n              </td>\r\n              <td style=\"font-size:12px;color:${u.last_login?'var(--ims-text)':'var(--ims-text-muted)'}\">${u.last_login?util().formatDateTime(u.last_login):'Never logged in'}${!u.auth_id&&u.invited_at?`<div style=\"font-size:11px\">Invited ${util().formatDateTime(u.invited_at)}</div>`:''}</td>\r\n              <td>\r\n                ${canManage(u)?`\r\n                  <label style=\"display:flex;align-items:center;gap:8px;cursor:pointer\">\r\n                    <div style=\"position:relative;width:40px;height:22px;flex-shrink:0\">\r\n                      <input type=\"checkbox\" ${u.is_active?'checked':''} style=\"opacity:0;width:0;height:0;position:absolute\"\r\n                        onchange=\"window.IMS_USERS.toggleActive('${util().jsArg(u.id)}',this.checked,'${util().jsArg(u.name||u.email)}')\">\r\n                      <div style=\"position:absolute;inset:0;border-radius:999px;background:${u.is_active?'var(--ims-success)':'var(--ims-border2)'};transition:.2s\"></div>\r\n                      <div style=\"position:absolute;top:3px;left:${u.is_active?'21':'3'}px;width:16px;height:16px;border-radius:50%;background:#fff;transition:.2s;box-shadow:0 1px 3px rgba(0,0,0,.2)\"></div>\r\n                    </div>\r\n                    <span style=\"font-size:12px;color:${u.is_active?'var(--ims-success)':'var(--ims-text-muted)'}\">${u.is_active?'Active':'Inactive'}</span>\r\n                  </label>`\r\n                :`<span class=\"ims__pill ims__pill--${u.is_active?'success':'neutral'}\">${u.is_active?'Active':'Inactive'}</span>`}\r\n              </td>\r\n              <td>\r\n                <div class=\"ims__btn-group\">\r\n                  ${window.SM.AUTH.isAdmin()&&!u.auth_id&&u.is_active&&canManage(u)?`<button class=\"ims__btn ims__btn--secondary ims__btn--sm\" onclick=\"window.IMS_USERS.resendInvite('${util().jsArg(u.id)}','${util().jsArg(u.name||u.email)}','${util().jsArg(u.email)}',this)\" title=\"The user has not set up their login yet\"><i class=\"ti ti-mail-forward\"></i> ${u.invited_at?'Resend invite':'Send invite'}</button>`:''}\r\n                  ${canManage(u)?`\r\n                    <button class=\"ims__btn ims__btn--secondary ims__btn--sm ims__btn--icon\" onclick=\"window.IMS_USERS.editUser('${util().jsArg(u.id)}')\" title=\"Edit role\"><i class=\"ti ti-edit\"></i></button>\r\n                    <button class=\"ims__btn ims__btn--danger ims__btn--sm ims__btn--icon\" onclick=\"window.IMS_USERS.deleteUser('${util().jsArg(u.id)}','${util().jsArg(u.name||u.email)}')\" title=\"Delete user\"><i class=\"ti ti-trash\"></i></button>\r\n                  `:''}\r\n                </div>\r\n              </td>\r\n            </tr>`).join('')||'<tr><td colspan=\"6\" class=\"ims__table-empty\">No users found</td></tr>'}\r\n            </tbody>\r\n          </table>\r\n        </div>\r\n      </div>`;\r\n  }\r\n\r\n  function showForm(existingId=null,userData=null){\r\n    const isEdit=!!existingId;\r\n    const roles=[\r\n      {value:'super_admin',label:'Super Admin \u2014 Full system access'},\r\n      {value:'admin',label:'Admin \u2014 All modules, user management'},\r\n      {value:'imports_manager',label:'Imports Manager \u2014 Imports only'},\r\n      {value:'warehouse_manager',label:'Warehouse Manager \u2014 Warehouse, logistics, inventory'},\r\n      {value:'warehouse_staff',label:'Warehouse Staff \u2014 Stock and warehouse'},\r\n      {value:'order_management',label:'Order Management \u2014 Orders, customers, logistics'},\r\n      {value:'logistics_staff',label:'Logistics Staff \u2014 Logistics only'},\r\n      {value:'accounts_staff',label:'Accounts Staff \u2014 Accounts and reports'},\r\n      {value:'viewer',label:'Viewer \u2014 Read only'},\r\n      {value:'custom',label:'Custom \u2014 choose specific modules'},\r\n      {value:'driver',label:'Driver: driver app only, on their phone'}\r\n    ];\r\n    const modules=[\r\n      {key:'dashboard',label:'Dashboard'},\r\n      {key:'customers',label:'Customers'},\r\n      {key:'inventory',label:'Inventory'},\r\n      {key:'orders',label:'Orders'},\r\n      {key:'purchases',label:'Purchases'},\r\n      {key:'imports',label:'Imports'},\r\n      {key:'warehouse',label:'Warehouse'},\r\n      {key:'logistics',label:'Logistics'},\r\n      {key:'dropship',label:'Dropship'},\r\n      {key:'warranty',label:'Warranty'},\r\n      {key:'accounts',label:'Accounts'},\r\n      {key:'reports',label:'Reports'},\r\n      {key:'deals',label:'Deals'},\r\n      {key:'company',label:'Company setup'},\r\n      {key:'platforms',label:'Platforms'},\r\n      {key:'users',label:'Users'},\r\n      {key:'backup',label:'Backup & restore'}\r\n    ];\r\n    const selectedModules=new Set(userData?.custom_permissions||[]);\r\n    const isCustom=userData?.role==='custom';\r\n    // Only a Super Admin may give the Super Admin role.\r\n    const iAmSuper=window.SM.AUTH.isSuperAdmin();\r\n    const roleChoices=roles.filter(r=>iAmSuper || r.value!=='super_admin');\r\n    // \"Extra permissions\" apply to every role except Super Admin and Admin,\r\n    // who always have them. Only a Super Admin may change them.\r\n    const canAddCust=(userData?.extra_permissions||[]).includes('add_customers');\r\n    const hideExtra=['super_admin','admin'].includes(userData?.role);\r\n    ui().openModal(isEdit?`Edit user: ${userData?.name||''}`:'Add user',`\r\n      <div class=\"ims__form-grid\">\r\n        <div class=\"ims__form-group\"><label class=\"ims__label ims__label--req\">Full name</label><input class=\"ims__input\" type=\"text\" id=\"ims-usr-name\" value=\"${util().sanitize(userData?.name||'')}\"></div>\r\n        <div class=\"ims__form-group\"><label class=\"ims__label ims__label--req\">Email address</label><input class=\"ims__input\" type=\"email\" id=\"ims-usr-email\" value=\"${util().sanitize(userData?.email||'')}\" ${isEdit?'readonly style=\"background:var(--ims-surface2)\"':''}></div>\r\n        <div class=\"ims__form-group ims__form-group--full\">\r\n          <label class=\"ims__label ims__label--req\">Role</label>\r\n          <select class=\"ims__select\" id=\"ims-usr-role\" onchange=\"window.IMS_USERS.onRoleChange()\">\r\n            ${roleChoices.map(r=>`<option value=\"${r.value}\" ${userData?.role===r.value?'selected':''}>${r.label}</option>`).join('')}\r\n          </select>\r\n        </div>\r\n        <div class=\"ims__form-group ims__form-group--full\" id=\"ims-usr-driver-wrap\" style=\"${userData?.role==='driver'?'':'display:none'}\">\r\n          <label class=\"ims__label ims__label--req\">Fleet driver</label>\r\n          <select class=\"ims__select\" id=\"ims-usr-driver\" data-current=\"${util().sanitize(userData?.driver_id||'')}\"><option value=\"\">Loading drivers...</option></select>\r\n          <span class=\"ims__input-hint\">The driver record (Logistics &rarr; Fleet) this login belongs to. A Driver sees only the manifests assigned to this driver, in the driver app, and never the office screens.</span>\r\n        </div>\r\n        <div class=\"ims__form-group ims__form-group--full\" id=\"ims-usr-modules-wrap\" style=\"${isCustom?'':'display:none'}\">\r\n          <label class=\"ims__label\">Module access</label>\r\n          <div style=\"display:grid;grid-template-columns:1fr 1fr;gap:6px;max-height:260px;overflow-y:auto;border:1px solid var(--ims-border);border-radius:var(--ims-radius);padding:10px\">\r\n            ${modules.map(m=>`\r\n              <label style=\"display:flex;align-items:center;gap:8px;font-size:13px;cursor:pointer;padding:4px 2px\">\r\n                <input type=\"checkbox\" class=\"ims-usr-module-cb\" value=\"${m.key}\" ${selectedModules.has(m.key)?'checked':''}>\r\n                ${m.label}\r\n              </label>`).join('')}\r\n          </div>\r\n          <span class=\"ims__input-hint\">Tick every module this user should be able to see and use. Admin-only destructive actions (e.g. deleting records) still require the Super Admin or Admin role, regardless of module access.</span>\r\n        </div>\r\n        <div class=\"ims__form-group ims__form-group--full\" id=\"ims-usr-extra-wrap\" style=\"${hideExtra?'display:none':''}\">\r\n          <label class=\"ims__label\">Extra permissions</label>\r\n          <label style=\"display:flex;align-items:center;gap:8px;font-size:13px;cursor:${iAmSuper?'pointer':'not-allowed'};padding:4px 2px\">\r\n            <input type=\"checkbox\" id=\"ims-usr-perm-addcust\" ${canAddCust?'checked':''} ${iAmSuper?'':'disabled'}>\r\n            Can add new customers\r\n          </label>\r\n          <span class=\"ims__input-hint\">${iAmSuper?'Super Admins and Admins can always add customers. Tick this to let this user add them too.':'Only a Super Admin can change this.'}</span>\r\n        </div>\r\n        ${!isEdit?`\r\n          <div class=\"ims__form-group ims__form-group--full\">\r\n            <div class=\"ims__alert ims__alert--info\"><i class=\"ti ti-info-circle\"></i>\r\n              <span>An invitation email is sent automatically, with a link for the user to set their password.</span>\r\n            </div>\r\n          </div>` : ''}\r\n      </div>\r\n    `,`\r\n      <button class=\"ims__btn ims__btn--ghost\" onclick=\"window.SM.UI.closeModal()\">Cancel</button>\r\n      <button class=\"ims__btn ims__btn--primary\" onclick=\"window.IMS_USERS.saveUser('${util().jsArg(existingId||'')}')\"><i class=\"ti ti-check\"></i> ${isEdit?'Save changes':'Add user'}</button>\r\n    `,'sm');\r\n    _fillDriverChoice();\r\n  }\r\n\r\n  // The database's own refusal, in plain words (e.g. two people saving a\r\n  // second login for the same driver at the same moment).\r\n  function _userSaveError(error){\r\n    const m=String(error?.message||error||'');\r\n    if(/users_one_active_login_per_driver|one_active/i.test(m)) return 'This Fleet driver already has an active driver login. Each driver can have only one, so deactivate or delete the other login first.';\r\n    return 'Failed: '+m;\r\n  }\r\n  // Fleet drivers for the \"Fleet driver\" choice (Driver role).\r\n  async function _fillDriverChoice(){\r\n    const sel=document.getElementById('ims-usr-driver'); if(!sel) return;\r\n    const current=sel.dataset.current||'';\r\n    const {data:all}=await db().select('drivers',{select:'id,name,is_active',order:{col:'name'}});\r\n    const data=(all||[]).filter(d=>d.is_active!==false||d.id===current);   // active drivers (and this user's current one)\r\n    sel.innerHTML=`<option value=\"\">Choose a driver</option>`+data.map(d=>`<option value=\"${d.id}\" ${d.id===current?'selected':''}>${util().sanitize(d.name)}${d.is_active===false?' (inactive)':''}</option>`).join('');\r\n    if(!data.length) sel.innerHTML='<option value=\"\">No drivers yet: add one in Logistics &rarr; Fleet</option>';\r\n  }\r\n  function onRoleChange(){\r\n    const role=document.getElementById('ims-usr-role')?.value;\r\n    const drv=document.getElementById('ims-usr-driver-wrap');\r\n    if(drv) drv.style.display=role==='driver'?'':'none';\r\n    const wrap=document.getElementById('ims-usr-modules-wrap');\r\n    if(wrap) wrap.style.display=role==='custom'?'':'none';\r\n    const extra=document.getElementById('ims-usr-extra-wrap');\r\n    if(extra) extra.style.display=['super_admin','admin'].includes(role)?'none':'';\r\n  }\r\n\r\n  // Refuses (with a message) any change to a Super Admin, or giving the\r\n  // Super Admin role, unless the person signed in is a Super Admin.\r\n  function _superAdminGuard(targetRole, newRole){\r\n    if(window.SM.AUTH.isSuperAdmin()) return true;\r\n    if(targetRole==='super_admin' || newRole==='super_admin'){\r\n      ui().toast('Only a Super Admin can give, change or remove the Super Admin role, or change a Super Admin\\'s account','error',6000);\r\n      return false;\r\n    }\r\n    return true;\r\n  }\r\n\r\n  async function editUser(id){\r\n    const {data:u}=await db().select('users',{eq:{id},maybeSingle:true,noCompanyFilter:true});\r\n    if(!u)return;\r\n    if(!_superAdminGuard(u.role, null)) return;\r\n    showForm(id,u);\r\n  }\r\n\r\n  async function saveUser(existingId, renameConfirmed=false){\r\n    const name=document.getElementById('ims-usr-name')?.value?.trim();\r\n    const email=document.getElementById('ims-usr-email')?.value?.trim();\r\n    const role=document.getElementById('ims-usr-role')?.value;\r\n    if(!name){ui().toast('Name is required','error');return;}\r\n    if(!email){ui().toast('Email is required','error');return;}\r\n    if(!role){ui().toast('Role is required','error');return;}\r\n\r\n    // Always computed explicitly (empty array for non-custom roles) so\r\n    // that switching a user away from Custom clears any stale selections,\r\n    // rather than leaving old permissions dormant in the database.\r\n    const customPermissions = role==='custom'\r\n      ? [...document.querySelectorAll('.ims-usr-module-cb:checked')].map(cb=>cb.value)\r\n      : [];\r\n    if(role==='custom' && !customPermissions.length){\r\n      ui().toast('Please tick at least one module for a Custom role','error');\r\n      return;\r\n    }\r\n\r\n    // Super Admin protection, checked again on saving.\r\n    let target=null;\r\n    if(existingId){\r\n      const {data}=await db().select('users',{eq:{id:existingId},maybeSingle:true,noCompanyFilter:true});\r\n      target=data;\r\n    }\r\n    if(!_superAdminGuard(target?.role, role)) return;\r\n\r\n    // Renaming an account: if it is being handed to a different person,\r\n    // a new user should be created instead, so everything each person does\r\n    // stays under their own login. (Renames are allowed for corrections,\r\n    // and every rename is kept in the Audit log.)\r\n    if(existingId && target && (target.name||'')!==name && !renameConfirmed){\r\n      ui().confirm(`You are renaming <strong>${util().sanitize(target.name||'')}</strong> to <strong>${util().sanitize(name)}</strong>.<br><br>If this account is being given to a <strong>different person</strong>, please create a new user for them instead (and deactivate this one), so that everything each person does stays under their own name.<br><br>Rename anyway (for example to correct a spelling)?`,\r\n        ()=>saveUser(existingId,true),'Rename',false);\r\n      return;\r\n    }\r\n\r\n    // \"Can add new customers\" is saved only when a Super Admin is signed in\r\n    // (otherwise the stored value is left exactly as it was). It is kept\r\n    // alongside any other extra permissions added in future.\r\n    const extraFields={};\r\n    // A Driver must be linked to their Fleet driver record; other roles are not.\r\n    if(role==='driver'){\r\n      const driverId=document.getElementById('ims-usr-driver')?.value||'';\r\n      if(!driverId){ ui().toast('Please choose the Fleet driver for this login','error'); return; }\r\n      // One active login per Fleet driver, so everything a driver does is\r\n      // clearly theirs. (The database enforces this too.)\r\n      const {data:others}=await db().select('users',{select:'id,name',eq:{driver_id:driverId,role:'driver',is_active:true}});\r\n      const clash=(others||[]).find(u=>u.id!==existingId);\r\n      if(clash){ ui().toast(`This Fleet driver already has an active driver login: ${clash.name}. Each driver can have only one, so deactivate or delete that login first.`,'error',9000); return; }\r\n      extraFields.driver_id=driverId;\r\n    } else {\r\n      extraFields.driver_id=null;\r\n    }\r\n    if(window.SM.AUTH.isSuperAdmin()){\r\n      const others=(target?.extra_permissions||[]).filter(p=>p!=='add_customers');\r\n      const grant=!!document.getElementById('ims-usr-perm-addcust')?.checked && !['super_admin','admin'].includes(role);\r\n      extraFields.extra_permissions=grant?[...others,'add_customers']:others;\r\n    }\r\n\r\n    if(existingId){\r\n      const {error}=await db().update('users',existingId,{name,role,custom_permissions:customPermissions,...extraFields});\r\n      if(error){ui().toast(_userSaveError(error),'error',9000);return;}\r\n      ui().closeModal();ui().toast('User updated','success');load();\r\n    } else {\r\n      // Check email not already in use\r\n      const {data:existing}=await db().select('users',{eq:{email},maybeSingle:true});\r\n      if(existing){ui().toast('A user with this email already exists','error');return;}\r\n\r\n      // Create the user, then send the invitation email through the\r\n      // invite-user Edge Function (it runs on Supabase's server, where the\r\n      // service key is safe). The browser cannot send invitations itself.\r\n      const {data:newUser,error}=await db().insert('users',{name,email,role,is_active:true,custom_permissions:customPermissions,...extraFields});\r\n      if(error){ui().toast(_userSaveError(error),'error',9000);return;}\r\n      ui().closeModal();\r\n      const res=await _sendInvite(newUser?.id);\r\n      if(res.ok) ui().toast(res.mode==='reset'\r\n        ? `${name} added. This email already had a login, so a password reset email was sent to ${email} instead.`\r\n        : `${name} added. Invitation email sent to ${email}: they will receive a link to set their password.`,'success',8000);\r\n      else _inviteFallback(name,email,res.error);\r\n      load();\r\n    }\r\n  }\r\n\r\n  async function toggleActive(id,newActive,name){\r\n    const {data:t}=await db().select('users',{select:'role',eq:{id},maybeSingle:true,noCompanyFilter:true});\r\n    if(!_superAdminGuard(t?.role, null)){ load(); return; }\r\n    ui().confirm(\r\n      `${newActive?'Activate':'Deactivate'} user \"${name}\"? ${newActive?'They will be able to log in again.':'They will no longer be able to log in.'}`,\r\n      async ()=>{\r\n        const {error}=await db().update('users',id,{is_active:newActive});\r\n        if(error){ui().toast(_userSaveError(error),'error',9000);return;}\r\n        ui().toast(`User ${newActive?'activated':'deactivated'}`,'success');\r\n        load();\r\n      },\r\n      newActive?'Activate':'Deactivate',\r\n      !newActive\r\n    );\r\n  }\r\n\r\n  async function deleteUser(id, name){\r\n    const {data:t}=await db().select('users',{select:'role',eq:{id},maybeSingle:true,noCompanyFilter:true});\r\n    if(!_superAdminGuard(t?.role, null)) return;\r\n    ui().confirm(\r\n      `Permanently delete user \"${name}\"? This cannot be undone. Their data and audit records will be retained but they will no longer be able to log in.`,\r\n      async () => {\r\n        const {error} = await db().update('users', id, {is_active: false, email: `deleted_${Date.now()}_${id}@deleted.com`, name: `[Deleted] ${name}`});\r\n        if(error){ ui().toast('Failed: '+error.message,'error'); return; }\r\n        ui().toast(`User \"${name}\" deleted`,'success');\r\n        load();\r\n      },\r\n      'Delete user',\r\n      true\r\n    );\r\n  }\r\n\r\n  // \u2500\u2500\u2500 AUDIT LOG (Admin) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n  // Everything added, changed or deleted, with who did it and when,\r\n  // recorded by the database itself (public.audit_log). Each entry keeps\r\n  // the account's name at that moment; if the account has been renamed\r\n  // since, its current name is shown alongside.\r\n  const AUDIT_LABELS={orders:'Order',order_items:'Order line',customers:'Customer',products:'Product',product_prices:'Price',\r\n    stock_levels:'Stock',manifests:'Manifest',logistics_jobs:'Delivery job',transactions:'Transaction',invoices:'Invoice',\r\n    accounts_receivable:'Amount owed',users:'User',companies:'Company settings',dropship_customers:'Dropship partner',\r\n    dropship_allocations:'Allocation',claims:'Claim',deals:'Deal',warehouses:'Warehouse',platforms:'Platform',couriers:'Courier',\r\n    drivers:'Driver',vehicles:'Vehicle'};\r\n  const _auditVal=v=>{ if(v===null||v===undefined||v==='') return 'empty'; const t=typeof v==='object'?JSON.stringify(v):String(v); return t.length>60?t.slice(0,57)+'...':t; };\r\n  const _auditNameOf=c=>c&&(c.order_number||c.business_name||c.name||c.manifest_number||c.invoice_number||c.claim_ref||c.product_name||c.sku||c.registration)||'';\r\n\r\n  async function showAuditLog(){\r\n    if(!window.SM.AUTH.isAdmin()){ui().toast('Only an Admin can view the audit log','error');return;}\r\n    const {data:users}=await db().select('users',{select:'id,name',order:{col:'name'}});\r\n    const userOpts=(users||[]).map(u=>`<option value=\"${util().sanitize(u.id)}\">${util().sanitize(u.name||'')}</option>`).join('');\r\n    const typeOpts=Object.entries(AUDIT_LABELS).map(([k,v])=>`<option value=\"${k}\">${v}</option>`).join('');\r\n    const today=new Date().toISOString().split('T')[0];\r\n    const weekAgo=new Date(Date.now()-7*86400000).toISOString().split('T')[0];\r\n    ui().openModal('Audit log',`\r\n      <div style=\"display:flex;flex-wrap:wrap;gap:8px;margin-bottom:12px\">\r\n        <select class=\"ims__select\" id=\"ims-audit-user\" style=\"max-width:180px\"><option value=\"\">Everyone</option>${userOpts}</select>\r\n        <select class=\"ims__select\" id=\"ims-audit-type\" style=\"max-width:180px\"><option value=\"\">All record types</option>${typeOpts}</select>\r\n        <input class=\"ims__input\" type=\"date\" id=\"ims-audit-from\" value=\"${weekAgo}\" style=\"max-width:150px\">\r\n        <input class=\"ims__input\" type=\"date\" id=\"ims-audit-to\" value=\"${today}\" style=\"max-width:150px\">\r\n        <input class=\"ims__input\" type=\"text\" id=\"ims-audit-text\" placeholder=\"Search, e.g. ORD-00597\" style=\"max-width:200px\">\r\n        <button class=\"ims__btn ims__btn--primary ims__btn--sm\" onclick=\"window.IMS_USERS.runAuditLog()\"><i class=\"ti ti-search\"></i> Show</button>\r\n      </div>\r\n      <div id=\"ims-audit-results\"></div>\r\n    `,`<button class=\"ims__btn ims__btn--ghost\" onclick=\"window.SM.UI.closeModal()\">Close</button>`,'lg');\r\n    runAuditLog();\r\n  }\r\n\r\n  async function runAuditLog(){\r\n    const out=document.getElementById('ims-audit-results'); if(!out) return;\r\n    out.innerHTML='<div class=\"ims__loading\"><i class=\"ti ti-loader-2 ims__spin\"></i></div>';\r\n    const g=id=>document.getElementById(id)?.value?.trim()||'';\r\n    const client=window.supabase.createClient(window.IMS_SUPABASE_URL,window.IMS_SUPABASE_ANON_KEY);\r\n    let q=client.from('audit_log').select('*').eq('company_id',window.SM.AUTH.company?.id).order('created_at',{ascending:false}).limit(500);\r\n    if(g('ims-audit-user')) q=q.eq('user_id',g('ims-audit-user'));\r\n    if(g('ims-audit-type')) q=q.eq('table_name',g('ims-audit-type'));\r\n    if(g('ims-audit-from')) q=q.gte('created_at',`${g('ims-audit-from')}T00:00:00`);\r\n    if(g('ims-audit-to'))   q=q.lte('created_at',`${g('ims-audit-to')}T23:59:59`);\r\n    const {data:rows,error}=await q;\r\n    if(error){ out.innerHTML=`<div class=\"ims__alert ims__alert--warning\"><i class=\"ti ti-alert-triangle\"></i><span>The audit log could not be loaded (${util().sanitize(error.message)}).</span></div>`; return; }\r\n    // Order numbers for order lines and changed orders, so entries read \"Order ORD-00597\".\r\n    const orderIds=[...new Set((rows||[]).flatMap(r=>[r.table_name==='orders'?r.record_id:null, r.changed?.order_id||null]).filter(Boolean))];\r\n    const orderNo={};\r\n    if(orderIds.length){ const {data:os}=await client.from('orders').select('id,order_number').in('id',orderIds.slice(0,500)); (os||[]).forEach(o=>{orderNo[o.id]=o.order_number;}); }\r\n    const {data:us}=await db().select('users',{select:'id,name'}); const nowName={}; (us||[]).forEach(u=>{nowName[u.id]=u.name;});\r\n    const text=g('ims-audit-text').toLowerCase();\r\n    const items=(rows||[]).map(r=>{\r\n      const label=AUDIT_LABELS[r.table_name]||r.table_name;\r\n      const ref=r.table_name==='orders'?orderNo[r.record_id]:r.table_name==='order_items'?orderNo[r.changed?.order_id]:'';\r\n      const name=ref||_auditNameOf(r.action==='update'?null:r.changed)||'';\r\n      const what=`${label}${name?' '+name:''}${r.table_name==='order_items'&&ref?' (line)':''}`;\r\n      const details=r.action==='update'\r\n        ? Object.entries(r.changed||{}).map(([k,v])=>`${k.replace(/_/g,' ')}: ${_auditVal(v?.[0])} to ${_auditVal(v?.[1])}`).join('; ')\r\n        : (r.action==='insert'?'Added':'Deleted');\r\n      const who=`${r.user_name||'-'}${r.user_id&&nowName[r.user_id]&&nowName[r.user_id]!==r.user_name?` (account now: ${nowName[r.user_id]})`:''}`;\r\n      return {r,what,details,who};\r\n    }).filter(x=>!text||`${x.what} ${x.details} ${x.who}`.toLowerCase().includes(text));\r\n    const act={insert:['success','Added'],update:['info','Changed'],delete:['danger','Deleted']};\r\n    out.innerHTML=items.length?`\r\n      <div style=\"font-size:12px;color:var(--ims-text-muted);margin-bottom:6px\">${items.length} entr${items.length===1?'y':'ies'}${(rows||[]).length===500?' (the latest 500: narrow the dates to see older ones)':''}</div>\r\n      <div class=\"ims__table-wrap\" style=\"max-height:60vh;overflow:auto\"><table class=\"ims__table\">\r\n        <thead><tr><th>When</th><th>Who</th><th>Action</th><th>Record</th><th>Details</th></tr></thead>\r\n        <tbody>${items.map(x=>`<tr>\r\n          <td style=\"font-size:12px;white-space:nowrap\">${util().formatDateTime(x.r.created_at)}</td>\r\n          <td style=\"font-size:12px\">${util().sanitize(x.who)}</td>\r\n          <td><span class=\"ims__pill ims__pill--${(act[x.r.action]||['neutral'])[0]}\" style=\"font-size:10px\">${(act[x.r.action]||[0,x.r.action])[1]}</span></td>\r\n          <td style=\"font-size:12px\">${util().sanitize(x.what)}</td>\r\n          <td style=\"font-size:12px;max-width:420px\">${util().sanitize(x.details)}</td>\r\n        </tr>`).join('')}</tbody>\r\n      </table></div>`\r\n      :'<div class=\"ims__empty\" style=\"padding:20px\"><p>No entries for these filters</p></div>';\r\n  }\r\n\r\n  // \u2500\u2500\u2500 INVITATIONS \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\r\n  // Sent by the invite-user Edge Function with the signed-in Admin's own\r\n  // token, so the server can check they are an Admin of the same company.\r\n  async function _sendInvite(userId){\r\n    if(!userId) return {ok:false,error:'The new user could not be identified'};\r\n    try{\r\n      const client=window.supabase.createClient(window.IMS_SUPABASE_URL,window.IMS_SUPABASE_ANON_KEY);\r\n      const {data:got}=await client.auth.getSession();\r\n      const token=got?.session?.access_token;\r\n      if(!token) return {ok:false,error:'Your session has ended. Please sign in again.'};\r\n      const r=await fetch(`${window.IMS_SUPABASE_URL}/functions/v1/invite-user`,{\r\n        method:'POST',\r\n        headers:{'Content-Type':'application/json','Authorization':`Bearer ${token}`,'apikey':window.IMS_SUPABASE_ANON_KEY},\r\n        body:JSON.stringify({user_id:userId,redirect_to:`${window.location.origin}/pages/stock-maestro-portal`})\r\n      });\r\n      const out=await r.json().catch(()=>({}));\r\n      if(!r.ok||!out.ok) return {ok:false,error:out.error||(r.status===404?'The invite-user function is not set up in Supabase yet':`Error ${r.status}`)};\r\n      return {ok:true,mode:out.mode};\r\n    }catch(e){ return {ok:false,error:'The invitation service could not be reached ('+(e.message||e)+')'}; }\r\n  }\r\n  // If sending fails: the reason, and the manual way (Supabase dashboard).\r\n  function _inviteFallback(name,email,reason){\r\n    ui().openModal('User added: invitation not sent',`\r\n      <div class=\"ims__alert ims__alert--warning\"><i class=\"ti ti-alert-triangle\"></i>\r\n        <span><strong>${util().sanitize(name)}</strong> has been added, but the invitation email could not be sent: ${util().sanitize(reason||'unknown reason')}</span>\r\n      </div>\r\n      <div style=\"font-size:13px;margin-top:12px\">Try <strong>Resend invite</strong> on the Users list in a minute, or send it from Supabase:</div>\r\n      <ol style=\"font-size:13px;color:var(--ims-text-sec);line-height:2;margin:8px 0 0 16px\">\r\n        <li>supabase.com &rarr; your project &rarr; <strong>Authentication</strong> &rarr; <strong>Users</strong></li>\r\n        <li><strong>Invite user</strong> &rarr; <strong>${util().sanitize(email)}</strong></li>\r\n      </ol>`,`<button class=\"ims__btn ims__btn--primary\" onclick=\"window.SM.UI.closeModal()\">Got it</button>`,'sm');\r\n  }\r\n  async function resendInvite(userId,name,email,btn){\r\n    if(!window.SM.AUTH.isAdmin()){ui().toast('Only an Admin can send invitations','error');return;}\r\n    if(btn){btn.disabled=true;btn.innerHTML='<i class=\"ti ti-loader-2 ims__spin\"></i> Sending...';}\r\n    const res=await _sendInvite(userId);\r\n    if(res.ok) ui().toast(res.mode==='reset'?`Password reset email sent to ${email} (this email already had a login)`:`Invitation email sent again to ${email}`,'success',7000);\r\n    else _inviteFallback(name,email,res.error);\r\n    load();\r\n  }\r\n\r\n  window.addEventListener('ims:panel',e=>{if(e.detail.panel==='users')load();});\r\n  window.addEventListener('ims:ready',()=>{\r\n    document.getElementById('ims-users-new-btn')?.addEventListener('click',()=>showForm());\r\n  });\r\n  window.IMS_USERS={load,showForm,editUser,saveUser,onRoleChange,toggleActive,deleteUser,showAuditLog,runAuditLog,resendInvite};\r\n})();\r\n"],
  "mappings": "CAAC,UAAU,CACT,aACA,MAAM,GAAG,IAAI,OAAO,GAAG,GAAI,GAAG,IAAI,OAAO,GAAG,GAAI,KAAK,IAAI,OAAO,GAAG,KAEnE,eAAe,MAAM,CACnB,MAAM,QAAQ,SAAS,eAAe,mBAAmB,EACzD,GAAG,CAAC,QAAQ,OACZ,MAAM,aAAe,SAAS,eAAe,yBAAyB,GAAG,SAAW,GACpF,QAAQ,UAAU,2EAClB,KAAM,CAAC,KAAK,MAAM,KAAK,EAAE,MAAM,GAAG,EAAE,OAAO,QAAQ,CAAC,MAAM,CAAC,IAA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