@sentientui/core 0.34.0 → 0.34.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/dist/chunk-G6VP7HGJ.mjs +2 -0
  2. package/dist/chunk-G6VP7HGJ.mjs.map +1 -0
  3. package/dist/{chunk-3FKD44SF.mjs → chunk-NCLBL5V3.mjs} +1 -1
  4. package/dist/{chunk-3FKD44SF.mjs.map → chunk-NCLBL5V3.mjs.map} +1 -1
  5. package/dist/{index-C2EOL-_c.d.cts → index-Dyc-wA0o.d.cts} +3 -3
  6. package/dist/{index-DrMXbLKP.d.ts → index-JgzRgOO4.d.ts} +3 -3
  7. package/dist/index-engagement.mjs +1 -1
  8. package/dist/index-graph.d.cts +6 -6
  9. package/dist/index-graph.d.ts +6 -6
  10. package/dist/index-graph.mjs +1 -1
  11. package/dist/index-local.d.cts +4 -4
  12. package/dist/index-local.d.ts +4 -4
  13. package/dist/index-region.d.cts +1 -1
  14. package/dist/index-region.d.ts +1 -1
  15. package/dist/index-region.js +1 -1
  16. package/dist/index-region.js.map +1 -1
  17. package/dist/index-region.mjs +1 -1
  18. package/dist/index-region.mjs.map +1 -1
  19. package/dist/index-server.d.cts +4 -4
  20. package/dist/index-server.d.ts +4 -4
  21. package/dist/index-style-sample.d.cts +2 -2
  22. package/dist/index-style-sample.d.ts +2 -2
  23. package/dist/index-style-sample.js +1 -1
  24. package/dist/index-style-sample.js.map +1 -1
  25. package/dist/index-style-sample.mjs +1 -1
  26. package/dist/index-style-sample.mjs.map +1 -1
  27. package/dist/index.d.cts +4 -4
  28. package/dist/index.d.ts +4 -4
  29. package/dist/index.js.map +1 -1
  30. package/dist/index.mjs +1 -1
  31. package/dist/{region-skeleton-CQ4yhVw1.d.cts → region-skeleton-D2ahkcbe.d.cts} +5 -0
  32. package/dist/{region-skeleton-CQ4yhVw1.d.ts → region-skeleton-D2ahkcbe.d.ts} +5 -0
  33. package/dist/{session-meta-KwDqU9a8.d.cts → session-meta-CJwAWbJr.d.cts} +2 -2
  34. package/dist/{session-meta-CWGtzFOQ.d.ts → session-meta-CKXcaBjt.d.ts} +2 -2
  35. package/dist/{style-vocabulary-BqviEw9O.d.cts → style-vocabulary-Ba_g6_DD.d.cts} +6 -0
  36. package/dist/{style-vocabulary-BqviEw9O.d.ts → style-vocabulary-Ba_g6_DD.d.ts} +6 -0
  37. package/package.json +1 -1
@@ -0,0 +1,2 @@
1
+ var o=/(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch|color)\([^()]*\)|#[0-9a-f]{3,8}\b/gi,c=/^rgba?\(\s*[\d.]+[,\s]+[\d.]+[,\s]+[\d.]+(?:[,\s/]+[\d.]+%?)?\s*\)$/i,a;function d(e){if(a!==void 0)return a;try{let r=e.createElement("canvas");r.width=r.height=1,a=r.getContext("2d",{willReadFrequently:!0})}catch(r){a=null}return a}function f(e,r){let t=(e!=null?e:"").trim();if(t===""||t==="transparent")return t==="transparent"?"rgba(0, 0, 0, 0)":"";if(c.test(t)||/^#[0-9a-f]{3,8}$/i.test(t))return t;let n=d(r);if(!n)return"";try{if(n.fillStyle="#010203",n.fillStyle=t,String(n.fillStyle).toLowerCase()==="#010203"&&t.toLowerCase()!=="#010203")return"";n.clearRect(0,0,1,1),n.fillRect(0,0,1,1);let[i,l,s,u]=n.getImageData(0,0,1,1).data;return u===255?`rgb(${i}, ${l}, ${s})`:`rgba(${i}, ${l}, ${s}, ${Math.round(u/255*1e3)/1e3})`}catch(i){return""}}function g(e,r){var t;return!e||e==="none"||!/gradient/i.test(e)?[]:((t=e.match(o))!=null?t:[]).map(n=>f(n,r)).filter(n=>n!=="")}export{f as a,g as b};
2
+ //# sourceMappingURL=chunk-G6VP7HGJ.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/css-color.ts"],"sourcesContent":["// Browser colour normalization for capture (spec 2026-09-23 §4.1/§4.2).\n// Chrome reports Tailwind v4 colours as `lab(…)` / `oklch(…)`, and the\n// contrast math, the server's colour check and the prompts all read `rgb()`.\n// Without this, a Tailwind v4 site's blue primary button had no measurable\n// fill (captured as a secondary button), its grey body text had no colour\n// (unusable under the contrast gate) and a slate gradient lost a stop —\n// found on bodyshopmanchester.co.uk, 2026-09-23.\n//\n// The browser is the one colour-space converter that is always right, so the\n// colour is painted to a 1×1 canvas and read back. No canvas (jsdom, some\n// privacy modes) → '' for non-rgb input: unknown, which every consumer\n// already treats as \"not measured\" rather than guessing.\n\nconst FN = /(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch|color)\\([^()]*\\)|#[0-9a-f]{3,8}\\b/gi;\nconst RGB = /^rgba?\\(\\s*[\\d.]+[,\\s]+[\\d.]+[,\\s]+[\\d.]+(?:[,\\s/]+[\\d.]+%?)?\\s*\\)$/i;\n\nlet ctx: CanvasRenderingContext2D | null | undefined;\n\nfunction context(doc: Document): CanvasRenderingContext2D | null {\n if (ctx !== undefined) return ctx;\n try {\n const c = doc.createElement('canvas');\n c.width = c.height = 1;\n ctx = c.getContext('2d', { willReadFrequently: true }) as CanvasRenderingContext2D | null;\n } catch {\n ctx = null;\n }\n return ctx;\n}\n\n/** `rgb(r, g, b)` / `rgba(r, g, b, a)` for any CSS colour; '' when unknown. */\nexport function toRgb(color: string | null | undefined, doc: Document): string {\n const c = (color ?? '').trim();\n if (c === '' || c === 'transparent') return c === 'transparent' ? 'rgba(0, 0, 0, 0)' : '';\n if (RGB.test(c) || /^#[0-9a-f]{3,8}$/i.test(c)) return c;\n const g = context(doc);\n if (!g) return '';\n try {\n // A sentinel detects an unparsable value: assigning garbage to fillStyle\n // is silently ignored, which would otherwise read back the sentinel.\n g.fillStyle = '#010203';\n g.fillStyle = c;\n if (String(g.fillStyle).toLowerCase() === '#010203' && c.toLowerCase() !== '#010203') return '';\n g.clearRect(0, 0, 1, 1);\n g.fillRect(0, 0, 1, 1);\n const [r, gr, b, a] = g.getImageData(0, 0, 1, 1).data as unknown as number[];\n return a === 255 ? `rgb(${r}, ${gr}, ${b})` : `rgba(${r}, ${gr}, ${b}, ${Math.round((a! / 255) * 1000) / 1000})`;\n } catch {\n return '';\n }\n}\n\n/** Colour stops of a `background-image` gradient, normalized; [] for none. */\nexport function gradientStopsRgb(img: string | null | undefined, doc: Document): string[] {\n if (!img || img === 'none' || !/gradient/i.test(img)) return [];\n return (img.match(FN) ?? []).map((s) => toRgb(s, doc)).filter((s) => s !== '');\n}\n\n/** Test seam: forget the cached canvas context. */\nexport function resetColorCanvas(): void {\n ctx = undefined;\n}\n"],"mappings":"AAaA,IAAMA,EAAK,6EACLC,EAAM,uEAERC,EAEJ,SAASC,EAAQC,EAAgD,CAC/D,GAAIF,IAAQ,OAAW,OAAOA,EAC9B,GAAI,CACF,IAAMG,EAAID,EAAI,cAAc,QAAQ,EACpCC,EAAE,MAAQA,EAAE,OAAS,EACrBH,EAAMG,EAAE,WAAW,KAAM,CAAE,mBAAoB,EAAK,CAAC,CACvD,OAAQC,EAAA,CACNJ,EAAM,IACR,CACA,OAAOA,CACT,CAGO,SAASK,EAAMC,EAAkCJ,EAAuB,CAC7E,IAAMC,GAAKG,GAAA,KAAAA,EAAS,IAAI,KAAK,EAC7B,GAAIH,IAAM,IAAMA,IAAM,cAAe,OAAOA,IAAM,cAAgB,mBAAqB,GACvF,GAAIJ,EAAI,KAAKI,CAAC,GAAK,oBAAoB,KAAKA,CAAC,EAAG,OAAOA,EACvD,IAAMI,EAAIN,EAAQC,CAAG,EACrB,GAAI,CAACK,EAAG,MAAO,GACf,GAAI,CAKF,GAFAA,EAAE,UAAY,UACdA,EAAE,UAAYJ,EACV,OAAOI,EAAE,SAAS,EAAE,YAAY,IAAM,WAAaJ,EAAE,YAAY,IAAM,UAAW,MAAO,GAC7FI,EAAE,UAAU,EAAG,EAAG,EAAG,CAAC,EACtBA,EAAE,SAAS,EAAG,EAAG,EAAG,CAAC,EACrB,GAAM,CAACC,EAAGC,EAAIC,EAAGC,CAAC,EAAIJ,EAAE,aAAa,EAAG,EAAG,EAAG,CAAC,EAAE,KACjD,OAAOI,IAAM,IAAM,OAAOH,CAAC,KAAKC,CAAE,KAAKC,CAAC,IAAM,QAAQF,CAAC,KAAKC,CAAE,KAAKC,CAAC,KAAK,KAAK,MAAOC,EAAK,IAAO,GAAI,EAAI,GAAI,GAC/G,OAAQP,EAAA,CACN,MAAO,EACT,CACF,CAGO,SAASQ,EAAiBC,EAAgCX,EAAyB,CArD1F,IAAAY,EAsDE,MAAI,CAACD,GAAOA,IAAQ,QAAU,CAAC,YAAY,KAAKA,CAAG,EAAU,CAAC,IACtDC,EAAAD,EAAI,MAAMf,CAAE,IAAZ,KAAAgB,EAAiB,CAAC,GAAG,IAAKC,GAAMV,EAAMU,EAAGb,CAAG,CAAC,EAAE,OAAQa,GAAMA,IAAM,EAAE,CAC/E","names":["FN","RGB","ctx","context","doc","c","e","toRgb","color","g","r","gr","b","a","gradientStopsRgb","img","_a","s"]}
@@ -1,2 +1,2 @@
1
1
  var e=40,t=120,o=300;export{e as a,t as b,o as c};
2
- //# sourceMappingURL=chunk-3FKD44SF.mjs.map
2
+ //# sourceMappingURL=chunk-NCLBL5V3.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/region-skeleton.ts"],"sourcesContent":["// Region skeleton (spec 2026-09-23 §4.1). The generator used to see a region\n// as its flattened textContent — \"Get in touch WhatsApp photos\" — and wrote a\n// heading + paragraph for what were two buttons. The skeleton is the region's\n// STRUCTURE: every element that carries text, its role, link, emphasis and\n// colour, so generation can write per-element edits and both SDKs can apply\n// them to the developer's own elements.\n//\n// Only the wrapped region is ever read (same scope as baselineText); query\n// strings and hashes never leave the page (tracking ids, sometimes PII).\n\nexport const MAX_SKELETON_NODES = 40;\nexport const MAX_SKELETON_LEAVES = 120;\nexport const MAX_SKELETON_TEXT = 300;\n\nexport type SkeletonRole = 'action' | 'heading' | 'text' | 'label' | 'image';\nexport type SkeletonNode = {\n tag: string;\n role: SkeletonRole;\n level?: 1 | 2 | 3 | 4 | 5 | 6;\n text: string; // joined normalized leaves of this node (image: alt)\n classes: string; // class attribute, whitespace-normalized\n filled?: boolean; // action only\n href?: string; // action only; same-origin → path; else origin+path; never query/hash\n src?: string; // image only; same rule\n color: string; // computed `color`\n group: number; // index of the node owner's parentElement among distinct parents\n restylable: boolean; // snippet: always true; React: set by annotateSkeletonForReact\n};\nexport type RegionSkeleton = {\n v: 1;\n root: { tag: string; classes: string; ambientBg: string | null; ambientBgAlt?: string; ambientText: string };\n nodes: SkeletonNode[];\n leaves: string[]; // normalized non-blank text leaves, document order\n leafToNode: number[]; // leaves[i] belongs to nodes[leafToNode[i]]\n fp: string;\n};\nexport type ArmEdits = {\n nodes: Record<string, { text?: string; hidden?: true; like?: number }>;\n order?: Record<string, number[]>;\n};\n/** What the requesting page can render for one slot (decide `render` field). */\nexport type RenderCaps = {\n fp?: string; // omitted = unknown (SSR): server assumes the stored skeleton\n forms: boolean; // a form-arm handler exists\n compose: boolean; // phase 2; always false in phase 1\n authored?: string[]; // phase 3\n content?: boolean; // false = a content arm cannot land (0 or >1 text leaves). Omitted = true.\n children?: boolean; // phase 3: false = no children to render, the first authored key is the baseline. Omitted = true.\n};\n/** How the server serves an `edits` arm (SlotConfigEntry.edits). */\nexport type ServedEdits = { edits: ArmEdits; fp: string; leafToNode: number[] };\n\n// DOM capture lives in ./region-capture.ts, exported from\n// `@sentientui/core/region`: only React and the snippet need it, and it would\n// otherwise ship in the lean entry every plain-JS install downloads.\n"],"mappings":"AAUO,IAAMA,EAAqB,GACrBC,EAAsB,IACtBC,EAAoB","names":["MAX_SKELETON_NODES","MAX_SKELETON_LEAVES","MAX_SKELETON_TEXT"]}
1
+ {"version":3,"sources":["../src/region-skeleton.ts"],"sourcesContent":["// Region skeleton (spec 2026-09-23 §4.1). The generator used to see a region\n// as its flattened textContent — \"Get in touch WhatsApp photos\" — and wrote a\n// heading + paragraph for what were two buttons. The skeleton is the region's\n// STRUCTURE: every element that carries text, its role, link, emphasis and\n// colour, so generation can write per-element edits and both SDKs can apply\n// them to the developer's own elements.\n//\n// Only the wrapped region is ever read (same scope as baselineText); query\n// strings and hashes never leave the page (tracking ids, sometimes PII).\n\nexport const MAX_SKELETON_NODES = 40;\nexport const MAX_SKELETON_LEAVES = 120;\nexport const MAX_SKELETON_TEXT = 300;\n\nexport type SkeletonRole = 'action' | 'heading' | 'text' | 'label' | 'image';\nexport type SkeletonNode = {\n tag: string;\n role: SkeletonRole;\n level?: 1 | 2 | 3 | 4 | 5 | 6;\n text: string; // joined normalized leaves of this node (image: alt)\n classes: string; // class attribute, whitespace-normalized\n filled?: boolean; // action only\n href?: string; // action only; same-origin → path; else origin+path; never query/hash\n src?: string; // image only; same rule\n color: string; // computed `color`\n group: number; // index of the node owner's parentElement among distinct parents\n restylable: boolean; // snippet: always true; React: set by annotateSkeletonForReact\n};\nexport type RegionSkeleton = {\n v: 1;\n root: { tag: string; classes: string; ambientBg: string | null; ambientBgAlt?: string; ambientText: string };\n nodes: SkeletonNode[];\n leaves: string[]; // normalized non-blank text leaves, document order\n leafToNode: number[]; // leaves[i] belongs to nodes[leafToNode[i]]\n fp: string;\n /** false = the page can't address these elements for per-element edits\n * (React: the region wraps a component whose text the element tree can't\n * see). The capture still describes the region — enough to REDESIGN it,\n * which replaces the whole region — but no Rewrite arm may target it. */\n editable?: false;\n};\nexport type ArmEdits = {\n nodes: Record<string, { text?: string; hidden?: true; like?: number }>;\n order?: Record<string, number[]>;\n};\n/** What the requesting page can render for one slot (decide `render` field). */\nexport type RenderCaps = {\n fp?: string; // omitted = unknown (SSR): server assumes the stored skeleton\n forms: boolean; // a form-arm handler exists\n compose: boolean; // phase 2; always false in phase 1\n authored?: string[]; // phase 3\n content?: boolean; // false = a content arm cannot land (0 or >1 text leaves). Omitted = true.\n children?: boolean; // phase 3: false = no children to render, the first authored key is the baseline. Omitted = true.\n};\n/** How the server serves an `edits` arm (SlotConfigEntry.edits). */\nexport type ServedEdits = { edits: ArmEdits; fp: string; leafToNode: number[] };\n\n// DOM capture lives in ./region-capture.ts, exported from\n// `@sentientui/core/region`: only React and the snippet need it, and it would\n// otherwise ship in the lean entry every plain-JS install downloads.\n"],"mappings":"AAUO,IAAMA,EAAqB,GACrBC,EAAsB,IACtBC,EAAoB","names":["MAX_SKELETON_NODES","MAX_SKELETON_LEAVES","MAX_SKELETON_TEXT"]}
@@ -1,6 +1,6 @@
1
- import { $ as SitePalette, a4 as StyleVocabulary } from './style-vocabulary-BqviEw9O.cjs';
2
- import { d as SlotConfigEntry, e as SlotDeclInput, b as CompoundLocator } from './session-meta-KwDqU9a8.cjs';
3
- import { c as RenderCaps, R as RegionSkeleton } from './region-skeleton-CQ4yhVw1.cjs';
1
+ import { $ as SitePalette, a4 as StyleVocabulary } from './style-vocabulary-Ba_g6_DD.cjs';
2
+ import { d as SlotConfigEntry, e as SlotDeclInput, b as CompoundLocator } from './session-meta-CJwAWbJr.cjs';
3
+ import { c as RenderCaps, R as RegionSkeleton } from './region-skeleton-D2ahkcbe.cjs';
4
4
  import { SlotResult } from '@sentientui/policy';
5
5
 
6
6
  /** Manages anonymous session identity with cookie + localStorage layers. */
@@ -1,6 +1,6 @@
1
- import { $ as SitePalette, a4 as StyleVocabulary } from './style-vocabulary-BqviEw9O.js';
2
- import { d as SlotConfigEntry, e as SlotDeclInput, b as CompoundLocator } from './session-meta-CWGtzFOQ.js';
3
- import { c as RenderCaps, R as RegionSkeleton } from './region-skeleton-CQ4yhVw1.js';
1
+ import { $ as SitePalette, a4 as StyleVocabulary } from './style-vocabulary-Ba_g6_DD.js';
2
+ import { d as SlotConfigEntry, e as SlotDeclInput, b as CompoundLocator } from './session-meta-CKXcaBjt.js';
3
+ import { c as RenderCaps, R as RegionSkeleton } from './region-skeleton-D2ahkcbe.js';
4
4
  import { SlotResult } from '@sentientui/policy';
5
5
 
6
6
  /** Manages anonymous session identity with cookie + localStorage layers. */
