@stagepass/loader 2.3.3 → 2.4.0

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.
package/README.md CHANGED
@@ -12,19 +12,27 @@ npm install @stagepass/loader@2
12
12
 
13
13
  ## CDN Usage
14
14
 
15
- Prefer the major pin `@2` in production on jsDelivr. Stagepass follows strict semver: no breaking changes within v2; breaking changes only in a new major (v3). Exact pins (e.g. `@2.2.0`) are optional for maximum control. jsDelivr may cache `@2` for a while; purge with `https://purge.jsdelivr.net/npm/@stagepass/loader@2/dist/loader.min.js`. See the root README [Version pinning](../../README.md#-version-pinning) section.
15
+ Prefer the major pin `@2` in production on jsDelivr. Stagepass follows strict semver: no breaking changes within v2; breaking changes only in a new major (v3). Exact pins (e.g. `@2.4.0`) are optional for maximum control. jsDelivr may cache `@2` for a while; purge with `https://purge.jsdelivr.net/npm/@stagepass/loader@2/dist/loader.min.js`. See [Version pinning](https://github.com/arobertherz/stagepass/blob/master/docs/loader.md#version-pinning) in the docs.
16
16
 
17
17
  ```html
18
18
  <script
19
19
  src="https://cdn.jsdelivr.net/npm/@stagepass/loader@2/dist/loader.min.js"
20
- data-stagepass-version="2.2.0"
20
+ data-stagepass-version="2.4.0"
21
21
  ></script>
22
22
  ```
23
23
 
24
- unpkg serves the same paths if you need an alternative CDN.
24
+ unpkg serves the same paths if you need an alternative CDN. Always embed the full `/dist/loader.min.js` path (not a short package URL that redirects); otherwise session chunks resolve from the wrong folder. Or set `data-stagepass-flag-base`.
25
25
 
26
26
  See [MIGRATION.md](../../MIGRATION.md) for breaking changes from 1.x.
27
27
 
28
+ ## Known limits (scoped acceptance)
29
+
30
+ Acceptance for `live.min.js` / live reload is **scoped localhost only**. It is not proof of the full default `setup` / `start` / `stop` path, System Trust / `certs renew`, autostart / login / boot / OS-crash recovery, or a real `.sp` resolver + production Webflow origin path.
31
+
32
+ A `localhost` / `localhost:<port>` session still reports `sp.env() === 'production'` (unchanged since 2.3.1 / 2.3.3). Only an active `*.sp` swap session is `local`. That is expected behaviour, not a live-reload failure.
33
+
34
+ This scoped OSS exception does **not** close GitHub issue #8 or mark P1 overall PASS.
35
+
28
36
  ## What it does
29
37
 
30
38
  - Processes `script[data-stagepass]:not([data-stagepass-processed])` and `link[rel="stylesheet"][data-stagepass]:not([data-stagepass-processed])`.
@@ -49,13 +57,14 @@ See [MIGRATION.md](../../MIGRATION.md) for breaking changes from 1.x.
49
57
  | `data-stagepass-staging-hosts` | Comma-separated hostnames treated as staging (in addition to `*.webflow.io`). |
50
58
  | `data-stagepass-alias` | Optional custom global name (valid JS identifier). Assigned only when that global is free. |
51
59
  | `data-stagepass-flag-base` | Folder for `flag.min.js` / `flag-card.min.js` when the loader is inlined or bundled (2.3.1+). `http(s)` or relative only; also `window.stagepassFlagBase`. Read only during a session. |
60
+ | `data-stagepass-live-src="true"` | Opt-in zero-cost mode: tagged assets use native `src` / `href`; the loader rewrites them only while a swap session is active. |
52
61
 
53
62
  ## Asset attributes
54
63
 
55
64
  | Attribute | Effect |
56
65
  | :--- | :--- |
57
66
  | `data-stagepass` | Marks the element for processing (any value). |
58
- | `data-src` / `data-href` | Production URL (required for processing). |
67
+ | `data-src` / `data-href` | Production URL for legacy mode (default). Required unless live-src opt-in uses native `src` / `href`. |
59
68
  | `data-stagepass-path` | Local path under the linked project root (optional). |
60
69
  | `data-stagepass-v` | Per-asset production `?v=<version>` (overrides loader `data-stagepass-version`). |
61
70
  | `data-stagepass-cachebust` | Legacy; ignored for production timestamps in v2. |
@@ -91,11 +100,15 @@ Shown only while a session is active (including debug).
91
100
  - Errors: `sp.error`, `sp.log('error', …)`, `console.error`, uncaught errors (with stack), failed resource loads, unhandled rejections (with stack). Local files report "Local file not found (404)" or "Local server not reachable … Run stagepass doctor". Sanitized errors from other origins show as "Error in a cross-origin script (details only in DevTools console)".
92
101
  - Accessibility: the pill is a button with `aria-expanded`, the card a `role="dialog"`; focus moves into the card and back to the pill; reduced motion makes all changes instant.
93
102
  - Rendered in an open Shadow DOM (`#stagepass-flag`) with DOM APIs only (no `innerHTML`, no `eval`, constructable stylesheet with a `<style>` fallback). No shadows, glow or filters.
94
- - The UI lives in `dist/flag.min.js` (about 2.7 KB gzip) and `dist/flag-card.min.js` (about 4.8 KB gzip, fetched on first expand). Both are fetched only during a session, from the folder of the loader's script URL under any file name (self-hosted or copied from `node_modules`: keep the three files together). Inlined or bundled: set `data-stagepass-flag-base`; without a script URL and without the option they come from jsDelivr at the same version (debug sessions warn). Allow that origin in `script-src` if the site uses a strict CSP.
103
+ - The UI lives in `dist/flag.min.js` (about 3.2 KB gzip) and `dist/flag-card.min.js` (about 4.8 KB gzip, fetched on first expand). The flag chunk also bootstraps `live.min.js` during a swap session. All three are fetched only during a session, from the folder of the loader's script URL under any file name (self-hosted or copied from `node_modules`: keep the three files together). Inlined or bundled: set `data-stagepass-flag-base`; without a script URL and without the option they come from jsDelivr at the same version (debug sessions warn). Allow that origin in `script-src` if the site uses a strict CSP.
104
+
105
+ ## Zero-cost production mode
106
+
107
+ Opt-in with `data-stagepass-live-src="true"` on the loader tag. Put a normal `src` / `href` (optional `integrity` + `crossorigin`) on `data-stagepass` assets instead of `data-src` / `data-href`. Without a session the browser loads those URLs directly; with a session Stagepass rewrites them to the local `.sp` host before classic scripts run (loader must be a sync script in `<head>` before the assets). Legacy `data-src` / `data-href` stays the default and keeps working. See the root README section “Zero-cost production mode” for migration, SRI, and limitations.
95
108
 
96
109
  ## Runtime API
97
110
 
98
- Preferred global is `sp` (aliases: `stagepass`, `window.stagepass`). Optional custom alias via `data-stagepass-alias` when free. Types ship in `global.d.ts` (complete `sp` API with JSDoc and examples, typed `sp.on(...)` events). Add `"@stagepass/loader"` to `compilerOptions.types` (or `/// <reference types="@stagepass/loader" />`).
111
+ Preferred global is `sp` (aliases: `stagepass`, `window.stagepass`; both always assigned in 2.x). Optional custom alias via `data-stagepass-alias` when free. Types ship in `global.d.ts` (complete `sp` API with JSDoc and examples, typed `sp.on(...)` events). Add `"@stagepass/loader"` to `compilerOptions.types` (or `/// <reference types="@stagepass/loader" />`). In debug mode, after the flag chunk loads, reading `sp.vars` once hints toward the flat helpers (reads before the chunk has loaded do not hint).
99
112
 
100
113
  ```js
101
114
  sp.vars.isLocal // boolean: session swap active or page on localhost
package/dist/flag.min.js CHANGED
@@ -1 +1 @@
1
- (()=>{var K=":host{all:initial!important;position:fixed!important;top:12px!important;right:12px!important;z-index:2147483647!important;display:block!important}.w{--W:44px;--k:1;--fg:#17171B;--a:#FF453A;--z:#FF8A3D;--ring:#121215;--bd:rgba(18,18,21,.22);position:relative;display:block;font:700 12px/1 ui-monospace,Menlo,Consolas,monospace;letter-spacing:.04em;color:var(--fg)}.b{all:unset;box-sizing:border-box;position:relative;display:block;margin-left:auto;height:44px;width:var(--W);cursor:pointer;-webkit-tap-highlight-color:transparent;touch-action:manipulation}[data-st=rest] .b{width:44px}.bg,.t,.fr{position:absolute;right:0;top:8px;height:28px;box-sizing:border-box}.bg{width:var(--W);transform-origin:100% 50%}.bg i{position:absolute;top:0;height:28px;box-sizing:border-box;border:solid var(--bd);border-width:1px 0}.bg .l{left:0;width:14px;border-left-width:1px;border-radius:14px 0 0 14px;background:var(--a)}.bg .r{right:0;width:14px;border-right-width:1px;border-radius:0 14px 14px 0;background:var(--z)}.m{left:13px;right:13px;background:linear-gradient(90deg,var(--a),var(--z));transform-origin:100% 0}[data-st=rest] .l{transform:translateX(calc(var(--W) - 44px))}[data-st=rest] .m{transform:scaleX(var(--k))}.t{display:flex;align-items:center;gap:10px;padding:0 14px;white-space:nowrap;pointer-events:none}[data-st=rest] .t>b,[data-st=rest] .c{opacity:0}.c{display:flex;gap:10px}.c:empty{display:none}.c span{display:flex;align-items:center;gap:4px}svg{flex:none;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}.c svg{width:12px;height:12px}.k{width:16px;height:8px;stroke-width:2}.dot{position:absolute;right:-1px;top:3px;width:8px;height:8px;border-radius:50%;border:2px solid var(--ring);background:var(--d);opacity:0}[data-d=e] .dot{--d:#FF2E4D}[data-d=w] .dot{--d:#FFB224}[data-st=rest][data-d] .dot{opacity:1}.fr{right:-4px;top:4px;height:36px;width:calc(var(--W) + 8px);border-radius:18px;border:2px solid #fff;outline:2px solid var(--ring);opacity:0;pointer-events:none}.b:focus-visible .fr{opacity:1}[data-st=rest] .fr{width:52px}.b:active .bg{transform:scale(.96)}@media (prefers-reduced-motion:no-preference){.l,.m{transition:transform .22s cubic-bezier(.2,.8,.2,1)}.t>b,.c{transition:opacity .14s .06s}[data-st=rest] .l,[data-st=rest] .m{transition:transform .16s cubic-bezier(.4,0,.6,1)}[data-st=rest] .t>b,[data-st=rest] .c{transition:opacity .08s}.dot{transition:opacity .12s}[data-st=rest] .dot{transition-delay:.12s}.fr{transition:opacity .12s .12s}.bg{transition:transform .08s}}",m="http://www.w3.org/2000/svg",R=["M6 1.3 11 10.3H1zM6 4.8v2.2m0 1.6v.1","M4 1h4l3 3v4l-3 3H4L1 8V4zM6 3.8v2.6m0 1.6v.1"],O="stagepass.flag.v2",L="stagepass:flash",V="stagepass.card.v2";function T(r,t){try{if(!("adoptedStyleSheets"in r))throw 0;let s=new CSSStyleSheet;s.replaceSync(t),r.adoptedStyleSheets=[...r.adoptedStyleSheets,s]}catch{r.appendChild(document.createElement("style")).textContent=t}}function M(r){let t=document.createElementNS(m,"svg");return t.setAttribute("viewBox","0 0 12 12"),t.setAttribute("aria-hidden","true"),t.appendChild(document.createElementNS(m,"path")).setAttribute("d",R[r]),t}var z=(r,t)=>r+" "+t+(r==1?"":"s"),H=(r,t)=>{try{return r.matches(t)}catch{return!1}};function N(r){let t=document,s=t.createElement("div");s.id="stagepass-flag";let x=s.attachShadow({mode:"open"});T(x,K);let p=(e,d,n)=>{let c=d.appendChild(t.createElement(e));return n&&(c.className=n),c},l=p("div",x,"w");l.setAttribute("data-st","rest");let a=p("button",l,"b");a.type="button",a.setAttribute("aria-haspopup","dialog"),a.setAttribute("aria-expanded","false");let S=p("span",a,"bg");["l","m","r"].forEach(e=>p("i",S,e)),p("span",a,"fr");let u=p("span",a,"t");S.setAttribute("aria-hidden","true"),u.setAttribute("aria-hidden","true");let G=p("b",u),F=p("span",u,"c"),v=u.appendChild(t.createElementNS(m,"svg"));v.setAttribute("class","k"),v.setAttribute("viewBox","0 0 16 8"),v.appendChild(t.createElementNS(m,"path")).setAttribute("d","M4 1h8a3 3 0 0 1 0 6H4a3 3 0 0 1 0-6z"),p("i",a,"dot");let o="rest",g=null,E=!1,y,h=!1,C="rest",w=!1,b=()=>{let[e,d]=r.n,n=r.debug?"DEBUG":"LOCAL";G.textContent=n,F.textContent="",[e,d].forEach((f,D)=>{if(!f)return;let k=p("span",F);k.appendChild(M(D)),k.appendChild(t.createTextNode(f>99?"99+":String(f)))}),d||e?l.setAttribute("data-d",d?"e":"w"):l.removeAttribute("data-d"),a.setAttribute("aria-label","Stagepass "+n+", "+z(e,"warning")+", "+z(d,"error")+". "+(o=="card"?"Hide":"Show")+" session details");let c=u.offsetWidth;c&&(l.style.setProperty("--W",c+"px"),l.style.setProperty("--k",String(18/(c-26)))),g&&g.render()},W=()=>{if(!E){E=!0;try{let e=window.stagepass,d=Symbol.for(V);Object.defineProperty(e,d,{configurable:!0,value:c=>{delete e[d];try{g=c(B),o=="card"&&g.show()}catch{}}});let n=t.createElement("script");n.src=r.card,n.async=!0,(t.head||t.documentElement).appendChild(n)}catch{}}},i=e=>{e!=o&&(clearTimeout(y),o=e,l.setAttribute("data-st",e),a.setAttribute("aria-expanded",String(e=="card")),e!="rest"&&W(),g&&(e=="card"?g.show():g.hide()),b())},B={s:r,root:x,w:l,host:s,go:i,icon:M,css:T};a.addEventListener("pointerdown",e=>{h=e.pointerType=="touch",C=o}),a.addEventListener("pointerenter",e=>{e.pointerType=="mouse"&&o=="rest"&&i("exp")}),l.addEventListener("pointerleave",e=>{e.pointerType=="mouse"&&o=="exp"&&!H(a,":focus-visible")&&i("rest")}),a.addEventListener("focus",()=>{!h&&!w&&o=="rest"&&i("exp")}),a.addEventListener("blur",()=>{o=="exp"&&!H(a,":hover")&&i("rest")}),a.addEventListener("click",()=>{h&&C=="rest"?(i("exp"),y=setTimeout(()=>i("rest"),4e3)):i(o=="card"?"exp":"card"),h=!1}),t.addEventListener("keydown",e=>{e.key!="Escape"||o=="rest"||(o=="card"?(i("exp"),a.focus()):i("rest"))}),t.addEventListener("pointerdown",e=>{if(o=="rest"||e.composedPath().indexOf(s)>=0)return;let d=t.activeElement==s;i("rest"),d&&setTimeout(()=>{let n=t.activeElement;(!n||n==t.body||n==s)&&(w=!0,a.focus({preventScroll:!0}),w=!1)})},!0);let A=()=>{s.isConnected||(t.body||t.documentElement).appendChild(s),b();try{sessionStorage.getItem(L)&&(sessionStorage.removeItem(L),i("exp"),y=setTimeout(()=>i("rest"),3e3))}catch{}};return t.readyState==="loading"?t.addEventListener("DOMContentLoaded",A):A(),b(),b}var _;try{let r=(_=window.stagepass)==null?void 0:_[Symbol.for(O)];typeof r=="function"&&r(N)}catch{}})();
1
+ (()=>{var V=":host{all:initial!important;position:fixed!important;top:12px!important;right:12px!important;z-index:2147483647!important;display:block!important}.w{--W:44px;--k:1;--fg:#17171B;--a:#FF453A;--z:#FF8A3D;--ring:#121215;--bd:rgba(18,18,21,.22);position:relative;display:block;font:700 12px/1 ui-monospace,Menlo,Consolas,monospace;letter-spacing:.04em;color:var(--fg)}.b{all:unset;box-sizing:border-box;position:relative;display:block;margin-left:auto;height:44px;width:var(--W);cursor:pointer;-webkit-tap-highlight-color:transparent;touch-action:manipulation}[data-st=rest] .b{width:44px}.bg,.t,.fr{position:absolute;right:0;top:8px;height:28px;box-sizing:border-box}.bg{width:var(--W);transform-origin:100% 50%}.bg i{position:absolute;top:0;height:28px;box-sizing:border-box;border:solid var(--bd);border-width:1px 0}.bg .l{left:0;width:14px;border-left-width:1px;border-radius:14px 0 0 14px;background:var(--a)}.bg .r{right:0;width:14px;border-right-width:1px;border-radius:0 14px 14px 0;background:var(--z)}.m{left:13px;right:13px;background:linear-gradient(90deg,var(--a),var(--z));transform-origin:100% 0}[data-st=rest] .l{transform:translateX(calc(var(--W) - 44px))}[data-st=rest] .m{transform:scaleX(var(--k))}.t{display:flex;align-items:center;gap:10px;padding:0 14px;white-space:nowrap;pointer-events:none}[data-st=rest] .t>b,[data-st=rest] .c{opacity:0}.c{display:flex;gap:10px}.c:empty{display:none}.c span{display:flex;align-items:center;gap:4px}svg{flex:none;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}.c svg{width:12px;height:12px}.k{width:16px;height:8px;stroke-width:2}.dot{position:absolute;right:-1px;top:3px;width:8px;height:8px;border-radius:50%;border:2px solid var(--ring);background:var(--d);opacity:0}[data-d=e] .dot{--d:#FF2E4D}[data-d=w] .dot{--d:#FFB224}[data-st=rest][data-d] .dot{opacity:1}.fr{right:-4px;top:4px;height:36px;width:calc(var(--W) + 8px);border-radius:18px;border:2px solid #fff;outline:2px solid var(--ring);opacity:0;pointer-events:none}.b:focus-visible .fr{opacity:1}[data-st=rest] .fr{width:52px}.b:active .bg{transform:scale(.96)}@media (prefers-reduced-motion:no-preference){.l,.m{transition:transform .22s cubic-bezier(.2,.8,.2,1)}.t>b,.c{transition:opacity .14s .06s}[data-st=rest] .l,[data-st=rest] .m{transition:transform .16s cubic-bezier(.4,0,.6,1)}[data-st=rest] .t>b,[data-st=rest] .c{transition:opacity .08s}.dot{transition:opacity .12s}[data-st=rest] .dot{transition-delay:.12s}.fr{transition:opacity .12s .12s}.bg{transition:transform .08s}}",S="http://www.w3.org/2000/svg",B=["M6 1.3 11 10.3H1zM6 4.8v2.2m0 1.6v.1","M4 1h4l3 3v4l-3 3H4L1 8V4zM6 3.8v2.6m0 1.6v.1"],N="stagepass.flag.v2",O="stagepass:flash",W="stagepass.card.v2";function _(r,t){try{if(!("adoptedStyleSheets"in r))throw 0;let n=new CSSStyleSheet;n.replaceSync(t),r.adoptedStyleSheets=[...r.adoptedStyleSheets,n]}catch{r.appendChild(document.createElement("style")).textContent=t}}function H(r){let t=document.createElementNS(S,"svg");return t.setAttribute("viewBox","0 0 12 12"),t.setAttribute("aria-hidden","true"),t.appendChild(document.createElementNS(S,"path")).setAttribute("d",B[r]),t}var T=(r,t)=>r+" "+t+(r==1?"":"s"),M=(r,t)=>{try{return r.matches(t)}catch{return!1}};function z(r){let t=document,n=t.createElement("div");n.id="stagepass-flag";let m=n.attachShadow({mode:"open"});_(m,V);let c=(e,g,d)=>{let f=g.appendChild(t.createElement(e));return d&&(f.className=d),f},p=c("div",m,"w");p.setAttribute("data-st","rest");let o=c("button",p,"b");o.type="button",o.setAttribute("aria-haspopup","dialog"),o.setAttribute("aria-expanded","false");let a=c("span",o,"bg");["l","m","r"].forEach(e=>c("i",a,e)),c("span",o,"fr");let s=c("span",o,"t");a.setAttribute("aria-hidden","true"),s.setAttribute("aria-hidden","true");let u=c("b",s),h=c("span",s,"c"),v=s.appendChild(t.createElementNS(S,"svg"));v.setAttribute("class","k"),v.setAttribute("viewBox","0 0 16 8"),v.appendChild(t.createElementNS(S,"path")).setAttribute("d","M4 1h8a3 3 0 0 1 0 6H4a3 3 0 0 1 0-6z"),c("i",o,"dot");let i="rest",b=null,F=!1,E,x=!1,k="rest",L=!1,y=()=>{let[e,g]=r.n,d=r.debug?"DEBUG":"LOCAL";u.textContent=d,h.textContent="",[e,g].forEach((w,D)=>{if(!w)return;let C=c("span",h);C.appendChild(H(D)),C.appendChild(t.createTextNode(w>99?"99+":String(w)))}),g||e?p.setAttribute("data-d",g?"e":"w"):p.removeAttribute("data-d"),o.setAttribute("aria-label","Stagepass "+d+", "+T(e,"warning")+", "+T(g,"error")+". "+(i=="card"?"Hide":"Show")+" session details");let f=s.offsetWidth;f&&(p.style.setProperty("--W",f+"px"),p.style.setProperty("--k",String(18/(f-26)))),b&&b.render()},I=()=>{if(!F){F=!0;try{let e=window.stagepass,g=Symbol.for(W);Object.defineProperty(e,g,{configurable:!0,value:f=>{delete e[g];try{b=f(P),i=="card"&&b.show()}catch{}}});let d=t.createElement("script");d.src=r.card,d.async=!0,(t.head||t.documentElement).appendChild(d)}catch{}}},l=e=>{e!=i&&(clearTimeout(E),i=e,p.setAttribute("data-st",e),o.setAttribute("aria-expanded",String(e=="card")),e!="rest"&&I(),b&&(e=="card"?b.show():b.hide()),y())},P={s:r,root:m,w:p,host:n,go:l,icon:H,css:_};o.addEventListener("pointerdown",e=>{x=e.pointerType=="touch",k=i}),o.addEventListener("pointerenter",e=>{e.pointerType=="mouse"&&i=="rest"&&l("exp")}),p.addEventListener("pointerleave",e=>{e.pointerType=="mouse"&&i=="exp"&&!M(o,":focus-visible")&&l("rest")}),o.addEventListener("focus",()=>{!x&&!L&&i=="rest"&&l("exp")}),o.addEventListener("blur",()=>{i=="exp"&&!M(o,":hover")&&l("rest")}),o.addEventListener("click",()=>{x&&k=="rest"?(l("exp"),E=setTimeout(()=>l("rest"),4e3)):l(i=="card"?"exp":"card"),x=!1}),t.addEventListener("keydown",e=>{e.key!="Escape"||i=="rest"||(i=="card"?(l("exp"),o.focus()):l("rest"))}),t.addEventListener("pointerdown",e=>{if(i=="rest"||e.composedPath().indexOf(n)>=0)return;let g=t.activeElement==n;l("rest"),g&&setTimeout(()=>{let d=t.activeElement;(!d||d==t.body||d==n)&&(L=!0,o.focus({preventScroll:!0}),L=!1)})},!0);let A=()=>{n.isConnected||(t.body||t.documentElement).appendChild(n),y();try{sessionStorage.getItem(O)&&(sessionStorage.removeItem(O),l("exp"),E=setTimeout(()=>l("rest"),3e3))}catch{}};return t.readyState==="loading"?t.addEventListener("DOMContentLoaded",A):A(),y(),y}var R="stagepass.live.v1";var U='Multiple assets resolve to local file "%s" without data-stagepass-path. Set unique paths to avoid collisions.',j="Prefer sp.env()/is()/can()/client()/on() over reading sp.vars directly.";try{let r=window.stagepass,t=r==null?void 0:r[Symbol.for(N)];if(typeof t!="function")throw 0;t(n=>{if(n.debug)try{let a=r.vars,s=!1;Object.defineProperty(r,"vars",{configurable:!0,enumerable:!0,get(){return s||(s=!0,r.warn(j)),a}})}catch{}if(!n.debug&&n.domain)try{let a=Symbol.for(R),s=n.domain;Object.defineProperty(r,a,{configurable:!0,value:h=>{delete r[a];try{h({url:"https://"+s+"/__stagepass/live",localBase:"https://"+s,debug:n.debug,log:(...v)=>r.log(...v)})}catch{}}});let u=document.createElement("script");u.src=new URL("live.min.js",n.card).href,u.async=!0,(document.head||document.documentElement).appendChild(u)}catch{}let m=new Set,c=a=>(a||"").split(/[?#]/)[0].split("/").pop()||"",p=()=>{try{let a=new Map;for(let s of n.f){if(s.x)continue;let u=c(s.local);if(!u)continue;let h=(a.get(u)||0)+1;a.set(u,h),h===2&&!m.has(u)&&(m.add(u),r.warn(U.replace("%s",u)))}}catch{}};p();let o=z(n);return()=>{p(),o()}})}catch{}})();
@@ -0,0 +1 @@
1
+ (()=>{var u="stagepass.live.v1",p="/__stagepass/live";function v(e,t){try{let r=new URL(e),l=new URL(t.endsWith("/")?t:t+"/");return!(r.protocol!=="https:"&&r.protocol!=="http:"||r.username||r.password||r.hostname!==l.hostname||r.pathname!==p)}catch{return!1}}function y(e,t=document){let r=e.replace(/\/?$/,"/"),l=Array.from(t.querySelectorAll('link[rel="stylesheet"][href]')),i=0,o=String(Date.now());for(let n of l){let a=n.href||n.getAttribute("href")||"";if(a.startsWith(r))try{let c=new URL(a,t.baseURI);c.searchParams.set("t",o);let s=n.cloneNode(!1);s.removeAttribute("integrity"),s.href=c.href,n.parentNode&&(n.parentNode.insertBefore(s,n),n.remove(),i++)}catch{}}return i}function h(e){try{let t=JSON.parse(e);return!t||typeof t!="object"||t.type!=="css"&&t.type!=="reload"?null:t}catch{return null}}function f(e){let t=e.log||(()=>{}),r=e.doc||document,l=e.reload||(()=>location.reload()),i=e.EventSourceImpl||(typeof EventSource<"u"?EventSource:null);if(!i)return()=>{};if(!v(e.url,e.localBase))return()=>{};let o=null,n=!1,a=()=>{if(!n&&(n=!0,o)){try{o.close()}catch{}o=null}};try{o=new i(e.url)}catch{return()=>{}}return o.onmessage=c=>{if(n)return;let s=h(String(c.data||""));if(s){if(s.type==="css"){y(e.localBase,r);return}s.type==="reload"&&(a(),l())}},o.onerror=()=>{e.debug&&t("Live reload unavailable (closed)."),a()},e.debug&&t("Live reload listening."),a}var d;try{let e=(d=window.stagepass)==null?void 0:d[Symbol.for(u)];typeof e=="function"&&e(f)}catch{}})();
package/dist/loader.js CHANGED
@@ -286,7 +286,7 @@ var Stagepass = (() => {
286
286
  const W = window;
287
287
  const d = document;
288
288
  const loc = location;
289
- const PKG_VERSION = true ? "2.3.3" : "0.0.0";
289
+ const PKG_VERSION = true ? "2.4.0" : "0.0.0";
290
290
  const LOADER_RE = /loader(?:\.min)?\.js/i;
291
291
  function flagBase(v, file) {
292
292
  if (typeof v !== "string" || !(v = v.trim())) return null;
@@ -320,6 +320,7 @@ var Stagepass = (() => {
320
320
  const loaderVersionAttr = attr("version");
321
321
  const stagingHosts = parseStagingHosts(attr("staging-hosts"));
322
322
  const aliasName = attr("alias");
323
+ const liveSrc = attr("live-src") === "true";
323
324
  const p = new URLSearchParams(loc.search);
324
325
  let hasActiveSession = false;
325
326
  const flagState = { n: [0, 0], m: [], f: [], swapped: 0, v: PKG_VERSION, vd: isValidDomain };
@@ -518,7 +519,7 @@ var Stagepass = (() => {
518
519
  });
519
520
  const stagepassObj = W.stagepass || {};
520
521
  const registry = createModuleRegistry(PKG_VERSION, spWarn);
521
- stagepassObj.vars = Object.freeze({
522
+ const varsFrozen = Object.freeze({
522
523
  isLocal,
523
524
  env,
524
525
  domain: dom || hostname,
@@ -526,10 +527,11 @@ var Stagepass = (() => {
526
527
  version: PKG_VERSION,
527
528
  client: clientInfo
528
529
  });
530
+ stagepassObj.vars = varsFrozen;
529
531
  stagepassObj.log = spLog;
530
532
  stagepassObj.warn = spWarn;
531
533
  stagepassObj.error = spError;
532
- stagepassObj.resolveLocalUrl = (relativePath) => swap && dom && relativePath ? buildLocalAssetUrl(dom, relativePath, stagepassObj.vars.timestamp || Date.now()) : "";
534
+ stagepassObj.resolveLocalUrl = (relativePath) => swap && dom && relativePath ? buildLocalAssetUrl(dom, relativePath, varsFrozen.timestamp || Date.now()) : "";
533
535
  stagepassObj.env = () => detectRuntimeEnv(hostname, dom, stagingHosts);
534
536
  stagepassObj.is = (name) => stagepassObj.env() === name;
535
537
  stagepassObj.can = (capability) => canCapability(clientInfo, capability);
@@ -641,8 +643,9 @@ var Stagepass = (() => {
641
643
  }
642
644
  const mine = /* @__PURE__ */ new WeakSet();
643
645
  let lnaState = "";
644
- function track(n, live, local, isScript, retry) {
646
+ function track(n, live, local, isScript, retry, explicit) {
645
647
  const f = { live, local, type: isScript ? "js" : "css", st: "" };
648
+ if (explicit) f.x = true;
646
649
  const name = fileOf(local);
647
650
  mine.add(n);
648
651
  flagState.f.push(f);
@@ -678,24 +681,43 @@ var Stagepass = (() => {
678
681
  "data-stagepass-cachebust",
679
682
  "data-stagepass-v"
680
683
  ];
681
- function swapEl(sel, srcAttr, type, seen) {
684
+ const LS = 'script[data-stagepass][src]:not([data-src]):not([data-stagepass-processed]),link[rel="stylesheet" i][data-stagepass][href]:not([data-href]):not([data-stagepass-processed])';
685
+ const ff = "onbeforescriptexecute" in d;
686
+ function rewriteLive(el) {
687
+ try {
688
+ const js = el.tagName === "SCRIPT";
689
+ if (js && (ff || d.currentScript === el)) return;
690
+ const k = js ? "src" : "href";
691
+ const ps = el.getAttribute(k);
692
+ if (!ps) return;
693
+ el.setAttribute("data-stagepass-processed", "true");
694
+ const x = el.getAttribute("data-stagepass-path");
695
+ const lp = x || extractLocalFilename(ps);
696
+ if (!lp) return;
697
+ const url = buildLocalAssetUrl(dom, lp, now);
698
+ el.removeAttribute("integrity");
699
+ if (!el.hasAttribute("crossorigin")) el.setAttribute("crossorigin", "anonymous");
700
+ el[k] = url;
701
+ track(el, ps, url, js, null, !!x);
702
+ } catch (_) {
703
+ }
704
+ }
705
+ const scanLive = (r) => {
706
+ try {
707
+ if (r.matches && r.matches(LS)) rewriteLive(r);
708
+ r.querySelectorAll(LS).forEach(rewriteLive);
709
+ } catch (_) {
710
+ }
711
+ };
712
+ function swapEl(sel, srcAttr, type) {
682
713
  d.querySelectorAll(`${sel}:not([data-stagepass-processed])`).forEach((el) => {
683
714
  try {
684
- el.setAttribute("data-stagepass-processed", "true");
685
715
  let lp = el.getAttribute("data-stagepass-path");
686
716
  const hadExplicitPath = !!lp;
687
717
  const ps = el.getAttribute(srcAttr);
688
718
  if (!ps) return;
719
+ el.setAttribute("data-stagepass-processed", "true");
689
720
  if (!lp && swap && dom) lp = extractLocalFilename(ps);
690
- if (swap && lp && !hadExplicitPath && hasActiveSession) {
691
- const count = (seen.get(lp) || 0) + 1;
692
- seen.set(lp, count);
693
- if (count === 2) {
694
- spWarn(
695
- `Multiple assets resolve to local file "${lp}" without data-stagepass-path. Set unique paths to avoid collisions.`
696
- );
697
- }
698
- }
699
721
  const url = resolveAssetUrl(el, ps, lp);
700
722
  if (!url) return;
701
723
  const local = swap && lp && dom;
@@ -709,12 +731,12 @@ var Stagepass = (() => {
709
731
  n2.href = url;
710
732
  }
711
733
  for (const a of Array.from(el.attributes)) {
712
- if (a.name !== srcAttr && !SKIP.includes(a.name) && (isScript || a.name !== "href")) {
734
+ if (a.name !== srcAttr && !SKIP.includes(a.name) && a.name !== (isScript ? "src" : "href"))
713
735
  n2.setAttribute(a.name, a.value);
714
- }
715
736
  }
737
+ if (local) n2.removeAttribute("integrity");
716
738
  if (isScript) applyScriptLoadOrder(n2, el);
717
- if (local) track(n2, ps, url, isScript, cors ? make : null);
739
+ if (local) track(n2, ps, url, isScript, cors ? make : null, hadExplicitPath);
718
740
  return n2;
719
741
  };
720
742
  const n = make(!!local && !el.hasAttribute("crossorigin"));
@@ -728,11 +750,35 @@ var Stagepass = (() => {
728
750
  }
729
751
  });
730
752
  }
753
+ if (swap && liveSrc) {
754
+ try {
755
+ new MutationObserver((ms) => {
756
+ for (const m of ms) for (const n of m.addedNodes) if (n.nodeType === 1) scanLive(n);
757
+ }).observe(d.documentElement, { childList: true, subtree: true });
758
+ if (ff)
759
+ d.addEventListener(
760
+ "beforescriptexecute",
761
+ (e) => {
762
+ const el = e.target;
763
+ if (!el || !el.matches || !el.matches(LS)) return;
764
+ const ps = el.getAttribute("src");
765
+ if (!ps || ps.indexOf("https://" + dom + "/") === 0) return;
766
+ e.preventDefault();
767
+ el.setAttribute("data-src", ps);
768
+ el.removeAttribute("src");
769
+ swapEl("script[data-stagepass]", "data-src", "script");
770
+ },
771
+ true
772
+ );
773
+ scanLive(d);
774
+ } catch (_) {
775
+ }
776
+ }
731
777
  const process = () => {
732
778
  try {
733
- const seen = /* @__PURE__ */ new Map();
734
- swapEl("script[data-stagepass]", "data-src", "script", seen);
735
- swapEl('link[rel="stylesheet"][data-stagepass]', "data-href", "link", seen);
779
+ swapEl("script[data-stagepass]", "data-src", "script");
780
+ swapEl('link[rel="stylesheet"][data-stagepass]', "data-href", "link");
781
+ if (swap && liveSrc) scanLive(d);
736
782
  if (renderFlag) renderFlag();
737
783
  } catch (_) {
738
784
  }
@@ -1,2 +1,2 @@
1
- var Stagepass=(()=>{function j(t){return typeof t!="string"||!t?!1:t==="debug"||t==="localhost"?!0:t.startsWith("localhost:")?(t=t.slice(10),/^[1-9]\d{0,4}$/.test(t)&&+t<65536):/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*\.sp$/i.test(t)}function Y(t){return t?t.replace(/^https?:\/\//i,"").replace(/\/$/,""):null}var Se="stagepass_domain",V=12;function ye(t,r=Date.now()){if(!t||!t.startsWith("{"))return null;try{let o=JSON.parse(t);return typeof o.domain!="string"||typeof o.expires!="number"||!Number.isFinite(o.expires)||!j(o.domain)||o.expires<=r?null:{domain:o.domain,expires:o.expires}}catch{return null}}function be(t,r=V,o=Date.now()){let c=Number.isFinite(r)&&r>0?r:V;return{domain:t,expires:o+c*60*60*1e3}}function we(t){return JSON.stringify(t)}function ke(t){if(t==null||t==="")return V;let r=Number(t);return!Number.isFinite(r)||r<=0?V:r}function ve(t,r,o){if(!t||typeof t!="string")return t;let c=encodeURIComponent(o),f=t.indexOf("#"),h=f>=0?t.slice(f):"",v=f>=0?t.slice(0,f):t,I=v.includes("?")?"&":"?";return`${v}${I}${encodeURIComponent(r)}=${c}${h}`}function X(t,r,o){let c=r.startsWith("/")?r.substring(1):r;return`https://${t}/${c}?_cb=${encodeURIComponent(String(o))}`}async function Ee(){let t=typeof navigator<"u"?navigator.permissions:void 0;if(!t||typeof t.query!="function")return"unknown";let r=["loopback-network","local-network-access"];for(let o of r)try{let c=await t.query({name:o}),f=c&&c.state;if(f==="granted"||f==="prompt"||f==="denied")return f}catch{}return"unknown"}function ee(t){return t==="prompt"?"Local network access is required. Allow local/loopback network access when Chrome prompts, then reload.":t==="denied"?"Local network access is blocked. Enable loopback/local network access for this site in Chrome settings, then reload.":null}function xe(t,r){let o=r.hasAttribute("async"),c=r.hasAttribute("defer");o?t.async=!0:(t.async=!1,c||(t.defer=!0))}function _e(t){return!t||typeof t!="string"?[]:t.split(",").map(r=>r.trim().toLowerCase()).filter(Boolean)}function Le(t,r,o=[]){if(r&&r.endsWith(".sp"))return"local";let c=(t||"").toLowerCase();return c.endsWith(".webflow.io")||o.some(f=>f===c)?"staging":"production"}function $e(t){return!t||typeof t!="string"?!1:/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(t)}function Ie(t,r){try{return typeof t[r]>"u"}catch{return!1}}var Ze=[["edge",/Edg\/(\d+)/],["opera",/OPR\/(\d+)/],["firefox",/Firefox\/(\d+)/],["chrome",/Chrome\/(\d+)/],["safari",/Version\/(\d+).+Safari\//]],Qe=[["android",/Android/i],["ios",/iPhone|iPad|iPod/i],["macos",/Mac OS X|Macintosh/i],["windows",/Windows NT/i],["linux",/Linux/i]];function Ye(t){for(let[r,o]of Ze){let c=t.match(o);if(c)return{family:r,major:Number(c[1]),userAgent:t}}return{family:"unknown",major:null,userAgent:t}}function Xe(t){let r=Qe.find(([,o])=>o.test(t));return{family:r?r[0]:"unknown"}}function et(t){let r="ontouchstart"in window||(navigator.maxTouchPoints||0)>0,o="desktop";return/iPad|Tablet/i.test(t)?o="tablet":/Mobi|Android.+Mobile|iPhone/i.test(t)?o="mobile":/Android/i.test(t)&&r&&(o="tablet"),{type:o,touch:r}}function te(){let t=null;try{let r=o=>matchMedia(`(prefers-color-scheme: ${o})`).matches;t=r("dark")?"dark":r("light")?"light":null}catch{}return{preferred:t||"no-preference",current:t||"unknown"}}function Ae(t){try{let r=window[t],o="__stagepass_test__";return r.setItem(o,"1"),r.removeItem(o),!0}catch{return!1}}function tt(){try{return typeof navigator<"u"&&"serviceWorker"in navigator}catch{return!1}}function Re(){let t=navigator.userAgent||"",r=null;try{r=Intl.DateTimeFormat().resolvedOptions().timeZone||null}catch{}return{theme:te(),browser:Ye(t),os:Xe(t),device:et(t),viewport:{width:window.innerWidth||0,height:window.innerHeight||0,dpr:window.devicePixelRatio||1},locale:{language:navigator.language||"unknown",timezone:r},capabilities:{cookiesEnabled:navigator.cookieEnabled===!0,localStorage:Ae("localStorage"),sessionStorage:Ae("sessionStorage")}}}function Oe(t,r){let o=t.capabilities;switch(r){case"localStorage":return o.localStorage===!0;case"sessionStorage":return o.sessionStorage===!0;case"cookies":return o.cookiesEnabled===!0;case"serviceWorker":return tt();default:return!1}}function Ce(t){if(!t||typeof t!="string")return null;let r=t.trim().match(/^(\d+)/);if(!r)return null;let o=Number(r[1]);return Number.isFinite(o)?o:null}function Ne(t,r){let o=Ce(t),c=new Map;function f(h,v,I,q){if(!h||typeof h!="string")return r("stagepass.use: invalid module name"),!1;let E=Ce(v);if(o==null||E==null)return r(`stagepass.use: cannot parse version for module "${h}"`),!1;if(E!==o)return r(`Module "${h}" major ${E} does not match loader major ${o}. Skipping.`),!1;try{return I(q),c.set(h,v),!0}catch(x){return r(`Module "${h}" failed to register:`,x),!1}}return{use:f,registered:c}}(function(){let t=Se,r="stagepass",o=window,c=document,f=location,h="2.3.3",v=/loader(?:\.min)?\.js/i;function I(e,n){if(typeof e!="string"||!(e=e.trim()))return null;try{let s=new URL(e,c.baseURI);return!/^https?:$/.test(s.protocol)||s.username||s.password?null:(s.search=s.hash="",n?new URL("./",s).href:s.href.replace(/\/?$/,"/"))}catch{return null}}function q(){try{if(c.currentScript instanceof HTMLScriptElement)return c.currentScript}catch{}try{let e=c.querySelectorAll('script[src*="loader"]');for(let n=e.length-1;n>=0;n--)if(v.test(e[n].src||""))return e[n]}catch{}return null}let E=q(),x=e=>E?E.getAttribute("data-stagepass-"+e):null,je=x("mute-console")==="true",Fe=ke(x("session-hours")),Me=x("version"),ne=_e(x("staging-hosts")),A=x("alias"),W=new URLSearchParams(f.search),k=!1,_={n:[0,0],m:[],f:[],swapped:0,v:h,vd:j},F=null,se=()=>F&&F(),re=()=>new Date().toTimeString().slice(0,8),H=e=>(e||"").split(/[?#]/)[0].split("/").pop()||"",z=(e,n)=>e.length>n?e.slice(0,n)+"\u2026":e,oe=(e,n=0)=>{try{if(typeof e=="string")return n?JSON.stringify(e):e;if(e instanceof Error)return e.name+": "+e.message;if(!e||typeof e!="object")return String(e);if(e instanceof Node)return"<"+e.nodeName.toLowerCase()+">";let s=Array.isArray(e);if(n>2)return s?"[\u2026]":"{\u2026}";let u=Object.keys(e),i=u.slice(0,20).map(a=>(s?"":a+": ")+oe(e[a],n+1));return u.length>20&&i.push("\u2026"),z(s?"["+i.join(", ")+"]":"{"+i.join(", ")+"}",1e3)}catch{return"[unserializable]"}},B=(e,n=0)=>{let s=(e||"").split(`
2
- `);for(let u=n;u<s.length;u++){let i=s[u].match(/([a-z][\w+.-]*:\/\/[^\s()]+?):(\d+):(\d+)/i);if(i&&!v.test(H(i[1])))return[i[1],i[2],i[3]]}return null},y=null,Pe=e=>e?y&&!e.indexOf(`https://${y}/`)?"local":"live":"external",R=(e,n,s="",u="",i="",a="",d)=>{_.n[e]++;let l=_.m,m={type:e?"error":"warn",time:re(),src:d||(s?Pe(s):""),file:H(s),url:s.split(/[?#]/)[0],line:u?String(u):"",col:i?String(i):"",text:z(n,500),stack:z(a,2e3),c:1},S=p=>p.type+p.text+p.url+p.line+p.col;for(let p=l.length-1;p>=0;p--)if(S(l[p])===S(m)){m.c=l[p].c+1,l.splice(p,1);break}l.push(m),l.length>50&&l.shift(),se()},G=(e,n,s,u)=>{let i=s.find(l=>l instanceof Error),a=i&&i.stack||"",d=B(a)||u;R(e,n+s.map(l=>oe(l)).join(" "),d?d[0]:"",d?d[1]:"",d?d[2]:"",a)},M=!1,Te=e=>{M=!0;try{e()}catch{}M=!1};function O(e,...n){if(!k)return;let s=B(new Error().stack||"",3);(e==="warn"||e==="error")&&G(e==="warn"?0:1,"",n,s),Te(()=>{let u=`[\u{1F3AB} ${re()}${s?" | "+H(s[0])+":"+s[1]:""}]`,i=console;e==="error"?i.log(`%c${u}`,"color:red;font-weight:bold",...n):i[e]?i[e](u,...n):i.log(u,e,...n)})}function De(...e){let n=e[0]==="warn"||e[0]==="error"?e.shift():"log";O(n,...e)}let C=(...e)=>O("warn",...e),ie=(...e)=>O("error",...e),J=(e,n)=>{let s=k;k=!0,O(e,n),k=s};function We(){try{let e=localStorage.getItem(t),n=ye(e);return!n&&e&&localStorage.removeItem(t),n?n.domain:null}catch{return null}}function K(){try{localStorage.removeItem(t)}catch{}}let ae=!1,b=We();if(W.has(r)){let e=W.get(r);if(e==="off"||e==="0"||e==="false")K(),b=null,J("log","\u{1F50C} Stagepass disconnected.");else if(e){let n=e==="debug"?"debug":Y(e);if(n&&j(n)){try{localStorage.setItem(t,we(be(n,Fe)))}catch{}b=n,ae=!0,J("log",n==="debug"?"\u{1F50D} Stagepass debug mode enabled.":`\u{1F50C} Stagepass connected to: ${n}`)}else n&&J("warn",`Invalid domain: ${n}. Only .sp domains are allowed.`)}try{W.delete(r);let n=W.toString();history.replaceState({},"",f.pathname+(n?`?${n}`:"")+f.hash)}catch{}}b&&!j(b)&&(K(),b=null);let P=b==="debug";k=!!b,b&&!ae&&!P&&O("log",`\u{1F50C} Stagepass connected to: ${b}`);let ce=!!b,w=ce&&!P;y=w?Y(b):null;let le=w?Date.now():0,L=f.hostname,He=L==="localhost"||L==="127.0.0.1"||L.startsWith("localhost:")||L.startsWith("127.0.0.1:"),ue=w||He,de=ue?"local":L.endsWith(".webflow.io")||ne.includes(L.toLowerCase())?"staging":"production";if(je&&de==="production"&&!k)try{console.log=console.warn=console.error=console.info=console.debug=()=>{}}catch{}let fe={theme:new Set,session:new Set},Z=(e,n)=>fe[e].forEach(s=>{try{s(n)}catch{}}),N=Re();try{let e=()=>Z("theme",{...Object.assign(N.theme,te())});["dark","light"].forEach(n=>{let s=matchMedia(`(prefers-color-scheme: ${n})`);s.addEventListener?s.addEventListener("change",e):s.addListener&&s.addListener(e)})}catch{}o.addEventListener("resize",()=>{let e=N.viewport;e.width=o.innerWidth||0,e.height=o.innerHeight||0,e.dpr=o.devicePixelRatio||1});let g=o.stagepass||{},ze=Ne(h,C);if(g.vars=Object.freeze({isLocal:ue,env:de,domain:y||L,timestamp:le,version:h,client:N}),g.log=De,g.warn=C,g.error=ie,g.resolveLocalUrl=e=>w&&y&&e?X(y,e,g.vars.timestamp||Date.now()):"",g.env=()=>Le(L,y,ne),g.is=e=>g.env()===e,g.can=e=>Oe(N,e),g.client=e=>e==null||e===""?N:N[e],g.on=(e,n)=>{let s=fe[e];return!s||e!=="theme"&&e!=="session"?()=>{}:(s.add(n),()=>{s.delete(n)})},g.use=(e,n,s)=>ze.use(e,n,s,g),o.stagepass=o.sp=g,globalThis.stagepass=globalThis.sp=g,A&&$e(A)&&A!=="sp"&&A!=="stagepass"&&[o,globalThis].forEach(e=>{Ie(e,A)&&(e[A]=g)}),ce)try{let e=Symbol.for("stagepass.flag.v2"),n=x("flag-base")??o.stagepassFlagBase,s=I(n,!1);n!=null&&!s&&C("Ignored flag base (http(s) or relative only): "+z(String(n),99)),s=s||I(E&&E.src||"",!0),s||(s=`https://cdn.jsdelivr.net/npm/@stagepass/loader@${h}/dist/`,P&&C("Loader URL unknown, flag loads from "+s+". Set data-stagepass-flag-base")),Object.assign(_,{debug:P,domain:y,card:s+"flag-card.min.js",end:()=>{K(),k=!0,O("log","\u{1F50C} Stagepass disconnected."),Z("session",{active:!1,domain:null,swap:!1,debug:!1}),f.reload()}}),Object.defineProperty(g,e,{configurable:!0,value:a=>{delete g[e];try{F=a(_)}catch{}}}),o.addEventListener("error",a=>{let d=a.target,l=d&&d!==o&&(d.src||d.href);typeof l=="string"?ge.has(d)||R(1,"Failed to load "+l.split(/[?#]/)[0],l):/^Script error\.?$/.test(a.message||"")&&!a.filename?R(1,"Error in a cross-origin script (details only in DevTools console)","","","","","external"):R(1,a.message||"Script error",a.filename||"",a.lineno,a.colno,a.error&&a.error.stack||"")},!0),o.addEventListener("unhandledrejection",a=>G(1,"Unhandled rejection: ",[a.reason],null));let u=console;["warn","error"].forEach((a,d)=>{let l=u[a];typeof l=="function"&&(u[a]=function(...m){if(!M){M=!0;try{G(d,"",m,B(new Error().stack||"",2))}catch{}M=!1}return l.apply(this,m)})});let i=c.createElement("script");i.src=s+"flag.min.js",i.async=!0,i.onerror=()=>C("Stagepass flag could not be loaded: "+i.src),(c.head||c.documentElement).appendChild(i)}catch{}Z("session",{active:k,domain:b,swap:w,debug:P});function Ue(e,n,s){if(w&&s&&y)return X(y,s,le);let u=e.getAttribute("data-stagepass-v")||Me;return u?ve(n,"v",u):n}function Ve(e){try{let n=new URL(e).pathname.split("/");return n[n.length-1]||n[n.length-2]||null}catch{let s=e.match(/\/([^\/\?#]+)(?:\?|#|$)/);return s?s[1]:null}}let ge=new WeakSet,Q="";function qe(e,n,s,u,i){let a={live:n,local:s,type:u?"js":"css",st:""},d=H(s);ge.add(e),_.f.push(a),e.addEventListener("load",()=>{a.st="ok",_.swapped++,se()}),e.addEventListener("error",()=>{let l=(S,p,U)=>{a.st=S,R(p,U,s)},m=o.fetch;if(typeof m!="function")return l("failed",1,`Failed to load ${d}`);m(s,{method:"HEAD",cache:"no-store"}).then(S=>l(S.ok?"failed":String(S.status),1,S.ok?`Failed to load ${d}`:`Local file not found (${S.status}): ${d}`),()=>m(s,{method:"HEAD",mode:"no-cors",cache:"no-store"}).then(()=>{if(!i)return l("failed",1,`Failed to load ${d}`);_.f.splice(_.f.indexOf(a),1),e.replaceWith(i(!1)),R(0,`Local server sends no CORS header for ${d}. Loaded without crossorigin, error details are limited`,s)},()=>l("failed",1,`Local server not reachable: ${d}. Run stagepass doctor`+(ee(Q)?". "+ee(Q):""))))})}let Be=["data-stagepass","data-stagepass-path","data-stagepass-cachebust","data-stagepass-v"];function pe(e,n,s,u){c.querySelectorAll(`${e}:not([data-stagepass-processed])`).forEach(i=>{try{i.setAttribute("data-stagepass-processed","true");let a=i.getAttribute("data-stagepass-path"),d=!!a,l=i.getAttribute(n);if(!l)return;if(!a&&w&&y&&(a=Ve(l)),w&&a&&!d&&k){let T=(u.get(a)||0)+1;u.set(a,T),T===2&&C(`Multiple assets resolve to local file "${a}" without data-stagepass-path. Set unique paths to avoid collisions.`)}let m=Ue(i,l,a);if(!m)return;let S=w&&a&&y,p=s==="script",U=T=>{let $=c.createElement(s);T&&($.crossOrigin="anonymous"),p?$.src=m:($.rel="stylesheet",$.href=m);for(let D of Array.from(i.attributes))D.name!==n&&!Be.includes(D.name)&&(p||D.name!=="href")&&$.setAttribute(D.name,D.value);return p&&xe($,i),S&&qe($,l,m,p,T?U:null),$},Ke=U(!!S&&!i.hasAttribute("crossorigin"));i.parentNode?(i.parentNode.insertBefore(Ke,i),i.remove()):ie(`${s} injection failed: No parent node`)}catch{}})}let Ge=()=>{try{let e=new Map;pe("script[data-stagepass]","data-src","script",e),pe('link[rel="stylesheet"][data-stagepass]',"data-href","link",e),F&&F()}catch{}},me=null,Je=()=>me=me||(w?Ee().then(e=>{Q=e}).catch(()=>{}):Promise.resolve()),he=()=>{Je().then(Ge)};he(),c.readyState==="loading"&&c.addEventListener("DOMContentLoaded",he)})();})();
1
+ var Stagepass=(()=>{function C(t){return typeof t!="string"||!t?!1:t==="debug"||t==="localhost"?!0:t.startsWith("localhost:")?(t=t.slice(10),/^[1-9]\d{0,4}$/.test(t)&&+t<65536):/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?)*\.sp$/i.test(t)}function se(t){return t?t.replace(/^https?:\/\//i,"").replace(/\/$/,""):null}var Le="stagepass_domain",U=12;function _e(t,r=Date.now()){if(!t||!t.startsWith("{"))return null;try{let o=JSON.parse(t);return typeof o.domain!="string"||typeof o.expires!="number"||!Number.isFinite(o.expires)||!C(o.domain)||o.expires<=r?null:{domain:o.domain,expires:o.expires}}catch{return null}}function Ae(t,r=U,o=Date.now()){let c=Number.isFinite(r)&&r>0?r:U;return{domain:t,expires:o+c*60*60*1e3}}function $e(t){return JSON.stringify(t)}function Ie(t){if(t==null||t==="")return U;let r=Number(t);return!Number.isFinite(r)||r<=0?U:r}function Oe(t,r,o){if(!t||typeof t!="string")return t;let c=encodeURIComponent(o),g=t.indexOf("#"),b=g>=0?t.slice(g):"",E=g>=0?t.slice(0,g):t,$=E.includes("?")?"&":"?";return`${E}${$}${encodeURIComponent(r)}=${c}${b}`}function V(t,r,o){let c=r.startsWith("/")?r.substring(1):r;return`https://${t}/${c}?_cb=${encodeURIComponent(String(o))}`}async function Re(){let t=typeof navigator<"u"?navigator.permissions:void 0;if(!t||typeof t.query!="function")return"unknown";let r=["loopback-network","local-network-access"];for(let o of r)try{let c=await t.query({name:o}),g=c&&c.state;if(g==="granted"||g==="prompt"||g==="denied")return g}catch{}return"unknown"}function re(t){return t==="prompt"?"Local network access is required. Allow local/loopback network access when Chrome prompts, then reload.":t==="denied"?"Local network access is blocked. Enable loopback/local network access for this site in Chrome settings, then reload.":null}function Ne(t,r){let o=r.hasAttribute("async"),c=r.hasAttribute("defer");o?t.async=!0:(t.async=!1,c||(t.defer=!0))}function Ce(t){return!t||typeof t!="string"?[]:t.split(",").map(r=>r.trim().toLowerCase()).filter(Boolean)}function je(t,r,o=[]){if(r&&r.endsWith(".sp"))return"local";let c=(t||"").toLowerCase();return c.endsWith(".webflow.io")||o.some(g=>g===c)?"staging":"production"}function Fe(t){return!t||typeof t!="string"?!1:/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(t)}function Te(t,r){try{return typeof t[r]>"u"}catch{return!1}}var tt=[["edge",/Edg\/(\d+)/],["opera",/OPR\/(\d+)/],["firefox",/Firefox\/(\d+)/],["chrome",/Chrome\/(\d+)/],["safari",/Version\/(\d+).+Safari\//]],nt=[["android",/Android/i],["ios",/iPhone|iPad|iPod/i],["macos",/Mac OS X|Macintosh/i],["windows",/Windows NT/i],["linux",/Linux/i]];function st(t){for(let[r,o]of tt){let c=t.match(o);if(c)return{family:r,major:Number(c[1]),userAgent:t}}return{family:"unknown",major:null,userAgent:t}}function rt(t){let r=nt.find(([,o])=>o.test(t));return{family:r?r[0]:"unknown"}}function ot(t){let r="ontouchstart"in window||(navigator.maxTouchPoints||0)>0,o="desktop";return/iPad|Tablet/i.test(t)?o="tablet":/Mobi|Android.+Mobile|iPhone/i.test(t)?o="mobile":/Android/i.test(t)&&r&&(o="tablet"),{type:o,touch:r}}function oe(){let t=null;try{let r=o=>matchMedia(`(prefers-color-scheme: ${o})`).matches;t=r("dark")?"dark":r("light")?"light":null}catch{}return{preferred:t||"no-preference",current:t||"unknown"}}function Me(t){try{let r=window[t],o="__stagepass_test__";return r.setItem(o,"1"),r.removeItem(o),!0}catch{return!1}}function it(){try{return typeof navigator<"u"&&"serviceWorker"in navigator}catch{return!1}}function Pe(){let t=navigator.userAgent||"",r=null;try{r=Intl.DateTimeFormat().resolvedOptions().timeZone||null}catch{}return{theme:oe(),browser:st(t),os:rt(t),device:ot(t),viewport:{width:window.innerWidth||0,height:window.innerHeight||0,dpr:window.devicePixelRatio||1},locale:{language:navigator.language||"unknown",timezone:r},capabilities:{cookiesEnabled:navigator.cookieEnabled===!0,localStorage:Me("localStorage"),sessionStorage:Me("sessionStorage")}}}function De(t,r){let o=t.capabilities;switch(r){case"localStorage":return o.localStorage===!0;case"sessionStorage":return o.sessionStorage===!0;case"cookies":return o.cookiesEnabled===!0;case"serviceWorker":return it();default:return!1}}function He(t){if(!t||typeof t!="string")return null;let r=t.trim().match(/^(\d+)/);if(!r)return null;let o=Number(r[1]);return Number.isFinite(o)?o:null}function We(t,r){let o=He(t),c=new Map;function g(b,E,$,q){if(!b||typeof b!="string")return r("stagepass.use: invalid module name"),!1;let x=He(E);if(o==null||x==null)return r(`stagepass.use: cannot parse version for module "${b}"`),!1;if(x!==o)return r(`Module "${b}" major ${x} does not match loader major ${o}. Skipping.`),!1;try{return $(q),c.set(b,E),!0}catch(v){return r(`Module "${b}" failed to register:`,v),!1}}return{use:g,registered:c}}(function(){let t=Le,r="stagepass",o=window,c=document,g=location,b="2.4.0",E=/loader(?:\.min)?\.js/i;function $(e,n){if(typeof e!="string"||!(e=e.trim()))return null;try{let s=new URL(e,c.baseURI);return!/^https?:$/.test(s.protocol)||s.username||s.password?null:(s.search=s.hash="",n?new URL("./",s).href:s.href.replace(/\/?$/,"/"))}catch{return null}}function q(){try{if(c.currentScript instanceof HTMLScriptElement)return c.currentScript}catch{}try{let e=c.querySelectorAll('script[src*="loader"]');for(let n=e.length-1;n>=0;n--)if(E.test(e[n].src||""))return e[n]}catch{}return null}let x=q(),v=e=>x?x.getAttribute("data-stagepass-"+e):null,ze=v("mute-console")==="true",Ue=Ie(v("session-hours")),Ve=v("version"),ie=Ce(v("staging-hosts")),I=v("alias"),ae=v("live-src")==="true",D=new URLSearchParams(g.search),L=!1,_={n:[0,0],m:[],f:[],swapped:0,v:b,vd:C},j=null,ce=()=>j&&j(),le=()=>new Date().toTimeString().slice(0,8),H=e=>(e||"").split(/[?#]/)[0].split("/").pop()||"",W=(e,n)=>e.length>n?e.slice(0,n)+"\u2026":e,ue=(e,n=0)=>{try{if(typeof e=="string")return n?JSON.stringify(e):e;if(e instanceof Error)return e.name+": "+e.message;if(!e||typeof e!="object")return String(e);if(e instanceof Node)return"<"+e.nodeName.toLowerCase()+">";let s=Array.isArray(e);if(n>2)return s?"[\u2026]":"{\u2026}";let i=Object.keys(e),a=i.slice(0,20).map(l=>(s?"":l+": ")+ue(e[l],n+1));return i.length>20&&a.push("\u2026"),W(s?"["+a.join(", ")+"]":"{"+a.join(", ")+"}",1e3)}catch{return"[unserializable]"}},B=(e,n=0)=>{let s=(e||"").split(`
2
+ `);for(let i=n;i<s.length;i++){let a=s[i].match(/([a-z][\w+.-]*:\/\/[^\s()]+?):(\d+):(\d+)/i);if(a&&!E.test(H(a[1])))return[a[1],a[2],a[3]]}return null},h=null,qe=e=>e?h&&!e.indexOf(`https://${h}/`)?"local":"live":"external",O=(e,n,s="",i="",a="",l="",u)=>{_.n[e]++;let d=_.m,m={type:e?"error":"warn",time:le(),src:u||(s?qe(s):""),file:H(s),url:s.split(/[?#]/)[0],line:i?String(i):"",col:a?String(a):"",text:W(n,500),stack:W(l,2e3),c:1},S=f=>f.type+f.text+f.url+f.line+f.col;for(let f=d.length-1;f>=0;f--)if(S(d[f])===S(m)){m.c=d[f].c+1,d.splice(f,1);break}d.push(m),d.length>50&&d.shift(),ce()},G=(e,n,s,i)=>{let a=s.find(d=>d instanceof Error),l=a&&a.stack||"",u=B(l)||i;O(e,n+s.map(d=>ue(d)).join(" "),u?u[0]:"",u?u[1]:"",u?u[2]:"",l)},F=!1,Be=e=>{F=!0;try{e()}catch{}F=!1};function R(e,...n){if(!L)return;let s=B(new Error().stack||"",3);(e==="warn"||e==="error")&&G(e==="warn"?0:1,"",n,s),Be(()=>{let i=`[\u{1F3AB} ${le()}${s?" | "+H(s[0])+":"+s[1]:""}]`,a=console;e==="error"?a.log(`%c${i}`,"color:red;font-weight:bold",...n):a[e]?a[e](i,...n):a.log(i,e,...n)})}function Ge(...e){let n=e[0]==="warn"||e[0]==="error"?e.shift():"log";R(n,...e)}let T=(...e)=>R("warn",...e),de=(...e)=>R("error",...e),J=(e,n)=>{let s=L;L=!0,R(e,n),L=s};function Je(){try{let e=localStorage.getItem(t),n=_e(e);return!n&&e&&localStorage.removeItem(t),n?n.domain:null}catch{return null}}function K(){try{localStorage.removeItem(t)}catch{}}let fe=!1,y=Je();if(D.has(r)){let e=D.get(r);if(e==="off"||e==="0"||e==="false")K(),y=null,J("log","\u{1F50C} Stagepass disconnected.");else if(e){let n=e==="debug"?"debug":se(e);if(n&&C(n)){try{localStorage.setItem(t,$e(Ae(n,Ue)))}catch{}y=n,fe=!0,J("log",n==="debug"?"\u{1F50D} Stagepass debug mode enabled.":`\u{1F50C} Stagepass connected to: ${n}`)}else n&&J("warn",`Invalid domain: ${n}. Only .sp domains are allowed.`)}try{D.delete(r);let n=D.toString();history.replaceState({},"",g.pathname+(n?`?${n}`:"")+g.hash)}catch{}}y&&!C(y)&&(K(),y=null);let M=y==="debug";L=!!y,y&&!fe&&!M&&R("log",`\u{1F50C} Stagepass connected to: ${y}`);let ge=!!y,w=ge&&!M;h=w?se(y):null;let Z=w?Date.now():0,A=g.hostname,Ke=A==="localhost"||A==="127.0.0.1"||A.startsWith("localhost:")||A.startsWith("127.0.0.1:"),pe=w||Ke,me=pe?"local":A.endsWith(".webflow.io")||ie.includes(A.toLowerCase())?"staging":"production";if(ze&&me==="production"&&!L)try{console.log=console.warn=console.error=console.info=console.debug=()=>{}}catch{}let he={theme:new Set,session:new Set},Q=(e,n)=>he[e].forEach(s=>{try{s(n)}catch{}}),N=Pe();try{let e=()=>Q("theme",{...Object.assign(N.theme,oe())});["dark","light"].forEach(n=>{let s=matchMedia(`(prefers-color-scheme: ${n})`);s.addEventListener?s.addEventListener("change",e):s.addListener&&s.addListener(e)})}catch{}o.addEventListener("resize",()=>{let e=N.viewport;e.width=o.innerWidth||0,e.height=o.innerHeight||0,e.dpr=o.devicePixelRatio||1});let p=o.stagepass||{},Ze=We(b,T),be=Object.freeze({isLocal:pe,env:me,domain:h||A,timestamp:Z,version:b,client:N});if(p.vars=be,p.log=Ge,p.warn=T,p.error=de,p.resolveLocalUrl=e=>w&&h&&e?V(h,e,be.timestamp||Date.now()):"",p.env=()=>je(A,h,ie),p.is=e=>p.env()===e,p.can=e=>De(N,e),p.client=e=>e==null||e===""?N:N[e],p.on=(e,n)=>{let s=he[e];return!s||e!=="theme"&&e!=="session"?()=>{}:(s.add(n),()=>{s.delete(n)})},p.use=(e,n,s)=>Ze.use(e,n,s,p),o.stagepass=o.sp=p,globalThis.stagepass=globalThis.sp=p,I&&Fe(I)&&I!=="sp"&&I!=="stagepass"&&[o,globalThis].forEach(e=>{Te(e,I)&&(e[I]=p)}),ge)try{let e=Symbol.for("stagepass.flag.v2"),n=v("flag-base")??o.stagepassFlagBase,s=$(n,!1);n!=null&&!s&&T("Ignored flag base (http(s) or relative only): "+W(String(n),99)),s=s||$(x&&x.src||"",!0),s||(s=`https://cdn.jsdelivr.net/npm/@stagepass/loader@${b}/dist/`,M&&T("Loader URL unknown, flag loads from "+s+". Set data-stagepass-flag-base")),Object.assign(_,{debug:M,domain:h,card:s+"flag-card.min.js",end:()=>{K(),L=!0,R("log","\u{1F50C} Stagepass disconnected."),Q("session",{active:!1,domain:null,swap:!1,debug:!1}),g.reload()}}),Object.defineProperty(p,e,{configurable:!0,value:l=>{delete p[e];try{j=l(_)}catch{}}}),o.addEventListener("error",l=>{let u=l.target,d=u&&u!==o&&(u.src||u.href);typeof d=="string"?Se.has(u)||O(1,"Failed to load "+d.split(/[?#]/)[0],d):/^Script error\.?$/.test(l.message||"")&&!l.filename?O(1,"Error in a cross-origin script (details only in DevTools console)","","","","","external"):O(1,l.message||"Script error",l.filename||"",l.lineno,l.colno,l.error&&l.error.stack||"")},!0),o.addEventListener("unhandledrejection",l=>G(1,"Unhandled rejection: ",[l.reason],null));let i=console;["warn","error"].forEach((l,u)=>{let d=i[l];typeof d=="function"&&(i[l]=function(...m){if(!F){F=!0;try{G(u,"",m,B(new Error().stack||"",2))}catch{}F=!1}return d.apply(this,m)})});let a=c.createElement("script");a.src=s+"flag.min.js",a.async=!0,a.onerror=()=>T("Stagepass flag could not be loaded: "+a.src),(c.head||c.documentElement).appendChild(a)}catch{}Q("session",{active:L,domain:y,swap:w,debug:M});function Qe(e,n,s){if(w&&s&&h)return V(h,s,Z);let i=e.getAttribute("data-stagepass-v")||Ve;return i?Oe(n,"v",i):n}function ye(e){try{let n=new URL(e).pathname.split("/");return n[n.length-1]||n[n.length-2]||null}catch{let s=e.match(/\/([^\/\?#]+)(?:\?|#|$)/);return s?s[1]:null}}let Se=new WeakSet,Y="";function we(e,n,s,i,a,l){let u={live:n,local:s,type:i?"js":"css",st:""};l&&(u.x=!0);let d=H(s);Se.add(e),_.f.push(u),e.addEventListener("load",()=>{u.st="ok",_.swapped++,ce()}),e.addEventListener("error",()=>{let m=(f,ne,z)=>{u.st=f,O(ne,z,s)},S=o.fetch;if(typeof S!="function")return m("failed",1,`Failed to load ${d}`);S(s,{method:"HEAD",cache:"no-store"}).then(f=>m(f.ok?"failed":String(f.status),1,f.ok?`Failed to load ${d}`:`Local file not found (${f.status}): ${d}`),()=>S(s,{method:"HEAD",mode:"no-cors",cache:"no-store"}).then(()=>{if(!a)return m("failed",1,`Failed to load ${d}`);_.f.splice(_.f.indexOf(u),1),e.replaceWith(a(!1)),O(0,`Local server sends no CORS header for ${d}. Loaded without crossorigin, error details are limited`,s)},()=>m("failed",1,`Local server not reachable: ${d}. Run stagepass doctor`+(re(Y)?". "+re(Y):""))))})}let Ye=["data-stagepass","data-stagepass-path","data-stagepass-cachebust","data-stagepass-v"],X='script[data-stagepass][src]:not([data-src]):not([data-stagepass-processed]),link[rel="stylesheet" i][data-stagepass][href]:not([data-href]):not([data-stagepass-processed])',ve="onbeforescriptexecute"in c;function ke(e){try{let n=e.tagName==="SCRIPT";if(n&&(ve||c.currentScript===e))return;let s=n?"src":"href",i=e.getAttribute(s);if(!i)return;e.setAttribute("data-stagepass-processed","true");let a=e.getAttribute("data-stagepass-path"),l=a||ye(i);if(!l)return;let u=V(h,l,Z);e.removeAttribute("integrity"),e.hasAttribute("crossorigin")||e.setAttribute("crossorigin","anonymous"),e[s]=u,we(e,i,u,n,null,!!a)}catch{}}let ee=e=>{try{e.matches&&e.matches(X)&&ke(e),e.querySelectorAll(X).forEach(ke)}catch{}};function te(e,n,s){c.querySelectorAll(`${e}:not([data-stagepass-processed])`).forEach(i=>{try{let a=i.getAttribute("data-stagepass-path"),l=!!a,u=i.getAttribute(n);if(!u)return;i.setAttribute("data-stagepass-processed","true"),!a&&w&&h&&(a=ye(u));let d=Qe(i,u,a);if(!d)return;let m=w&&a&&h,S=s==="script",f=z=>{let k=c.createElement(s);z&&(k.crossOrigin="anonymous"),S?k.src=d:(k.rel="stylesheet",k.href=d);for(let P of Array.from(i.attributes))P.name!==n&&!Ye.includes(P.name)&&P.name!==(S?"src":"href")&&k.setAttribute(P.name,P.value);return m&&k.removeAttribute("integrity"),S&&Ne(k,i),m&&we(k,u,d,S,z?f:null,l),k},ne=f(!!m&&!i.hasAttribute("crossorigin"));i.parentNode?(i.parentNode.insertBefore(ne,i),i.remove()):de(`${s} injection failed: No parent node`)}catch{}})}if(w&&ae)try{new MutationObserver(e=>{for(let n of e)for(let s of n.addedNodes)s.nodeType===1&&ee(s)}).observe(c.documentElement,{childList:!0,subtree:!0}),ve&&c.addEventListener("beforescriptexecute",e=>{let n=e.target;if(!n||!n.matches||!n.matches(X))return;let s=n.getAttribute("src");!s||s.indexOf("https://"+h+"/")===0||(e.preventDefault(),n.setAttribute("data-src",s),n.removeAttribute("src"),te("script[data-stagepass]","data-src","script"))},!0),ee(c)}catch{}let Xe=()=>{try{te("script[data-stagepass]","data-src","script"),te('link[rel="stylesheet"][data-stagepass]',"data-href","link"),w&&ae&&ee(c),j&&j()}catch{}},Ee=null,et=()=>Ee=Ee||(w?Re().then(e=>{Y=e}).catch(()=>{}):Promise.resolve()),xe=()=>{et().then(Xe)};xe(),c.readyState==="loading"&&c.addEventListener("DOMContentLoaded",xe)})();})();
package/global.d.ts CHANGED
@@ -105,6 +105,8 @@ export type StagepassModuleFactory = (api: StagepassAPI) => void;
105
105
  export interface StagepassAPI {
106
106
  /**
107
107
  * Frozen runtime variables.
108
+ * Prefer flat helpers (`env` / `is` / `can` / `client` / `on`) for new code.
109
+ * In `?stagepass=debug`, the first read logs a one-time hint toward those helpers.
108
110
  * @example
109
111
  * if (sp.vars.isLocal) sp.log('local session on', sp.vars.domain);
110
112
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stagepass/loader",
3
- "version": "2.3.3",
3
+ "version": "2.4.0",
4
4
  "description": "Universal loader for Stagepass - injects local files into Webflow projects",
5
5
  "main": "dist/loader.min.js",
6
6
  "types": "global.d.ts",