{
  "version": 3,
  "sources": ["/cdn/shop/t/1237/assets/bysize-v4-size-gate.js?auto=format%2Ccompress"],
  "sourcesContent": ["/* bysize-v4-size-gate.js \u2014 SIZE GATE for the By Size tools (Owen 2026-10-14, bands > 509 sq in).\n *\n * \"Make certain tools not available at certain sizes \u2014 gray them out with a roll-over / tap\n * message.\" One shared module for BOTH engines (assets/bysize-v4.js and the live DTF fork\n * assets/nt-bgr-common.js): it only reads window.__bsv4Bridge (getState / subscribe / cfg),\n * which both expose, and never touches engine state except to switch precut off.\n *\n * A file is GATED when\n *   \u2022 file.bigFile \u2014 the upload exceeds imgix's render cap (pipeline.js applyRenderCap):\n *     the production file is the raw S3 original, so no imgix-served tool can apply; or\n *   \u2022 any of its rows is TALLER OR WIDER than cfg.limits.maxIn (22 in, the roll width \u2014 the\n *     size customers already know; Owen 2026-10-15: \"22 inches height or width, our customers\n *     can't calculate sq inches\"). Every size that existed before the bands fits in 22 x 22, so\n *     nothing changes for those; every new size has a side over 22; or\n *   \u2022 any row is larger than cfg.toolsGate.maxArea square inches, when that is set (Customizer:\n *     upload box \u2192 \"Tools cutoff\", product metafield custom.tools_max_area overrides). With the\n *     default 509 this never fires on its own (509 sq in always has a side over 22).\n *\n * Gated controls: Remove Background (toggle + options panel), Upscale, Edit with AI, Add Text,\n * Recolor, Filters (stage toolbar AND the dropdown variant), the DPI warning's \"Upscale for Free\"\n * button, and Design Notes (Owen 2026-10-15 \"gray out notes\": the stage tool + its popover\n * buttons, the band under the stage, the modal tile note \u2014 a note already typed is cleared so it\n * never ships on an oversized line). Precut and BG Color stay usable at every size (Owen\n * 2026-10-15). Greyed = .bsv4-size-gated (CSS in bysize-v4-size-gate.css);\n *\n * LABS FUNNEL BEACONS (Owen 2026-10-15: \"how many people are uploading oversized sheets to\n * these pages and of that who sizes down before their add to cart\"). This module already knows\n * the moment a design crosses 22 in on a side, so it reports it \u2014 Labs feature slug\n * `oversized-by-size`, the same POST /evt path AI Edits and Design Studio use (sendBeacon,\n * fire-and-forget, nothing awaited). Two TRACKS (Owen 2026-10-15 \"two tracks, landed oversized\n * and landed under\"), each once per file unless noted:\n *   track L \u2014 landed oversized:  ovs_landed (the measured upload is already over 22 on a side)\n *             \u2192 ovs_landed_down (went back under) \u2192 ovs_landed_atc_over / ovs_landed_atc_under\n *   track U \u2014 landed under, sized up:  ovs_sized_up (typed past 22)\n *             \u2192 ovs_up_down (went back under) \u2192 ovs_up_atc_over / ovs_up_atc_under\n *   adds count every add (v = sq in). The earlier un-tracked names (ovs_sized_down, ovs_atc_over,\n *   ovs_atc_under) are retired here but stay on the Labs allowlist so a cached copy never strays.\n * `ver` = dtf | uv | dtf-gang | uv-gang (the page). Every beacon call is wrapped so counting can\n * never stop the gate from marking.\n * BY SIZE FUNNEL (Owen 2026-10-20, the Labs \"By Size\" report \u2014 visits \u2192 uploads \u2192 the 2x2 of\n * landed under/over x added under/over): three more beacons, same slug, same `ver`:\n *   bs_visit      once per page load (the report's Visited tile)\n *   bs_upload     once per measured file, v = sq in (Uploaded; under = bs_upload \u2212 ovs_landed)\n *   bs_atc_under  on add, per file that landed under 22 and NEVER went over (the plain path;\n *                 a sized-up-then-down file is ovs_up_atc_under, as before)\n * the switch-off of an already-on Remove Background / Upscale waits SETTLE_MS and runs only if the\n * file is still gated (a transient over-22 value the engine clamps back must not flip BGR off);\n * every click / tap / keyboard activation inside is cancelled at the WINDOW capture phase (fires\n * before any document-level capture listener, e.g. the recolor engine's) and shows the message\n * in a real <div> tooltip (no pseudo-elements \u2014 see the Visual Verification Gate precedent).\n */\n(function () {\n  'use strict';\n  if (window.__bsv4SizeGate) return;\n  window.__bsv4SizeGate = true;\n\n  var SEL = [\n    '.bsv4-ai-card--bgr', '.bsv4-ai-card--up', '.bsv4-bgr',\n    '[data-bsv4-edit-open]', '[data-bsv4-addtext]', '.nt-recolor-btn', '[data-bsv4-fx]', '[data-bsv4-upscale]',\n    '[data-bsv4-aitools-trigger]',\n    '[data-bsv4-notes]', '.bsv4-notes-fab', '.bsv4-cta__notes', '.bsv4-tile__note',\n    // By Size v5 (Owen 2026-11-01 \"all tools become unavailable at anything over 22\"): Eraser, Crop, Edges, Undo/Redo,\n    // Add a Note. Absent on every other page, so nothing changes there.\n    '[data-bsv4-erase]', '[data-ntst-crop]', '[data-bsv4-edges-open]', '[data-ntst-undo]', '[data-ntst-redo]', '[data-ntre-open]',\n    // Frames & Filters (Owen 2026-11-17): the tool-bar button that replaced Filters when Frames launched (11-16) was never\n    // added here, so it stayed on over the limit. Absent on pages without the Frames button.\n    '[data-ntsf-open]',\n    // Outline (Justin 11-18) and the phone card menu's Crop / Outline rows (nt-stage-tools.js paintMenus) were never added\n    // either (11-23). Absent on pages without them.\n    '[data-ntst-outline]', '[data-ntst-moutline]', '[data-ntst-mcrop]'\n  ].join(',');\n  // v5 = the tool bar page. There, over 22 SUSPENDS the work instead of discarding it (Owen 2026-11-01: \"keep their\n  // history if they size back down so work with tools isn't lost\"): what the gate switched off comes back on, and a\n  // typed note comes back, once every row is back under the line. History is frozen while gated (no undo/redo).\n  function isV5() { return !!window.__bsv5Tools; }\n  var CLS = 'bsv4-size-gated';\n  var B = null, cfg = null, root = null, tip = null, tipTimer = null, raf = 0;\n\n  // ---- Labs funnel beacons (see header) ---------------------------------------------------\n  var EVT_URL = 'https://uszaouez69.execute-api.us-east-1.amazonaws.com/evt';\n  var SLUG = 'oversized-by-size';\n  var track = {}; // fileId -> { landed, over, everOver, up, down, sqin }  (landed = track L, else track U)\n  function labsEnv() { try { return window.Shopify && Shopify.theme && Shopify.theme.role === 'main' ? 'production' : 'staging'; } catch (e) { return 'staging'; } }\n  function pageVariant() {\n    try {\n      var p = String(location.pathname || '');\n      var gang = !!(cfg && cfg.gangSheet) || /gang/i.test(p);\n      return (/uv/i.test(p) ? 'uv' : 'dtf') + (gang ? '-gang' : '');\n    } catch (e) { return 'dtf'; }\n  }\n  function beacon(e, v) {\n    try {\n      var body = JSON.stringify({ f: SLUG, e: e, v: v, ver: pageVariant(), env: labsEnv() });\n      if (navigator.sendBeacon) navigator.sendBeacon(EVT_URL, body);\n      else fetch(EVT_URL, { method: 'POST', body: body, keepalive: true }).catch(function () {});\n    } catch (x) { /* never break the gate */ }\n  }\n  // VISITED = SESSIONS, ONE stream for every Labs report (Owen 2026-10-21: \"needs to be sessions for all\n  // labs that reference visited, using the same feature\"). Labs feature `visits`, event `visit`,\n  // Variant `<product>:<page>` (dtf:bysize, uv:bysize, dtf:gang, uv:gang) \u2014 fired once per browser\n  // session per page variant from THIS module, which every By Size and gang page loads. Reloads and\n  // back-and-forward do not count again; a new tab is a new session (close to Shopify's own session);\n  // a browser that refuses sessionStorage counts every load. The gang card's own `visit:page` and the\n  // old `bs_visit` are retired \u2014 both reports read this stream.\n  function visitBeacon() {\n    try {\n      var pv = pageVariant();\n      var ver = (/^uv/.test(pv) ? 'uv' : 'dtf') + ':' + (/-gang$/.test(pv) ? 'gang' : 'bysize');\n      var body = JSON.stringify({ f: 'visits', e: 'visit', ver: ver, env: labsEnv() });\n      if (navigator.sendBeacon) navigator.sendBeacon(EVT_URL, body);\n      else fetch(EVT_URL, { method: 'POST', body: body, keepalive: true }).catch(function () {});\n    } catch (x) { /* never break the gate */ }\n  }\n  try {\n    var vkey = 'labs:visited:' + pageVariant();\n    if (!sessionStorage.getItem(vkey)) { sessionStorage.setItem(vkey, '1'); visitBeacon(); }\n  } catch (e) { visitBeacon(); }\n  // LANDING RECORD (Owen 2026-10-21, the Labs upload ledger): once per measured file, the file's own\n  // key + page + measured size go to Labs as a stored row (not a metric) \u2014 the per-file identity that\n  // lets Labs join this landing to the cart line and the order line that carry the same key. Same\n  // fire-and-forget sendBeacon, text/plain (no preflight), wrapped so it can never touch the page.\n  var LANDED_URL = 'https://labs-admin.ninjaondemand.com/api/landed';\n  function fileKeyOf(file) {\n    try {\n      var u = String((file && (file.s3Url || file.imgixUrl)) || '');\n      var base = u.split('?')[0].split('#')[0].split('/').pop() || '';\n      return /____image_\\d{13}_/.test(base) ? base.slice(0, 200) : '';\n    } catch (e) { return ''; }\n  }\n  function landedRecord(file, sz, w, h) {\n    try {\n      var k = fileKeyOf(file); if (!k || !(w > 0 && h > 0)) return;\n      var pv = pageVariant();\n      var body = JSON.stringify({ k: k, p: /^uv/.test(pv) ? 'uv' : 'dtf', pg: /-gang$/.test(pv) ? 'gang' : 'bysize', w: Math.round(w * 100) / 100, h: Math.round(h * 100) / 100, env: labsEnv() });\n      var blob = new Blob([body], { type: 'text/plain' });\n      if (navigator.sendBeacon) navigator.sendBeacon(LANDED_URL, blob);\n      else fetch(LANDED_URL, { method: 'POST', body: blob, keepalive: true }).catch(function () {});\n    } catch (x) { /* never break the gate */ }\n  }\n  function maxDimOf() { return Number(cfg && cfg.limits && cfg.limits.maxIn) || 22; }\n  // Largest row's sq in, and whether any row is over the max side.\n  function sizeOf(file) {\n    var rows = (file && file.rows) || []; var max = maxDimOf(); var over = false, sqin = 0, bw = 0, bh = 0;\n    for (var i = 0; i < rows.length; i++) {\n      var r = rows[i]; if (!r) continue; var w = Number(r.w), h = Number(r.h);\n      if (!(w > 0 && h > 0)) continue;\n      if (Math.max(w, h) > max + EPS) over = true;\n      if (w * h > sqin) { sqin = Math.round(w * h); bw = w; bh = h; }\n    }\n    // w/h = the largest row's size (= the measured size at landing, before any edit)\n    return { over: over, sqin: sqin, w: bw, h: bh, measured: rows.length > 0 };\n  }\n  function trackFiles(files) {\n    try {\n      var live = {};\n      files.forEach(function (f) {\n        if (!f || !f.id) return; live[f.id] = 1;\n        var sz = sizeOf(f); if (!sz.measured) return;\n        var t = track[f.id];\n        if (!t) {\n          t = track[f.id] = { landed: sz.over, over: sz.over, everOver: sz.over, up: false, down: false, sqin: sz.sqin };\n          beacon('bs_upload', sz.sqin); // By Size funnel: every measured upload, once\n          // The ledger wants the file's NATURAL measured size (the engine's inW/inH), not the first row:\n          // By Size seeds the first row to FIT 22 in, so a 22x24 upload lands as a 17.98x20 row and the\n          // \"landed over 22\" signal would never fire. The rows still drive the gate itself.\n          var nw = Number(f.inW), nh = Number(f.inH);\n          landedRecord(f, sz, nw > 0 && nh > 0 ? nw : sz.w, nw > 0 && nh > 0 ? nh : sz.h);\n          if (sz.over) beacon('ovs_landed', sz.sqin);\n          return;\n        }\n        if (sz.over) t.sqin = sz.sqin;\n        if (sz.over && !t.over) { t.over = true; t.everOver = true; if (!t.up && !t.landed) { t.up = true; beacon('ovs_sized_up', sz.sqin); } }\n        else if (!sz.over && t.over) { t.over = false; if (!t.down) { t.down = true; beacon(t.landed ? 'ovs_landed_down' : 'ovs_up_down', sz.sqin); } }\n      });\n      Object.keys(track).forEach(function (id) { if (!live[id]) delete track[id]; });\n    } catch (x) { /* never break the gate */ }\n  }\n  document.addEventListener('bsv4:added-to-cart', function () {\n    try {\n      Object.keys(track).forEach(function (id) {\n        var t = track[id];\n        var pre = t.landed ? 'ovs_landed_' : 'ovs_up_';\n        if (t.over) beacon(pre + 'atc_over', t.sqin);\n        else if (t.everOver) beacon(pre + 'atc_under', t.sqin);\n        else beacon('bs_atc_under', t.sqin); // By Size funnel: landed under, never over, added under\n      });\n    } catch (x) { /* never break the gate */ }\n  });\n\n  /* Tools size rule (Owen 2026-11-17, \"22x40\"): SHORT side over limits.maxIn (22, the roll width) or LONG side over\n     toolsGate.maxLong. maxLong unset (or below maxIn) = the original rule, both sides <= maxIn. The tools keep the\n     upload's resolution (sandbox 11-17: 200 DPI in, 200 DPI out at 22 x 40); imgix Upscale tops out ~8192 px on the\n     long side, so an upscaled 22 x 40 lands ~105-205 DPI. Edit with AI returns ~2,700 px max (~60-70 DPI at 40 in). */\n  function toolsDims() {\n    var tg = cfg.toolsGate || {}, s = Number(cfg.limits && cfg.limits.maxIn) || 22;\n    return { s: s, l: Math.max(s, Number(tg.maxLong) || s) };\n  }\n  function overTools(w, h, D) { return Math.min(w, h) > D.s + EPS || Math.max(w, h) > D.l + EPS; }\n  function sizeMsg(tg, D, area) {\n    return String(tg.msg || 'Not available for designs over [dim] inches tall or wide')\n      .replace(/\\[dim\\]|\\{dim\\}/g, D.s).replace(/\\[long\\]|\\{long\\}/g, D.l).replace(/\\[area\\]|\\{area\\}/g, area)\n      /* \"22 \u00D7 40\" never splits across lines, however the Customizer message was typed (Owen 11-17) */\n      .replace(/(\\d)\\s*([\u00D7x])\\s*(?=\\d)/g, '$1\\u00a0$2\\u00a0');\n  }\n  function gateFor(file) {\n    if (!file) return null;\n    var tg = cfg.toolsGate || {};\n    if (file.bigFile) return { kind: 'file', msg: tg.fileMsg || 'Not available for files this large' };\n    var D = toolsDims();\n    var maxArea = Number(tg.maxArea);\n    var rows = file.rows || [];\n    for (var i = 0; i < rows.length; i++) {\n      var r = rows[i]; if (!r) continue;\n      var w = Number(r.w), h = Number(r.h);\n      if (overTools(w, h, D) || (maxArea > 0 && w * h > maxArea + 1e-6)) {\n        return { kind: 'size', msg: sizeMsg(tg, D, maxArea > 0 ? maxArea : Math.round(D.s * D.l)) };\n      }\n    }\n    return null;\n  }\n\n  // v5: a file whose tools the gate holds is still gated while its size, at the HELD shape (same width, the shape it\n  // has with the tools back on), would be over the line \u2014 the switch-back waits for a size that fits with the tools on\n  function heldGate(file) {\n    var re = file && reenable[file.id];\n    if (!re || !(re.aspect > 0)) return null;\n    var D = toolsDims();\n    var rows = file.rows || [];\n    for (var i = 0; i < rows.length; i++) {\n      var r = rows[i]; if (!r) continue;\n      var w = Number(r.w); if (!(w > 0)) continue;\n      if (overTools(w, w / re.aspect, D)) {\n        var tg = cfg.toolsGate || {};\n        return { kind: 'size', msg: sizeMsg(tg, D, Math.round(D.s * D.l)) };\n      }\n    }\n    return null;\n  }\n\n  // By Size v5 (Owen 2026-11-02): a print-ready file (nt-print-ready.js) can't take Remove BG / Upscale \u2014 those controls\n  // stay visible but greyed, with this hover message, through the same mark / tooltip / click guard as the size gate.\n  var PR_SEL = '.bsv4-ai-card--bgr,.bsv4-ai-card--up,.bsv4-bgr,[data-bsv4-upscale],.bsv4-dpi-up';\n  var PR_GATE = { kind: 'print-ready', msg: 'This feature is disabled for print ready files' };\n  function prGate(f, el) {\n    var pr = window.ntPrintReady;\n    if (!isV5() || !f || !el || !pr || typeof pr.isPrintReady !== 'function' || !pr.isPrintReady(f.s3Url)) return null;\n    return el.matches && el.matches(PR_SEL) ? PR_GATE : null;\n  }\n  function mark(el, g) {\n    if (!el) return;\n    if (g) { el.classList.add(CLS); el.setAttribute('data-bsv4-size-gate-msg', g.msg); el.setAttribute('aria-disabled', 'true'); }\n    else if (el.classList.contains(CLS)) { el.classList.remove(CLS); el.removeAttribute('data-bsv4-size-gate-msg'); el.removeAttribute('aria-disabled'); }\n  }\n\n  function each(scope, fn) { Array.prototype.forEach.call(scope.querySelectorAll(SEL), fn); }\n\n  // Design Notes (Owen 2026-10-15 \"gray out notes\"): a gated file must not ship a note. The page\n  // band / stage drawer write properties[Design Notes] (cart.js reads it at add time) and the modal\n  // tile keeps file.designNote in sync with its textarea + checkbox (modal.js) \u2014 so clear the\n  // textareas, uncheck the tile box (change event lets modal.js clear file.designNote), close the\n  // stage popover and drop the tool's \"saved\" tick. Done BEFORE marking so the capture guard does\n  // not swallow the synthetic change.\n  function clearNotes(scope, active) {\n    Array.prototype.forEach.call(scope.querySelectorAll('[data-bsv4-tile-note-open]:checked'), function (cb) {\n      cb.checked = false; cb.dispatchEvent(new Event('change', { bubbles: true }));\n    });\n    Array.prototype.forEach.call(scope.querySelectorAll('[data-bsv4-tile-note]'), function (ta) {\n      if (ta.value) { ta.value = ''; ta.dispatchEvent(new Event('input', { bubbles: true })); }\n    });\n    if (!active) return;\n    Array.prototype.forEach.call(root.querySelectorAll('.bsv4-cta__notes textarea, [data-bsv4-notes-ta]'), function (ta) {\n      if (ta.value && isV5()) stashedNotes.push({ ta: ta, v: ta.value });\n      ta.value = '';\n    });\n    Array.prototype.forEach.call(root.querySelectorAll('[data-bsv4-notes-panel]'), function (p) { p.hidden = true; });\n    Array.prototype.forEach.call(root.querySelectorAll('[data-bsv4-notes], .bsv4-notes-fab'), function (b) { b.classList.remove('is-saved'); b.setAttribute('aria-expanded', 'false'); });\n  }\n\n  // \"Not available\" must also mean OFF: a file whose Remove Background / Upscale was already on\n  // (the raster default) when it crossed the cutoff gets them switched off through the engine's\n  // own toggles \u2014 clicked BEFORE the controls are marked, so the window-capture guard lets the\n  // click through and bgr.js / edit.js run their normal off path (preview swap, picker, commit).\n  // Switching Remove Background off makes the engine re-measure the file and RE-SEED its rows\n  // to the default size (seen on the sandbox 2026-10-15: a typed 22 x 46 snapped back to\n  // 6 x 12.67). So the typed sizes are remembered per file and, once the engine has re-seeded,\n  // replayed through the width input exactly as typing would (sizing.js listens to input +\n  // change on [data-bsv4-w]). One replay per switch-off, within 8 s.\n  var restores = {};\n  // v5 only: per file, the toggles the gate switched off ({bgr, sr, up}); turned back on when the file is under the\n  // line again (settled, like the switch-off). Survives the customer's own typing \u2014 typing back down is the point.\n  var reenable = {}, reenableTimers = {}, reenableHold = {}, stashedNotes = [];\n  // v5 history (nt-stage-tools.js) asks this before recording a step: the gate's own switch-off / switch-on is never\n  // an undo step. Held while over the line, while a switch-back is pending, and 4 s after it (Remove BG re-measures).\n  window.__bsv4SizeGated = function (fileId) {\n    try {\n      if (reenable[fileId] || reenableTimers[fileId] || (reenableHold[fileId] && Date.now() < reenableHold[fileId])) return true;\n      var f = (B.getState().files || []).find(function (x) { return x.id === fileId; });\n      return !!(f && gateFor(f));\n    } catch (x) { return false; }\n  };\n  // SETTLE before switching anything off (Owen 2026-10-15, seen on Will's arm): a typed value can\n  // be over 22 for one state commit and then be clamped back by the engine (23 on a square design\n  // snaps to 22 x 22). Marking is immediate and harmless; the switch-off changes engine state, so\n  // it waits SETTLE_MS and runs only if the file is STILL gated. One timer per file.\n  var SETTLE_MS = 1000;\n  // Rounding tolerance (seen on Will's arm 2026-10-16): a typed 23 on a square design lands as\n  // 22.01 x 22 for ~600 ms before the engine's second pass rounds it to 22 x 22. 22.01 is never\n  // a real new size (its area is 484, far under the first new band), so anything within EPS of\n  // the max side is treated as AT the limit, for the gate and for the funnel beacons alike.\n  var EPS = 0.05;\n  var settleTimers = {};\n  function switchOffSettled(fileId) {\n    if (settleTimers[fileId]) return;\n    settleTimers[fileId] = setTimeout(function () {\n      delete settleTimers[fileId];\n      try {\n        var st = B.getState(); var f = (st.files || []).find(function (x) { return x.id === fileId; });\n        if (!f || !gateFor(f)) return; // clamped back under the line meanwhile \u2014 leave the toggles alone\n        var hosts = root.querySelectorAll('[data-bsv4-bgr-for=\"' + fileId + '\"],[data-bsv4-edit-for=\"' + fileId + '\"],[data-bsv4-tile=\"' + fileId + '\"]');\n        Array.prototype.forEach.call(hosts, function (host) { switchOff(host, fileId); });\n        var act = activeFile(st);\n        if (act && act.id === fileId) Array.prototype.forEach.call(root.querySelectorAll('.bsv4-aitools--stage'), function (card) { switchOff(card, fileId); });\n      } catch (x) { /* never break the gate */ }\n    }, SETTLE_MS);\n  }\n  function switchOff(scope, fileId) {\n    var sel = '[data-bsv4-toggle-bgr]:checked, [data-bsv4-toggle-sr]:checked, [data-bsv4-upscale][aria-pressed=\"true\"]';\n    var toggles = scope.querySelectorAll(sel);\n    if (!toggles.length) return;\n    if (isV5()) {\n      var re = reenable[fileId] || (reenable[fileId] = {});\n      // the design's shape WITH the held tools (Remove BG on): switching it off re-measures the bare upload, whose\n      // shape differs \u2014 a tall cut-out on a square upload lands at 22 x 22 (under the line) and would look \"back\n      // under\" while switching the tools back on puts it straight over again (Eraser session 11-01: endless loop)\n      var r0 = (rowsFor(fileId) || [])[0];\n      if (!re.aspect && r0 && r0.w > 0 && r0.h > 0) re.aspect = Number(r0.w) / Number(r0.h);\n      Array.prototype.forEach.call(toggles, function (el) {\n        if (el.matches('[data-bsv4-toggle-bgr]')) re.bgr = true;\n        else if (el.matches('[data-bsv4-toggle-sr]')) re.sr = true;\n        else re.up = true;\n      });\n    }\n    var rows = rowsFor(fileId);\n    if (rows.length && !restores[fileId]) restores[fileId] = { at: Date.now(), dims: rows.map(function (r) { return { w: Number(r.w), h: Number(r.h) }; }) };\n    Array.prototype.forEach.call(toggles, function (el) {\n      var g = el.closest('.' + CLS); if (g) g.classList.remove(CLS);\n      try { el.click(); } catch (e) { /* never let a stuck toggle break the gate */ }\n    });\n  }\n  function reenableSettled(fileId) {\n    if (reenableTimers[fileId]) return;\n    reenableTimers[fileId] = setTimeout(function () {\n      delete reenableTimers[fileId];\n      try {\n        var st = B.getState(); var f = (st.files || []).find(function (x) { return x.id === fileId; });\n        var re = reenable[fileId];\n        if (!f) { delete reenable[fileId]; return; }\n        if (!re || gateFor(f) || heldGate(f)) return; // still over the line (as it is, or with the tools back on) \u2014 keep waiting\n        delete reenable[fileId];\n        reenableHold[fileId] = Date.now() + 4000;\n        // turning Remove BG back on re-measures + re-seeds the rows (to the default size); keep the size the customer\n        // typed coming back under the line \u2014 the same replay the switch-off uses\n        var rows = f.rows || [];\n        if (rows.length) restores[fileId] = { at: Date.now(), dims: rows.map(function (r) { return { w: Number(r.w), h: Number(r.h) }; }) };\n        var hosts = Array.prototype.slice.call(root.querySelectorAll('[data-bsv4-bgr-for=\"' + fileId + '\"],[data-bsv4-edit-for=\"' + fileId + '\"],[data-bsv4-tile=\"' + fileId + '\"]'));\n        var act = activeFile(st);\n        if (act && act.id === fileId) hosts = hosts.concat(Array.prototype.slice.call(root.querySelectorAll('.bsv4-aitools--stage')));\n        var done = {};\n        hosts.forEach(function (host) {\n          var pick = [];\n          if (re.bgr && !done.bgr) pick.push(['bgr', '[data-bsv4-toggle-bgr]:not(:checked)']);\n          if (re.sr && !done.sr) pick.push(['sr', '[data-bsv4-toggle-sr]:not(:checked)']);\n          if (re.up && !done.up) pick.push(['up', '[data-bsv4-upscale]:not([aria-pressed=\"true\"])']);\n          pick.forEach(function (p) { var el = host.querySelector(p[1]); if (el) { done[p[0]] = true; try { el.click(); } catch (e) { /* never break the gate */ } } });\n        });\n      } catch (x) { /* never break the gate */ }\n    }, SETTLE_MS);\n  }\n  function restoreNotes() {\n    if (!stashedNotes.length) return;\n    var list = stashedNotes; stashedNotes = [];\n    list.forEach(function (n) { if (n.ta.isConnected && !n.ta.value) { n.ta.value = n.v; n.ta.dispatchEvent(new Event('input', { bubbles: true })); } });\n  }\n  function rowsFor(fileId) {\n    var st = B.getState(); var f = (st.files || []).find(function (x) { return x.id === fileId; });\n    return (f && f.rows) || [];\n  }\n  function widthInputsFor(fileId) {\n    // page rows carry the file id on their row node; tiles on [data-bsv4-tile]\n    var tile = root.querySelector('[data-bsv4-tile=\"' + fileId + '\"]');\n    var scope = tile || root;\n    return Array.prototype.slice.call(scope.querySelectorAll('[data-bsv4-w]')).filter(function (i) { return i.offsetWidth || i.offsetHeight; });\n  }\n  // The customer's OWN typing after a switch-off must win (live 2026-10-16, stock engine: a\n  // customer who crossed 22, then typed 7 within the 8 s window, was snapped back to 22 because\n  // the replay took their edit for the engine's re-seed). Any real input/change on a size field\n  // that the gate did not dispatch itself drops every pending restore.\n  var replaying = false;\n  ['input', 'change'].forEach(function (type) {\n    document.addEventListener(type, function (e) {\n      if (replaying) return;\n      var t = e.target;\n      if (t && t.matches && t.matches('[data-bsv4-w],[data-bsv4-h]')) restores = {};\n    }, true);\n  });\n  function replayRestores() {\n    Object.keys(restores).forEach(function (fileId) {\n      var r = restores[fileId];\n      if (Date.now() - r.at > 8000) { delete restores[fileId]; return; }\n      var rows = rowsFor(fileId); if (!rows.length) return;\n      var changed = rows.some(function (row, i) { return r.dims[i] && Math.abs(Number(row.w) - r.dims[i].w) > 0.01; });\n      if (!changed) return; // the engine has not re-seeded (yet)\n      delete restores[fileId];\n      var inputs = widthInputsFor(fileId);\n      replaying = true;\n      try {\n        r.dims.forEach(function (d, i) {\n          var input = inputs[i]; if (!input || !(d.w > 0)) return;\n          input.value = String(d.w);\n          input.dispatchEvent(new Event('input', { bubbles: true }));\n          input.dispatchEvent(new Event('change', { bubbles: true }));\n        });\n      } finally { replaying = false; }\n    });\n  }\n\n  function activeFile(st) {\n    return (st.activeFileId && st.files.find(function (f) { return f.id === st.activeFileId; })) || st.files[0] || null;\n  }\n\n  // PERF (Lighthouse 11-06): apply() runs on every childList batch inside the by-size root, and\n  // before any upload that is a stream of no-op passes (6+ root/document queries each) while the\n  // engine and apps build the page. With no files there is nothing to gate, so when nothing is\n  // marked, no note is stashed and no restore is pending, the pass would change nothing: skip it.\n  var gatedLive = document.getElementsByClassName(CLS);\n  function apply() {\n    raf = 0;\n    if (!B || !root) return;\n    var st = B.getState(); var files = st.files || [];\n    if (!files.length && !gatedLive.length && !stashedNotes.length && !Object.keys(restores).length && !Object.keys(track).length) return;\n    trackFiles(files);\n    replayRestores();\n    var seen = []; var anyGated = null;\n    files.forEach(function (f) {\n      var g = gateFor(f) || heldGate(f); if (g && !anyGated) anyGated = g;\n      var hosts = root.querySelectorAll('[data-bsv4-bgr-for=\"' + f.id + '\"],[data-bsv4-edit-for=\"' + f.id + '\"],[data-bsv4-tile=\"' + f.id + '\"]');\n      Array.prototype.forEach.call(hosts, function (host) { seen.push(host); if (g) clearNotes(host, false); each(host, function (el) { mark(el, g || prGate(f, el)); }); });\n      if (gateFor(f)) switchOffSettled(f.id);\n      else if (reenable[f.id] && !heldGate(f)) reenableSettled(f.id);\n    });\n    // The phone dock moves the stage toolbar OUT of its host (edit.js dockStageTools); it shows the ACTIVE file.\n    var act = activeFile(st); var ag = gateFor(act) || heldGate(act);\n    Array.prototype.forEach.call(root.querySelectorAll('.bsv4-aitools--stage'), function (card) {\n      if (seen.some(function (h) { return h.contains(card); })) return;\n      each(card, function (el) { mark(el, ag || prGate(act, el)); });\n    });\n    // The DPI warning's \"Upscale for Free\" button (sizing row, sizing.js) is a second door into\n    // Upscale: it follows the active file's gate too.\n    Array.prototype.forEach.call(root.querySelectorAll('.bsv4-dpi-up'), function (el) { mark(el, ag || prGate(act, el)); });\n    // v5 page-level doors (the stage's Undo/Redo, the Edge row, Add a Note) live outside the per-file hosts; they\n    // follow the active file's gate. document, not root: Add a Note can render outside the by-size root.\n    if (isV5()) Array.prototype.forEach.call(document.querySelectorAll('[data-ntst-undo],[data-ntst-redo],[data-bsv4-edges-open],[data-ntre-open]'), function (el) {\n      if (seen.some(function (h) { return h.contains(el); })) return;\n      mark(el, ag);\n    });\n    // Design Notes on the page (band under the stage, stage tool, navy/rail popover buttons) are\n    // page-level, not per file: they follow the active file's gate, like the docked toolbar.\n    if (ag) clearNotes(root, true);\n    else restoreNotes();\n    Array.prototype.forEach.call(root.querySelectorAll('.bsv4-cta__notes, .bsv4-notes-fab'), function (el) {\n      if (seen.some(function (h) { return h.contains(el); })) return;\n      mark(el, ag);\n    });\n    // Precut is NOT gated (Owen 2026-10-15: \"enable precut on oversized prints\") \u2014 it stays available at every size.\n    void anyGated;\n  }\n  // setTimeout, not requestAnimationFrame: browsers pause rAF in a hidden tab, and an upload\n  // that finishes while the customer is on another tab must still land gated when they return\n  // (seen on the sandbox 2026-10-15: hosts rendered, nothing marked while the tab was hidden).\n  function schedule() { if (!raf) raf = setTimeout(apply, 0); }\n\n  // ---- tooltip: one real element, positioned above the control --------------------------------\n  function ensureTip() {\n    if (tip) return tip;\n    tip = document.createElement('div');\n    tip.className = 'bsv4-size-gate__tip';\n    tip.setAttribute('role', 'status');\n    document.body.appendChild(tip);\n    return tip;\n  }\n  function showTip(el, sticky) {\n    var t = ensureTip();\n    t.textContent = el.getAttribute('data-bsv4-size-gate-msg') || '';\n    t.classList.add('is-on');\n    var r = el.getBoundingClientRect();\n    t.style.left = '0px'; t.style.top = '0px';\n    var tw = t.offsetWidth, th = t.offsetHeight;\n    var left = Math.max(8, Math.min(window.innerWidth - tw - 8, r.left + r.width / 2 - tw / 2));\n    var top = r.top - th - 8; if (top < 8) top = r.bottom + 8;\n    t.style.left = left + 'px'; t.style.top = top + 'px';\n    clearTimeout(tipTimer);\n    if (sticky) tipTimer = setTimeout(hideTip, 2800);\n  }\n  function hideTip() { clearTimeout(tipTimer); if (tip) tip.classList.remove('is-on'); }\n\n  function gated(target) { return target && target.closest ? target.closest('.' + CLS) : null; }\n  ['pointerdown', 'click', 'change', 'keydown'].forEach(function (type) {\n    window.addEventListener(type, function (e) {\n      var g = gated(e.target); if (!g) return;\n      if (type === 'keydown' && e.key !== 'Enter' && e.key !== ' ' && e.key !== 'Spacebar') return;\n      e.preventDefault(); e.stopImmediatePropagation();\n      if (type !== 'change') showTip(g, true);\n    }, true);\n  });\n  // v5: Cmd/Ctrl+Z (and Shift+Cmd+Z / Ctrl+Y) is the keyboard door into Undo/Redo \u2014 closed while the active file is\n  // over the line, like the buttons (window capture runs before nt-stage-tools' document listener).\n  window.addEventListener('keydown', function (e) {\n    if (!isV5() || !B || !(e.metaKey || e.ctrlKey) || e.altKey) return;\n    var k = (e.key || '').toLowerCase(); if (k !== 'z' && k !== 'y') return;\n    var a = document.activeElement;\n    if (a && (/^(input|textarea|select)$/i.test(a.tagName) || a.isContentEditable)) return;\n    try { var af = activeFile(B.getState()); if (!gateFor(af) && !heldGate(af)) return; } catch (x) { return; }\n    e.preventDefault(); e.stopImmediatePropagation();\n  }, true);\n  document.addEventListener('mouseover', function (e) { var g = gated(e.target); if (g) showTip(g, false); }, true);\n  document.addEventListener('mouseout', function (e) { var g = gated(e.target); if (g && !(e.relatedTarget && g.contains(e.relatedTarget))) hideTip(); }, true);\n  window.addEventListener('scroll', hideTip, true);\n\n  // ---- boot: wait for the engine bridge (the fork loads its bundle asynchronously) ------------\n  var tries = 0;\n  (function boot() {\n    B = window.__bsv4Bridge;\n    if (!B || !B.cfg || !B.subscribe) { if (++tries < 400) return setTimeout(boot, 50); return; }\n    cfg = B.cfg;\n    root = document.querySelector('[data-bsv4-root], .bsv4') || document.body;\n    B.subscribe(schedule);\n    // controls render after the state commit that announces the file \u2014 catch those paints too\n    new MutationObserver(schedule).observe(root, { childList: true, subtree: true });\n    schedule();\n  })();\n})();\n"],
  "mappings": "CAmDC,UAAY,CACX,aACA,GAAI,OAAO,eAAgB,OAC3B,OAAO,eAAiB,GAExB,IAAI,IAAM,CACR,qBAAsB,oBAAqB,YAC3C,wBAAyB,sBAAuB,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