@@ -1,2 +1,2 @@
1
- import{a as Z}from"./chunk-WKXD7KI3.mjs";import{K as Q,M as X}from"./chunk-DGRAS5VP.mjs";import"./chunk-3FKD44SF.mjs";import"./chunk-2NVSFI4V.mjs";import{a as j,d as J,e as H,f as q,g as se}from"./chunk-Z6ILOYBD.mjs";import{a as $,b as z}from"./chunk-TMCGHANO.mjs";import{fnv1a as ue}from"@sentientui/policy";var ee=[100,300,1e3,3e3,1e4],ie=250,ae=1e3,ce=new Set(["Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight"]);function te(t,o){t.n++;let e=o-t.mean;t.mean+=e/t.n,t.m2+=e*(o-t.mean)}var ne=t=>t.n>1?Math.sqrt(t.m2/t.n):0;function le(t){var o;try{let e=t.createElement("canvas"),u=e.getContext("webgl")||e.getContext("experimental-webgl");if(!u)return"unknown";let d=u.getExtension("WEBGL_debug_renderer_info"),p=d?String((o=u.getParameter(d.UNMASKED_RENDERER_WEBGL))!=null?o:""):"";return p?/swiftshader|llvmpipe|softpipe|software|mesa offscreen/i.test(p)?"sw":"hw":"unknown"}catch(e){return"unknown"}}function re(t,o=Date.now){var a,c;let e=(a=t.defaultView)!=null?a:typeof window!="undefined"?window:void 0,u={n:0,mean:0,m2:0},d={n:0,mean:0,m2:0},p=[0,0,0,0,0,0],_=0,G=0,k=0,U=0,g=0,V=0,T=0,h=0,I=0,b=0,L=-1/0,C=-1/0,m=null,w=null,A=null,x=(c=e==null?void 0:e.scrollY)!=null?c:0,N=0,f=t.hidden?null:o(),E=()=>{let n=o();if(A!=null){let l=n-A,v=0;for(;v<ee.length&&l>=ee[v];)v++;p[v]++}A=n},O=()=>{_++,L=o()},R=()=>{G++,C=o()},M=()=>{m=o()},D=()=>{m!=null&&(te(u,o()-m),m=null)},P=()=>{let n=o();k++,n-L>ie&&n-C>ae&&U++,E()},S=()=>{g++},W=()=>{var l;let n=(l=e==null?void 0:e.scrollY)!=null?l:0;V+=Math.abs(n-x),x=n,E()},K=n=>{let l=o();T++,(n.key==="Backspace"||n.key==="Delete")&&I++,ce.has(n.key)&&b++,w!=null&&te(d,l-w),w=l,E()},F=n=>{let l=n.data;typeof l=="string"&&(h+=l.length),E()},B=()=>{let n=o();t.hidden?f!=null&&(N+=n-f,f=null):f==null&&(f=n)},i={passive:!0,capture:!0};t.addEventListener("mousemove",O,i),t.addEventListener("touchstart",R,i),t.addEventListener("touchmove",S,i),t.addEventListener("mousedown",M,i),t.addEventListener("mouseup",D,i),t.addEventListener("click",P,i),t.addEventListener("wheel",S,i),t.addEventListener("keydown",K,i),t.addEventListener("input",F,i),t.addEventListener("visibilitychange",B),e==null||e.addEventListener("scroll",W,i);let r=le(t),s=(()=>{var n;try{return((n=e==null?void 0:e.matchMedia)==null?void 0:n.call(e,"(prefers-reduced-motion: reduce)").matches)===!0}catch(l){return!1}})();return{snapshot(){var v,y;let n=o(),l=N+(f!=null?n-f:0);return{v:1,active_ms:Math.round(l),mm:_,mm_rate:l>0?Number((_*1e3/l).toFixed(2)):0,touches:G,clicks:k,hold_n:u.n,hold_mean:Math.round(u.mean),hold_std:Math.round(ne(u)),teleport:U,wheel:g,scroll_px:Math.round(V),keydowns:T,input_chars:h,ik_cv:d.mean>0?Number((ne(d)/d.mean).toFixed(2)):0,backspaces:I,gaps:[...p],reduced_motion:s,kb_nav:b,renderer:r,vp:[(v=e==null?void 0:e.innerWidth)!=null?v:0,(y=e==null?void 0:e.innerHeight)!=null?y:0],dpr:(e==null?void 0:e.devicePixelRatio)||1}},stop(){t.removeEventListener("mousemove",O,i),t.removeEventListener("touchstart",R,i),t.removeEventListener("touchmove",S,i),t.removeEventListener("mousedown",M,i),t.removeEventListener("mouseup",D,i),t.removeEventListener("click",P,i),t.removeEventListener("wheel",S,i),t.removeEventListener("keydown",K,i),t.removeEventListener("input",F,i),t.removeEventListener("visibilitychange",B),e==null||e.removeEventListener("scroll",W,i)}}}var de="section, header, footer, nav, main > div, [data-sentient-section]",me=2e4,oe="__session__";function pe(t){let o=Array.from(t.querySelectorAll(de)),e=o.filter(u=>o.filter(d=>d!==u&&u.contains(d)).length<2);return e.filter(u=>!e.some(d=>d!==u&&d.contains(u)))}function fe(t,o,e,u){try{fetch(`${o}/v1/section-map`,{method:"POST",keepalive:!0,headers:{"content-type":"application/json",authorization:`Bearer ${t}`},body:JSON.stringify({pageUrl:e,sections:u})}).catch(()=>{})}catch(d){}}var Y=()=>{};function ve(t,o){var x,N,f,E,O,R,M,D,P,S,W,K,F,B,i;let e=(x=o.doc)!=null?x:typeof document!="undefined"?document:void 0;if(!e||typeof IntersectionObserver=="undefined"||X()||!o.apiKey||!o.apiKey.startsWith("pk_"))return Y;let u=((N=o.apiBase)!=null?N:"https://api.sentient-ui.com").replace(/\/+$/,"").replace(/\/v1$/,""),d=pe(e);if(d.length===0)return Y;let p=new Map,_=[];for(let r of d){let s=(O=[(E=o.sectionTypes)==null?void 0:E[(f=r.getAttribute("data-sentient-id"))!=null?f:""],r.getAttribute("data-sentient-type")].find(y=>j.includes(y)))!=null?O:null,a=q(r),c=(M=s!=null?s:(R=o.typeOf)==null?void 0:R.call(o,r))!=null?M:H(a).type,n=Z(r,e),l=n?`nc-${c}-${ue(JSON.stringify({id:(D=n.id)!=null?D:null,dataAttr:(P=n.dataAttr)!=null?P:null,selector:(S=n.selector)!=null?S:null})).toString(36)}`:`nc-${c}`;p.set(r,l);let v=J.filter(([,y])=>y.test(a.bodyText)).map(([y])=>y);_.push(z($({componentId:l,semanticType:c,source:s?"markup":"auto"},n?{locator:n}:{}),{observation:$($({tag:a.tag,idClass:a.idClass.slice(0,200),headingText:a.headingText,textLength:a.textLength,actionCount:a.actionCount},a.ariaRole?{ariaRole:a.ariaRole}:{}),v.length>0?{patternFlags:v}:{})}))}let G=(B=(F=(K=(W=e.defaultView)!=null?W:typeof window!="undefined"?window:void 0)==null?void 0:K.location)==null?void 0:F.pathname)!=null?B:"/";fe(o.apiKey,u,G,_);let k=re(e),U=()=>{let r;try{r=k.snapshot()}catch(s){return}try{t.track({projectId:o.apiKey,componentId:oe,eventType:"interaction_stats",payload:r})}catch(s){}},g=new Map,V=r=>{let s=g.get(r);return s||(s={ms:0,scroll:0,enterAt:null,intersecting:!1},g.set(r,s)),s},T=new IntersectionObserver(r=>{for(let s of r){let a=p.get(s.target);if(!a)continue;let c=V(a);s.isIntersecting?(c.intersecting=!0,c.enterAt=Date.now(),s.intersectionRatio>c.scroll&&(c.scroll=s.intersectionRatio)):(c.intersecting=!1,c.enterAt!=null&&(c.ms+=Date.now()-c.enterAt,c.enterAt=null))}},{threshold:[0,.25,.5,.75,1]});for(let r of p.keys())T.observe(r);let h=(r=!1)=>{var a;let s=Date.now();for(let[c,n]of g)if(n.enterAt!=null&&(n.ms+=s-n.enterAt,n.enterAt=null),!(n.ms<=0)){try{t.track({projectId:o.apiKey,componentId:c,eventType:"dwell",payload:{dwell_time:Math.round(n.ms),scroll_depth:Number(n.scroll.toFixed(2))}})}catch(l){}n.ms=0}if(U(),r)try{(a=t.flush)==null||a.call(t)}catch(c){}},I=()=>{if(e.hidden)h(!0);else{let r=Date.now();for(let s of g.values())s.intersecting&&(s.enterAt=r)}},b=!1,L=r=>{if(h(!0),r!=null&&r.persisted){b=!0;return}try{T.disconnect()}catch(s){}},C=r=>{if(!(r!=null&&r.persisted)||!b)return;b=!1;let s=Date.now();for(let a of g.values())a.enterAt=a.intersecting&&!e.hidden?s:null};e.addEventListener("visibilitychange",I);let m=(i=e.defaultView)!=null?i:typeof window!="undefined"?window:void 0;m==null||m.addEventListener("pagehide",L),m==null||m.addEventListener("pageshow",C);let w=setInterval(()=>{if(e.hidden||b)return;h();let r=Date.now();for(let s of g.values())s.intersecting&&(s.enterAt=r)},me),A=[];return o.microSignals&&[...p.entries()].forEach(([r,s],a)=>{A.push(Q((c,n={})=>{try{t.track({projectId:o.apiKey,componentId:s,eventType:"micro_signal",payload:$({signalType:c},n)})}catch(l){}},r,void 0,{tabLoss:a===0}))}),()=>{h(!0),clearInterval(w),k.stop(),e.removeEventListener("visibilitychange",I),m==null||m.removeEventListener("pagehide",L),m==null||m.removeEventListener("pageshow",C);for(let r of A)r();try{T.disconnect()}catch(r){}}}export{oe as INTERACTION_STATS_COMPONENT,j as SEMANTIC_TYPES,H as classifyFeatures,se as classifySection,q as featuresFromElement,ve as startEngagementCapture};
1
+ import{a as Z}from"./chunk-WKXD7KI3.mjs";import{K as Q,M as X}from"./chunk-DGRAS5VP.mjs";import"./chunk-NCLBL5V3.mjs";import"./chunk-2NVSFI4V.mjs";import{a as j,d as J,e as H,f as q,g as se}from"./chunk-Z6ILOYBD.mjs";import{a as $,b as z}from"./chunk-TMCGHANO.mjs";import{fnv1a as ue}from"@sentientui/policy";var ee=[100,300,1e3,3e3,1e4],ie=250,ae=1e3,ce=new Set(["Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight"]);function te(t,o){t.n++;let e=o-t.mean;t.mean+=e/t.n,t.m2+=e*(o-t.mean)}var ne=t=>t.n>1?Math.sqrt(t.m2/t.n):0;function le(t){var o;try{let e=t.createElement("canvas"),u=e.getContext("webgl")||e.getContext("experimental-webgl");if(!u)return"unknown";let d=u.getExtension("WEBGL_debug_renderer_info"),p=d?String((o=u.getParameter(d.UNMASKED_RENDERER_WEBGL))!=null?o:""):"";return p?/swiftshader|llvmpipe|softpipe|software|mesa offscreen/i.test(p)?"sw":"hw":"unknown"}catch(e){return"unknown"}}function re(t,o=Date.now){var a,c;let e=(a=t.defaultView)!=null?a:typeof window!="undefined"?window:void 0,u={n:0,mean:0,m2:0},d={n:0,mean:0,m2:0},p=[0,0,0,0,0,0],_=0,G=0,k=0,U=0,g=0,V=0,T=0,h=0,I=0,b=0,L=-1/0,C=-1/0,m=null,w=null,A=null,x=(c=e==null?void 0:e.scrollY)!=null?c:0,N=0,f=t.hidden?null:o(),E=()=>{let n=o();if(A!=null){let l=n-A,v=0;for(;v<ee.length&&l>=ee[v];)v++;p[v]++}A=n},O=()=>{_++,L=o()},R=()=>{G++,C=o()},M=()=>{m=o()},D=()=>{m!=null&&(te(u,o()-m),m=null)},P=()=>{let n=o();k++,n-L>ie&&n-C>ae&&U++,E()},S=()=>{g++},W=()=>{var l;let n=(l=e==null?void 0:e.scrollY)!=null?l:0;V+=Math.abs(n-x),x=n,E()},K=n=>{let l=o();T++,(n.key==="Backspace"||n.key==="Delete")&&I++,ce.has(n.key)&&b++,w!=null&&te(d,l-w),w=l,E()},F=n=>{let l=n.data;typeof l=="string"&&(h+=l.length),E()},B=()=>{let n=o();t.hidden?f!=null&&(N+=n-f,f=null):f==null&&(f=n)},i={passive:!0,capture:!0};t.addEventListener("mousemove",O,i),t.addEventListener("touchstart",R,i),t.addEventListener("touchmove",S,i),t.addEventListener("mousedown",M,i),t.addEventListener("mouseup",D,i),t.addEventListener("click",P,i),t.addEventListener("wheel",S,i),t.addEventListener("keydown",K,i),t.addEventListener("input",F,i),t.addEventListener("visibilitychange",B),e==null||e.addEventListener("scroll",W,i);let r=le(t),s=(()=>{var n;try{return((n=e==null?void 0:e.matchMedia)==null?void 0:n.call(e,"(prefers-reduced-motion: reduce)").matches)===!0}catch(l){return!1}})();return{snapshot(){var v,y;let n=o(),l=N+(f!=null?n-f:0);return{v:1,active_ms:Math.round(l),mm:_,mm_rate:l>0?Number((_*1e3/l).toFixed(2)):0,touches:G,clicks:k,hold_n:u.n,hold_mean:Math.round(u.mean),hold_std:Math.round(ne(u)),teleport:U,wheel:g,scroll_px:Math.round(V),keydowns:T,input_chars:h,ik_cv:d.mean>0?Number((ne(d)/d.mean).toFixed(2)):0,backspaces:I,gaps:[...p],reduced_motion:s,kb_nav:b,renderer:r,vp:[(v=e==null?void 0:e.innerWidth)!=null?v:0,(y=e==null?void 0:e.innerHeight)!=null?y:0],dpr:(e==null?void 0:e.devicePixelRatio)||1}},stop(){t.removeEventListener("mousemove",O,i),t.removeEventListener("touchstart",R,i),t.removeEventListener("touchmove",S,i),t.removeEventListener("mousedown",M,i),t.removeEventListener("mouseup",D,i),t.removeEventListener("click",P,i),t.removeEventListener("wheel",S,i),t.removeEventListener("keydown",K,i),t.removeEventListener("input",F,i),t.removeEventListener("visibilitychange",B),e==null||e.removeEventListener("scroll",W,i)}}}var de="section, header, footer, nav, main > div, [data-sentient-section]",me=2e4,oe="__session__";function pe(t){let o=Array.from(t.querySelectorAll(de)),e=o.filter(u=>o.filter(d=>d!==u&&u.contains(d)).length<2);return e.filter(u=>!e.some(d=>d!==u&&d.contains(u)))}function fe(t,o,e,u){try{fetch(`${o}/v1/section-map`,{method:"POST",keepalive:!0,headers:{"content-type":"application/json",authorization:`Bearer ${t}`},body:JSON.stringify({pageUrl:e,sections:u})}).catch(()=>{})}catch(d){}}var Y=()=>{};function ve(t,o){var x,N,f,E,O,R,M,D,P,S,W,K,F,B,i;let e=(x=o.doc)!=null?x:typeof document!="undefined"?document:void 0;if(!e||typeof IntersectionObserver=="undefined"||X()||!o.apiKey||!o.apiKey.startsWith("pk_"))return Y;let u=((N=o.apiBase)!=null?N:"https://api.sentient-ui.com").replace(/\/+$/,"").replace(/\/v1$/,""),d=pe(e);if(d.length===0)return Y;let p=new Map,_=[];for(let r of d){let s=(O=[(E=o.sectionTypes)==null?void 0:E[(f=r.getAttribute("data-sentient-id"))!=null?f:""],r.getAttribute("data-sentient-type")].find(y=>j.includes(y)))!=null?O:null,a=q(r),c=(M=s!=null?s:(R=o.typeOf)==null?void 0:R.call(o,r))!=null?M:H(a).type,n=Z(r,e),l=n?`nc-${c}-${ue(JSON.stringify({id:(D=n.id)!=null?D:null,dataAttr:(P=n.dataAttr)!=null?P:null,selector:(S=n.selector)!=null?S:null})).toString(36)}`:`nc-${c}`;p.set(r,l);let v=J.filter(([,y])=>y.test(a.bodyText)).map(([y])=>y);_.push(z($({componentId:l,semanticType:c,source:s?"markup":"auto"},n?{locator:n}:{}),{observation:$($({tag:a.tag,idClass:a.idClass.slice(0,200),headingText:a.headingText,textLength:a.textLength,actionCount:a.actionCount},a.ariaRole?{ariaRole:a.ariaRole}:{}),v.length>0?{patternFlags:v}:{})}))}let G=(B=(F=(K=(W=e.defaultView)!=null?W:typeof window!="undefined"?window:void 0)==null?void 0:K.location)==null?void 0:F.pathname)!=null?B:"/";fe(o.apiKey,u,G,_);let k=re(e),U=()=>{let r;try{r=k.snapshot()}catch(s){return}try{t.track({projectId:o.apiKey,componentId:oe,eventType:"interaction_stats",payload:r})}catch(s){}},g=new Map,V=r=>{let s=g.get(r);return s||(s={ms:0,scroll:0,enterAt:null,intersecting:!1},g.set(r,s)),s},T=new IntersectionObserver(r=>{for(let s of r){let a=p.get(s.target);if(!a)continue;let c=V(a);s.isIntersecting?(c.intersecting=!0,c.enterAt=Date.now(),s.intersectionRatio>c.scroll&&(c.scroll=s.intersectionRatio)):(c.intersecting=!1,c.enterAt!=null&&(c.ms+=Date.now()-c.enterAt,c.enterAt=null))}},{threshold:[0,.25,.5,.75,1]});for(let r of p.keys())T.observe(r);let h=(r=!1)=>{var a;let s=Date.now();for(let[c,n]of g)if(n.enterAt!=null&&(n.ms+=s-n.enterAt,n.enterAt=null),!(n.ms<=0)){try{t.track({projectId:o.apiKey,componentId:c,eventType:"dwell",payload:{dwell_time:Math.round(n.ms),scroll_depth:Number(n.scroll.toFixed(2))}})}catch(l){}n.ms=0}if(U(),r)try{(a=t.flush)==null||a.call(t)}catch(c){}},I=()=>{if(e.hidden)h(!0);else{let r=Date.now();for(let s of g.values())s.intersecting&&(s.enterAt=r)}},b=!1,L=r=>{if(h(!0),r!=null&&r.persisted){b=!0;return}try{T.disconnect()}catch(s){}},C=r=>{if(!(r!=null&&r.persisted)||!b)return;b=!1;let s=Date.now();for(let a of g.values())a.enterAt=a.intersecting&&!e.hidden?s:null};e.addEventListener("visibilitychange",I);let m=(i=e.defaultView)!=null?i:typeof window!="undefined"?window:void 0;m==null||m.addEventListener("pagehide",L),m==null||m.addEventListener("pageshow",C);let w=setInterval(()=>{if(e.hidden||b)return;h();let r=Date.now();for(let s of g.values())s.intersecting&&(s.enterAt=r)},me),A=[];return o.microSignals&&[...p.entries()].forEach(([r,s],a)=>{A.push(Q((c,n={})=>{try{t.track({projectId:o.apiKey,componentId:s,eventType:"micro_signal",payload:$({signalType:c},n)})}catch(l){}},r,void 0,{tabLoss:a===0}))}),()=>{h(!0),clearInterval(w),k.stop(),e.removeEventListener("visibilitychange",I),m==null||m.removeEventListener("pagehide",L),m==null||m.removeEventListener("pageshow",C);for(let r of A)r();try{T.disconnect()}catch(r){}}}export{oe as INTERACTION_STATS_COMPONENT,j as SEMANTIC_TYPES,H as classifyFeatures,se as classifySection,q as featuresFromElement,ve as startEngagementCapture};
2
2
  //# sourceMappingURL=index-engagement.mjs.map
@@ -1,10 +1,10 @@
1
- import { q as SentientConfig, p as SentientClient } from './index-C2EOL-_c.cjs';
2
- export { A as AssignResult, a as Assignment, b as AssignmentCache, E as EventQueue, f as EventType, h as GraphClient, i as GraphConfig, j as GraphSnapshot, L as LEGACY_SESSION_COOKIE_NAME, M as MicroSignalEmitter, l as MicroSignalType, n as PageNode, Q as QueueConfig, r as SentientEvent, s as SessionConfig, t as SessionManager, v as attachMicroSignalDetectors, w as grantConsent, y as isDoNotTrackEnabled, H as sanitizePageUrl, I as sessionCookieName } from './index-C2EOL-_c.cjs';
3
- import { b as CompoundLocator } from './session-meta-KwDqU9a8.cjs';
4
- export { D as DecisionSnapshot, S as SNAPSHOT_STORAGE_KEY_PREFIX, d as SlotConfigEntry, e as SlotDeclInput, f as SlotOps, i as armOfResult, j as baselineResultFor, k as baselineSlots, n as deriveSessionSegment, o as detectDeviceClass, p as detectTimeOfDay, q as detectTrafficSource, t as readSnapshot, u as referrerDomainFromReferer, v as renderPrePaintScript, w as toWireSlot, y as writeSnapshot } from './session-meta-KwDqU9a8.cjs';
5
- export { B as BLOCK_ALIGNS, a as BLOCK_EMPHASES, b as BLOCK_FITS, c as BLOCK_GAPS, d as BLOCK_GRID_COLUMNS, e as BLOCK_HEADING_LEVELS, f as BLOCK_JUSTIFIES, g as BLOCK_MAX_WIDTHS, h as BLOCK_PADS, i as BLOCK_RATIOS, j as BLOCK_SIZES, k as BLOCK_SURFACES, l as BLOCK_TEXT_ALIGNS, m as BLOCK_TONES, n as BLOCK_WEIGHTS, o as BadgeBlock, p as BlockAlign, q as BlockEmphasis, r as BlockFit, s as BlockGap, t as BlockJustify, u as BlockMaxWidth, v as BlockNode, w as BlockPad, x as BlockRatio, y as BlockSize, z as BlockSurface, A as BlockTextAlign, C as BlockTone, D as BlockWeight, E as ButtonBlock, G as DividerBlock, H as FORM_FIELD_KINDS, I as FORM_INPUT_TYPES, J as FormBlock, K as FormField, L as GridBlock, M as HeadingBlock, N as ImageBlock, P as LinkBlock, Q as MAX_BLOCK_ARMS, R as MAX_BLOCK_CHILDREN, S as MAX_BLOCK_DEPTH, T as MAX_BLOCK_NODES, U as MAX_BLOCK_TEXT_LEN, V as MAX_FORM_FIELDS, W as MAX_FORM_SELECT_OPTIONS, $ as SitePalette, a0 as SpacerBlock, a1 as StackBlock, a5 as TextBlock, a6 as containsFormBlock } from './style-vocabulary-BqviEw9O.cjs';
1
+ import { q as SentientConfig, p as SentientClient } from './index-Dyc-wA0o.cjs';
2
+ export { A as AssignResult, a as Assignment, b as AssignmentCache, E as EventQueue, f as EventType, h as GraphClient, i as GraphConfig, j as GraphSnapshot, L as LEGACY_SESSION_COOKIE_NAME, M as MicroSignalEmitter, l as MicroSignalType, n as PageNode, Q as QueueConfig, r as SentientEvent, s as SessionConfig, t as SessionManager, v as attachMicroSignalDetectors, w as grantConsent, y as isDoNotTrackEnabled, H as sanitizePageUrl, I as sessionCookieName } from './index-Dyc-wA0o.cjs';
3
+ import { b as CompoundLocator } from './session-meta-CJwAWbJr.cjs';
4
+ export { D as DecisionSnapshot, S as SNAPSHOT_STORAGE_KEY_PREFIX, d as SlotConfigEntry, e as SlotDeclInput, f as SlotOps, i as armOfResult, j as baselineResultFor, k as baselineSlots, n as deriveSessionSegment, o as detectDeviceClass, p as detectTimeOfDay, q as detectTrafficSource, t as readSnapshot, u as referrerDomainFromReferer, v as renderPrePaintScript, w as toWireSlot, y as writeSnapshot } from './session-meta-CJwAWbJr.cjs';
5
+ export { B as BLOCK_ALIGNS, a as BLOCK_EMPHASES, b as BLOCK_FITS, c as BLOCK_GAPS, d as BLOCK_GRID_COLUMNS, e as BLOCK_HEADING_LEVELS, f as BLOCK_JUSTIFIES, g as BLOCK_MAX_WIDTHS, h as BLOCK_PADS, i as BLOCK_RATIOS, j as BLOCK_SIZES, k as BLOCK_SURFACES, l as BLOCK_TEXT_ALIGNS, m as BLOCK_TONES, n as BLOCK_WEIGHTS, o as BadgeBlock, p as BlockAlign, q as BlockEmphasis, r as BlockFit, s as BlockGap, t as BlockJustify, u as BlockMaxWidth, v as BlockNode, w as BlockPad, x as BlockRatio, y as BlockSize, z as BlockSurface, A as BlockTextAlign, C as BlockTone, D as BlockWeight, E as ButtonBlock, G as DividerBlock, H as FORM_FIELD_KINDS, I as FORM_INPUT_TYPES, J as FormBlock, K as FormField, L as GridBlock, M as HeadingBlock, N as ImageBlock, P as LinkBlock, Q as MAX_BLOCK_ARMS, R as MAX_BLOCK_CHILDREN, S as MAX_BLOCK_DEPTH, T as MAX_BLOCK_NODES, U as MAX_BLOCK_TEXT_LEN, V as MAX_FORM_FIELDS, W as MAX_FORM_SELECT_OPTIONS, $ as SitePalette, a0 as SpacerBlock, a1 as StackBlock, a5 as TextBlock, a6 as containsFormBlock } from './style-vocabulary-Ba_g6_DD.cjs';
6
6
  export { SlotResult } from '@sentientui/policy';
7
- import './region-skeleton-CQ4yhVw1.cjs';
7
+ import './region-skeleton-D2ahkcbe.cjs';
8
8
 
9
9
  /** Reads the rendered DOM to build the page-side context graph. */
10
10
 
@@ -1,10 +1,10 @@
1
- import { q as SentientConfig, p as SentientClient } from './index-DrMXbLKP.js';
2
- export { A as AssignResult, a as Assignment, b as AssignmentCache, E as EventQueue, f as EventType, h as GraphClient, i as GraphConfig, j as GraphSnapshot, L as LEGACY_SESSION_COOKIE_NAME, M as MicroSignalEmitter, l as MicroSignalType, n as PageNode, Q as QueueConfig, r as SentientEvent, s as SessionConfig, t as SessionManager, v as attachMicroSignalDetectors, w as grantConsent, y as isDoNotTrackEnabled, H as sanitizePageUrl, I as sessionCookieName } from './index-DrMXbLKP.js';
3
- import { b as CompoundLocator } from './session-meta-CWGtzFOQ.js';
4
- export { D as DecisionSnapshot, S as SNAPSHOT_STORAGE_KEY_PREFIX, d as SlotConfigEntry, e as SlotDeclInput, f as SlotOps, i as armOfResult, j as baselineResultFor, k as baselineSlots, n as deriveSessionSegment, o as detectDeviceClass, p as detectTimeOfDay, q as detectTrafficSource, t as readSnapshot, u as referrerDomainFromReferer, v as renderPrePaintScript, w as toWireSlot, y as writeSnapshot } from './session-meta-CWGtzFOQ.js';
5
- export { B as BLOCK_ALIGNS, a as BLOCK_EMPHASES, b as BLOCK_FITS, c as BLOCK_GAPS, d as BLOCK_GRID_COLUMNS, e as BLOCK_HEADING_LEVELS, f as BLOCK_JUSTIFIES, g as BLOCK_MAX_WIDTHS, h as BLOCK_PADS, i as BLOCK_RATIOS, j as BLOCK_SIZES, k as BLOCK_SURFACES, l as BLOCK_TEXT_ALIGNS, m as BLOCK_TONES, n as BLOCK_WEIGHTS, o as BadgeBlock, p as BlockAlign, q as BlockEmphasis, r as BlockFit, s as BlockGap, t as BlockJustify, u as BlockMaxWidth, v as BlockNode, w as BlockPad, x as BlockRatio, y as BlockSize, z as BlockSurface, A as BlockTextAlign, C as BlockTone, D as BlockWeight, E as ButtonBlock, G as DividerBlock, H as FORM_FIELD_KINDS, I as FORM_INPUT_TYPES, J as FormBlock, K as FormField, L as GridBlock, M as HeadingBlock, N as ImageBlock, P as LinkBlock, Q as MAX_BLOCK_ARMS, R as MAX_BLOCK_CHILDREN, S as MAX_BLOCK_DEPTH, T as MAX_BLOCK_NODES, U as MAX_BLOCK_TEXT_LEN, V as MAX_FORM_FIELDS, W as MAX_FORM_SELECT_OPTIONS, $ as SitePalette, a0 as SpacerBlock, a1 as StackBlock, a5 as TextBlock, a6 as containsFormBlock } from './style-vocabulary-BqviEw9O.js';
1
+ import { q as SentientConfig, p as SentientClient } from './index-JgzRgOO4.js';
2
+ export { A as AssignResult, a as Assignment, b as AssignmentCache, E as EventQueue, f as EventType, h as GraphClient, i as GraphConfig, j as GraphSnapshot, L as LEGACY_SESSION_COOKIE_NAME, M as MicroSignalEmitter, l as MicroSignalType, n as PageNode, Q as QueueConfig, r as SentientEvent, s as SessionConfig, t as SessionManager, v as attachMicroSignalDetectors, w as grantConsent, y as isDoNotTrackEnabled, H as sanitizePageUrl, I as sessionCookieName } from './index-JgzRgOO4.js';
3
+ import { b as CompoundLocator } from './session-meta-CKXcaBjt.js';
4
+ export { D as DecisionSnapshot, S as SNAPSHOT_STORAGE_KEY_PREFIX, d as SlotConfigEntry, e as SlotDeclInput, f as SlotOps, i as armOfResult, j as baselineResultFor, k as baselineSlots, n as deriveSessionSegment, o as detectDeviceClass, p as detectTimeOfDay, q as detectTrafficSource, t as readSnapshot, u as referrerDomainFromReferer, v as renderPrePaintScript, w as toWireSlot, y as writeSnapshot } from './session-meta-CKXcaBjt.js';
5
+ export { B as BLOCK_ALIGNS, a as BLOCK_EMPHASES, b as BLOCK_FITS, c as BLOCK_GAPS, d as BLOCK_GRID_COLUMNS, e as BLOCK_HEADING_LEVELS, f as BLOCK_JUSTIFIES, g as BLOCK_MAX_WIDTHS, h as BLOCK_PADS, i as BLOCK_RATIOS, j as BLOCK_SIZES, k as BLOCK_SURFACES, l as BLOCK_TEXT_ALIGNS, m as BLOCK_TONES, n as BLOCK_WEIGHTS, o as BadgeBlock, p as BlockAlign, q as BlockEmphasis, r as BlockFit, s as BlockGap, t as BlockJustify, u as BlockMaxWidth, v as BlockNode, w as BlockPad, x as BlockRatio, y as BlockSize, z as BlockSurface, A as BlockTextAlign, C as BlockTone, D as BlockWeight, E as ButtonBlock, G as DividerBlock, H as FORM_FIELD_KINDS, I as FORM_INPUT_TYPES, J as FormBlock, K as FormField, L as GridBlock, M as HeadingBlock, N as ImageBlock, P as LinkBlock, Q as MAX_BLOCK_ARMS, R as MAX_BLOCK_CHILDREN, S as MAX_BLOCK_DEPTH, T as MAX_BLOCK_NODES, U as MAX_BLOCK_TEXT_LEN, V as MAX_FORM_FIELDS, W as MAX_FORM_SELECT_OPTIONS, $ as SitePalette, a0 as SpacerBlock, a1 as StackBlock, a5 as TextBlock, a6 as containsFormBlock } from './style-vocabulary-Ba_g6_DD.js';
6
6
  export { SlotResult } from '@sentientui/policy';
7
- import './region-skeleton-CQ4yhVw1.js';
7
+ import './region-skeleton-D2ahkcbe.js';
8
8
 
9
9
  /** Reads the rendered DOM to build the page-side context graph. */
10
10
 
@@ -1,2 +1,2 @@
1
- import{a as v}from"./chunk-WKXD7KI3.mjs";import{A as qe,B as ze,C as Be,D as He,E as Ye,F as Ve,G as We,K as ee,L as O,M,N as te,O as P,a as J,b as X,c as Q,d as Z,i as ve,j as Ae,k as Ne,l as xe,m as Re,n as _e,o as Oe,p as Me,q as Pe,r as De,s as ke,t as Ge,u as $e,v as Le,w as je,x as Ke,y as Ue,z as Fe}from"./chunk-DGRAS5VP.mjs";import"./chunk-3FKD44SF.mjs";import{a as _,b as w,c as T,j as U,k as F,l as q,o as z,p as B,r as H,s as Y,t as V,u as W}from"./chunk-2NVSFI4V.mjs";import{a as x,g as R}from"./chunk-Z6ILOYBD.mjs";import{a as E,b as I}from"./chunk-TMCGHANO.mjs";var D="_snt_graph_edges",ne={pricing:["features","faq"],features:["pricing"],faq:["pricing"],social_proof:["cta"],cta:["social_proof","hero","trust"],hero:["cta"],comparison:["pricing"],trust:["cta"]};function oe(e){var t;return(t=ne[e])!=null?t:[]}function re(e,t){try{let n=localStorage.getItem(e);return n?JSON.parse(n):t}catch(n){return t}}function se(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch(n){}}var ae=new Set(["pricing","hero","social_proof","cta","features","faq","comparison","trust","navigation","generic"]);function ie(e){return ae.has(e)?e:"generic"}function k(e){try{let t=new URL(e);return`${t.origin}${t.pathname}`}catch(t){return"/"}}function ce(e,t,n){let a=`${e}:${t}:${n.join(",")}`,s=5381;for(let o=0;o<a.length;o++)s=(s<<5)+s+a.charCodeAt(o)&4294967295;return(s>>>0).toString(16).padStart(8,"0")}function G(e){let t=new Map,n=new Map,a=`_snt_graph_nodes${_(e==null?void 0:e.apiKey)}`,s=()=>{typeof window!="undefined"&&se(a,[...t.values()])};if(typeof window!="undefined"){let o=re(a,[]);for(let i of o)t.set(i.componentId,i);try{localStorage.removeItem(D)}catch(i){}}return{addPageNode(o){t.set(o.componentId,o),s()},addStructuralEdge(o){let i=`${o.fromComponentId}->${o.toComponentId}`;n.set(i,o)},syncOnce(){var i,c;if(!(e!=null&&e.syncUrl)||typeof window=="undefined")return;let o=[...t.values()];if(o.length!==0)try{let g=new Map;for(let r of o){let m=(i=g.get(r.semanticType))!=null?i:[];m.push(r),g.set(r.semanticType,m)}let u=[],p=new Set;for(let r of o)for(let m of oe(r.semanticType)){let d=(c=g.get(m))!=null?c:[];for(let h of d){if(h.componentId===r.componentId)continue;let S=`semantic:${r.componentId}->${h.componentId}`;p.has(S)||(p.add(S),u.push({fromComponentId:r.componentId,toComponentId:h.componentId,type:"semantic",weight:.4,confidence:.9}))}}let l=new Set(o.map(r=>r.componentId));for(let r of n.values()){if(!l.has(r.fromComponentId)||!l.has(r.toComponentId))continue;let m=`structural:${r.fromComponentId}->${r.toComponentId}`;p.has(m)||(p.add(m),u.push({fromComponentId:r.fromComponentId,toComponentId:r.toComponentId,type:"structural",weight:r.weight,confidence:1}))}let f=I(E(E({pageUrl:k(window.location.href)},e.sessionId?{sessionId:e.sessionId}:{}),e.projectId?{projectId:e.projectId}:{}),{nodes:o.map(r=>{let m=ie(r.semanticType);return{componentId:r.componentId,semanticType:m,answers:r.answers,contentHash:ce(r.componentId,m,r.answers),prominenceScore:r.prominenceScore,depthInPage:r.depth}}),edges:u});fetch(e.syncUrl,{method:"POST",keepalive:!0,headers:E({"Content-Type":"application/json"},e.apiKey?{Authorization:`Bearer ${e.apiKey}`}:{}),body:JSON.stringify(f)}).catch(()=>{})}catch(g){}},snapshot(){return{pageNodes:[...t.values()],capturedAt:Date.now()}},destroy(){if(typeof window!="undefined")try{localStorage.removeItem(a),localStorage.removeItem(D)}catch(o){}}}}var de=new Set(["SECTION","ARTICLE","MAIN","DIV","ASIDE"]),pe="h1, h2, h3",ue="[data-sentient-id], section[aria-label], article[aria-label], main[aria-label], aside[aria-label]",$=30,le=1500,me={scan:async()=>({nodes:[],edges:[],scannedAt:0}),observe:()=>{},getProminenceScore:()=>0,destroy:()=>{}};function L(e,t,n){return n<=t?0:Math.max(0,Math.min(1,(e-t)/(n-t)))}function ge(e){var t,n,a;try{let s=e;for(let o of Object.keys(s)){if(!o.startsWith("__reactFiber")&&!o.startsWith("__reactInternalInstance"))continue;let i=s[o],c=(a=(t=i==null?void 0:i.type)==null?void 0:t.displayName)!=null?a:(n=i==null?void 0:i.type)==null?void 0:n.name;if(c&&c.length>1)return c}}catch(s){}}function fe(e){let t={};for(let n of Array.from(e.attributes))n.name.startsWith("data-")&&(t[n.name]=n.value);return t}var A=new Set(x);function he(e,t){let n=e.getAttribute("data-sentient-id"),a=n?t==null?void 0:t[n]:void 0;if(a&&A.has(a))return a;let s=e.getAttribute("data-sentient-type");if(s&&A.has(s))return s;let o=e.getAttribute("role");return o&&A.has(o)?o:R(e)}function Se(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e.charCodeAt(n)&4294967295;return(t>>>0).toString(16).padStart(8,"0")}function ye(e){let t=[],n=e;for(;n;){let a=n.parentElement;if(!a){t.push(n.tagName.toLowerCase());break}let s=Array.prototype.indexOf.call(a.children,n);t.push(`${n.tagName.toLowerCase()}[${s}]`),n=a}return t.reverse().join("/")}function Ee(e){var n;let t=(n=e.getAttribute("data-sentient-id"))!=null?n:e.getAttribute("id");return t||`${e.tagName.toLowerCase()}-${Se(ye(e))}`}function Ie(e){let t=0,n=e.parentElement;for(;n;)t++,n=n.parentElement;return t}function N(e,t,n){var s,o,i,c;let a=e.querySelector(pe);return{componentId:Ee(e),semanticType:he(e,n),ariaLabel:(s=e.getAttribute("aria-label"))!=null?s:void 0,headingText:(i=(o=a==null?void 0:a.textContent)==null?void 0:o.trim())!=null?i:void 0,isAboveFold:e.getBoundingClientRect().top<window.innerHeight,prominenceScore:t(e),depth:Ie(e),reactComponentName:ge(e),dataAttributes:fe(e),locator:(c=v(e,e.ownerDocument))!=null?c:void 0}}function j(e){var o;let t=[],n=new Set,a="__root__",s=new Map;for(let[i,c]of e){let g=i.parentElement,u=a;for(;g;){if(e.has(g)){u=e.get(g);let l=e.get(i),f=`${u}->${l}`;!n.has(f)&&u!==l&&(n.add(f),t.push({fromComponentId:u,toComponentId:l,weight:.6}));break}g=g.parentElement}let p=(o=s.get(u))!=null?o:[];p.push(i),s.set(u,p)}for(let i of s.values()){if(i.length<2)continue;let c=i.length>$?i.slice(0,$):i;for(let g=0;g<c.length;g++)for(let u=g+1;u<c.length;u++){if(t.length>=le)return t;let p=e.get(c[g]),l=e.get(c[u]);if(p===l)continue;let f=`${p}->${l}::sib`,r=`${l}->${p}::sib`;n.has(f)||(n.add(f),t.push({fromComponentId:p,toComponentId:l,weight:.3})),n.has(r)||(n.add(r),t.push({fromComponentId:l,toComponentId:p,weight:.3}))}}return t}function Ce(e,t){let n=[],a=new Set,s=new Map;return document.querySelectorAll("[data-sentient-id]").forEach(c=>{if(c instanceof Element&&!a.has(c)){a.add(c);let g=N(c,e,t);n.push(g),s.set(c,g.componentId)}}),document.querySelectorAll("section, article, main, aside").forEach(c=>{if(!(c instanceof Element)||a.has(c))return;let g=c.hasAttribute("aria-label"),u=c.hasAttribute("data-sentient-id");if(!g&&!u)return;a.add(c);let p=N(c,e,t);n.push(p),s.set(c,p.componentId)}),{nodes:n,edges:j(s),elementToId:s}}function K(e={}){let{sectionTypes:t}=e;if(typeof window=="undefined")return me;let n=null,a=0,s=null,o=new Map,i=p=>{try{let l=window.getComputedStyle(p),f=parseFloat(l.fontSize)||12,r=parseFloat(l.zIndex)||0,m=p.getBoundingClientRect(),d=Math.max(m.top,0),h=window.innerHeight||1,S=1/(d/h+1),y=L(f,12,48)*.4+S*.4+L(r,0,100)*.2;return Math.max(0,Math.min(1,y))}catch(l){return .5}};return{scan:()=>new Promise(p=>{let l=()=>{let{nodes:f,edges:r,elementToId:m}=Ce(i,t);o.clear();for(let[d,h]of m)o.set(d,h);p({nodes:f,edges:r,scannedAt:Date.now()})};try{typeof requestIdleCallback=="function"?a=requestIdleCallback(l,{timeout:100}):l()}catch(f){l()}}),observe:p=>{s=p;try{n=new MutationObserver(l=>{let f=[],r=new Set;for(let d of l)d.type==="childList"&&d.addedNodes.forEach(h=>{if(!(h instanceof Element))return;let S=[];de.has(h.tagName)&&(h.hasAttribute("data-sentient-id")||h.hasAttribute("aria-label"))&&S.push(h);try{h.querySelectorAll(ue).forEach(y=>S.push(y))}catch(y){}for(let y of S){if(o.has(y))continue;let b=N(y,i,t);f.push(b),r.add(b.componentId),o.set(y,b.componentId)}});if(f.length===0||!s)return;for(let d of[...o.keys()])d.isConnected||o.delete(d);let m=j(o).filter(d=>r.has(d.fromComponentId)||r.has(d.toComponentId));s({nodes:f,edges:m,addedAt:Date.now()})}),n.observe(document.body,{childList:!0,subtree:!0})}catch(l){}},getProminenceScore:i,destroy:()=>{if(n&&(n.disconnect(),n=null),a&&typeof cancelIdleCallback=="function")try{cancelIdleCallback(a)}catch(p){}a=0,s=null,o.clear()}}}var be="https://api.sentient-ui.com/v1/events";function we(e){var n;let t=a=>{try{let s=document.cookie.match(new RegExp(`(?:^|; )${a}=([^;]*)`));return s?decodeURIComponent(s[1]):void 0}catch(s){return}};return(n=e?t(T(e)):void 0)!=null?n:t(w)}var C=new Map;function Te(e){var r;let t=P(e),n=e.respectDoNotTrack!==!1&&M(),a=e.consent===!1||n,s=typeof e.apiKey=="string"&&e.apiKey.startsWith("pk_"),o=e.localMode===!0||!s;if(!e.graph||o||typeof window=="undefined")return t;if(a)return n||O(e.apiKey,m=>Te(m)),t;let i=C.get(e.apiKey);if(i)try{i()}catch(m){}let c=K({sectionTypes:e.sectionTypes}),g=(r=e.ingestUrl)!=null?r:be,u=G({syncUrl:g.replace(/\/events\/?$/,"/graph/sync"),apiKey:e.apiKey,projectId:e.apiKey,sessionId:we(e.apiKey)});c.scan().then(m=>{for(let d of m.nodes)u.addPageNode({id:d.componentId,componentId:d.componentId,semanticType:d.semanticType,answers:e.captureDomText&&d.headingText?[d.headingText]:[],prominenceScore:d.prominenceScore,depth:d.depth});for(let d of m.edges)u.addStructuralEdge(d);u.syncOnce()});let p=null,l=()=>{p!==null&&clearTimeout(p),p=setTimeout(()=>{p=null,u.syncOnce()},500)};c.observe(m=>{for(let d of m.nodes)u.addPageNode({id:d.componentId,componentId:d.componentId,semanticType:d.semanticType,answers:e.captureDomText&&d.headingText?[d.headingText]:[],prominenceScore:d.prominenceScore,depth:d.depth});for(let d of m.edges)u.addStructuralEdge(d);l()});let f=()=>{p!==null&&(clearTimeout(p),p=null),c.destroy(),u.destroy(),C.get(e.apiKey)===f&&C.delete(e.apiKey)};return C.set(e.apiKey,f),I(E({},t),{getGraph:()=>u.snapshot(),dispose:()=>{f(),t.dispose()},destroy:()=>{f(),t.destroy()}})}export{Ae as BLOCK_ALIGNS,Oe as BLOCK_EMPHASES,De as BLOCK_FITS,ve as BLOCK_GAPS,ke as BLOCK_GRID_COLUMNS,Ge as BLOCK_HEADING_LEVELS,Ne as BLOCK_JUSTIFIES,je as BLOCK_MAX_WIDTHS,Le as BLOCK_PADS,Pe as BLOCK_RATIOS,xe as BLOCK_SIZES,$e as BLOCK_SURFACES,Me as BLOCK_TEXT_ALIGNS,_e as BLOCK_TONES,Re as BLOCK_WEIGHTS,Ke as FORM_FIELD_KINDS,Ue as FORM_INPUT_TYPES,w as LEGACY_SESSION_COOKIE_NAME,Ye as MAX_BLOCK_ARMS,He as MAX_BLOCK_CHILDREN,Be as MAX_BLOCK_DEPTH,ze as MAX_BLOCK_NODES,Ve as MAX_BLOCK_TEXT_LEN,Fe as MAX_FORM_FIELDS,qe as MAX_FORM_SELECT_OPTIONS,J as SNAPSHOT_STORAGE_KEY_PREFIX,W as armOfResult,ee as attachMicroSignalDetectors,Y as baselineResultFor,V as baselineSlots,We as containsFormBlock,B as deriveSessionSegment,U as detectDeviceClass,z as detectTimeOfDay,F as detectTrafficSource,te as grantConsent,Te as init,M as isDoNotTrackEnabled,v as locatorFromElement,X as readSnapshot,q as referrerDomainFromReferer,Z as renderPrePaintScript,k as sanitizePageUrl,T as sessionCookieName,H as toWireSlot,Q as writeSnapshot};
1
+ import{a as v}from"./chunk-WKXD7KI3.mjs";import{A as qe,B as ze,C as Be,D as He,E as Ye,F as Ve,G as We,K as ee,L as O,M,N as te,O as P,a as J,b as X,c as Q,d as Z,i as ve,j as Ae,k as Ne,l as xe,m as Re,n as _e,o as Oe,p as Me,q as Pe,r as De,s as ke,t as Ge,u as $e,v as Le,w as je,x as Ke,y as Ue,z as Fe}from"./chunk-DGRAS5VP.mjs";import"./chunk-NCLBL5V3.mjs";import{a as _,b as w,c as T,j as U,k as F,l as q,o as z,p as B,r as H,s as Y,t as V,u as W}from"./chunk-2NVSFI4V.mjs";import{a as x,g as R}from"./chunk-Z6ILOYBD.mjs";import{a as E,b as I}from"./chunk-TMCGHANO.mjs";var D="_snt_graph_edges",ne={pricing:["features","faq"],features:["pricing"],faq:["pricing"],social_proof:["cta"],cta:["social_proof","hero","trust"],hero:["cta"],comparison:["pricing"],trust:["cta"]};function oe(e){var t;return(t=ne[e])!=null?t:[]}function re(e,t){try{let n=localStorage.getItem(e);return n?JSON.parse(n):t}catch(n){return t}}function se(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch(n){}}var ae=new Set(["pricing","hero","social_proof","cta","features","faq","comparison","trust","navigation","generic"]);function ie(e){return ae.has(e)?e:"generic"}function k(e){try{let t=new URL(e);return`${t.origin}${t.pathname}`}catch(t){return"/"}}function ce(e,t,n){let a=`${e}:${t}:${n.join(",")}`,s=5381;for(let o=0;o<a.length;o++)s=(s<<5)+s+a.charCodeAt(o)&4294967295;return(s>>>0).toString(16).padStart(8,"0")}function G(e){let t=new Map,n=new Map,a=`_snt_graph_nodes${_(e==null?void 0:e.apiKey)}`,s=()=>{typeof window!="undefined"&&se(a,[...t.values()])};if(typeof window!="undefined"){let o=re(a,[]);for(let i of o)t.set(i.componentId,i);try{localStorage.removeItem(D)}catch(i){}}return{addPageNode(o){t.set(o.componentId,o),s()},addStructuralEdge(o){let i=`${o.fromComponentId}->${o.toComponentId}`;n.set(i,o)},syncOnce(){var i,c;if(!(e!=null&&e.syncUrl)||typeof window=="undefined")return;let o=[...t.values()];if(o.length!==0)try{let g=new Map;for(let r of o){let m=(i=g.get(r.semanticType))!=null?i:[];m.push(r),g.set(r.semanticType,m)}let u=[],p=new Set;for(let r of o)for(let m of oe(r.semanticType)){let d=(c=g.get(m))!=null?c:[];for(let h of d){if(h.componentId===r.componentId)continue;let S=`semantic:${r.componentId}->${h.componentId}`;p.has(S)||(p.add(S),u.push({fromComponentId:r.componentId,toComponentId:h.componentId,type:"semantic",weight:.4,confidence:.9}))}}let l=new Set(o.map(r=>r.componentId));for(let r of n.values()){if(!l.has(r.fromComponentId)||!l.has(r.toComponentId))continue;let m=`structural:${r.fromComponentId}->${r.toComponentId}`;p.has(m)||(p.add(m),u.push({fromComponentId:r.fromComponentId,toComponentId:r.toComponentId,type:"structural",weight:r.weight,confidence:1}))}let f=I(E(E({pageUrl:k(window.location.href)},e.sessionId?{sessionId:e.sessionId}:{}),e.projectId?{projectId:e.projectId}:{}),{nodes:o.map(r=>{let m=ie(r.semanticType);return{componentId:r.componentId,semanticType:m,answers:r.answers,contentHash:ce(r.componentId,m,r.answers),prominenceScore:r.prominenceScore,depthInPage:r.depth}}),edges:u});fetch(e.syncUrl,{method:"POST",keepalive:!0,headers:E({"Content-Type":"application/json"},e.apiKey?{Authorization:`Bearer ${e.apiKey}`}:{}),body:JSON.stringify(f)}).catch(()=>{})}catch(g){}},snapshot(){return{pageNodes:[...t.values()],capturedAt:Date.now()}},destroy(){if(typeof window!="undefined")try{localStorage.removeItem(a),localStorage.removeItem(D)}catch(o){}}}}var de=new Set(["SECTION","ARTICLE","MAIN","DIV","ASIDE"]),pe="h1, h2, h3",ue="[data-sentient-id], section[aria-label], article[aria-label], main[aria-label], aside[aria-label]",$=30,le=1500,me={scan:async()=>({nodes:[],edges:[],scannedAt:0}),observe:()=>{},getProminenceScore:()=>0,destroy:()=>{}};function L(e,t,n){return n<=t?0:Math.max(0,Math.min(1,(e-t)/(n-t)))}function ge(e){var t,n,a;try{let s=e;for(let o of Object.keys(s)){if(!o.startsWith("__reactFiber")&&!o.startsWith("__reactInternalInstance"))continue;let i=s[o],c=(a=(t=i==null?void 0:i.type)==null?void 0:t.displayName)!=null?a:(n=i==null?void 0:i.type)==null?void 0:n.name;if(c&&c.length>1)return c}}catch(s){}}function fe(e){let t={};for(let n of Array.from(e.attributes))n.name.startsWith("data-")&&(t[n.name]=n.value);return t}var A=new Set(x);function he(e,t){let n=e.getAttribute("data-sentient-id"),a=n?t==null?void 0:t[n]:void 0;if(a&&A.has(a))return a;let s=e.getAttribute("data-sentient-type");if(s&&A.has(s))return s;let o=e.getAttribute("role");return o&&A.has(o)?o:R(e)}function Se(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e.charCodeAt(n)&4294967295;return(t>>>0).toString(16).padStart(8,"0")}function ye(e){let t=[],n=e;for(;n;){let a=n.parentElement;if(!a){t.push(n.tagName.toLowerCase());break}let s=Array.prototype.indexOf.call(a.children,n);t.push(`${n.tagName.toLowerCase()}[${s}]`),n=a}return t.reverse().join("/")}function Ee(e){var n;let t=(n=e.getAttribute("data-sentient-id"))!=null?n:e.getAttribute("id");return t||`${e.tagName.toLowerCase()}-${Se(ye(e))}`}function Ie(e){let t=0,n=e.parentElement;for(;n;)t++,n=n.parentElement;return t}function N(e,t,n){var s,o,i,c;let a=e.querySelector(pe);return{componentId:Ee(e),semanticType:he(e,n),ariaLabel:(s=e.getAttribute("aria-label"))!=null?s:void 0,headingText:(i=(o=a==null?void 0:a.textContent)==null?void 0:o.trim())!=null?i:void 0,isAboveFold:e.getBoundingClientRect().top<window.innerHeight,prominenceScore:t(e),depth:Ie(e),reactComponentName:ge(e),dataAttributes:fe(e),locator:(c=v(e,e.ownerDocument))!=null?c:void 0}}function j(e){var o;let t=[],n=new Set,a="__root__",s=new Map;for(let[i,c]of e){let g=i.parentElement,u=a;for(;g;){if(e.has(g)){u=e.get(g);let l=e.get(i),f=`${u}->${l}`;!n.has(f)&&u!==l&&(n.add(f),t.push({fromComponentId:u,toComponentId:l,weight:.6}));break}g=g.parentElement}let p=(o=s.get(u))!=null?o:[];p.push(i),s.set(u,p)}for(let i of s.values()){if(i.length<2)continue;let c=i.length>$?i.slice(0,$):i;for(let g=0;g<c.length;g++)for(let u=g+1;u<c.length;u++){if(t.length>=le)return t;let p=e.get(c[g]),l=e.get(c[u]);if(p===l)continue;let f=`${p}->${l}::sib`,r=`${l}->${p}::sib`;n.has(f)||(n.add(f),t.push({fromComponentId:p,toComponentId:l,weight:.3})),n.has(r)||(n.add(r),t.push({fromComponentId:l,toComponentId:p,weight:.3}))}}return t}function Ce(e,t){let n=[],a=new Set,s=new Map;return document.querySelectorAll("[data-sentient-id]").forEach(c=>{if(c instanceof Element&&!a.has(c)){a.add(c);let g=N(c,e,t);n.push(g),s.set(c,g.componentId)}}),document.querySelectorAll("section, article, main, aside").forEach(c=>{if(!(c instanceof Element)||a.has(c))return;let g=c.hasAttribute("aria-label"),u=c.hasAttribute("data-sentient-id");if(!g&&!u)return;a.add(c);let p=N(c,e,t);n.push(p),s.set(c,p.componentId)}),{nodes:n,edges:j(s),elementToId:s}}function K(e={}){let{sectionTypes:t}=e;if(typeof window=="undefined")return me;let n=null,a=0,s=null,o=new Map,i=p=>{try{let l=window.getComputedStyle(p),f=parseFloat(l.fontSize)||12,r=parseFloat(l.zIndex)||0,m=p.getBoundingClientRect(),d=Math.max(m.top,0),h=window.innerHeight||1,S=1/(d/h+1),y=L(f,12,48)*.4+S*.4+L(r,0,100)*.2;return Math.max(0,Math.min(1,y))}catch(l){return .5}};return{scan:()=>new Promise(p=>{let l=()=>{let{nodes:f,edges:r,elementToId:m}=Ce(i,t);o.clear();for(let[d,h]of m)o.set(d,h);p({nodes:f,edges:r,scannedAt:Date.now()})};try{typeof requestIdleCallback=="function"?a=requestIdleCallback(l,{timeout:100}):l()}catch(f){l()}}),observe:p=>{s=p;try{n=new MutationObserver(l=>{let f=[],r=new Set;for(let d of l)d.type==="childList"&&d.addedNodes.forEach(h=>{if(!(h instanceof Element))return;let S=[];de.has(h.tagName)&&(h.hasAttribute("data-sentient-id")||h.hasAttribute("aria-label"))&&S.push(h);try{h.querySelectorAll(ue).forEach(y=>S.push(y))}catch(y){}for(let y of S){if(o.has(y))continue;let b=N(y,i,t);f.push(b),r.add(b.componentId),o.set(y,b.componentId)}});if(f.length===0||!s)return;for(let d of[...o.keys()])d.isConnected||o.delete(d);let m=j(o).filter(d=>r.has(d.fromComponentId)||r.has(d.toComponentId));s({nodes:f,edges:m,addedAt:Date.now()})}),n.observe(document.body,{childList:!0,subtree:!0})}catch(l){}},getProminenceScore:i,destroy:()=>{if(n&&(n.disconnect(),n=null),a&&typeof cancelIdleCallback=="function")try{cancelIdleCallback(a)}catch(p){}a=0,s=null,o.clear()}}}var be="https://api.sentient-ui.com/v1/events";function we(e){var n;let t=a=>{try{let s=document.cookie.match(new RegExp(`(?:^|; )${a}=([^;]*)`));return s?decodeURIComponent(s[1]):void 0}catch(s){return}};return(n=e?t(T(e)):void 0)!=null?n:t(w)}var C=new Map;function Te(e){var r;let t=P(e),n=e.respectDoNotTrack!==!1&&M(),a=e.consent===!1||n,s=typeof e.apiKey=="string"&&e.apiKey.startsWith("pk_"),o=e.localMode===!0||!s;if(!e.graph||o||typeof window=="undefined")return t;if(a)return n||O(e.apiKey,m=>Te(m)),t;let i=C.get(e.apiKey);if(i)try{i()}catch(m){}let c=K({sectionTypes:e.sectionTypes}),g=(r=e.ingestUrl)!=null?r:be,u=G({syncUrl:g.replace(/\/events\/?$/,"/graph/sync"),apiKey:e.apiKey,projectId:e.apiKey,sessionId:we(e.apiKey)});c.scan().then(m=>{for(let d of m.nodes)u.addPageNode({id:d.componentId,componentId:d.componentId,semanticType:d.semanticType,answers:e.captureDomText&&d.headingText?[d.headingText]:[],prominenceScore:d.prominenceScore,depth:d.depth});for(let d of m.edges)u.addStructuralEdge(d);u.syncOnce()});let p=null,l=()=>{p!==null&&clearTimeout(p),p=setTimeout(()=>{p=null,u.syncOnce()},500)};c.observe(m=>{for(let d of m.nodes)u.addPageNode({id:d.componentId,componentId:d.componentId,semanticType:d.semanticType,answers:e.captureDomText&&d.headingText?[d.headingText]:[],prominenceScore:d.prominenceScore,depth:d.depth});for(let d of m.edges)u.addStructuralEdge(d);l()});let f=()=>{p!==null&&(clearTimeout(p),p=null),c.destroy(),u.destroy(),C.get(e.apiKey)===f&&C.delete(e.apiKey)};return C.set(e.apiKey,f),I(E({},t),{getGraph:()=>u.snapshot(),dispose:()=>{f(),t.dispose()},destroy:()=>{f(),t.destroy()}})}export{Ae as BLOCK_ALIGNS,Oe as BLOCK_EMPHASES,De as BLOCK_FITS,ve as BLOCK_GAPS,ke as BLOCK_GRID_COLUMNS,Ge as BLOCK_HEADING_LEVELS,Ne as BLOCK_JUSTIFIES,je as BLOCK_MAX_WIDTHS,Le as BLOCK_PADS,Pe as BLOCK_RATIOS,xe as BLOCK_SIZES,$e as BLOCK_SURFACES,Me as BLOCK_TEXT_ALIGNS,_e as BLOCK_TONES,Re as BLOCK_WEIGHTS,Ke as FORM_FIELD_KINDS,Ue as FORM_INPUT_TYPES,w as LEGACY_SESSION_COOKIE_NAME,Ye as MAX_BLOCK_ARMS,He as MAX_BLOCK_CHILDREN,Be as MAX_BLOCK_DEPTH,ze as MAX_BLOCK_NODES,Ve as MAX_BLOCK_TEXT_LEN,Fe as MAX_FORM_FIELDS,qe as MAX_FORM_SELECT_OPTIONS,J as SNAPSHOT_STORAGE_KEY_PREFIX,W as armOfResult,ee as attachMicroSignalDetectors,Y as baselineResultFor,V as baselineSlots,We as containsFormBlock,B as deriveSessionSegment,U as detectDeviceClass,z as detectTimeOfDay,F as detectTrafficSource,te as grantConsent,Te as init,M as isDoNotTrackEnabled,v as locatorFromElement,X as readSnapshot,q as referrerDomainFromReferer,Z as renderPrePaintScript,k as sanitizePageUrl,T as sessionCookieName,H as toWireSlot,Q as writeSnapshot};
2
2
  //# sourceMappingURL=index-graph.mjs.map
@@ -1,7 +1,7 @@
1
- import { e as DecideOutcome } from './index-C2EOL-_c.cjs';
2
- import { e as SlotDeclInput } from './session-meta-KwDqU9a8.cjs';
3
- import './style-vocabulary-BqviEw9O.cjs';
4
- import './region-skeleton-CQ4yhVw1.cjs';
1
+ import { e as DecideOutcome } from './index-Dyc-wA0o.cjs';
2
+ import { e as SlotDeclInput } from './session-meta-CJwAWbJr.cjs';
3
+ import './style-vocabulary-Ba_g6_DD.cjs';
4
+ import './region-skeleton-D2ahkcbe.cjs';
5
5
  import '@sentientui/policy';
6
6
 
7
7
  /**
@@ -1,7 +1,7 @@
1
- import { e as DecideOutcome } from './index-DrMXbLKP.js';
2
- import { e as SlotDeclInput } from './session-meta-CWGtzFOQ.js';
3
- import './style-vocabulary-BqviEw9O.js';
4
- import './region-skeleton-CQ4yhVw1.js';
1
+ import { e as DecideOutcome } from './index-JgzRgOO4.js';
2
+ import { e as SlotDeclInput } from './session-meta-CKXcaBjt.js';
3
+ import './style-vocabulary-Ba_g6_DD.js';
4
+ import './region-skeleton-D2ahkcbe.js';
5
5
  import '@sentientui/policy';
6
6
 
7
7
  /**
@@ -1,4 +1,4 @@
1
- import { R as RegionSkeleton } from './region-skeleton-CQ4yhVw1.cjs';
1
+ import { R as RegionSkeleton } from './region-skeleton-D2ahkcbe.cjs';
2
2
 
3
3
  declare function normalizeLeafText(s: string): string;
4
4
  /** 16 hex chars over the normalized leaf texts. Text-only on purpose: React
@@ -1,4 +1,4 @@
1
- import { R as RegionSkeleton } from './region-skeleton-CQ4yhVw1.js';
1
+ import { R as RegionSkeleton } from './region-skeleton-D2ahkcbe.js';
2
2
 
3
3
  declare function normalizeLeafText(s: string): string;
4
4
  /** 16 hex chars over the normalized leaf texts. Text-only on purpose: React
@@ -1,2 +1,2 @@
1
- "use strict";var E=Object.defineProperty,H=Object.defineProperties,U=Object.getOwnPropertyDescriptor,X=Object.getOwnPropertyDescriptors,j=Object.getOwnPropertyNames,O=Object.getOwnPropertySymbols;var D=Object.prototype.hasOwnProperty,z=Object.prototype.propertyIsEnumerable;var I=(e,t,n)=>t in e?E(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,p=(e,t)=>{for(var n in t||(t={}))D.call(t,n)&&I(e,n,t[n]);if(O)for(var n of O(t))z.call(t,n)&&I(e,n,t[n]);return e},b=(e,t)=>H(e,X(t));var Q=(e,t)=>{for(var n in t)E(e,n,{get:t[n],enumerable:!0})},W=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of j(t))!D.call(e,r)&&r!==n&&E(e,r,{get:()=>t[r],enumerable:!(o=U(t,r))||o.enumerable});return e};var Y=e=>W(E({},"__esModule",{value:!0}),e);var le={};Q(le,{captureRegionDom:()=>x,captureRegionSkeleton:()=>M,normalizeLeafText:()=>T,regionAddress:()=>S,skeletonFingerprint:()=>k});module.exports=Y(le);function T(e){return e.replace(/\s+/g," ").trim().slice(0,300)}function B(e,t){let n=t>>>0;for(let o=0;o<e.length;o++)n^=e.charCodeAt(o),n=Math.imul(n,16777619)>>>0;return n.toString(16).padStart(8,"0")}function k(e){let t=e.join("");return B(t,2166136261)+B(t,1523705862)}var J=new Set(["A","BUTTON"]),v=/^H([1-6])$/,Z=new Set(["P","LI","LABEL","BLOCKQUOTE","FIGCAPTION","DT","DD","TD","TH"]),ee=new Set(["LABEL","FIGCAPTION","DT"]),te=new Set(["SCRIPT","STYLE","TEMPLATE","NOSCRIPT"]);function G(e){return J.has(e.tagName)||e.getAttribute("role")==="button"?!0:e.tagName==="INPUT"&&/^(submit|button)$/i.test(e.type)}function ne(e){if(v.test(e.tagName)||Z.has(e.tagName))return!0;let t=e.ownerDocument.defaultView,n=t?t.getComputedStyle(e).display:"";return n!==""&&n!=="inline"&&n!=="contents"}function oe(e,t){let n=null;for(let o=e.parentElement;o&&o!==t.parentElement;o=o.parentElement){if(G(o)){n=o;break}if(o===t)break}if(n)return n;for(let o=e.parentElement;o;o=o.parentElement)if(o===t||ne(o))return o;return t}function P(e,t){var n,o;if(e)try{let r=new URL(e,(o=(n=t.location)==null?void 0:n.href)!=null?o:"https://relative.invalid/");return r.protocol!=="https:"&&r.protocol!=="http:"?void 0:t.location&&r.origin===t.location.origin?r.pathname:`${r.origin}${r.pathname}`}catch(r){return}}function K(e){return e===""||e==="transparent"||/rgba\([^)]*,\s*0\)$/.test(e)}function re(e){var n;let t=e.ownerDocument.defaultView;if(!t)return{bg:null};for(let o=e;o;o=o.parentElement){let r=t.getComputedStyle(o),s=r.backgroundImage;if(s&&s!=="none"&&/gradient/.test(s)){let l=(n=s.match(/rgba?\([^)]+\)|#[0-9a-f]{3,8}/gi))!=null?n:[];if(l.length>0)return p({bg:l[0]},l.length>1?{alt:l[l.length-1]}:{})}if(!K(r.backgroundColor))return{bg:r.backgroundColor}}return{bg:null}}function S(e,t=40){var f,i,d;let n=e.ownerDocument.createTreeWalker(e,4),o=[];for(let a=n.nextNode();a;a=n.nextNode())if(((f=a.nodeValue)!=null?f:"").trim()!==""&&!te.has((d=(i=a.parentElement)==null?void 0:i.tagName)!=null?d:"")&&(o.push(a),o.length>120))return{reason:"too_large"};if(o.length===0)return{reason:"empty"};let r=[],s=[];for(let a of o){let u=oe(a,e),g=r.indexOf(u);g===-1&&(r.push(u),g=r.length-1),s.push(g)}if(r.length>t)return{reason:"too_large"};let l=o.map(a=>{var u;return T((u=a.nodeValue)!=null?u:"")});return{textNodes:o,ownerEls:r,leafToNode:s,leaves:l,fp:k(l)}}function x(e,t=40){var A,L;let n=S(e,t);if(!("fp"in n))return{skeleton:null,reason:n.reason};let{textNodes:o,ownerEls:r,leafToNode:s,leaves:l}=n,f=e.ownerDocument,i=f.defaultView,d=[],a=r.map((c,V)=>{var R,_,C;let m=i==null?void 0:i.getComputedStyle(c),w=(R=c.parentElement)!=null?R:e,N=d.indexOf(w);N===-1&&(d.push(w),N=d.length-1);let h=v.exec(c.tagName),y=G(c)?"action":h?"heading":ee.has(c.tagName)?"label":"text",$=T(l.filter((se,F)=>s[F]===V).join(" "));return b(p(b(p({tag:c.tagName.toLowerCase(),role:y},h?{level:Number(h[1])}:{}),{text:$,classes:((_=c.getAttribute("class"))!=null?_:"").replace(/\s+/g," ").trim()}),y==="action"?p({filled:!!m&&(!K(m.backgroundColor)||m.backgroundImage!==""&&m.backgroundImage!=="none")},P(c.getAttribute("href"),f)!==void 0?{href:P(c.getAttribute("href"),f)}:{}):{}),{color:(C=m==null?void 0:m.color)!=null?C:"",group:N,restylable:!0})}),u=re(e),g=i==null?void 0:i.getComputedStyle(e);return{skeleton:{v:1,root:b(p({tag:e.tagName.toLowerCase(),classes:((A=e.getAttribute("class"))!=null?A:"").replace(/\s+/g," ").trim(),ambientBg:u.bg},u.alt?{ambientBgAlt:u.alt}:{}),{ambientText:(L=g==null?void 0:g.color)!=null?L:""}),nodes:a,leaves:l,leafToNode:s,fp:k(l)},textNodes:o,ownerEls:r}}function M(e,t){try{let n=x(e,t==null?void 0:t.maxNodes);return n.skeleton?{skeleton:n.skeleton}:n}catch(n){return{skeleton:null,reason:"unaddressable"}}}0&&(module.exports={captureRegionDom,captureRegionSkeleton,normalizeLeafText,regionAddress,skeletonFingerprint});
1
+ "use strict";var h=Object.defineProperty,U=Object.defineProperties,X=Object.getOwnPropertyDescriptor,j=Object.getOwnPropertyDescriptors,z=Object.getOwnPropertyNames,_=Object.getOwnPropertySymbols;var O=Object.prototype.hasOwnProperty,q=Object.prototype.propertyIsEnumerable;var I=(e,t,n)=>t in e?h(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,p=(e,t)=>{for(var n in t||(t={}))O.call(t,n)&&I(e,n,t[n]);if(_)for(var n of _(t))q.call(t,n)&&I(e,n,t[n]);return e},x=(e,t)=>U(e,j(t));var Q=(e,t)=>{for(var n in t)h(e,n,{get:t[n],enumerable:!0})},W=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of z(t))!O.call(e,o)&&o!==n&&h(e,o,{get:()=>t[o],enumerable:!(r=X(t,o))||r.enumerable});return e};var Y=e=>W(h({},"__esModule",{value:!0}),e);var ue={};Q(ue,{captureRegionDom:()=>R,captureRegionSkeleton:()=>F,normalizeLeafText:()=>S,regionAddress:()=>A,skeletonFingerprint:()=>k});module.exports=Y(ue);var J=/(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch|color)\([^()]*\)|#[0-9a-f]{3,8}\b/gi,Z=/^rgba?\(\s*[\d.]+[,\s]+[\d.]+[,\s]+[\d.]+(?:[,\s/]+[\d.]+%?)?\s*\)$/i,E;function ee(e){if(E!==void 0)return E;try{let t=e.createElement("canvas");t.width=t.height=1,E=t.getContext("2d",{willReadFrequently:!0})}catch(t){E=null}return E}function b(e,t){let n=(e!=null?e:"").trim();if(n===""||n==="transparent")return n==="transparent"?"rgba(0, 0, 0, 0)":"";if(Z.test(n)||/^#[0-9a-f]{3,8}$/i.test(n))return n;let r=ee(t);if(!r)return"";try{if(r.fillStyle="#010203",r.fillStyle=n,String(r.fillStyle).toLowerCase()==="#010203"&&n.toLowerCase()!=="#010203")return"";r.clearRect(0,0,1,1),r.fillRect(0,0,1,1);let[o,l,a,i]=r.getImageData(0,0,1,1).data;return i===255?`rgb(${o}, ${l}, ${a})`:`rgba(${o}, ${l}, ${a}, ${Math.round(i/255*1e3)/1e3})`}catch(o){return""}}function v(e,t){var n;return!e||e==="none"||!/gradient/i.test(e)?[]:((n=e.match(J))!=null?n:[]).map(r=>b(r,t)).filter(r=>r!=="")}function S(e){return e.replace(/\s+/g," ").trim().slice(0,300)}function $(e,t){let n=t>>>0;for(let r=0;r<e.length;r++)n^=e.charCodeAt(r),n=Math.imul(n,16777619)>>>0;return n.toString(16).padStart(8,"0")}function k(e){let t=e.join("");return $(t,2166136261)+$(t,1523705862)}var ne=new Set(["A","BUTTON"]),P=/^H([1-6])$/,re=new Set(["P","LI","LABEL","BLOCKQUOTE","FIGCAPTION","DT","DD","TD","TH"]),oe=new Set(["LABEL","FIGCAPTION","DT"]),le=new Set(["SCRIPT","STYLE","TEMPLATE","NOSCRIPT"]);function G(e){return ne.has(e.tagName)||e.getAttribute("role")==="button"?!0:e.tagName==="INPUT"&&/^(submit|button)$/i.test(e.type)}function ae(e){if(P.test(e.tagName)||re.has(e.tagName))return!0;let t=e.ownerDocument.defaultView,n=t?t.getComputedStyle(e).display:"";return n!==""&&n!=="inline"&&n!=="contents"}function se(e,t){let n=null;for(let r=e.parentElement;r&&r!==t.parentElement;r=r.parentElement){if(G(r)){n=r;break}if(r===t)break}if(n)return n;for(let r=e.parentElement;r;r=r.parentElement)if(r===t||ae(r))return r;return t}function B(e,t){var n,r;if(e)try{let o=new URL(e,(r=(n=t.location)==null?void 0:n.href)!=null?r:"https://relative.invalid/");return o.protocol!=="https:"&&o.protocol!=="http:"?void 0:t.location&&o.origin===t.location.origin?o.pathname:`${o.origin}${o.pathname}`}catch(o){return}}function M(e){return e===""||e==="transparent"||/rgba\([^)]*,\s*0\)$/.test(e)}function ie(e){let t=e.ownerDocument,n=t.defaultView;if(!n)return{bg:null};for(let r=e;r;r=r.parentElement){let o=n.getComputedStyle(r),l=v(o.backgroundImage,t);if(l.length>0)return p({bg:l[0]},l.length>1?{alt:l[l.length-1]}:{});let a=b(o.backgroundColor,t);if(!M(a))return{bg:a}}return{bg:null}}function A(e,t=40){var i,u,m;let n=e.ownerDocument.createTreeWalker(e,4),r=[];for(let s=n.nextNode();s;s=n.nextNode())if(((i=s.nodeValue)!=null?i:"").trim()!==""&&!le.has((m=(u=s.parentElement)==null?void 0:u.tagName)!=null?m:"")&&(r.push(s),r.length>120))return{reason:"too_large"};if(r.length===0)return{reason:"empty"};let o=[],l=[];for(let s of r){let c=se(s,e),f=o.indexOf(c);f===-1&&(o.push(c),f=o.length-1),l.push(f)}if(o.length>t)return{reason:"too_large"};let a=r.map(s=>{var c;return S((c=s.nodeValue)!=null?c:"")});return{textNodes:r,ownerEls:o,leafToNode:l,leaves:a,fp:k(a)}}function R(e,t=40){var w;let n=A(e,t);if(!("fp"in n))return{skeleton:null,reason:n.reason};let{textNodes:r,ownerEls:o,leafToNode:l,leaves:a}=n,i=e.ownerDocument,u=i.defaultView,m=[],s=o.map((g,K)=>{var D,L;let d=u==null?void 0:u.getComputedStyle(g),C=(D=g.parentElement)!=null?D:e,T=m.indexOf(C);T===-1&&(m.push(C),T=m.length-1);let N=P.exec(g.tagName),y=G(g)?"action":N?"heading":oe.has(g.tagName)?"label":"text",V=S(a.filter((ge,H)=>l[H]===K).join(" "));return x(p(x(p({tag:g.tagName.toLowerCase(),role:y},N?{level:Number(N[1])}:{}),{text:V,classes:((L=g.getAttribute("class"))!=null?L:"").replace(/\s+/g," ").trim()}),y==="action"?p({filled:!!d&&(!M(b(d.backgroundColor,e.ownerDocument))||d.backgroundImage!==""&&d.backgroundImage!=="none")},B(g.getAttribute("href"),i)!==void 0?{href:B(g.getAttribute("href"),i)}:{}):{}),{color:b(d==null?void 0:d.color,e.ownerDocument),group:T,restylable:!0})}),c=ie(e),f=u==null?void 0:u.getComputedStyle(e);return{skeleton:{v:1,root:x(p({tag:e.tagName.toLowerCase(),classes:((w=e.getAttribute("class"))!=null?w:"").replace(/\s+/g," ").trim(),ambientBg:c.bg},c.alt?{ambientBgAlt:c.alt}:{}),{ambientText:b(f==null?void 0:f.color,e.ownerDocument)}),nodes:s,leaves:a,leafToNode:l,fp:k(a)},textNodes:r,ownerEls:o}}function F(e,t){try{let n=R(e,t==null?void 0:t.maxNodes);return n.skeleton?{skeleton:n.skeleton}:n}catch(n){return{skeleton:null,reason:"unaddressable"}}}0&&(module.exports={captureRegionDom,captureRegionSkeleton,normalizeLeafText,regionAddress,skeletonFingerprint});
2
2
  //# sourceMappingURL=index-region.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index-region.ts","../src/region-capture.ts"],"sourcesContent":["/**\n * `@sentientui/core/region`: region skeleton capture and fingerprinting for\n * the React SDK, the snippet and the API. Split from the lean entry for bundle\n * size — see region-capture.ts.\n */\nexport { captureRegionDom, captureRegionSkeleton, normalizeLeafText, regionAddress, skeletonFingerprint } from './region-capture.js';\nexport type { RegionAddress } from './region-capture.js';\n","// DOM capture of a region skeleton (spec 2026-09-23 §4.1). Its own entry —\n// `@sentientui/core/region` — so the lean core that every plain-JS install\n// downloads doesn't carry ~2 KB of capture code only React and the snippet use.\nimport {\n MAX_SKELETON_LEAVES,\n MAX_SKELETON_NODES,\n MAX_SKELETON_TEXT,\n type RegionSkeleton,\n type SkeletonNode,\n type SkeletonRole,\n} from './region-skeleton.js';\n\nexport function normalizeLeafText(s: string): string {\n return s.replace(/\\s+/g, ' ').trim().slice(0, MAX_SKELETON_TEXT);\n}\n\nfunction fnv(str: string, seed: number): string {\n let h = seed >>> 0;\n for (let i = 0; i < str.length; i++) {\n h ^= str.charCodeAt(i);\n h = Math.imul(h, 0x01000193) >>> 0;\n }\n return h.toString(16).padStart(8, '0');\n}\n\n/** 16 hex chars over the normalized leaf texts. Text-only on purpose: React\n * must compute the same value from its element tree at decide time, when no\n * DOM for the baseline may exist (a served arm is on screen). */\nexport function skeletonFingerprint(leaves: string[]): string {\n const s = leaves.join('\\u001f');\n return fnv(s, 0x811c9dc5) + fnv(s, 0x01000193 ^ 0x5bd1e995);\n}\n\n\nconst ACTION_TAGS = new Set(['A', 'BUTTON']);\nconst HEADING_RE = /^H([1-6])$/;\nconst BLOCK_TAGS = new Set(['P', 'LI', 'LABEL', 'BLOCKQUOTE', 'FIGCAPTION', 'DT', 'DD', 'TD', 'TH']);\nconst LABEL_TAGS = new Set(['LABEL', 'FIGCAPTION', 'DT']);\nconst SKIP_PARENTS = new Set(['SCRIPT', 'STYLE', 'TEMPLATE', 'NOSCRIPT']);\n\nfunction isAction(el: Element): boolean {\n if (ACTION_TAGS.has(el.tagName)) return true;\n if (el.getAttribute('role') === 'button') return true;\n return el.tagName === 'INPUT' && /^(submit|button)$/i.test((el as HTMLInputElement).type);\n}\n\nfunction isBlock(el: Element): boolean {\n if (HEADING_RE.test(el.tagName) || BLOCK_TAGS.has(el.tagName)) return true;\n const view = el.ownerDocument.defaultView;\n const d = view ? view.getComputedStyle(el).display : '';\n return d !== '' && d !== 'inline' && d !== 'contents';\n}\n\n/** Owner of a text node: the nearest ACTION ancestor inside the region if any\n * (a styled button wrapping a display:block span is still a button), else the\n * nearest block ancestor, else the region root. */\nfunction ownerOf(text: Text, root: Element): Element {\n let action: Element | null = null;\n for (let el = text.parentElement; el && el !== root.parentElement; el = el.parentElement) {\n if (isAction(el)) { action = el; break; }\n if (el === root) break;\n }\n if (action) return action;\n for (let el = text.parentElement; el; el = el.parentElement) {\n if (el === root || isBlock(el)) return el;\n }\n return root;\n}\n\nfunction linkOf(raw: string | null, doc: Document): string | undefined {\n if (!raw) return undefined;\n try {\n const u = new URL(raw, doc.location?.href ?? 'https://relative.invalid/');\n if (u.protocol !== 'https:' && u.protocol !== 'http:') return undefined;\n return doc.location && u.origin === doc.location.origin ? u.pathname : `${u.origin}${u.pathname}`;\n } catch {\n return undefined;\n }\n}\n\nfunction transparent(c: string): boolean {\n return c === '' || c === 'transparent' || /rgba\\([^)]*,\\s*0\\)$/.test(c);\n}\n\nfunction ambient(root: Element): { bg: string | null; alt?: string } {\n const view = root.ownerDocument.defaultView;\n if (!view) return { bg: null };\n for (let el: Element | null = root; el; el = el.parentElement) {\n const cs = view.getComputedStyle(el);\n const img = cs.backgroundImage;\n if (img && img !== 'none' && /gradient/.test(img)) {\n const stops = img.match(/rgba?\\([^)]+\\)|#[0-9a-f]{3,8}/gi) ?? [];\n if (stops.length > 0) return { bg: stops[0]!, ...(stops.length > 1 ? { alt: stops[stops.length - 1]! } : {}) };\n }\n if (!transparent(cs.backgroundColor)) return { bg: cs.backgroundColor };\n }\n return { bg: null };\n}\n\n/** The addressing half of a capture: which text nodes the region has, which\n * element owns each, and the fingerprint. No computed colours, classes or\n * roles — this is all the snippet needs on every page view (fingerprint for\n * the decide, owners for applying edits), and keeping it separate keeps the\n * descriptive half out of the always-on bundle. */\nexport type RegionAddress = { textNodes: Text[]; ownerEls: Element[]; leafToNode: number[]; leaves: string[]; fp: string };\n\nexport function regionAddress(\n root: Element,\n maxNodes = MAX_SKELETON_NODES,\n): RegionAddress | { reason: 'too_large' | 'empty' } {\n const walker = root.ownerDocument.createTreeWalker(root, 4 /* SHOW_TEXT */);\n const textNodes: Text[] = [];\n for (let n = walker.nextNode(); n; n = walker.nextNode()) {\n if ((n.nodeValue ?? '').trim() === '') continue;\n if (SKIP_PARENTS.has(n.parentElement?.tagName ?? '')) continue;\n textNodes.push(n as Text);\n if (textNodes.length > MAX_SKELETON_LEAVES) return { reason: 'too_large' };\n }\n if (textNodes.length === 0) return { reason: 'empty' };\n const ownerEls: Element[] = [];\n const leafToNode: number[] = [];\n for (const t of textNodes) {\n const owner = ownerOf(t, root);\n let idx = ownerEls.indexOf(owner);\n if (idx === -1) { ownerEls.push(owner); idx = ownerEls.length - 1; }\n leafToNode.push(idx);\n }\n if (ownerEls.length > maxNodes) return { reason: 'too_large' };\n const leaves = textNodes.map((t) => normalizeLeafText(t.nodeValue ?? ''));\n return { textNodes, ownerEls, leafToNode, leaves, fp: skeletonFingerprint(leaves) };\n}\n\nexport function captureRegionDom(\n root: Element,\n maxNodes = MAX_SKELETON_NODES,\n): { skeleton: RegionSkeleton; textNodes: Text[]; ownerEls: Element[] } | { skeleton: null; reason: 'too_large' | 'empty' } {\n const addr = regionAddress(root, maxNodes);\n if (!('fp' in addr)) return { skeleton: null, reason: addr.reason };\n const { textNodes, ownerEls, leafToNode, leaves } = addr;\n const doc = root.ownerDocument;\n const view = doc.defaultView;\n\n const parents: Element[] = [];\n const nodes: SkeletonNode[] = ownerEls.map((el, i) => {\n const cs = view?.getComputedStyle(el);\n const parent = el.parentElement ?? root;\n let group = parents.indexOf(parent);\n if (group === -1) { parents.push(parent); group = parents.length - 1; }\n const h = HEADING_RE.exec(el.tagName);\n const role: SkeletonRole = isAction(el) ? 'action' : h ? 'heading' : LABEL_TAGS.has(el.tagName) ? 'label' : 'text';\n const text = normalizeLeafText(leaves.filter((_, li) => leafToNode[li] === i).join(' '));\n return {\n tag: el.tagName.toLowerCase(),\n role,\n ...(h ? { level: Number(h[1]) as SkeletonNode['level'] } : {}),\n text,\n classes: (el.getAttribute('class') ?? '').replace(/\\s+/g, ' ').trim(),\n ...(role === 'action'\n ? {\n filled: !!cs && (!transparent(cs.backgroundColor) || (cs.backgroundImage !== '' && cs.backgroundImage !== 'none')),\n ...(linkOf(el.getAttribute('href'), doc) !== undefined ? { href: linkOf(el.getAttribute('href'), doc)! } : {}),\n }\n : {}),\n color: cs?.color ?? '',\n group,\n restylable: true,\n };\n });\n const amb = ambient(root);\n const rootCs = view?.getComputedStyle(root);\n const skeleton: RegionSkeleton = {\n v: 1,\n root: {\n tag: root.tagName.toLowerCase(),\n classes: (root.getAttribute('class') ?? '').replace(/\\s+/g, ' ').trim(),\n ambientBg: amb.bg,\n ...(amb.alt ? { ambientBgAlt: amb.alt } : {}),\n ambientText: rootCs?.color ?? '',\n },\n nodes,\n leaves,\n leafToNode,\n fp: skeletonFingerprint(leaves),\n };\n return { skeleton, textNodes, ownerEls };\n}\n\nexport function captureRegionSkeleton(\n root: Element,\n opts?: { maxNodes?: number },\n): { skeleton: RegionSkeleton } | { skeleton: null; reason: 'too_large' | 'empty' | 'unaddressable' } {\n try {\n const out = captureRegionDom(root, opts?.maxNodes);\n return out.skeleton ? { skeleton: out.skeleton } : out;\n } catch {\n return { skeleton: null, reason: 'unaddressable' };\n }\n}\n"],"mappings":"owBAAA,IAAAA,GAAA,GAAAC,EAAAD,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D,CACF","names":["index_region_exports","__export","captureRegionDom","captureRegionSkeleton","normalizeLeafText","regionAddress","skeletonFingerprint","__toCommonJS","normalizeLeafText","s","fnv","str","seed","h","i","skeletonFingerprint","leaves","ACTION_TAGS","HEADING_RE","BLOCK_TAGS","LABEL_TAGS","SKIP_PARENTS","isAction","el","isBlock","view","d","ownerOf","text","root","action","linkOf","raw","doc","_a","_b","u","e","transparent","c","ambient","cs","img","stops","__spreadValues","regionAddress","maxNodes","_c","walker","textNodes","n","ownerEls","leafToNode","t","owner","idx","captureRegionDom","addr","parents","nodes","parent","group","role","_","li","__spreadProps","amb","rootCs","captureRegionSkeleton","opts","out"]}
1
+ {"version":3,"sources":["../src/index-region.ts","../src/css-color.ts","../src/region-capture.ts"],"sourcesContent":["/**\n * `@sentientui/core/region`: region skeleton capture and fingerprinting for\n * the React SDK, the snippet and the API. Split from the lean entry for bundle\n * size — see region-capture.ts.\n */\nexport { captureRegionDom, captureRegionSkeleton, normalizeLeafText, regionAddress, skeletonFingerprint } from './region-capture.js';\nexport type { RegionAddress } from './region-capture.js';\n","// Browser colour normalization for capture (spec 2026-09-23 §4.1/§4.2).\n// Chrome reports Tailwind v4 colours as `lab(…)` / `oklch(…)`, and the\n// contrast math, the server's colour check and the prompts all read `rgb()`.\n// Without this, a Tailwind v4 site's blue primary button had no measurable\n// fill (captured as a secondary button), its grey body text had no colour\n// (unusable under the contrast gate) and a slate gradient lost a stop —\n// found on bodyshopmanchester.co.uk, 2026-09-23.\n//\n// The browser is the one colour-space converter that is always right, so the\n// colour is painted to a 1×1 canvas and read back. No canvas (jsdom, some\n// privacy modes) → '' for non-rgb input: unknown, which every consumer\n// already treats as \"not measured\" rather than guessing.\n\nconst FN = /(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch|color)\\([^()]*\\)|#[0-9a-f]{3,8}\\b/gi;\nconst RGB = /^rgba?\\(\\s*[\\d.]+[,\\s]+[\\d.]+[,\\s]+[\\d.]+(?:[,\\s/]+[\\d.]+%?)?\\s*\\)$/i;\n\nlet ctx: CanvasRenderingContext2D | null | undefined;\n\nfunction context(doc: Document): CanvasRenderingContext2D | null {\n if (ctx !== undefined) return ctx;\n try {\n const c = doc.createElement('canvas');\n c.width = c.height = 1;\n ctx = c.getContext('2d', { willReadFrequently: true }) as CanvasRenderingContext2D | null;\n } catch {\n ctx = null;\n }\n return ctx;\n}\n\n/** `rgb(r, g, b)` / `rgba(r, g, b, a)` for any CSS colour; '' when unknown. */\nexport function toRgb(color: string | null | undefined, doc: Document): string {\n const c = (color ?? '').trim();\n if (c === '' || c === 'transparent') return c === 'transparent' ? 'rgba(0, 0, 0, 0)' : '';\n if (RGB.test(c) || /^#[0-9a-f]{3,8}$/i.test(c)) return c;\n const g = context(doc);\n if (!g) return '';\n try {\n // A sentinel detects an unparsable value: assigning garbage to fillStyle\n // is silently ignored, which would otherwise read back the sentinel.\n g.fillStyle = '#010203';\n g.fillStyle = c;\n if (String(g.fillStyle).toLowerCase() === '#010203' && c.toLowerCase() !== '#010203') return '';\n g.clearRect(0, 0, 1, 1);\n g.fillRect(0, 0, 1, 1);\n const [r, gr, b, a] = g.getImageData(0, 0, 1, 1).data as unknown as number[];\n return a === 255 ? `rgb(${r}, ${gr}, ${b})` : `rgba(${r}, ${gr}, ${b}, ${Math.round((a! / 255) * 1000) / 1000})`;\n } catch {\n return '';\n }\n}\n\n/** Colour stops of a `background-image` gradient, normalized; [] for none. */\nexport function gradientStopsRgb(img: string | null | undefined, doc: Document): string[] {\n if (!img || img === 'none' || !/gradient/i.test(img)) return [];\n return (img.match(FN) ?? []).map((s) => toRgb(s, doc)).filter((s) => s !== '');\n}\n\n/** Test seam: forget the cached canvas context. */\nexport function resetColorCanvas(): void {\n ctx = undefined;\n}\n","// DOM capture of a region skeleton (spec 2026-09-23 §4.1). Its own entry —\n// `@sentientui/core/region` — so the lean core that every plain-JS install\n// downloads doesn't carry ~2 KB of capture code only React and the snippet use.\nimport {\n MAX_SKELETON_LEAVES,\n MAX_SKELETON_NODES,\n MAX_SKELETON_TEXT,\n type RegionSkeleton,\n type SkeletonNode,\n type SkeletonRole,\n} from './region-skeleton.js';\nimport { gradientStopsRgb, toRgb } from './css-color.js';\n\nexport function normalizeLeafText(s: string): string {\n return s.replace(/\\s+/g, ' ').trim().slice(0, MAX_SKELETON_TEXT);\n}\n\nfunction fnv(str: string, seed: number): string {\n let h = seed >>> 0;\n for (let i = 0; i < str.length; i++) {\n h ^= str.charCodeAt(i);\n h = Math.imul(h, 0x01000193) >>> 0;\n }\n return h.toString(16).padStart(8, '0');\n}\n\n/** 16 hex chars over the normalized leaf texts. Text-only on purpose: React\n * must compute the same value from its element tree at decide time, when no\n * DOM for the baseline may exist (a served arm is on screen). */\nexport function skeletonFingerprint(leaves: string[]): string {\n const s = leaves.join('\\u001f');\n return fnv(s, 0x811c9dc5) + fnv(s, 0x01000193 ^ 0x5bd1e995);\n}\n\n\nconst ACTION_TAGS = new Set(['A', 'BUTTON']);\nconst HEADING_RE = /^H([1-6])$/;\nconst BLOCK_TAGS = new Set(['P', 'LI', 'LABEL', 'BLOCKQUOTE', 'FIGCAPTION', 'DT', 'DD', 'TD', 'TH']);\nconst LABEL_TAGS = new Set(['LABEL', 'FIGCAPTION', 'DT']);\nconst SKIP_PARENTS = new Set(['SCRIPT', 'STYLE', 'TEMPLATE', 'NOSCRIPT']);\n\nfunction isAction(el: Element): boolean {\n if (ACTION_TAGS.has(el.tagName)) return true;\n if (el.getAttribute('role') === 'button') return true;\n return el.tagName === 'INPUT' && /^(submit|button)$/i.test((el as HTMLInputElement).type);\n}\n\nfunction isBlock(el: Element): boolean {\n if (HEADING_RE.test(el.tagName) || BLOCK_TAGS.has(el.tagName)) return true;\n const view = el.ownerDocument.defaultView;\n const d = view ? view.getComputedStyle(el).display : '';\n return d !== '' && d !== 'inline' && d !== 'contents';\n}\n\n/** Owner of a text node: the nearest ACTION ancestor inside the region if any\n * (a styled button wrapping a display:block span is still a button), else the\n * nearest block ancestor, else the region root. */\nfunction ownerOf(text: Text, root: Element): Element {\n let action: Element | null = null;\n for (let el = text.parentElement; el && el !== root.parentElement; el = el.parentElement) {\n if (isAction(el)) { action = el; break; }\n if (el === root) break;\n }\n if (action) return action;\n for (let el = text.parentElement; el; el = el.parentElement) {\n if (el === root || isBlock(el)) return el;\n }\n return root;\n}\n\nfunction linkOf(raw: string | null, doc: Document): string | undefined {\n if (!raw) return undefined;\n try {\n const u = new URL(raw, doc.location?.href ?? 'https://relative.invalid/');\n if (u.protocol !== 'https:' && u.protocol !== 'http:') return undefined;\n return doc.location && u.origin === doc.location.origin ? u.pathname : `${u.origin}${u.pathname}`;\n } catch {\n return undefined;\n }\n}\n\nfunction transparent(c: string): boolean {\n return c === '' || c === 'transparent' || /rgba\\([^)]*,\\s*0\\)$/.test(c);\n}\n\nfunction ambient(root: Element): { bg: string | null; alt?: string } {\n const doc = root.ownerDocument;\n const view = doc.defaultView;\n if (!view) return { bg: null };\n for (let el: Element | null = root; el; el = el.parentElement) {\n const cs = view.getComputedStyle(el);\n // lab()/oklch() stops (Tailwind v4) normalized, or the gradient's second\n // stop was silently dropped (css-color.ts).\n const stops = gradientStopsRgb(cs.backgroundImage, doc);\n if (stops.length > 0) return { bg: stops[0]!, ...(stops.length > 1 ? { alt: stops[stops.length - 1]! } : {}) };\n const bg = toRgb(cs.backgroundColor, doc);\n if (!transparent(bg)) return { bg };\n }\n return { bg: null };\n}\n\n/** The addressing half of a capture: which text nodes the region has, which\n * element owns each, and the fingerprint. No computed colours, classes or\n * roles — this is all the snippet needs on every page view (fingerprint for\n * the decide, owners for applying edits), and keeping it separate keeps the\n * descriptive half out of the always-on bundle. */\nexport type RegionAddress = { textNodes: Text[]; ownerEls: Element[]; leafToNode: number[]; leaves: string[]; fp: string };\n\nexport function regionAddress(\n root: Element,\n maxNodes = MAX_SKELETON_NODES,\n): RegionAddress | { reason: 'too_large' | 'empty' } {\n const walker = root.ownerDocument.createTreeWalker(root, 4 /* SHOW_TEXT */);\n const textNodes: Text[] = [];\n for (let n = walker.nextNode(); n; n = walker.nextNode()) {\n if ((n.nodeValue ?? '').trim() === '') continue;\n if (SKIP_PARENTS.has(n.parentElement?.tagName ?? '')) continue;\n textNodes.push(n as Text);\n if (textNodes.length > MAX_SKELETON_LEAVES) return { reason: 'too_large' };\n }\n if (textNodes.length === 0) return { reason: 'empty' };\n const ownerEls: Element[] = [];\n const leafToNode: number[] = [];\n for (const t of textNodes) {\n const owner = ownerOf(t, root);\n let idx = ownerEls.indexOf(owner);\n if (idx === -1) { ownerEls.push(owner); idx = ownerEls.length - 1; }\n leafToNode.push(idx);\n }\n if (ownerEls.length > maxNodes) return { reason: 'too_large' };\n const leaves = textNodes.map((t) => normalizeLeafText(t.nodeValue ?? ''));\n return { textNodes, ownerEls, leafToNode, leaves, fp: skeletonFingerprint(leaves) };\n}\n\nexport function captureRegionDom(\n root: Element,\n maxNodes = MAX_SKELETON_NODES,\n): { skeleton: RegionSkeleton; textNodes: Text[]; ownerEls: Element[] } | { skeleton: null; reason: 'too_large' | 'empty' } {\n const addr = regionAddress(root, maxNodes);\n if (!('fp' in addr)) return { skeleton: null, reason: addr.reason };\n const { textNodes, ownerEls, leafToNode, leaves } = addr;\n const doc = root.ownerDocument;\n const view = doc.defaultView;\n\n const parents: Element[] = [];\n const nodes: SkeletonNode[] = ownerEls.map((el, i) => {\n const cs = view?.getComputedStyle(el);\n const parent = el.parentElement ?? root;\n let group = parents.indexOf(parent);\n if (group === -1) { parents.push(parent); group = parents.length - 1; }\n const h = HEADING_RE.exec(el.tagName);\n const role: SkeletonRole = isAction(el) ? 'action' : h ? 'heading' : LABEL_TAGS.has(el.tagName) ? 'label' : 'text';\n const text = normalizeLeafText(leaves.filter((_, li) => leafToNode[li] === i).join(' '));\n return {\n tag: el.tagName.toLowerCase(),\n role,\n ...(h ? { level: Number(h[1]) as SkeletonNode['level'] } : {}),\n text,\n classes: (el.getAttribute('class') ?? '').replace(/\\s+/g, ' ').trim(),\n ...(role === 'action'\n ? {\n filled: !!cs && (!transparent(toRgb(cs.backgroundColor, root.ownerDocument)) || (cs.backgroundImage !== '' && cs.backgroundImage !== 'none')),\n ...(linkOf(el.getAttribute('href'), doc) !== undefined ? { href: linkOf(el.getAttribute('href'), doc)! } : {}),\n }\n : {}),\n color: toRgb(cs?.color, root.ownerDocument),\n group,\n restylable: true,\n };\n });\n const amb = ambient(root);\n const rootCs = view?.getComputedStyle(root);\n const skeleton: RegionSkeleton = {\n v: 1,\n root: {\n tag: root.tagName.toLowerCase(),\n classes: (root.getAttribute('class') ?? '').replace(/\\s+/g, ' ').trim(),\n ambientBg: amb.bg,\n ...(amb.alt ? { ambientBgAlt: amb.alt } : {}),\n ambientText: toRgb(rootCs?.color, root.ownerDocument),\n },\n nodes,\n leaves,\n leafToNode,\n fp: skeletonFingerprint(leaves),\n };\n return { skeleton, textNodes, ownerEls };\n}\n\nexport function captureRegionSkeleton(\n root: Element,\n opts?: { maxNodes?: number },\n): { skeleton: RegionSkeleton } | { skeleton: null; reason: 'too_large' | 'empty' | 'unaddressable' } {\n try {\n const out = captureRegionDom(root, opts?.maxNodes);\n return out.skeleton ? { skeleton: out.skeleton } : out;\n } catch {\n return { skeleton: null, reason: 'unaddressable' };\n }\n}\n"],"mappings":"owBAAA,IAAAA,GAAA,GAAAC,EAAAD,GAAA,sBAAAE,EAAA,0BAAAC,EAAA,sBAAAC,EAAA,kBAAAC,EAAA,wBAAAC,IAAA,eAAAC,EAAAP,ICaA,IAAMQ,EAAK,6EACLC,EAAM,uEAERC,EAEJ,SAASC,GAAQC,EAAgD,CAC/D,GAAIF,IAAQ,OAAW,OAAOA,EAC9B,GAAI,CACF,IAAMG,EAAID,EAAI,cAAc,QAAQ,EACpCC,EAAE,MAAQA,EAAE,OAAS,EACrBH,EAAMG,EAAE,WAAW,KAAM,CAAE,mBAAoB,EAAK,CAAC,CACvD,OAAQC,EAAA,CACNJ,EAAM,IACR,CACA,OAAOA,CACT,CAGO,SAASK,EAAMC,EAAkCJ,EAA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G,CAAG,EAAI,CAAC,GAE9G,CAAC,GAXA,CAYL,MAAOa,EAAML,GAAA,YAAAA,EAAI,MAAOZ,EAAK,aAAa,EAC1C,MAAAkC,EACA,WAAY,EACd,EACF,CAAC,EACKK,EAAM5B,GAAQX,CAAI,EAClBwC,EAAS5C,GAAA,YAAAA,EAAM,iBAAiBI,GAetC,MAAO,CAAE,SAdwB,CAC/B,EAAG,EACH,KAAMsC,EAAAvB,EAAA,CACJ,IAAKf,EAAK,QAAQ,YAAY,EAC9B,UAAUK,EAAAL,EAAK,aAAa,OAAO,IAAzB,KAAAK,EAA8B,IAAI,QAAQ,OAAQ,GAAG,EAAE,KAAK,EACtE,UAAWkC,EAAI,IACXA,EAAI,IAAM,CAAE,aAAcA,EAAI,GAAI,EAAI,CAAC,GAJvC,CAKJ,YAAatB,EAAMuB,GAAA,YAAAA,EAAQ,MAAOxC,EAAK,aAAa,CACtD,GACA,MAAAgC,EACA,OAAA7C,EACA,WAAAsC,EACA,GAAIvC,EAAoBC,CAAM,CAChC,EACmB,UAAAmC,EAAW,SAAAE,CAAS,CACzC,CAEO,SAASiB,EACdzC,EACA0C,EACoG,CACpG,GAAI,CACF,IAAMC,EAAMd,EAAiB7B,EAAM0C,GAAA,YAAAA,EAAM,QAAQ,EACjD,OAAOC,EAAI,SAAW,CAAE,SAAUA,EAAI,QAAS,EAAIA,CACrD,OAAQnC,EAAA,CACN,MAAO,CAAE,SAAU,KAAM,OAAQ,eAAgB,CACnD,CACF","names":["index_region_exports","__export","captureRegionDom","captureRegionSkeleton","normalizeLeafText","regionAddress","skeletonFingerprint","__toCommonJS","FN","RGB","ctx","context","doc","c","e","toRgb","color","g","r","gr","b","a","gradientStopsRgb","img","_a","s","normalizeLeafText","s","fnv","str","seed","h","i","skeletonFingerprint","leaves","ACTION_TAGS","HEADING_RE","BLOCK_TAGS","LABEL_TAGS","SKIP_PARENTS","isAction","el","isBlock","view","d","ownerOf","text","root","action","linkOf","raw","doc","_a","_b","u","e","transparent","c","ambient","cs","stops","gradientStopsRgb","__spreadValues","bg","toRgb","regionAddress","maxNodes","_c","walker","textNodes","n","ownerEls","leafToNode","t","owner","idx","captureRegionDom","addr","parents","nodes","parent","group","role","_","li","__spreadProps","amb","rootCs","captureRegionSkeleton","opts","out"]}
@@ -1,2 +1,2 @@
1
- import{a as R,b as M,c as V}from"./chunk-3FKD44SF.mjs";import{a as p,b as E}from"./chunk-TMCGHANO.mjs";function k(e){return e.replace(/\s+/g," ").trim().slice(0,300)}function _(e,o){let n=o>>>0;for(let t=0;t<e.length;t++)n^=e.charCodeAt(t),n=Math.imul(n,16777619)>>>0;return n.toString(16).padStart(8,"0")}function N(e){let o=e.join("");return _(o,2166136261)+_(o,1523705862)}var $=new Set(["A","BUTTON"]),O=/^H([1-6])$/,F=new Set(["P","LI","LABEL","BLOCKQUOTE","FIGCAPTION","DT","DD","TD","TH"]),H=new Set(["LABEL","FIGCAPTION","DT"]),U=new Set(["SCRIPT","STYLE","TEMPLATE","NOSCRIPT"]);function I(e){return $.has(e.tagName)||e.getAttribute("role")==="button"?!0:e.tagName==="INPUT"&&/^(submit|button)$/i.test(e.type)}function X(e){if(O.test(e.tagName)||F.has(e.tagName))return!0;let o=e.ownerDocument.defaultView,n=o?o.getComputedStyle(e).display:"";return n!==""&&n!=="inline"&&n!=="contents"}function j(e,o){let n=null;for(let t=e.parentElement;t&&t!==o.parentElement;t=t.parentElement){if(I(t)){n=t;break}if(t===o)break}if(n)return n;for(let t=e.parentElement;t;t=t.parentElement)if(t===o||X(t))return t;return o}function C(e,o){var n,t;if(e)try{let r=new URL(e,(t=(n=o.location)==null?void 0:n.href)!=null?t:"https://relative.invalid/");return r.protocol!=="https:"&&r.protocol!=="http:"?void 0:o.location&&r.origin===o.location.origin?r.pathname:`${r.origin}${r.pathname}`}catch(r){return}}function D(e){return e===""||e==="transparent"||/rgba\([^)]*,\s*0\)$/.test(e)}function z(e){var n;let o=e.ownerDocument.defaultView;if(!o)return{bg:null};for(let t=e;t;t=t.parentElement){let r=o.getComputedStyle(t),s=r.backgroundImage;if(s&&s!=="none"&&/gradient/.test(s)){let l=(n=s.match(/rgba?\([^)]+\)|#[0-9a-f]{3,8}/gi))!=null?n:[];if(l.length>0)return p({bg:l[0]},l.length>1?{alt:l[l.length-1]}:{})}if(!D(r.backgroundColor))return{bg:r.backgroundColor}}return{bg:null}}function B(e,o=40){var f,i,d;let n=e.ownerDocument.createTreeWalker(e,4),t=[];for(let a=n.nextNode();a;a=n.nextNode())if(((f=a.nodeValue)!=null?f:"").trim()!==""&&!U.has((d=(i=a.parentElement)==null?void 0:i.tagName)!=null?d:"")&&(t.push(a),t.length>120))return{reason:"too_large"};if(t.length===0)return{reason:"empty"};let r=[],s=[];for(let a of t){let u=j(a,e),g=r.indexOf(u);g===-1&&(r.push(u),g=r.length-1),s.push(g)}if(r.length>o)return{reason:"too_large"};let l=t.map(a=>{var u;return k((u=a.nodeValue)!=null?u:"")});return{textNodes:t,ownerEls:r,leafToNode:s,leaves:l,fp:N(l)}}function P(e,o=40){var h,S;let n=B(e,o);if(!("fp"in n))return{skeleton:null,reason:n.reason};let{textNodes:t,ownerEls:r,leafToNode:s,leaves:l}=n,f=e.ownerDocument,i=f.defaultView,d=[],a=r.map((c,v)=>{var L,w,y;let m=i==null?void 0:i.getComputedStyle(c),x=(L=c.parentElement)!=null?L:e,b=d.indexOf(x);b===-1&&(d.push(x),b=d.length-1);let T=O.exec(c.tagName),A=I(c)?"action":T?"heading":H.has(c.tagName)?"label":"text",G=k(l.filter((Y,K)=>s[K]===v).join(" "));return E(p(E(p({tag:c.tagName.toLowerCase(),role:A},T?{level:Number(T[1])}:{}),{text:G,classes:((w=c.getAttribute("class"))!=null?w:"").replace(/\s+/g," ").trim()}),A==="action"?p({filled:!!m&&(!D(m.backgroundColor)||m.backgroundImage!==""&&m.backgroundImage!=="none")},C(c.getAttribute("href"),f)!==void 0?{href:C(c.getAttribute("href"),f)}:{}):{}),{color:(y=m==null?void 0:m.color)!=null?y:"",group:b,restylable:!0})}),u=z(e),g=i==null?void 0:i.getComputedStyle(e);return{skeleton:{v:1,root:E(p({tag:e.tagName.toLowerCase(),classes:((h=e.getAttribute("class"))!=null?h:"").replace(/\s+/g," ").trim(),ambientBg:u.bg},u.alt?{ambientBgAlt:u.alt}:{}),{ambientText:(S=g==null?void 0:g.color)!=null?S:""}),nodes:a,leaves:l,leafToNode:s,fp:N(l)},textNodes:t,ownerEls:r}}function Q(e,o){try{let n=P(e,o==null?void 0:o.maxNodes);return n.skeleton?{skeleton:n.skeleton}:n}catch(n){return{skeleton:null,reason:"unaddressable"}}}export{P as captureRegionDom,Q as captureRegionSkeleton,k as normalizeLeafText,B as regionAddress,N as skeletonFingerprint};
1
+ import{a as R,b as M,c as V}from"./chunk-NCLBL5V3.mjs";import{a as E,b as y}from"./chunk-G6VP7HGJ.mjs";import{a as p,b}from"./chunk-TMCGHANO.mjs";function k(e){return e.replace(/\s+/g," ").trim().slice(0,300)}function D(e,o){let n=o>>>0;for(let t=0;t<e.length;t++)n^=e.charCodeAt(t),n=Math.imul(n,16777619)>>>0;return n.toString(16).padStart(8,"0")}function S(e){let o=e.join("");return D(o,2166136261)+D(o,1523705862)}var $=new Set(["A","BUTTON"]),O=/^H([1-6])$/,F=new Set(["P","LI","LABEL","BLOCKQUOTE","FIGCAPTION","DT","DD","TD","TH"]),H=new Set(["LABEL","FIGCAPTION","DT"]),U=new Set(["SCRIPT","STYLE","TEMPLATE","NOSCRIPT"]);function C(e){return $.has(e.tagName)||e.getAttribute("role")==="button"?!0:e.tagName==="INPUT"&&/^(submit|button)$/i.test(e.type)}function X(e){if(O.test(e.tagName)||F.has(e.tagName))return!0;let o=e.ownerDocument.defaultView,n=o?o.getComputedStyle(e).display:"";return n!==""&&n!=="inline"&&n!=="contents"}function j(e,o){let n=null;for(let t=e.parentElement;t&&t!==o.parentElement;t=t.parentElement){if(C(t)){n=t;break}if(t===o)break}if(n)return n;for(let t=e.parentElement;t;t=t.parentElement)if(t===o||X(t))return t;return o}function _(e,o){var n,t;if(e)try{let r=new URL(e,(t=(n=o.location)==null?void 0:n.href)!=null?t:"https://relative.invalid/");return r.protocol!=="https:"&&r.protocol!=="http:"?void 0:o.location&&r.origin===o.location.origin?r.pathname:`${r.origin}${r.pathname}`}catch(r){return}}function I(e){return e===""||e==="transparent"||/rgba\([^)]*,\s*0\)$/.test(e)}function z(e){let o=e.ownerDocument,n=o.defaultView;if(!n)return{bg:null};for(let t=e;t;t=t.parentElement){let r=n.getComputedStyle(t),l=y(r.backgroundImage,o);if(l.length>0)return p({bg:l[0]},l.length>1?{alt:l[l.length-1]}:{});let s=E(r.backgroundColor,o);if(!I(s))return{bg:s}}return{bg:null}}function B(e,o=40){var f,i,d;let n=e.ownerDocument.createTreeWalker(e,4),t=[];for(let a=n.nextNode();a;a=n.nextNode())if(((f=a.nodeValue)!=null?f:"").trim()!==""&&!U.has((d=(i=a.parentElement)==null?void 0:i.tagName)!=null?d:"")&&(t.push(a),t.length>120))return{reason:"too_large"};if(t.length===0)return{reason:"empty"};let r=[],l=[];for(let a of t){let u=j(a,e),g=r.indexOf(u);g===-1&&(r.push(u),g=r.length-1),l.push(g)}if(r.length>o)return{reason:"too_large"};let s=t.map(a=>{var u;return k((u=a.nodeValue)!=null?u:"")});return{textNodes:t,ownerEls:r,leafToNode:l,leaves:s,fp:S(s)}}function P(e,o=40){var h;let n=B(e,o);if(!("fp"in n))return{skeleton:null,reason:n.reason};let{textNodes:t,ownerEls:r,leafToNode:l,leaves:s}=n,f=e.ownerDocument,i=f.defaultView,d=[],a=r.map((c,v)=>{var w,L;let m=i==null?void 0:i.getComputedStyle(c),x=(w=c.parentElement)!=null?w:e,T=d.indexOf(x);T===-1&&(d.push(x),T=d.length-1);let N=O.exec(c.tagName),A=C(c)?"action":N?"heading":H.has(c.tagName)?"label":"text",G=k(s.filter((Y,K)=>l[K]===v).join(" "));return b(p(b(p({tag:c.tagName.toLowerCase(),role:A},N?{level:Number(N[1])}:{}),{text:G,classes:((L=c.getAttribute("class"))!=null?L:"").replace(/\s+/g," ").trim()}),A==="action"?p({filled:!!m&&(!I(E(m.backgroundColor,e.ownerDocument))||m.backgroundImage!==""&&m.backgroundImage!=="none")},_(c.getAttribute("href"),f)!==void 0?{href:_(c.getAttribute("href"),f)}:{}):{}),{color:E(m==null?void 0:m.color,e.ownerDocument),group:T,restylable:!0})}),u=z(e),g=i==null?void 0:i.getComputedStyle(e);return{skeleton:{v:1,root:b(p({tag:e.tagName.toLowerCase(),classes:((h=e.getAttribute("class"))!=null?h:"").replace(/\s+/g," ").trim(),ambientBg:u.bg},u.alt?{ambientBgAlt:u.alt}:{}),{ambientText:E(g==null?void 0:g.color,e.ownerDocument)}),nodes:a,leaves:s,leafToNode:l,fp:S(s)},textNodes:t,ownerEls:r}}function Q(e,o){try{let n=P(e,o==null?void 0:o.maxNodes);return n.skeleton?{skeleton:n.skeleton}:n}catch(n){return{skeleton:null,reason:"unaddressable"}}}export{P as captureRegionDom,Q as captureRegionSkeleton,k as normalizeLeafText,B as regionAddress,S as skeletonFingerprint};
2
2
  //# sourceMappingURL=index-region.mjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/region-capture.ts"],"sourcesContent":["// DOM capture of a region skeleton (spec 2026-09-23 §4.1). Its own entry —\n// `@sentientui/core/region` — so the lean core that every plain-JS install\n// downloads doesn't carry ~2 KB of capture code only React and the snippet use.\nimport {\n MAX_SKELETON_LEAVES,\n MAX_SKELETON_NODES,\n MAX_SKELETON_TEXT,\n type RegionSkeleton,\n type SkeletonNode,\n type SkeletonRole,\n} from './region-skeleton.js';\n\nexport function normalizeLeafText(s: string): string {\n return s.replace(/\\s+/g, ' ').trim().slice(0, MAX_SKELETON_TEXT);\n}\n\nfunction fnv(str: string, seed: number): string {\n let h = seed >>> 0;\n for (let i = 0; i < str.length; i++) {\n h ^= str.charCodeAt(i);\n h = Math.imul(h, 0x01000193) >>> 0;\n }\n return h.toString(16).padStart(8, '0');\n}\n\n/** 16 hex chars over the normalized leaf texts. Text-only on purpose: React\n * must compute the same value from its element tree at decide time, when no\n * DOM for the baseline may exist (a served arm is on screen). */\nexport function skeletonFingerprint(leaves: string[]): string {\n const s = leaves.join('\\u001f');\n return fnv(s, 0x811c9dc5) + fnv(s, 0x01000193 ^ 0x5bd1e995);\n}\n\n\nconst ACTION_TAGS = new Set(['A', 'BUTTON']);\nconst HEADING_RE = /^H([1-6])$/;\nconst BLOCK_TAGS = new Set(['P', 'LI', 'LABEL', 'BLOCKQUOTE', 'FIGCAPTION', 'DT', 'DD', 'TD', 'TH']);\nconst LABEL_TAGS = new Set(['LABEL', 'FIGCAPTION', 'DT']);\nconst SKIP_PARENTS = new Set(['SCRIPT', 'STYLE', 'TEMPLATE', 'NOSCRIPT']);\n\nfunction isAction(el: Element): boolean {\n if (ACTION_TAGS.has(el.tagName)) return true;\n if (el.getAttribute('role') === 'button') return true;\n return el.tagName === 'INPUT' && /^(submit|button)$/i.test((el as HTMLInputElement).type);\n}\n\nfunction isBlock(el: Element): boolean {\n if (HEADING_RE.test(el.tagName) || BLOCK_TAGS.has(el.tagName)) return true;\n const view = el.ownerDocument.defaultView;\n const d = view ? view.getComputedStyle(el).display : '';\n return d !== '' && d !== 'inline' && d !== 'contents';\n}\n\n/** Owner of a text node: the nearest ACTION ancestor inside the region if any\n * (a styled button wrapping a display:block span is still a button), else the\n * nearest block ancestor, else the region root. */\nfunction ownerOf(text: Text, root: Element): Element {\n let action: Element | null = null;\n for (let el = text.parentElement; el && el !== root.parentElement; el = el.parentElement) {\n if (isAction(el)) { action = el; break; }\n if (el === root) break;\n }\n if (action) return action;\n for (let el = text.parentElement; el; el = el.parentElement) {\n if (el === root || isBlock(el)) return el;\n }\n return root;\n}\n\nfunction linkOf(raw: string | null, doc: Document): string | undefined {\n if (!raw) return undefined;\n try {\n const u = new URL(raw, doc.location?.href ?? 'https://relative.invalid/');\n if (u.protocol !== 'https:' && u.protocol !== 'http:') return undefined;\n return doc.location && u.origin === doc.location.origin ? u.pathname : `${u.origin}${u.pathname}`;\n } catch {\n return undefined;\n }\n}\n\nfunction transparent(c: string): boolean {\n return c === '' || c === 'transparent' || /rgba\\([^)]*,\\s*0\\)$/.test(c);\n}\n\nfunction ambient(root: Element): { bg: string | null; alt?: string } {\n const view = root.ownerDocument.defaultView;\n if (!view) return { bg: null };\n for (let el: Element | null = root; el; el = el.parentElement) {\n const cs = view.getComputedStyle(el);\n const img = cs.backgroundImage;\n if (img && img !== 'none' && /gradient/.test(img)) {\n const stops = img.match(/rgba?\\([^)]+\\)|#[0-9a-f]{3,8}/gi) ?? [];\n if (stops.length > 0) return { bg: stops[0]!, ...(stops.length > 1 ? { alt: stops[stops.length - 1]! } : {}) };\n }\n if (!transparent(cs.backgroundColor)) return { bg: cs.backgroundColor };\n }\n return { bg: null };\n}\n\n/** The addressing half of a capture: which text nodes the region has, which\n * element owns each, and the fingerprint. No computed colours, classes or\n * roles — this is all the snippet needs on every page view (fingerprint for\n * the decide, owners for applying edits), and keeping it separate keeps the\n * descriptive half out of the always-on bundle. */\nexport type RegionAddress = { textNodes: Text[]; ownerEls: Element[]; leafToNode: number[]; leaves: string[]; fp: string };\n\nexport function regionAddress(\n root: Element,\n maxNodes = MAX_SKELETON_NODES,\n): RegionAddress | { reason: 'too_large' | 'empty' } {\n const walker = root.ownerDocument.createTreeWalker(root, 4 /* SHOW_TEXT */);\n const textNodes: Text[] = [];\n for (let n = walker.nextNode(); n; n = walker.nextNode()) {\n if ((n.nodeValue ?? '').trim() === '') continue;\n if (SKIP_PARENTS.has(n.parentElement?.tagName ?? '')) continue;\n textNodes.push(n as Text);\n if (textNodes.length > MAX_SKELETON_LEAVES) return { reason: 'too_large' };\n }\n if (textNodes.length === 0) return { reason: 'empty' };\n const ownerEls: Element[] = [];\n const leafToNode: number[] = [];\n for (const t of textNodes) {\n const owner = ownerOf(t, root);\n let idx = ownerEls.indexOf(owner);\n if (idx === -1) { ownerEls.push(owner); idx = ownerEls.length - 1; }\n leafToNode.push(idx);\n }\n if (ownerEls.length > maxNodes) return { reason: 'too_large' };\n const leaves = textNodes.map((t) => normalizeLeafText(t.nodeValue ?? ''));\n return { textNodes, ownerEls, leafToNode, leaves, fp: skeletonFingerprint(leaves) };\n}\n\nexport function captureRegionDom(\n root: Element,\n maxNodes = MAX_SKELETON_NODES,\n): { skeleton: RegionSkeleton; textNodes: Text[]; ownerEls: Element[] } | { skeleton: null; reason: 'too_large' | 'empty' } {\n const addr = regionAddress(root, maxNodes);\n if (!('fp' in addr)) return { skeleton: null, reason: addr.reason };\n const { textNodes, ownerEls, leafToNode, leaves } = addr;\n const doc = root.ownerDocument;\n const view = doc.defaultView;\n\n const parents: Element[] = [];\n const nodes: SkeletonNode[] = ownerEls.map((el, i) => {\n const cs = view?.getComputedStyle(el);\n const parent = el.parentElement ?? root;\n let group = parents.indexOf(parent);\n if (group === -1) { parents.push(parent); group = parents.length - 1; }\n const h = HEADING_RE.exec(el.tagName);\n const role: SkeletonRole = isAction(el) ? 'action' : h ? 'heading' : LABEL_TAGS.has(el.tagName) ? 'label' : 'text';\n const text = normalizeLeafText(leaves.filter((_, li) => leafToNode[li] === i).join(' '));\n return {\n tag: el.tagName.toLowerCase(),\n role,\n ...(h ? { level: Number(h[1]) as SkeletonNode['level'] } : {}),\n text,\n classes: (el.getAttribute('class') ?? '').replace(/\\s+/g, ' ').trim(),\n ...(role === 'action'\n ? {\n filled: !!cs && (!transparent(cs.backgroundColor) || (cs.backgroundImage !== '' && cs.backgroundImage !== 'none')),\n ...(linkOf(el.getAttribute('href'), doc) !== undefined ? { href: linkOf(el.getAttribute('href'), doc)! } : {}),\n }\n : {}),\n color: cs?.color ?? '',\n group,\n restylable: true,\n };\n });\n const amb = ambient(root);\n const rootCs = view?.getComputedStyle(root);\n const skeleton: RegionSkeleton = {\n v: 1,\n root: {\n tag: root.tagName.toLowerCase(),\n classes: (root.getAttribute('class') ?? '').replace(/\\s+/g, ' ').trim(),\n ambientBg: amb.bg,\n ...(amb.alt ? { ambientBgAlt: amb.alt } : {}),\n ambientText: rootCs?.color ?? '',\n },\n nodes,\n leaves,\n leafToNode,\n fp: skeletonFingerprint(leaves),\n };\n return { skeleton, textNodes, ownerEls };\n}\n\nexport function captureRegionSkeleton(\n root: Element,\n opts?: { maxNodes?: number },\n): { skeleton: RegionSkeleton } | { skeleton: null; reason: 'too_large' | 'empty' | 'unaddressable' } {\n try {\n const out = captureRegionDom(root, opts?.maxNodes);\n return out.skeleton ? { skeleton: out.skeleton } : out;\n } catch {\n return { skeleton: null, reason: 'unaddressable' };\n }\n}\n"],"mappings":"uGAYO,SAASA,EAAkBC,EAAmB,CACnD,OAAOA,EAAE,QAAQ,OAAQ,GAAG,EAAE,KAAK,EAAE,MAAM,EAAG,GAAiB,CACjE,CAEA,SAASC,EAAIC,EAAaC,EAAsB,CAC9C,IAAIC,EAAID,IAAS,EACjB,QAASE,EAAI,EAAGA,EAAIH,EAAI,OAAQG,IAC9BD,GAAKF,EAAI,WAAWG,CAAC,EACrBD,EAAI,KAAK,KAAKA,EAAG,QAAU,IAAM,EAEnC,OAAOA,EAAE,SAAS,EAAE,EAAE,SAAS,EAAG,GAAG,CACvC,CAKO,SAASE,EAAoBC,EAA0B,CAC5D,IAAMP,EAAIO,EAAO,KAAK,GAAQ,EAC9B,OAAON,EAAID,EAAG,UAAU,EAAIC,EAAID,EAAG,UAAuB,CAC5D,CAGA,IAAMQ,EAAc,IAAI,IAAI,CAAC,IAAK,QAAQ,CAAC,EACrCC,EAAa,aACbC,EAAa,IAAI,IAAI,CAAC,IAAK,KAAM,QAAS,aAAc,aAAc,KAAM,KAAM,KAAM,IAAI,CAAC,EAC7FC,EAAa,IAAI,IAAI,CAAC,QAAS,aAAc,IAAI,CAAC,EAClDC,EAAe,IAAI,IAAI,CAAC,SAAU,QAAS,WAAY,UAAU,CAAC,EAExE,SAASC,EAASC,EAAsB,CAEtC,OADIN,EAAY,IAAIM,EAAG,OAAO,GAC1BA,EAAG,aAAa,MAAM,IA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AChC,EACmB,UAAAiC,EAAW,SAAAE,CAAS,CACzC,CAEO,SAASiB,EACdvC,EACAwC,EACoG,CACpG,GAAI,CACF,IAAMC,EAAMd,EAAiB3B,EAAMwC,GAAA,YAAAA,EAAM,QAAQ,EACjD,OAAOC,EAAI,SAAW,CAAE,SAAUA,EAAI,QAAS,EAAIA,CACrD,OAAQjC,EAAA,CACN,MAAO,CAAE,SAAU,KAAM,OAAQ,eAAgB,CACnD,CACF","names":["normalizeLeafText","s","fnv","str","seed","h","i","skeletonFingerprint","leaves","ACTION_TAGS","HEADING_RE","BLOCK_TAGS","LABEL_TAGS","SKIP_PARENTS","isAction","el","isBlock","view","d","ownerOf","text","root","action","linkOf","raw","doc","_a","_b","u","e","transparent","c","ambient","cs","img","stops","__spreadValues","regionAddress","maxNodes","_c","walker","textNodes","n","ownerEls","leafToNode","t","owner","idx","captureRegionDom","addr","parents","nodes","parent","group","role","_","li","__spreadProps","amb","rootCs","captureRegionSkeleton","opts","out"]}
1
+ {"version":3,"sources":["../src/region-capture.ts"],"sourcesContent":["// DOM capture of a region skeleton (spec 2026-09-23 §4.1). Its own entry —\n// `@sentientui/core/region` — so the lean core that every plain-JS install\n// downloads doesn't carry ~2 KB of capture code only React and the snippet use.\nimport {\n MAX_SKELETON_LEAVES,\n MAX_SKELETON_NODES,\n MAX_SKELETON_TEXT,\n type RegionSkeleton,\n type SkeletonNode,\n type SkeletonRole,\n} from './region-skeleton.js';\nimport { gradientStopsRgb, toRgb } from './css-color.js';\n\nexport function normalizeLeafText(s: string): string {\n return s.replace(/\\s+/g, ' ').trim().slice(0, MAX_SKELETON_TEXT);\n}\n\nfunction fnv(str: string, seed: number): string {\n let h = seed >>> 0;\n for (let i = 0; i < str.length; i++) {\n h ^= str.charCodeAt(i);\n h = Math.imul(h, 0x01000193) >>> 0;\n }\n return h.toString(16).padStart(8, '0');\n}\n\n/** 16 hex chars over the normalized leaf texts. Text-only on purpose: React\n * must compute the same value from its element tree at decide time, when no\n * DOM for the baseline may exist (a served arm is on screen). */\nexport function skeletonFingerprint(leaves: string[]): string {\n const s = leaves.join('\\u001f');\n return fnv(s, 0x811c9dc5) + fnv(s, 0x01000193 ^ 0x5bd1e995);\n}\n\n\nconst ACTION_TAGS = new Set(['A', 'BUTTON']);\nconst HEADING_RE = /^H([1-6])$/;\nconst BLOCK_TAGS = new Set(['P', 'LI', 'LABEL', 'BLOCKQUOTE', 'FIGCAPTION', 'DT', 'DD', 'TD', 'TH']);\nconst LABEL_TAGS = new Set(['LABEL', 'FIGCAPTION', 'DT']);\nconst SKIP_PARENTS = new Set(['SCRIPT', 'STYLE', 'TEMPLATE', 'NOSCRIPT']);\n\nfunction isAction(el: Element): boolean {\n if (ACTION_TAGS.has(el.tagName)) return true;\n if (el.getAttribute('role') === 'button') return true;\n return el.tagName === 'INPUT' && /^(submit|button)$/i.test((el as HTMLInputElement).type);\n}\n\nfunction isBlock(el: Element): boolean {\n if (HEADING_RE.test(el.tagName) || BLOCK_TAGS.has(el.tagName)) return true;\n const view = el.ownerDocument.defaultView;\n const d = view ? view.getComputedStyle(el).display : '';\n return d !== '' && d !== 'inline' && d !== 'contents';\n}\n\n/** Owner of a text node: the nearest ACTION ancestor inside the region if any\n * (a styled button wrapping a display:block span is still a button), else the\n * nearest block ancestor, else the region root. */\nfunction ownerOf(text: Text, root: Element): Element {\n let action: Element | null = null;\n for (let el = text.parentElement; el && el !== root.parentElement; el = el.parentElement) {\n if (isAction(el)) { action = el; break; }\n if (el === root) break;\n }\n if (action) return action;\n for (let el = text.parentElement; el; el = el.parentElement) {\n if (el === root || isBlock(el)) return el;\n }\n return root;\n}\n\nfunction linkOf(raw: string | null, doc: Document): string | undefined {\n if (!raw) return undefined;\n try {\n const u = new URL(raw, doc.location?.href ?? 'https://relative.invalid/');\n if (u.protocol !== 'https:' && u.protocol !== 'http:') return undefined;\n return doc.location && u.origin === doc.location.origin ? u.pathname : `${u.origin}${u.pathname}`;\n } catch {\n return undefined;\n }\n}\n\nfunction transparent(c: string): boolean {\n return c === '' || c === 'transparent' || /rgba\\([^)]*,\\s*0\\)$/.test(c);\n}\n\nfunction ambient(root: Element): { bg: string | null; alt?: string } {\n const doc = root.ownerDocument;\n const view = doc.defaultView;\n if (!view) return { bg: null };\n for (let el: Element | null = root; el; el = el.parentElement) {\n const cs = view.getComputedStyle(el);\n // lab()/oklch() stops (Tailwind v4) normalized, or the gradient's second\n // stop was silently dropped (css-color.ts).\n const stops = gradientStopsRgb(cs.backgroundImage, doc);\n if (stops.length > 0) return { bg: stops[0]!, ...(stops.length > 1 ? { alt: stops[stops.length - 1]! } : {}) };\n const bg = toRgb(cs.backgroundColor, doc);\n if (!transparent(bg)) return { bg };\n }\n return { bg: null };\n}\n\n/** The addressing half of a capture: which text nodes the region has, which\n * element owns each, and the fingerprint. No computed colours, classes or\n * roles — this is all the snippet needs on every page view (fingerprint for\n * the decide, owners for applying edits), and keeping it separate keeps the\n * descriptive half out of the always-on bundle. */\nexport type RegionAddress = { textNodes: Text[]; ownerEls: Element[]; leafToNode: number[]; leaves: string[]; fp: string };\n\nexport function regionAddress(\n root: Element,\n maxNodes = MAX_SKELETON_NODES,\n): RegionAddress | { reason: 'too_large' | 'empty' } {\n const walker = root.ownerDocument.createTreeWalker(root, 4 /* SHOW_TEXT */);\n const textNodes: Text[] = [];\n for (let n = walker.nextNode(); n; n = walker.nextNode()) {\n if ((n.nodeValue ?? '').trim() === '') continue;\n if (SKIP_PARENTS.has(n.parentElement?.tagName ?? '')) continue;\n textNodes.push(n as Text);\n if (textNodes.length > MAX_SKELETON_LEAVES) return { reason: 'too_large' };\n }\n if (textNodes.length === 0) return { reason: 'empty' };\n const ownerEls: Element[] = [];\n const leafToNode: number[] = [];\n for (const t of textNodes) {\n const owner = ownerOf(t, root);\n let idx = ownerEls.indexOf(owner);\n if (idx === -1) { ownerEls.push(owner); idx = ownerEls.length - 1; }\n leafToNode.push(idx);\n }\n if (ownerEls.length > maxNodes) return { reason: 'too_large' };\n const leaves = textNodes.map((t) => normalizeLeafText(t.nodeValue ?? ''));\n return { textNodes, ownerEls, leafToNode, leaves, fp: skeletonFingerprint(leaves) };\n}\n\nexport function captureRegionDom(\n root: Element,\n maxNodes = MAX_SKELETON_NODES,\n): { skeleton: RegionSkeleton; textNodes: Text[]; ownerEls: Element[] } | { skeleton: null; reason: 'too_large' | 'empty' } {\n const addr = regionAddress(root, maxNodes);\n if (!('fp' in addr)) return { skeleton: null, reason: addr.reason };\n const { textNodes, ownerEls, leafToNode, leaves } = addr;\n const doc = root.ownerDocument;\n const view = doc.defaultView;\n\n const parents: Element[] = [];\n const nodes: SkeletonNode[] = ownerEls.map((el, i) => {\n const cs = view?.getComputedStyle(el);\n const parent = el.parentElement ?? root;\n let group = parents.indexOf(parent);\n if (group === -1) { parents.push(parent); group = parents.length - 1; }\n const h = HEADING_RE.exec(el.tagName);\n const role: SkeletonRole = isAction(el) ? 'action' : h ? 'heading' : LABEL_TAGS.has(el.tagName) ? 'label' : 'text';\n const text = normalizeLeafText(leaves.filter((_, li) => leafToNode[li] === i).join(' '));\n return {\n tag: el.tagName.toLowerCase(),\n role,\n ...(h ? { level: Number(h[1]) as SkeletonNode['level'] } : {}),\n text,\n classes: (el.getAttribute('class') ?? '').replace(/\\s+/g, ' ').trim(),\n ...(role === 'action'\n ? {\n filled: !!cs && (!transparent(toRgb(cs.backgroundColor, root.ownerDocument)) || (cs.backgroundImage !== '' && cs.backgroundImage !== 'none')),\n ...(linkOf(el.getAttribute('href'), doc) !== undefined ? { href: linkOf(el.getAttribute('href'), doc)! } : {}),\n }\n : {}),\n color: toRgb(cs?.color, root.ownerDocument),\n group,\n restylable: true,\n };\n });\n const amb = ambient(root);\n const rootCs = view?.getComputedStyle(root);\n const skeleton: RegionSkeleton = {\n v: 1,\n root: {\n tag: root.tagName.toLowerCase(),\n classes: (root.getAttribute('class') ?? '').replace(/\\s+/g, ' ').trim(),\n ambientBg: amb.bg,\n ...(amb.alt ? { ambientBgAlt: amb.alt } : {}),\n ambientText: toRgb(rootCs?.color, root.ownerDocument),\n },\n nodes,\n leaves,\n leafToNode,\n fp: skeletonFingerprint(leaves),\n };\n return { skeleton, textNodes, ownerEls };\n}\n\nexport function captureRegionSkeleton(\n root: Element,\n opts?: { maxNodes?: number },\n): { skeleton: RegionSkeleton } | { skeleton: null; reason: 'too_large' | 'empty' | 'unaddressable' } {\n try {\n const out = captureRegionDom(root, opts?.maxNodes);\n return out.skeleton ? { skeleton: out.skeleton } : out;\n } catch {\n return { skeleton: null, reason: 'unaddressable' };\n }\n}\n"],"mappings":"kJAaO,SAASA,EAAkBC,EAAmB,CACnD,OAAOA,EAAE,QAAQ,OAAQ,GAAG,EAAE,KAAK,EAAE,MAAM,EAAG,GAAiB,CACjE,CAEA,SAASC,EAAIC,EAAaC,EAAsB,CAC9C,IAAIC,EAAID,IAAS,EACjB,QAASE,EAAI,EAAGA,EAAIH,EAAI,OAAQG,IAC9BD,GAAKF,EAAI,WAAWG,CAAC,EACrBD,EAAI,KAAK,KAAKA,EAAG,QAAU,IAAM,EAEnC,OAAOA,EAAE,SAAS,EAAE,EAAE,SAAS,EAAG,GAAG,CACvC,CAKO,SAASE,EAAoBC,EAA0B,CAC5D,IAAMP,EAAIO,EAAO,KAAK,GAAQ,EAC9B,OAAON,EAAID,EAAG,UAAU,EAAIC,EAAID,EAAG,UAAuB,CAC5D,CAGA,IAAMQ,EAAc,IAAI,IAAI,CAAC,IAAK,QAAQ,CAAC,EACrCC,EAAa,aACbC,EAAa,IAAI,IAAI,CAAC,IAAK,KAAM,QAAS,aAAc,aAAc,KAAM,KAAM,KAAM,IAAI,CAAC,EAC7FC,EAAa,IAAI,IAAI,CAAC,QAAS,aAAc,IAAI,CAAC,EAClDC,EAAe,IAAI,IAAI,CAAC,SAAU,QAAS,WAAY,UAAU,CAAC,EAExE,SAASC,EAASC,EAAsB,CAEtC,OADIN,EAAY,IAAIM,EAAG,OAAO,GAC1BA,EAAG,aAAa,MAAM,IAAM,SAAiB,GAC1CA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pG,GAAI,CACF,IAAMC,EAAMd,EAAiB7B,EAAM0C,GAAA,YAAAA,EAAM,QAAQ,EACjD,OAAOC,EAAI,SAAW,CAAE,SAAUA,EAAI,QAAS,EAAIA,CACrD,OAAQnC,EAAA,CACN,MAAO,CAAE,SAAU,KAAM,OAAQ,eAAgB,CACnD,CACF","names":["normalizeLeafText","s","fnv","str","seed","h","i","skeletonFingerprint","leaves","ACTION_TAGS","HEADING_RE","BLOCK_TAGS","LABEL_TAGS","SKIP_PARENTS","isAction","el","isBlock","view","d","ownerOf","text","root","action","linkOf","raw","doc","_a","_b","u","e","transparent","c","ambient","cs","stops","gradientStopsRgb","__spreadValues","bg","toRgb","regionAddress","maxNodes","_c","walker","textNodes","n","ownerEls","leafToNode","t","owner","idx","captureRegionDom","addr","parents","nodes","parent","group","role","_","li","__spreadProps","amb","rootCs","captureRegionSkeleton","opts","out"]}
@@ -1,7 +1,7 @@
1
- import { $ as SitePalette, a4 as StyleVocabulary } from './style-vocabulary-BqviEw9O.cjs';
2
- import { d as SlotConfigEntry, e as SlotDeclInput } from './session-meta-KwDqU9a8.cjs';
3
- export { C as CLICK_ID_KEYS, c as SessionUpsertPayload, l as buildSessionUpsertPayload, n as deriveSessionSegment, o as detectDeviceClass, p as detectTimeOfDay, q as detectTrafficSource, r as extractTrackedParams, u as referrerDomainFromReferer } from './session-meta-KwDqU9a8.cjs';
4
- import { c as RenderCaps } from './region-skeleton-CQ4yhVw1.cjs';
1
+ import { $ as SitePalette, a4 as StyleVocabulary } from './style-vocabulary-Ba_g6_DD.cjs';
2
+ import { d as SlotConfigEntry, e as SlotDeclInput } from './session-meta-CJwAWbJr.cjs';
3
+ export { C as CLICK_ID_KEYS, c as SessionUpsertPayload, l as buildSessionUpsertPayload, n as deriveSessionSegment, o as detectDeviceClass, p as detectTimeOfDay, q as detectTrafficSource, r as extractTrackedParams, u as referrerDomainFromReferer } from './session-meta-CJwAWbJr.cjs';
4
+ import { c as RenderCaps } from './region-skeleton-D2ahkcbe.cjs';
5
5
  import { SlotResult } from '@sentientui/policy';
6
6
  export { SlotResult } from '@sentientui/policy';
7
7
 
@@ -1,7 +1,7 @@
1
- import { $ as SitePalette, a4 as StyleVocabulary } from './style-vocabulary-BqviEw9O.js';
2
- import { d as SlotConfigEntry, e as SlotDeclInput } from './session-meta-CWGtzFOQ.js';
3
- export { C as CLICK_ID_KEYS, c as SessionUpsertPayload, l as buildSessionUpsertPayload, n as deriveSessionSegment, o as detectDeviceClass, p as detectTimeOfDay, q as detectTrafficSource, r as extractTrackedParams, u as referrerDomainFromReferer } from './session-meta-CWGtzFOQ.js';
4
- import { c as RenderCaps } from './region-skeleton-CQ4yhVw1.js';
1
+ import { $ as SitePalette, a4 as StyleVocabulary } from './style-vocabulary-Ba_g6_DD.js';
2
+ import { d as SlotConfigEntry, e as SlotDeclInput } from './session-meta-CKXcaBjt.js';
3
+ export { C as CLICK_ID_KEYS, c as SessionUpsertPayload, l as buildSessionUpsertPayload, n as deriveSessionSegment, o as detectDeviceClass, p as detectTimeOfDay, q as detectTrafficSource, r as extractTrackedParams, u as referrerDomainFromReferer } from './session-meta-CKXcaBjt.js';
4
+ import { c as RenderCaps } from './region-skeleton-D2ahkcbe.js';
5
5
  import { SlotResult } from '@sentientui/policy';
6
6
  export { SlotResult } from '@sentientui/policy';
7
7
 
@@ -1,5 +1,5 @@
1
- import { a2 as StyleEntry, _ as SiteImage } from './style-vocabulary-BqviEw9O.cjs';
2
- export { O as LIKE_ID_RE, X as MAX_SITE_IMAGES, Y as MAX_STYLE_ENTRIES, Z as STYLE_ROLES } from './style-vocabulary-BqviEw9O.cjs';
1
+ import { a2 as StyleEntry, _ as SiteImage } from './style-vocabulary-Ba_g6_DD.cjs';
2
+ export { O as LIKE_ID_RE, X as MAX_SITE_IMAGES, Y as MAX_STYLE_ENTRIES, Z as STYLE_ROLES } from './style-vocabulary-Ba_g6_DD.cjs';
3
3
 
4
4
  type Sampled = Omit<StyleEntry, 'source'>;
5
5
  declare function sampleStyleVocabulary(doc: Document, opts?: {
@@ -1,5 +1,5 @@
1
- import { a2 as StyleEntry, _ as SiteImage } from './style-vocabulary-BqviEw9O.js';
2
- export { O as LIKE_ID_RE, X as MAX_SITE_IMAGES, Y as MAX_STYLE_ENTRIES, Z as STYLE_ROLES } from './style-vocabulary-BqviEw9O.js';
1
+ import { a2 as StyleEntry, _ as SiteImage } from './style-vocabulary-Ba_g6_DD.js';
2
+ export { O as LIKE_ID_RE, X as MAX_SITE_IMAGES, Y as MAX_STYLE_ENTRIES, Z as STYLE_ROLES } from './style-vocabulary-Ba_g6_DD.js';
3
3
 
4
4
  type Sampled = Omit<StyleEntry, 'source'>;
5
5
  declare function sampleStyleVocabulary(doc: Document, opts?: {