@datacub/web 0.5.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.6.0](https://github.com/datacub/sdk/compare/web-v0.5.0...web-v0.6.0) (2026-11-24)
4
+
5
+
6
+ ### Features
7
+
8
+ * **web:** feedback card look: font, corners, size, card and text colours, and feedback.look in init ([#8](https://github.com/datacub/sdk/issues/8)) ([466ee22](https://github.com/datacub/sdk/commit/466ee226c3081246e6afd075e67ba0917e5ea22c))
9
+
3
10
  ## [0.5.0](https://github.com/datacub/sdk/compare/web-v0.4.3...web-v0.5.0) (2026-11-23)
4
11
 
5
12
 
package/dist/datacub.js CHANGED
@@ -1,4 +1,4 @@
1
- (()=>{var _={n:0},Et=(t)=>t.replace(/[\u0660-\u0669\u06f0-\u06f9\uff10-\uff19]/g,(e)=>String(e.charCodeAt(0)&15)),Se=/[\s./()\u0640\u066b\u066c\u2010-\u2015\u200b-\u200f\u061c\u202a-\u202e\u2066-\u2069\ufeff-]/g,Xt=(t)=>Et(t).replace(Se,""),Re=/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b|bearer\s+\S{16,}|AKIA[0-9A-Z]{16}|xox[abprs]-[\w-]+|PRIVATE KEY|[^\s@]{1,64}@[^\s@]{1,253}\.[^\s@]{2,}|eyJ[\w-]+\.[\w-]+\.[\w-]*|\d(?:[\s./()\u0640\u066b\u066c\u2010-\u2015\u200b-\u200f\u061c\u202a-\u202e\u2066-\u2069\ufeff-]*\d){8,}|[\w+/=]{32,}/gi;function Z(t){let e="",n=0;for(let r of Et(t).matchAll(Re)){if(/^[0-9a-f]{8}-/i.test(r[0])&&r[0].length===36)continue;e+=`${t.slice(n,r.index)}[redacted]`,n=r.index+r[0].length,_.n++}return e+t.slice(n)}function H(t,e=1024){if(t=t.normalize("NFC"),t.length>256||t.trim().split(/\s+/).length>11)return _.n++,"[redacted]";return Z(t).slice(0,e).replace(/[\uD800-\uDBFF]$/,"")}var z=(t)=>/[\u0000-\u001f\u007f-\u009f\u200e\u200f\u061c\u202a-\u202e\u2066-\u2069]/.test(t),Ae=/(?:passw(?:or)?d|passcode|pwd|pin|pincode|otp|otpcode|onetimecode|mfacode|2facode|tfacode|smscode|secretkey|privatekey|authcode|verificationcode|securitycode|resetcode|cvv|cvc|cardnumber|ccnumber|creditcard|pan|iban|iqama|hawiya|nationalid|nid|idnumber|ssn|token|authorization|secret|apikey|sessionid|cookie|jwt|bearer|csrf|xsrf|passport|\u0643\u0644\u0645\u0647\u0627\u0644\u0645\u0631\u0648\u0631|\u0643\u0644\u0645\u0647\u0627\u0644\u0633\u0631|\u0627\u0644\u0631\u0645\u0632\u0627\u0644\u0633\u0631\u064a|\u0627\u0644\u0631\u0642\u0645\u0627\u0644\u0633\u0631\u064a|\u0631\u0645\u0632\u0627\u0644\u062a\u062d\u0642\u0642|\u0631\u0642\u0645\u0627\u0644\u0647\u0648\u064a\u0647|\u0627\u0644\u0647\u0648\u064a\u0647\u0627\u0644\u0648\u0637\u0646\u064a\u0647|\u0627\u0644\u0627\u0642\u0627\u0645\u0647|\u0627\u0644\u0628\u0637\u0627\u0642\u0647|\u0627\u0644\u0627\u064a\u0628\u0627\u0646)$/;function Yt(t,e){let n=t.normalize("NFKD").replace(/[\p{M}\u0640]/gu,"").replace(/\u0629/g,"\u0647").replace(/\u0649/g,"\u064a").replace(/(\p{Ll})(?=\p{Lu})|(\p{N}+)/gu,"$1 $2 ").toLowerCase().split(/[^\p{L}\p{N}]+/u).filter(Boolean);while(n.length>1&&/^\p{N}+$/u.test(n[n.length-1]))n.pop();return!t||[...t].length>200||/\./.test(t)||z(t)||/^(?:__proto__|constructor|prototype)$/.test(t)||e&&/^(?:\$|(?:distinct_id|person_id|project_id|timestamp|uuid|ip|api_key)$)/.test(t)||Ae.test(n.join(""))&&!/^(?:japan|span|timespan|lifespan|wingspan|saucepan|spin|chopin|android)$/.test(n[n.length-1])||n.some((r)=>/^(?:password|passwd|pwd|passcode|otp|pin|secret|iqama|ssn|cvv|cvc|iban)$/.test(r))}function F(t,e=0){if(typeof t==="string")return H(t);if(typeof t==="number")return Number.isFinite(t)?Number.isInteger(t)&&Z(`${t}`)!==`${t}`?"[redacted]":t:void 0;if(typeof t==="boolean"||t===null)return t;if(t instanceof Date)return Number.isNaN(+t)?void 0:t.toISOString();if(typeof t!=="object")return;if(e>2)return"[depth]";if(Array.isArray(t))return t.slice(0,100).map((i)=>F(i,e+1)).filter((i)=>i!==void 0);let n=Object.getPrototypeOf(t);if(n!==Object.prototype&&n)return;let r={};for(let[i,s]of Object.entries(t).slice(0,200)){let o=i.trim();if(Yt(o,!e))_.n++;else{let a=F(s,e+1);if(a!==void 0)r[o]=a}}return r}function Wt(t){let e=t;try{e=decodeURIComponent(t)}catch{}e=Et(e);let n=_.n;if(Z(e)!==e)return _.n=n+1,":redacted";if(/^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$/i.test(e))return":uuid";if(/^[0-9a-f]{16,}$/i.test(e))return e.length===24?":id":":hash";if(/^[\w-]{20,}$/.test(e)&&/\d/.test(e)&&/[a-z]/.test(e)&&/[A-Z]/.test(e))return":token";let r=e.replace(/\D/g,"").length;return r&&(r===e.length||r>3&&r*2>=e.length)?":id":t}var Oe=/^(?:reset|invite|sid|token|jwt|otp|code|key|state|sig(?:nature)?|auth\w*|nonce|session\w*|hash|q|query|search\w*|s|keywords?|term|text|msg|message|comments?|\w*name|e?-?mail\w*|phone|mobile|tel|address\w*|city|zip|postcode|dob|birth\w*)$/i,Ie=(t)=>/^(?:[a-z0-9][a-z0-9._~-]*|[A-Z0-9][A-Z0-9_-]*)$/.test(t)&&!(t.length>=8&&/\d/.test(t)&&/[a-z]/i.test(t)),v=(t,e)=>Z(t.normalize("NFC")).slice(0,e),Kt=(t)=>t.split("/").map((e)=>e&&Wt(e)).join("/");function R(t,e,n){let r;try{r=new URL(t)}catch{return null}let i=r.protocol;if(/^(?:mailto|tel|sms|whatsapp):$/.test(i))return{url:i,path:i};if(!/^https?:$/.test(i))return null;let s=Kt(r.pathname);if(e&&/^#!?\//.test(r.hash))s+=`#${Kt(r.hash.slice(1).split("?")[0])}`;s=s.slice(0,1024);let o={url:(r.origin+s).slice(0,2048),path:s};for(let[a,f]of r.searchParams){let g=a.toLowerCase();if(/^utm_(?:source|medium|campaign|term|content)$/.test(g)&&f)o.utm={...o.utm,[g.slice(4)]:H(f,200)};else if(/^(?:gclid|gbraid|wbraid|fbclid|ttclid|msclkid|sccid|twclid|li_fat_id)$/.test(g))o.click_id_type=g.replace(/^[gw]braid$/,"gclid");else if(n&&Object.keys(o.q||{}).length<30){let m=Wt(f);o.q??={},o.q[v(a,64)]=Yt(a,!1)||Oe.test(a)||f.length>40||!(m[0]===":"||Ie(f))?"":m===":redacted"?"":m}}return o}function Zt(t){let e=t.trim().normalize("NFC");return!e||[...e].length>100||e[0]==="$"||z(e)||/[0-9a-f]{8}-[0-9a-f]{4}-|[0-9a-f]{16}|@/i.test(e)||/\d{6}/.test(Xt(e))?null:e}function xt(t,e){if(typeof t==="number"&&Number.isFinite(t))t=`${t}`;if(typeof t!=="string")return null;let n=t.trim().normalize("NFC"),r=Xt(n),i=0;for(let s=0;s<r.length;s++){let o=+r[r.length-1-s];i+=s%2?o>4?o*2-9:o*2:o}return!n||[...n].length>128||/^(?:null|undefined|0|-1|anonymous|guest|\[object object\]|none|nan|false|true|user|test|unknown|not_authenticated|distinct_id|id)$/i.test(n)||z(n)||/@|^eyJ/.test(n)||/^(?:[12]\d{9}|(?:\+?966|00966|0)5\d{8}|\+\d{8,15})$/.test(r)||/^[2-6]\d{14,15}$/.test(r)&&i%10===0||e.includes(n)?null:n}var Ot="0.5.0",Jt=1800000,Te=86400000,Ce=34560000,It=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/,kt=".datacub-no-capture,[data-datacub-no-capture]",oe=["datacub_id","datacub_u","datacub_a","datacub_ss"],c,ft=!1,I={},se=!0,ae=!0,dt=0,Tt=0,et=0,nt=0,rt=0,it={},Ct=new Set,Nt,j=0,pt=0,w,ot,gt,J,q={},ce=!1,Dt="",T="",jt=!1,le=null,Y="pending",qt=!1,k=!1,B="",mt="",l="",E=null,L=null,P=null,b="",st=0,A=0,ue,G=0,W="",K=null,Ne=0,at=0,bt=0,ht=0,fe="",ct=!0,Q,Qt=0,u=[],Pt,de=!1,te="",V=!1,lt=0,yt=!1,y=0,Lt=[],x=Date.now;function wt(t){if(ce)console.warn(`[datacub] ${t}`)}var S=(t)=>(...e)=>{try{t(...e)}catch{}},d=(t,e,n)=>t.addEventListener(e,S(n),!0);function U(t){let e=crypto.getRandomValues(new Uint8Array(16));for(let r=5,i=t;t&&r>=0;r--,i=Math.floor(i/256))e[r]=i&255;return e[6]=e[6]&15|(t?112:64),e[8]=e[8]&63|128,Array.from(e,(r)=>(r+256).toString(16).slice(1)).join("").replace(/(.{8})(.{4})(.{4})(.{4})/,"$1-$2-$3-$4-")}function X(){let t={};try{for(let e of c.cookie.split("; ")){let n=e.indexOf("="),r=e.slice(0,n);if(r==="datacub_optout"||B&&r.endsWith(B))t[r==="datacub_optout"?r:r.slice(0,-B.length)]=decodeURIComponent(e.slice(n+1))}}catch{}return t}function h(t,e,n=mt,r=e?Ce:0){try{c.cookie=`${t==="datacub_optout"?t:t+B}=${encodeURIComponent(e||"")};Path=/;Max-Age=${r};SameSite=Lax${n}${location.protocol==="https:"?";Secure":""}`}catch{}}function pe(){let t=location.hostname.split(".");return/^[\d.]+$|:/.test(location.hostname)?[]:t.slice(0,-1).map((e,n)=>`;Domain=${t.slice(n).join(".")}`)}function Ft(){if(!k)return;let t=X(),e=t.datacub_id??null;if(e!==l)l=e&&It.test(e)?e:U(),h("datacub_id",l),b="";E=t.datacub_u??null,L=t.datacub_a??null;let[n,r,i]=(t.datacub_ss||"").split(".");if(ue=n,G=+i,n&&It.test(n)&&G&&(n!==b||G>A))b=n,st=+r,A=G}function ge(t,e){if(!b||t-A>Jt||t-st>Te){if(b=U(x()),st=A=t,k)h("datacub_id",l)}else if(e&&t>A)A=t;if(k&&(ue!==b||A-G>5000))h("datacub_ss",`${b}.${st}.${A}`,mt,Jt/1000)}function O(t){clearTimeout(Pt),de=t===0,Pt=t==null?void 0:setTimeout(S(Vt),t)}function me(t){if((t||u.length>19||c.visibilityState==="hidden")&&!de&&!lt)O(0);else if(!Pt)O(5000)}var je=new TextEncoder;function p(t,e,n,r){if(!l)return;let i=x();if(Ft(),ge(i,!/^\$(?:pageleave|error|request|form_fields)$/.test(t)),_.n)e={...e,$d:_.n};let s=JSON.stringify([U(i),t,i,l,E,L,b,W||null,Ne++,+(Y==="granted"),+k,K?.url,fe,e,n]),o=je.encode(s).length;if(o>31000){y++;return}_.n=0,u.push([s,o]),ke(),me(r)}function qe(t,e){if(!l||typeof t!=="string")return;let n=Zt(t);if(!n)return wt("bad name");p(n,e&&typeof e==="object"&&!Array.isArray(e)&&F(e)||{})}function Ht(t=x()){if(at)bt+=t-at;at=c.visibilityState==="visible"?t:0}var ut=()=>{j=innerWidth,pt=innerHeight,fe=j<360?"xs":j<480?"s":j<768?"m":j<1280?"l":"xl",ht=Math.max(ht,scrollY+pt)};function zt(t,e){return it[t]=(it[t]||0)+1,it[t]<=e}function be(){if(!W)return;Ht();let t=bt-Tt;if(ct&&t<1)return;let e=c.documentElement.scrollHeight,n={$v:t,$s:e?ht/e:null};if(ct)n.$e=!0;if(et)n.$ec=et;if(nt)n.$rq=nt;if(rt)n.$rf=rt;et=nt=rt=0;try{Object.assign(n,q.l?.())}catch{}ct=!0,Tt=bt,p("$pageleave",n)}function Gt(t,e){if(!l)return;let n=location.pathname+(jt?location.hash.split("?")[0]:"");if(!t&&n===te)return;let r=R(location.href,jt,I.query!==!1);if(!r)return;te=n,be();let i={};if(K)i.$p=K.path;if(t&&!e)i.$b=!0;if(i.$N=e?performance.getEntriesByType?.("navigation")[0]?.type:t?"back_forward":Nt,r.q)i.$q=r.q;if(I.title!==!1&&c.title)i.$T=v(c.title,200);K=r,W=U(x()),ct=!1,bt=ht=at=Tt=0,it={},Ct.clear(),Ht(),ut(),i.$vw=j,i.$vh=pt;let s=null;if(e)try{let o=new URL(c.referrer);s=o.hostname,i.$R=R(o.href)?.path}catch{}p("$pageview",i,[r.utm,r.click_id_type,s],e)}var St=(t)=>()=>{if(!(Q&&t==="replace"&&Nt==="push"))Nt=t;w?.(),clearTimeout(Q),Q=setTimeout(S(()=>{Q=void 0,Gt()}),100)},he=(t)=>{let e=t.closest("[data-datacub-name]")?.getAttribute("data-datacub-name");return e?H(e,100):null},ye=!0;function Pe(t){let e="";for(let n=0;t&&n<10&&t!==c.body;n++,t=t.parentElement){let r=1;for(let o=t.previousElementSibling;o;o=o.previousElementSibling)if(o.localName===t.localName)r++;let i=t.id,s=t.getAttribute("data-datacub-name");e=`${t.localName}${i&&!/\d{4}|[\da-f]{8}|^:|radix-|headlessui-|mui-|ember\d|react-select/i.test(i)?`#${v(i,64)}`:""}${r>1?`:${r}`:""}${s?`[${v(s,64)}]`:""}${e&&">"}${e}`}return e.slice(-512)}function Le(t){let e=t.querySelector(`input,textarea,select,[contenteditable],${kt}`)?"":(t.textContent||"").replace(/\s+/g," ").trim();return v(e&&e.length<101?e:t.getAttribute("aria-label")||t.getAttribute("title")||t.querySelector("img")?.getAttribute("alt")||"",100)||void 0}function Ue(t,e){w?.(),ot=void 0;let n=c.activeElement,r=new MutationObserver(()=>w?.()),i=setTimeout(S(()=>{w?.();let s=e.target.closest('a[href]:not([href^="javascript:"]):not([href^="#"])');if(c.activeElement===n&&!(s&&!e.defaultPrevented)&&!(ot&&!ot.defaultPrevented))p("$deadclick",t)}),1000);w=()=>{r.disconnect(),clearTimeout(i),w=void 0},r.observe(c,{subtree:!0,childList:!0,attributes:!0,characterData:!0})}function Me(t){let e=t.target,n=t;if(!l||!(e instanceof Element)||e.closest(`${kt},input:not([type=submit]):not([type=button]),textarea,select,[contenteditable]:not([contenteditable=false])`))return;let r=e.closest("a,button,summary,input,[data-datacub-name],[role=button],[role=link],[role=menuitem],[role=tab]"),i=!r&&!/^(?:canvas|video)$/.test(e.localName)&&getComputedStyle(e).cursor==="pointer",s=r||e,o={$t:s.localName,$n:he(e),$g:Pe(s)};if(s.closest("form"))o.$o=!0;if(n.detail)o.$cx=Math.round(n.clientX/j*100),o.$cy=Math.round(n.clientY/pt*100);if((r||i)&&I.text!==!1)o.$l=Le(s);if(r){let a=r.getAttribute("role");if(a&&/^(?:button|link|menuitem|tab)$/.test(a))o.$r=a;if(r.localName==="input")o.$y=r.type;if(r.localName==="a"&&r.hasAttribute("href"))o.$h=R(r.href)?.url;p("$click",o)}if(ye&&n.detail===3&&!(s.textContent?.trim()&&getSelection()?.isCollapsed===!1))p("$rageclick",{...o});if((r||i)&&!n.metaKey&&!n.ctrlKey&&!n.shiftKey&&!s.closest("[target=_blank],[download]"))Ue(o,t)}var _t=(t)=>({$f:he(t),$a:R(new URL(t.getAttribute("action")||"",location.href).href)?.url,$i:t.querySelectorAll("input,select,textarea").length});function De(t){let e=t.target;if(ot=t,!l||e.localName!=="form"||e.closest(kt))return;p("$form_submit",_t(e))}var we=(t)=>{let e=t.target.form;return l&&e&&I.forms!==!1&&!e.closest(kt)?e:null},ee=new WeakSet;function Fe(t){w?.();let e=we(t);if(e&&!ee.has(e))ee.add(e),p("$form_start",_t(e))}var tt=new Map;function He(t){w?.();let e=we(t);if(!e)return;let n=tt.get(e)||0;if(tt.set(e,n+1),!n)setTimeout(S(()=>{if(zt("i",10))p("$form_invalid",{..._t(e),$iv:tt.get(e)});tt.delete(e)}))}var ne=(t)=>t.replace(/https?:\/\/[^\s'"<>()]+/g,(e)=>{let n=/(?::\d+){1,2}$/.exec(e)?.[0]||"";return(R(e.slice(0,e.length-n.length))?.url??"")+n});function Rt(t,e,n,r,i){let s=`${r}`.startsWith(T.slice(0,-5));if(!l||I.errors===!1||t==="resource"&&(!i||s))return;et++;let o=e&&typeof e==="object"?e:{},a=v(ne(`${o.message??n??(e&&e!==o?e:"")}`).replace(/(["'\u201c\u201d\u00ab\u00bb\u2018\u2019])[^"'\u201c\u201d\u00ab\u00bb\u2018\u2019]*["'\u201c\u201d\u00ab\u00bb\u2018\u2019]/g,'"\u2026"'),200),f=typeof o.stack==="string"?v(ne(o.stack.split(`
1
+ (()=>{var _={n:0},Et=(t)=>t.replace(/[\u0660-\u0669\u06f0-\u06f9\uff10-\uff19]/g,(e)=>String(e.charCodeAt(0)&15)),Re=/[\s./()\u0640\u066b\u066c\u2010-\u2015\u200b-\u200f\u061c\u202a-\u202e\u2066-\u2069\ufeff-]/g,Xt=(t)=>Et(t).replace(Re,""),Ae=/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b|bearer\s+\S{16,}|AKIA[0-9A-Z]{16}|xox[abprs]-[\w-]+|PRIVATE KEY|[^\s@]{1,64}@[^\s@]{1,253}\.[^\s@]{2,}|eyJ[\w-]+\.[\w-]+\.[\w-]*|\d(?:[\s./()\u0640\u066b\u066c\u2010-\u2015\u200b-\u200f\u061c\u202a-\u202e\u2066-\u2069\ufeff-]*\d){8,}|[\w+/=]{32,}/gi;function Z(t){let e="",n=0;for(let r of Et(t).matchAll(Ae)){if(/^[0-9a-f]{8}-/i.test(r[0])&&r[0].length===36)continue;e+=`${t.slice(n,r.index)}[redacted]`,n=r.index+r[0].length,_.n++}return e+t.slice(n)}function H(t,e=1024){if(t=t.normalize("NFC"),t.length>256||t.trim().split(/\s+/).length>11)return _.n++,"[redacted]";return Z(t).slice(0,e).replace(/[\uD800-\uDBFF]$/,"")}var z=(t)=>/[\u0000-\u001f\u007f-\u009f\u200e\u200f\u061c\u202a-\u202e\u2066-\u2069]/.test(t),Oe=/(?:passw(?:or)?d|passcode|pwd|pin|pincode|otp|otpcode|onetimecode|mfacode|2facode|tfacode|smscode|secretkey|privatekey|authcode|verificationcode|securitycode|resetcode|cvv|cvc|cardnumber|ccnumber|creditcard|pan|iban|iqama|hawiya|nationalid|nid|idnumber|ssn|token|authorization|secret|apikey|sessionid|cookie|jwt|bearer|csrf|xsrf|passport|\u0643\u0644\u0645\u0647\u0627\u0644\u0645\u0631\u0648\u0631|\u0643\u0644\u0645\u0647\u0627\u0644\u0633\u0631|\u0627\u0644\u0631\u0645\u0632\u0627\u0644\u0633\u0631\u064a|\u0627\u0644\u0631\u0642\u0645\u0627\u0644\u0633\u0631\u064a|\u0631\u0645\u0632\u0627\u0644\u062a\u062d\u0642\u0642|\u0631\u0642\u0645\u0627\u0644\u0647\u0648\u064a\u0647|\u0627\u0644\u0647\u0648\u064a\u0647\u0627\u0644\u0648\u0637\u0646\u064a\u0647|\u0627\u0644\u0627\u0642\u0627\u0645\u0647|\u0627\u0644\u0628\u0637\u0627\u0642\u0647|\u0627\u0644\u0627\u064a\u0628\u0627\u0646)$/;function Yt(t,e){let n=t.normalize("NFKD").replace(/[\p{M}\u0640]/gu,"").replace(/\u0629/g,"\u0647").replace(/\u0649/g,"\u064a").replace(/(\p{Ll})(?=\p{Lu})|(\p{N}+)/gu,"$1 $2 ").toLowerCase().split(/[^\p{L}\p{N}]+/u).filter(Boolean);while(n.length>1&&/^\p{N}+$/u.test(n[n.length-1]))n.pop();return!t||[...t].length>200||/\./.test(t)||z(t)||/^(?:__proto__|constructor|prototype)$/.test(t)||e&&/^(?:\$|(?:distinct_id|person_id|project_id|timestamp|uuid|ip|api_key)$)/.test(t)||Oe.test(n.join(""))&&!/^(?:japan|span|timespan|lifespan|wingspan|saucepan|spin|chopin|android)$/.test(n[n.length-1])||n.some((r)=>/^(?:password|passwd|pwd|passcode|otp|pin|secret|iqama|ssn|cvv|cvc|iban)$/.test(r))}function D(t,e=0){if(typeof t==="string")return H(t);if(typeof t==="number")return Number.isFinite(t)?Number.isInteger(t)&&Z(`${t}`)!==`${t}`?"[redacted]":t:void 0;if(typeof t==="boolean"||t===null)return t;if(t instanceof Date)return Number.isNaN(+t)?void 0:t.toISOString();if(typeof t!=="object")return;if(e>2)return"[depth]";if(Array.isArray(t))return t.slice(0,100).map((i)=>D(i,e+1)).filter((i)=>i!==void 0);let n=Object.getPrototypeOf(t);if(n!==Object.prototype&&n)return;let r={};for(let[i,s]of Object.entries(t).slice(0,200)){let o=i.trim();if(Yt(o,!e))_.n++;else{let a=D(s,e+1);if(a!==void 0)r[o]=a}}return r}function Wt(t){let e=t;try{e=decodeURIComponent(t)}catch{}e=Et(e);let n=_.n;if(Z(e)!==e)return _.n=n+1,":redacted";if(/^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$/i.test(e))return":uuid";if(/^[0-9a-f]{16,}$/i.test(e))return e.length===24?":id":":hash";if(/^[\w-]{20,}$/.test(e)&&/\d/.test(e)&&/[a-z]/.test(e)&&/[A-Z]/.test(e))return":token";let r=e.replace(/\D/g,"").length;return r&&(r===e.length||r>3&&r*2>=e.length)?":id":t}var Ie=/^(?:reset|invite|sid|token|jwt|otp|code|key|state|sig(?:nature)?|auth\w*|nonce|session\w*|hash|q|query|search\w*|s|keywords?|term|text|msg|message|comments?|\w*name|e?-?mail\w*|phone|mobile|tel|address\w*|city|zip|postcode|dob|birth\w*)$/i,Te=(t)=>/^(?:[a-z0-9][a-z0-9._~-]*|[A-Z0-9][A-Z0-9_-]*)$/.test(t)&&!(t.length>=8&&/\d/.test(t)&&/[a-z]/i.test(t)),v=(t,e)=>Z(t.normalize("NFC")).slice(0,e),Kt=(t)=>t.split("/").map((e)=>e&&Wt(e)).join("/");function R(t,e,n){let r;try{r=new URL(t)}catch{return null}let i=r.protocol;if(/^(?:mailto|tel|sms|whatsapp):$/.test(i))return{url:i,path:i};if(!/^https?:$/.test(i))return null;let s=Kt(r.pathname);if(e&&/^#!?\//.test(r.hash))s+=`#${Kt(r.hash.slice(1).split("?")[0])}`;s=s.slice(0,1024);let o={url:(r.origin+s).slice(0,2048),path:s};for(let[a,f]of r.searchParams){let g=a.toLowerCase();if(/^utm_(?:source|medium|campaign|term|content)$/.test(g)&&f)o.utm={...o.utm,[g.slice(4)]:H(f,200)};else if(/^(?:gclid|gbraid|wbraid|fbclid|ttclid|msclkid|sccid|twclid|li_fat_id)$/.test(g))o.click_id_type=g.replace(/^[gw]braid$/,"gclid");else if(n&&Object.keys(o.q||{}).length<30){let m=Wt(f);o.q??={},o.q[v(a,64)]=Yt(a,!1)||Ie.test(a)||f.length>40||!(m[0]===":"||Te(f))?"":m===":redacted"?"":m}}return o}function Zt(t){let e=t.trim().normalize("NFC");return!e||[...e].length>100||e[0]==="$"||z(e)||/[0-9a-f]{8}-[0-9a-f]{4}-|[0-9a-f]{16}|@/i.test(e)||/\d{6}/.test(Xt(e))?null:e}function xt(t,e){if(typeof t==="number"&&Number.isFinite(t))t=`${t}`;if(typeof t!=="string")return null;let n=t.trim().normalize("NFC"),r=Xt(n),i=0;for(let s=0;s<r.length;s++){let o=+r[r.length-1-s];i+=s%2?o>4?o*2-9:o*2:o}return!n||[...n].length>128||/^(?:null|undefined|0|-1|anonymous|guest|\[object object\]|none|nan|false|true|user|test|unknown|not_authenticated|distinct_id|id)$/i.test(n)||z(n)||/@|^eyJ/.test(n)||/^(?:[12]\d{9}|(?:\+?966|00966|0)5\d{8}|\+\d{8,15})$/.test(r)||/^[2-6]\d{14,15}$/.test(r)&&i%10===0||e.includes(n)?null:n}var Ot="0.6.0",Jt=1800000,Ce=86400000,Ne=34560000,It=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/,kt=".datacub-no-capture,[data-datacub-no-capture]",oe=["datacub_id","datacub_u","datacub_a","datacub_ss"],c,ft=!1,I={},se=!0,ae=!0,ce,dt=0,Tt=0,et=0,nt=0,rt=0,it={},Ct=new Set,Nt,j=0,pt=0,w,ot,gt,J,q={},le=!1,Ft="",T="",jt=!1,ue=null,Y="pending",qt=!1,k=!1,B="",mt="",l="",E=null,L=null,P=null,b="",st=0,A=0,fe,G=0,W="",K=null,je=0,at=0,bt=0,ht=0,de="",ct=!0,Q,Qt=0,u=[],Pt,pe=!1,te="",V=!1,lt=0,yt=!1,y=0,Lt=[],x=Date.now;function wt(t){if(le)console.warn(`[datacub] ${t}`)}var S=(t)=>(...e)=>{try{t(...e)}catch{}},d=(t,e,n)=>t.addEventListener(e,S(n),!0);function U(t){let e=crypto.getRandomValues(new Uint8Array(16));for(let r=5,i=t;t&&r>=0;r--,i=Math.floor(i/256))e[r]=i&255;return e[6]=e[6]&15|(t?112:64),e[8]=e[8]&63|128,Array.from(e,(r)=>(r+256).toString(16).slice(1)).join("").replace(/(.{8})(.{4})(.{4})(.{4})/,"$1-$2-$3-$4-")}function X(){let t={};try{for(let e of c.cookie.split("; ")){let n=e.indexOf("="),r=e.slice(0,n);if(r==="datacub_optout"||B&&r.endsWith(B))t[r==="datacub_optout"?r:r.slice(0,-B.length)]=decodeURIComponent(e.slice(n+1))}}catch{}return t}function h(t,e,n=mt,r=e?Ne:0){try{c.cookie=`${t==="datacub_optout"?t:t+B}=${encodeURIComponent(e||"")};Path=/;Max-Age=${r};SameSite=Lax${n}${location.protocol==="https:"?";Secure":""}`}catch{}}function ge(){let t=location.hostname.split(".");return/^[\d.]+$|:/.test(location.hostname)?[]:t.slice(0,-1).map((e,n)=>`;Domain=${t.slice(n).join(".")}`)}function Dt(){if(!k)return;let t=X(),e=t.datacub_id??null;if(e!==l)l=e&&It.test(e)?e:U(),h("datacub_id",l),b="";E=t.datacub_u??null,L=t.datacub_a??null;let[n,r,i]=(t.datacub_ss||"").split(".");if(fe=n,G=+i,n&&It.test(n)&&G&&(n!==b||G>A))b=n,st=+r,A=G}function me(t,e){if(!b||t-A>Jt||t-st>Ce){if(b=U(x()),st=A=t,k)h("datacub_id",l)}else if(e&&t>A)A=t;if(k&&(fe!==b||A-G>5000))h("datacub_ss",`${b}.${st}.${A}`,mt,Jt/1000)}function O(t){clearTimeout(Pt),pe=t===0,Pt=t==null?void 0:setTimeout(S(Vt),t)}function be(t){if((t||u.length>19||c.visibilityState==="hidden")&&!pe&&!lt)O(0);else if(!Pt)O(5000)}var qe=new TextEncoder;function p(t,e,n,r){if(!l)return;let i=x();if(Dt(),me(i,!/^\$(?:pageleave|error|request|form_fields)$/.test(t)),_.n)e={...e,$d:_.n};let s=JSON.stringify([U(i),t,i,l,E,L,b,W||null,je++,+(Y==="granted"),+k,K?.url,de,e,n]),o=qe.encode(s).length;if(o>31000){y++;return}_.n=0,u.push([s,o]),_e(),be(r)}function Pe(t,e){if(!l||typeof t!=="string")return;let n=Zt(t);if(!n)return wt("bad name");p(n,e&&typeof e==="object"&&!Array.isArray(e)&&D(e)||{})}function Ht(t=x()){if(at)bt+=t-at;at=c.visibilityState==="visible"?t:0}var ut=()=>{j=innerWidth,pt=innerHeight,de=j<360?"xs":j<480?"s":j<768?"m":j<1280?"l":"xl",ht=Math.max(ht,scrollY+pt)};function zt(t,e){return it[t]=(it[t]||0)+1,it[t]<=e}function he(){if(!W)return;Ht();let t=bt-Tt;if(ct&&t<1)return;let e=c.documentElement.scrollHeight,n={$v:t,$s:e?ht/e:null};if(ct)n.$e=!0;if(et)n.$ec=et;if(nt)n.$rq=nt;if(rt)n.$rf=rt;et=nt=rt=0;try{Object.assign(n,q.l?.())}catch{}ct=!0,Tt=bt,p("$pageleave",n)}function Gt(t,e){if(!l)return;let n=location.pathname+(jt?location.hash.split("?")[0]:"");if(!t&&n===te)return;let r=R(location.href,jt,I.query!==!1);if(!r)return;te=n,he();let i={};if(K)i.$p=K.path;if(t&&!e)i.$b=!0;if(i.$N=e?performance.getEntriesByType?.("navigation")[0]?.type:t?"back_forward":Nt,r.q)i.$q=r.q;if(I.title!==!1&&c.title)i.$T=v(c.title,200);K=r,W=U(x()),ct=!1,bt=ht=at=Tt=0,it={},Ct.clear(),Ht(),ut(),i.$vw=j,i.$vh=pt;let s=null;if(e)try{let o=new URL(c.referrer);s=o.hostname,i.$R=R(o.href)?.path}catch{}p("$pageview",i,[r.utm,r.click_id_type,s],e)}var St=(t)=>()=>{if(!(Q&&t==="replace"&&Nt==="push"))Nt=t;w?.(),clearTimeout(Q),Q=setTimeout(S(()=>{Q=void 0,Gt()}),100)},ye=(t)=>{let e=t.closest("[data-datacub-name]")?.getAttribute("data-datacub-name");return e?H(e,100):null},we=!0;function Le(t){let e="";for(let n=0;t&&n<10&&t!==c.body;n++,t=t.parentElement){let r=1;for(let o=t.previousElementSibling;o;o=o.previousElementSibling)if(o.localName===t.localName)r++;let i=t.id,s=t.getAttribute("data-datacub-name");e=`${t.localName}${i&&!/\d{4}|[\da-f]{8}|^:|radix-|headlessui-|mui-|ember\d|react-select/i.test(i)?`#${v(i,64)}`:""}${r>1?`:${r}`:""}${s?`[${v(s,64)}]`:""}${e&&">"}${e}`}return e.slice(-512)}function Ue(t){let e=t.querySelector(`input,textarea,select,[contenteditable],${kt}`)?"":(t.textContent||"").replace(/\s+/g," ").trim();return v(e&&e.length<101?e:t.getAttribute("aria-label")||t.getAttribute("title")||t.querySelector("img")?.getAttribute("alt")||"",100)||void 0}function Me(t,e){w?.(),ot=void 0;let n=c.activeElement,r=new MutationObserver(()=>w?.()),i=setTimeout(S(()=>{w?.();let s=e.target.closest('a[href]:not([href^="javascript:"]):not([href^="#"])');if(c.activeElement===n&&!(s&&!e.defaultPrevented)&&!(ot&&!ot.defaultPrevented))p("$deadclick",t)}),1000);w=()=>{r.disconnect(),clearTimeout(i),w=void 0},r.observe(c,{subtree:!0,childList:!0,attributes:!0,characterData:!0})}function Fe(t){let e=t.target,n=t;if(!l||!(e instanceof Element)||e.closest(`${kt},input:not([type=submit]):not([type=button]),textarea,select,[contenteditable]:not([contenteditable=false])`))return;let r=e.closest("a,button,summary,input,[data-datacub-name],[role=button],[role=link],[role=menuitem],[role=tab]"),i=!r&&!/^(?:canvas|video)$/.test(e.localName)&&getComputedStyle(e).cursor==="pointer",s=r||e,o={$t:s.localName,$n:ye(e),$g:Le(s)};if(s.closest("form"))o.$o=!0;if(n.detail)o.$cx=Math.round(n.clientX/j*100),o.$cy=Math.round(n.clientY/pt*100);if((r||i)&&I.text!==!1)o.$l=Ue(s);if(r){let a=r.getAttribute("role");if(a&&/^(?:button|link|menuitem|tab)$/.test(a))o.$r=a;if(r.localName==="input")o.$y=r.type;if(r.localName==="a"&&r.hasAttribute("href"))o.$h=R(r.href)?.url;p("$click",o)}if(we&&n.detail===3&&!(s.textContent?.trim()&&getSelection()?.isCollapsed===!1))p("$rageclick",{...o});if((r||i)&&!n.metaKey&&!n.ctrlKey&&!n.shiftKey&&!s.closest("[target=_blank],[download]"))Me(o,t)}var _t=(t)=>({$f:ye(t),$a:R(new URL(t.getAttribute("action")||"",location.href).href)?.url,$i:t.querySelectorAll("input,select,textarea").length});function De(t){let e=t.target;if(ot=t,!l||e.localName!=="form"||e.closest(kt))return;p("$form_submit",_t(e))}var $e=(t)=>{let e=t.target.form;return l&&e&&I.forms!==!1&&!e.closest(kt)?e:null},ee=new WeakSet;function He(t){w?.();let e=$e(t);if(e&&!ee.has(e))ee.add(e),p("$form_start",_t(e))}var tt=new Map;function ze(t){w?.();let e=$e(t);if(!e)return;let n=tt.get(e)||0;if(tt.set(e,n+1),!n)setTimeout(S(()=>{if(zt("i",10))p("$form_invalid",{..._t(e),$iv:tt.get(e)});tt.delete(e)}))}var ne=(t)=>t.replace(/https?:\/\/[^\s'"<>()]+/g,(e)=>{let n=/(?::\d+){1,2}$/.exec(e)?.[0]||"";return(R(e.slice(0,e.length-n.length))?.url??"")+n});function Rt(t,e,n,r,i){let s=`${r}`.startsWith(T.slice(0,-5));if(!l||I.errors===!1||t==="resource"&&(!i||s))return;et++;let o=e&&typeof e==="object"?e:{},a=v(ne(`${o.message??n??(e&&e!==o?e:"")}`).replace(/(["'\u201c\u201d\u00ab\u00bb\u2018\u2019])[^"'\u201c\u201d\u00ab\u00bb\u2018\u2019]*["'\u201c\u201d\u00ab\u00bb\u2018\u2019]/g,'"\u2026"'),200),f=typeof o.stack==="string"?v(ne(o.stack.split(`
2
2
  `).filter((m)=>/:\d+:\d+/.test(m)).slice(0,5).map((m)=>m.trim().replace(/@(?=https?:)/," ")).join(`
3
3
  `)),1000):void 0,g=`${t}${o.name}${a}${f?.split(`
4
- `)[0]}${r}`;if(Ct.has(g)||!zt("e",20))return;Ct.add(g),p("$error",{$ek:t,$en:typeof o.name==="string"?v(o.name,64):void 0,$em:a||void 0,$es:f||void 0,$eu:r?R(`${r}`)?.url:void 0,$et:i})}function $e(t,e,n,r,i){if(!l||I.network===!1)return;let s=new URL(e,location.href).href;if(s.startsWith(T.slice(0,-5)))return;nt++;let o=x()-r,a=i==="AbortError"?"abort":i?"network_error":n>399?"http_error":o>2999&&"slow";if(!a)return;if(a!=="slow"&&a!=="abort")rt++;if(zt("r",30))p("$request",{$nm:`${t}`.toUpperCase().slice(0,10),$nu:R(s)?.url,$ns:n,$nd:o,$nk:a})}var re=S($e);function ke(){let t=u.length-1000;if(t>0)y+=u.splice(0,t).length}function ze(){if(!J)try{let r=(s)=>+matchMedia(`(${s})`).matches,i=navigator;J=[screen.width,screen.height,Math.round(devicePixelRatio*100)/100,null,i.hardwareConcurrency,i.deviceMemory,i.maxTouchPoints,r("pointer:coarse")?"c":"f",r("prefers-color-scheme:dark")?"d":"l",r("prefers-reduced-motion:reduce")]}catch{J=Array(10)}let t=navigator.connection||{},e=q.h||[];return[...J,t.effectiveType,t.rtt,t.downlink,+t.saveData,e[0],e[1],-new Date().getTimezoneOffset()]}var Ut=(t,e)=>`${JSON.stringify([3,Dt,x(),Ot,e,le,navigator.language,!!navigator.webdriver,ze()]).slice(0,-1)},${t.map((n)=>n[0])}]`;function Mt(t){let e=0,n=200;while(e<u.length&&e<100){if(n+=u[e][1]+1,n>t)break;e++}return u.splice(0,e||1)}var At=!1;async function Vt(){if(O(),V)At=!0;if(V||yt||!u.length||!navigator.onLine)return;V=!0;let t=Mt(30720),e=y;y=0;let n=0;try{let r=await gt(T,{method:"POST",body:Ut(t,e),keepalive:!0,credentials:"omit",referrerPolicy:"no-referrer"}),i=r.status;if(i===401||i===403)yt=!0,u=[];else if(i===429||i>499)n=Math.min(+(r.headers.get("Retry-After")||0),3600)*1000||-1;else if(lt=0,i>299)y+=t.length+e;else{let s=await r.json().catch(()=>0);if(s.directives?.includes("rotate_anon_id"))Bt();if(s.feedback)$t()}}catch{n=-1}V=!1;try{if(n&&l){if(u=t.concat(u),y+=e,ke(),++lt<11)O(n>0?n:Math.random()*Math.min(1000*2**lt,300000))}else if(u.length)me(At);At=!1}catch{}}function ie(){if(w?.(),be(),O(),!V&&typeof Request==="function"&&"keepalive"in Request.prototype){let t=61440;while(u.length&&!yt&&t>2048){let e=Mt(t),n=y,r=Ut(e,n);t-=r.length,y=0;let i=()=>{u=e.concat(u),y+=n,O(1000)};try{gt(T,{method:"POST",body:r,keepalive:!0,credentials:"omit",referrerPolicy:"no-referrer"}).catch(i)}catch{i();break}}}else{let t=61440;while(u.length&&!yt&&navigator.sendBeacon){let e=Mt(t);if(navigator.sendBeacon(T,Ut(e,y)))y=0;else{if(u=e.concat(u),e.length<2)break;t/=2}}}if(u.length)O(1000)}function _e(t){Y=t?"granted":"not_required";for(let n of pe().reverse())if(h("datacub_tld","1",n,9),X().datacub_tld){h("datacub_tld","",n),mt=n;break}let e=X().datacub_id;if(l=e&&It.test(e)?e:U(),h("datacub_id",l),k=X().datacub_id===l,t){for(let n of["",mt])h("datacub_optout","",n);p("$consent",{$m:/^(?:banner|settings|api|cmp)$/.test(`${t.method}`)?t.method:"api",$P:typeof t.policyVersion==="string"?H(t.policyVersion,64):null})}if(P)xe(...P);if(P=null,Gt(!0,!0),se&&!q.v)q.v=Ot,q.e=(n,r)=>n==="$form_fields"&&I.forms!==!1&&p(n,r),q.f=_t,window.__datacub=q,ve(`sdk/insights-${Ot}.min.js`,"sha384-7xNcWolajp48vRTTBdYbGMF2VDBSxZ5qtqZeoosFSuy8Os18qOd9cEUDuSCp9I9z")}function ve(t,e){try{let n=c.createElement("script");if(n.src=T.slice(0,-5)+t,n.async=!0,n.referrerPolicy="no-referrer",e)n.integrity=e,n.crossOrigin="anonymous";n.setAttribute("fetchpriority","low"),(c.head||c.documentElement).append(n)}catch{}}function $t(t){if(!ae||!l||dt===1)return;if(t)dt=t;if(!c.querySelector('script[src*="/v1/feedback.js"]'))ve("feedback.js")}var Ge=()=>{let t=dt;return dt=1,t!==1&&(t||[])};function Ve(t={}){if(!l&&(!qt||t.overrideGPC))_e(t)}function Ee(){Y="denied",O(),u=[];for(let t of oe)for(let e of["",...pe()])h(t,"",e);l=b=W="",E=L=P=K=null,k=!1,h("datacub_optout","1")}function xe(t,e,n){if(Ft(),E&&E!==t)Bt();if(e!==L&&k)h("datacub_a",e);if(L=e,E!==t){if(E=t,k)h("datacub_u",t);n.$A=l}for(let r in n)return p(n.$A?"$identify":"$set",n,0,!0)}function Be(t,e){if(t&&typeof t==="object")e=t,t=e.id??e.userId??e.user_id;let n=[l,b,W],r=xt(t,n),i=e?.account==null?null:xt(e.account,n);if(!r||e?.account!=null&&!i)return wt("bad id");let s=e&&F(e)||{};for(let o in s){let a=/^(?:account|id|user_?id|(email)|(?:full_?)?(name)|(phone)(?:_?number)?)$/i.exec(o);if(a){let f=a[1]||a[2]||a[3];if(f)s[`$${f.toLowerCase()}`]=e[o];delete s[o]}}if(l)xe(r,i,s);else if(Y==="pending")P=[r,i,s]}function Bt(){if(P=null,!l)return;if(Vt(),l=U(),E=L=null,b="",k){h("datacub_id",l);for(let t of oe.slice(1))h(t,"")}}function Ke(t,e={}){if(ce=/^(?:localhost|127\.0\.0\.1|\[::1\])$|\.(?:localhost|test)$/.test(location.hostname),ft||typeof t!=="string")return;if(/^sk_/.test(t))return console.error("[datacub] refused a secret key. Use your project ID.");let n;try{n=new URL(e.apiHost||"https://in.datacub.to",location.href)}catch{}if(!/^(?:pk_(?:live|test)_[A-Za-z0-9]{24,48}|[a-z0-9]{8})$/.test(t))return wt("init: bad key");if(!n||n.username||n.password||!(n.protocol==="https:"||n.protocol==="http:"&&/^(?:localhost|127\.0\.0\.1)$/.test(n.hostname)))return wt("init: bad apiHost");if(ft=!0,Dt=t,B=`_${t.replace(/^pk_[a-z]+_/,"").slice(0,8)}`,T=`${n.origin}${n.pathname.replace(/\/+$/,"")}/v1/batch`,jt=e.hashRouting===!0,le=typeof e.release==="string"&&!z(e.release)?e.release.slice(0,64):null,I=e.capture&&typeof e.capture==="object"&&e.capture||{},se=e.insights!==!1,ae=e.feedback!==!1,d(c,"click",(r)=>r.target?.closest?.("[data-datacub-feedback]")&&$t(["feedback",[]])),gt=fetch,qt=navigator.globalPrivacyControl===!0,qt||X().datacub_optout)Ee();else if(!e.requireConsent)_e();if(ye=e.rageClicks!==!1,e.autocapture!==!1)d(c,"click",Me),d(c,"submit",De),d(c,"input",Fe),d(c,"invalid",He);for(let r of["pointerdown","keydown","scroll"])d(c,r,(i)=>{let s=x();if(i.target===c)ut();if(r==="scroll")w?.();if(b&&c.visibilityState==="visible"&&s-Qt>5000)Qt=s,Ft(),ge(s,!0)});d(c,"visibilitychange",()=>{if(Ht(),c.visibilityState==="hidden")ie()}),ut(),d(window,"resize",ut),d(window,"pagehide",ie),d(window,"pageshow",(r)=>r.persisted&&Gt(!0)),d(window,"online",Vt),d(window,"popstate",St("pop")),d(window,"hashchange",St("hash"));for(let r of["pushState","replaceState"]){let i=history[r];history[r]=function(...s){i.apply(this,s),St(r==="pushState"?"push":"replace")()}}try{d(window,"error",(o)=>o instanceof ErrorEvent?Rt("js",o.error,o.message,o.filename):Rt("resource",0,"",o.target.src||o.target.href,o.target.localName)),d(window,"unhandledrejection",(o)=>Rt("rejection",o.reason)),window.fetch=function(...o){let a=gt.apply(this,o);try{let f=x(),g=o[0],m=`${g.url||g}`,D=o[1]?.method||g.method||"GET";return a.then((C)=>{try{re(D,C.url||m,C.type==="opaque"?200:C.status,f)}catch{}return C},(C)=>{throw re(D,m,0,f,C?.name||"Error"),C})}catch{}return a};let r=XMLHttpRequest.prototype,{open:i,send:s}=r;r.open=function(...o){return this._x=o,i.apply(this,o)},r.send=function(...o){if(this._x&&!this._t)for(let a of["load","error","abort","timeout"])d(this,a,()=>$e(this._x?.[0],`${this._x?.[1]}`,this.status,this._t,a==="load"?"":a==="abort"?"AbortError":"TypeError"));return this._t=x(),s.apply(this,o)}}catch{}}var N=(t)=>S((...e)=>{if(typeof window>"u")return;if(ft)t(...e);else if(Lt.length<100)Lt.push([t,e])}),Xe={init:S((t,e)=>{if(typeof window>"u"||!globalThis.crypto?.getRandomValues)return;c=document;let n=S(()=>{Ke(t,e);for(let[r,i]of Lt.splice(0))if(ft)r(...i)});if(c.prerendering)d(c,"prerenderingchange",n);else n()}),track:N(qe),identify:N(Be),reset:N(Bt),consent:{grant:N(Ve),revoke:N(Ee)},ask:N((...t)=>$t(["ask",t])),feedback:N(()=>$t(["feedback",[]])),_fb:()=>[Y,k,Dt,T,l,E,b,p,Ge]},M=Xe;var vt=window;if(!vt.datacub?._fb){let t=Array.isArray(vt.datacub)?vt.datacub:[],e=document.currentScript,n=e?.dataset,r=e?.src?new URL(e.src).origin:void 0,i=M.init;M.init=(o,a)=>{let f=a?.apiHost||r;return i(o,f?{...a,apiHost:f}:a)},vt.datacub=M;let s=n?.id||n?.key;if(s)M.init(s,{apiHost:n.apiHost,requireConsent:n.requireConsent!=null,feedback:n.feedback!=="off"});for(let o of t)try{let[a,...f]=o,g=String(a).split(".").reduce((m,D)=>m&&Object.hasOwn(m,D)?m[D]:void 0,M);if(typeof g==="function")g(...f)}catch{}}})();
4
+ `)[0]}${r}`;if(Ct.has(g)||!zt("e",20))return;Ct.add(g),p("$error",{$ek:t,$en:typeof o.name==="string"?v(o.name,64):void 0,$em:a||void 0,$es:f||void 0,$eu:r?R(`${r}`)?.url:void 0,$et:i})}function ke(t,e,n,r,i){if(!l||I.network===!1)return;let s=new URL(e,location.href).href;if(s.startsWith(T.slice(0,-5)))return;nt++;let o=x()-r,a=i==="AbortError"?"abort":i?"network_error":n>399?"http_error":o>2999&&"slow";if(!a)return;if(a!=="slow"&&a!=="abort")rt++;if(zt("r",30))p("$request",{$nm:`${t}`.toUpperCase().slice(0,10),$nu:R(s)?.url,$ns:n,$nd:o,$nk:a})}var re=S(ke);function _e(){let t=u.length-1000;if(t>0)y+=u.splice(0,t).length}function Ge(){if(!J)try{let r=(s)=>+matchMedia(`(${s})`).matches,i=navigator;J=[screen.width,screen.height,Math.round(devicePixelRatio*100)/100,null,i.hardwareConcurrency,i.deviceMemory,i.maxTouchPoints,r("pointer:coarse")?"c":"f",r("prefers-color-scheme:dark")?"d":"l",r("prefers-reduced-motion:reduce")]}catch{J=Array(10)}let t=navigator.connection||{},e=q.h||[];return[...J,t.effectiveType,t.rtt,t.downlink,+t.saveData,e[0],e[1],-new Date().getTimezoneOffset()]}var Ut=(t,e)=>`${JSON.stringify([3,Ft,x(),Ot,e,ue,navigator.language,!!navigator.webdriver,Ge()]).slice(0,-1)},${t.map((n)=>n[0])}]`;function Mt(t){let e=0,n=200;while(e<u.length&&e<100){if(n+=u[e][1]+1,n>t)break;e++}return u.splice(0,e||1)}var At=!1;async function Vt(){if(O(),V)At=!0;if(V||yt||!u.length||!navigator.onLine)return;V=!0;let t=Mt(30720),e=y;y=0;let n=0;try{let r=await gt(T,{method:"POST",body:Ut(t,e),keepalive:!0,credentials:"omit",referrerPolicy:"no-referrer"}),i=r.status;if(i===401||i===403)yt=!0,u=[];else if(i===429||i>499)n=Math.min(+(r.headers.get("Retry-After")||0),3600)*1000||-1;else if(lt=0,i>299)y+=t.length+e;else{let s=await r.json().catch(()=>0);if(s.directives?.includes("rotate_anon_id"))Bt();if(s.feedback)$t()}}catch{n=-1}V=!1;try{if(n&&l){if(u=t.concat(u),y+=e,_e(),++lt<11)O(n>0?n:Math.random()*Math.min(1000*2**lt,300000))}else if(u.length)be(At);At=!1}catch{}}function ie(){if(w?.(),he(),O(),!V&&typeof Request==="function"&&"keepalive"in Request.prototype){let t=61440;while(u.length&&!yt&&t>2048){let e=Mt(t),n=y,r=Ut(e,n);t-=r.length,y=0;let i=()=>{u=e.concat(u),y+=n,O(1000)};try{gt(T,{method:"POST",body:r,keepalive:!0,credentials:"omit",referrerPolicy:"no-referrer"}).catch(i)}catch{i();break}}}else{let t=61440;while(u.length&&!yt&&navigator.sendBeacon){let e=Mt(t);if(navigator.sendBeacon(T,Ut(e,y)))y=0;else{if(u=e.concat(u),e.length<2)break;t/=2}}}if(u.length)O(1000)}function ve(t){Y=t?"granted":"not_required";for(let n of ge().reverse())if(h("datacub_tld","1",n,9),X().datacub_tld){h("datacub_tld","",n),mt=n;break}let e=X().datacub_id;if(l=e&&It.test(e)?e:U(),h("datacub_id",l),k=X().datacub_id===l,t){for(let n of["",mt])h("datacub_optout","",n);p("$consent",{$m:/^(?:banner|settings|api|cmp)$/.test(`${t.method}`)?t.method:"api",$P:typeof t.policyVersion==="string"?H(t.policyVersion,64):null})}if(P)Se(...P);if(P=null,Gt(!0,!0),se&&!q.v)q.v=Ot,q.e=(n,r)=>n==="$form_fields"&&I.forms!==!1&&p(n,r),q.f=_t,window.__datacub=q,Ee(`sdk/insights-${Ot}.min.js`,"sha384-7xNcWolajp48vRTTBdYbGMF2VDBSxZ5qtqZeoosFSuy8Os18qOd9cEUDuSCp9I9z")}function Ee(t,e){try{let n=c.createElement("script");if(n.src=T.slice(0,-5)+t,n.async=!0,n.referrerPolicy="no-referrer",e)n.integrity=e,n.crossOrigin="anonymous";n.setAttribute("fetchpriority","low"),(c.head||c.documentElement).append(n)}catch{}}function $t(t){if(!ae||!l||dt===1)return;if(t)dt=t;if(!c.querySelector('script[src*="/v1/feedback.js"]'))Ee("feedback.js")}var Ve=()=>{let t=dt;return dt=1,t!==1&&(t||[])};function Be(t={}){if(!l&&(!qt||t.overrideGPC))ve(t)}function xe(){Y="denied",O(),u=[];for(let t of oe)for(let e of["",...ge()])h(t,"",e);l=b=W="",E=L=P=K=null,k=!1,h("datacub_optout","1")}function Se(t,e,n){if(Dt(),E&&E!==t)Bt();if(e!==L&&k)h("datacub_a",e);if(L=e,E!==t){if(E=t,k)h("datacub_u",t);n.$A=l}for(let r in n)return p(n.$A?"$identify":"$set",n,0,!0)}function Ke(t,e){if(t&&typeof t==="object")e=t,t=e.id??e.userId??e.user_id;let n=[l,b,W],r=xt(t,n),i=e?.account==null?null:xt(e.account,n);if(!r||e?.account!=null&&!i)return wt("bad id");let s=e&&D(e)||{};for(let o in s){let a=/^(?:account|id|user_?id|(email)|(?:full_?)?(name)|(phone)(?:_?number)?)$/i.exec(o);if(a){let f=a[1]||a[2]||a[3];if(f)s[`$${f.toLowerCase()}`]=e[o];delete s[o]}}if(l)Se(r,i,s);else if(Y==="pending")P=[r,i,s]}function Bt(){if(P=null,!l)return;if(Vt(),l=U(),E=L=null,b="",k){h("datacub_id",l);for(let t of oe.slice(1))h(t,"")}}function Xe(t,e={}){if(le=/^(?:localhost|127\.0\.0\.1|\[::1\])$|\.(?:localhost|test)$/.test(location.hostname),ft||typeof t!=="string")return;if(/^sk_/.test(t))return console.error("[datacub] refused a secret key. Use your project ID.");let n;try{n=new URL(e.apiHost||"https://in.datacub.to",location.href)}catch{}if(!/^(?:pk_(?:live|test)_[A-Za-z0-9]{24,48}|[a-z0-9]{8})$/.test(t))return wt("init: bad key");if(!n||n.username||n.password||!(n.protocol==="https:"||n.protocol==="http:"&&/^(?:localhost|127\.0\.0\.1)$/.test(n.hostname)))return wt("init: bad apiHost");if(ft=!0,Ft=t,B=`_${t.replace(/^pk_[a-z]+_/,"").slice(0,8)}`,T=`${n.origin}${n.pathname.replace(/\/+$/,"")}/v1/batch`,jt=e.hashRouting===!0,ue=typeof e.release==="string"&&!z(e.release)?e.release.slice(0,64):null,I=e.capture&&typeof e.capture==="object"&&e.capture||{},se=e.insights!==!1,ae=e.feedback!==!1,ce=e.feedback?.look,d(c,"click",(r)=>r.target?.closest?.("[data-datacub-feedback]")&&$t(["feedback",[]])),gt=fetch,qt=navigator.globalPrivacyControl===!0,qt||X().datacub_optout)xe();else if(!e.requireConsent)ve();if(we=e.rageClicks!==!1,e.autocapture!==!1)d(c,"click",Fe),d(c,"submit",De),d(c,"input",He),d(c,"invalid",ze);for(let r of["pointerdown","keydown","scroll"])d(c,r,(i)=>{let s=x();if(i.target===c)ut();if(r==="scroll")w?.();if(b&&c.visibilityState==="visible"&&s-Qt>5000)Qt=s,Dt(),me(s,!0)});d(c,"visibilitychange",()=>{if(Ht(),c.visibilityState==="hidden")ie()}),ut(),d(window,"resize",ut),d(window,"pagehide",ie),d(window,"pageshow",(r)=>r.persisted&&Gt(!0)),d(window,"online",Vt),d(window,"popstate",St("pop")),d(window,"hashchange",St("hash"));for(let r of["pushState","replaceState"]){let i=history[r];history[r]=function(...s){i.apply(this,s),St(r==="pushState"?"push":"replace")()}}try{d(window,"error",(o)=>o instanceof ErrorEvent?Rt("js",o.error,o.message,o.filename):Rt("resource",0,"",o.target.src||o.target.href,o.target.localName)),d(window,"unhandledrejection",(o)=>Rt("rejection",o.reason)),window.fetch=function(...o){let a=gt.apply(this,o);try{let f=x(),g=o[0],m=`${g.url||g}`,F=o[1]?.method||g.method||"GET";return a.then((C)=>{try{re(F,C.url||m,C.type==="opaque"?200:C.status,f)}catch{}return C},(C)=>{throw re(F,m,0,f,C?.name||"Error"),C})}catch{}return a};let r=XMLHttpRequest.prototype,{open:i,send:s}=r;r.open=function(...o){return this._x=o,i.apply(this,o)},r.send=function(...o){if(this._x&&!this._t)for(let a of["load","error","abort","timeout"])d(this,a,()=>ke(this._x?.[0],`${this._x?.[1]}`,this.status,this._t,a==="load"?"":a==="abort"?"AbortError":"TypeError"));return this._t=x(),s.apply(this,o)}}catch{}}var N=(t)=>S((...e)=>{if(typeof window>"u")return;if(ft)t(...e);else if(Lt.length<100)Lt.push([t,e])}),Ye={init:S((t,e)=>{if(typeof window>"u"||!globalThis.crypto?.getRandomValues)return;c=document;let n=S(()=>{Xe(t,e);for(let[r,i]of Lt.splice(0))if(ft)r(...i)});if(c.prerendering)d(c,"prerenderingchange",n);else n()}),track:N(Pe),identify:N(Ke),reset:N(Bt),consent:{grant:N(Be),revoke:N(xe)},ask:N((...t)=>$t(["ask",t])),feedback:N(()=>$t(["feedback",[]])),_fb:()=>[Y,k,Ft,T,l,E,b,p,Ve,ce]},M=Ye;var vt=window;if(!vt.datacub?._fb){let t=Array.isArray(vt.datacub)?vt.datacub:[],e=document.currentScript,n=e?.dataset,r=e?.src?new URL(e.src).origin:void 0,i=M.init;M.init=(o,a)=>{let f=a?.apiHost||r;return i(o,f?{...a,apiHost:f}:a)},vt.datacub=M;let s=n?.id||n?.key;if(s)M.init(s,{apiHost:n.apiHost,requireConsent:n.requireConsent!=null,feedback:n.feedback!=="off"});for(let o of t)try{let[a,...f]=o,g=String(a).split(".").reduce((m,F)=>m&&Object.hasOwn(m,F)?m[F]:void 0,M);if(typeof g==="function")g(...f)}catch{}}})();
package/dist/datacub.mjs CHANGED
@@ -1,4 +1,4 @@
1
- var _={n:0},kt=(t)=>t.replace(/[\u0660-\u0669\u06f0-\u06f9\uff10-\uff19]/g,(e)=>String(e.charCodeAt(0)&15)),Ee=/[\s./()\u0640\u066b\u066c\u2010-\u2015\u200b-\u200f\u061c\u202a-\u202e\u2066-\u2069\ufeff-]/g,Bt=(t)=>kt(t).replace(Ee,""),xe=/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b|bearer\s+\S{16,}|AKIA[0-9A-Z]{16}|xox[abprs]-[\w-]+|PRIVATE KEY|[^\s@]{1,64}@[^\s@]{1,253}\.[^\s@]{2,}|eyJ[\w-]+\.[\w-]+\.[\w-]*|\d(?:[\s./()\u0640\u066b\u066c\u2010-\u2015\u200b-\u200f\u061c\u202a-\u202e\u2066-\u2069\ufeff-]*\d){8,}|[\w+/=]{32,}/gi;function Y(t){let e="",n=0;for(let r of kt(t).matchAll(xe)){if(/^[0-9a-f]{8}-/i.test(r[0])&&r[0].length===36)continue;e+=`${t.slice(n,r.index)}[redacted]`,n=r.index+r[0].length,_.n++}return e+t.slice(n)}function D(t,e=1024){if(t=t.normalize("NFC"),t.length>256||t.trim().split(/\s+/).length>11)return _.n++,"[redacted]";return Y(t).slice(0,e).replace(/[\uD800-\uDBFF]$/,"")}var F=(t)=>/[\u0000-\u001f\u007f-\u009f\u200e\u200f\u061c\u202a-\u202e\u2066-\u2069]/.test(t),Se=/(?:passw(?:or)?d|passcode|pwd|pin|pincode|otp|otpcode|onetimecode|mfacode|2facode|tfacode|smscode|secretkey|privatekey|authcode|verificationcode|securitycode|resetcode|cvv|cvc|cardnumber|ccnumber|creditcard|pan|iban|iqama|hawiya|nationalid|nid|idnumber|ssn|token|authorization|secret|apikey|sessionid|cookie|jwt|bearer|csrf|xsrf|passport|\u0643\u0644\u0645\u0647\u0627\u0644\u0645\u0631\u0648\u0631|\u0643\u0644\u0645\u0647\u0627\u0644\u0633\u0631|\u0627\u0644\u0631\u0645\u0632\u0627\u0644\u0633\u0631\u064a|\u0627\u0644\u0631\u0642\u0645\u0627\u0644\u0633\u0631\u064a|\u0631\u0645\u0632\u0627\u0644\u062a\u062d\u0642\u0642|\u0631\u0642\u0645\u0627\u0644\u0647\u0648\u064a\u0647|\u0627\u0644\u0647\u0648\u064a\u0647\u0627\u0644\u0648\u0637\u0646\u064a\u0647|\u0627\u0644\u0627\u0642\u0627\u0645\u0647|\u0627\u0644\u0628\u0637\u0627\u0642\u0647|\u0627\u0644\u0627\u064a\u0628\u0627\u0646)$/;function Kt(t,e){let n=t.normalize("NFKD").replace(/[\p{M}\u0640]/gu,"").replace(/\u0629/g,"\u0647").replace(/\u0649/g,"\u064a").replace(/(\p{Ll})(?=\p{Lu})|(\p{N}+)/gu,"$1 $2 ").toLowerCase().split(/[^\p{L}\p{N}]+/u).filter(Boolean);while(n.length>1&&/^\p{N}+$/u.test(n[n.length-1]))n.pop();return!t||[...t].length>200||/\./.test(t)||F(t)||/^(?:__proto__|constructor|prototype)$/.test(t)||e&&/^(?:\$|(?:distinct_id|person_id|project_id|timestamp|uuid|ip|api_key)$)/.test(t)||Se.test(n.join(""))&&!/^(?:japan|span|timespan|lifespan|wingspan|saucepan|spin|chopin|android)$/.test(n[n.length-1])||n.some((r)=>/^(?:password|passwd|pwd|passcode|otp|pin|secret|iqama|ssn|cvv|cvc|iban)$/.test(r))}function M(t,e=0){if(typeof t==="string")return D(t);if(typeof t==="number")return Number.isFinite(t)?Number.isInteger(t)&&Y(`${t}`)!==`${t}`?"[redacted]":t:void 0;if(typeof t==="boolean"||t===null)return t;if(t instanceof Date)return Number.isNaN(+t)?void 0:t.toISOString();if(typeof t!=="object")return;if(e>2)return"[depth]";if(Array.isArray(t))return t.slice(0,100).map((i)=>M(i,e+1)).filter((i)=>i!==void 0);let n=Object.getPrototypeOf(t);if(n!==Object.prototype&&n)return;let r={};for(let[i,s]of Object.entries(t).slice(0,200)){let o=i.trim();if(Kt(o,!e))_.n++;else{let a=M(s,e+1);if(a!==void 0)r[o]=a}}return r}function Xt(t){let e=t;try{e=decodeURIComponent(t)}catch{}e=kt(e);let n=_.n;if(Y(e)!==e)return _.n=n+1,":redacted";if(/^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$/i.test(e))return":uuid";if(/^[0-9a-f]{16,}$/i.test(e))return e.length===24?":id":":hash";if(/^[\w-]{20,}$/.test(e)&&/\d/.test(e)&&/[a-z]/.test(e)&&/[A-Z]/.test(e))return":token";let r=e.replace(/\D/g,"").length;return r&&(r===e.length||r>3&&r*2>=e.length)?":id":t}var Re=/^(?:reset|invite|sid|token|jwt|otp|code|key|state|sig(?:nature)?|auth\w*|nonce|session\w*|hash|q|query|search\w*|s|keywords?|term|text|msg|message|comments?|\w*name|e?-?mail\w*|phone|mobile|tel|address\w*|city|zip|postcode|dob|birth\w*)$/i,Ae=(t)=>/^(?:[a-z0-9][a-z0-9._~-]*|[A-Z0-9][A-Z0-9_-]*)$/.test(t)&&!(t.length>=8&&/\d/.test(t)&&/[a-z]/i.test(t)),v=(t,e)=>Y(t.normalize("NFC")).slice(0,e),Vt=(t)=>t.split("/").map((e)=>e&&Xt(e)).join("/");function R(t,e,n){let r;try{r=new URL(t)}catch{return null}let i=r.protocol;if(/^(?:mailto|tel|sms|whatsapp):$/.test(i))return{url:i,path:i};if(!/^https?:$/.test(i))return null;let s=Vt(r.pathname);if(e&&/^#!?\//.test(r.hash))s+=`#${Vt(r.hash.slice(1).split("?")[0])}`;s=s.slice(0,1024);let o={url:(r.origin+s).slice(0,2048),path:s};for(let[a,p]of r.searchParams){let h=a.toLowerCase();if(/^utm_(?:source|medium|campaign|term|content)$/.test(h)&&p)o.utm={...o.utm,[h.slice(4)]:D(p,200)};else if(/^(?:gclid|gbraid|wbraid|fbclid|ttclid|msclkid|sccid|twclid|li_fat_id)$/.test(h))o.click_id_type=h.replace(/^[gw]braid$/,"gclid");else if(n&&Object.keys(o.q||{}).length<30){let y=Xt(p);o.q??={},o.q[v(a,64)]=Kt(a,!1)||Re.test(a)||p.length>40||!(y[0]===":"||Ae(p))?"":y===":redacted"?"":y}}return o}function Yt(t){let e=t.trim().normalize("NFC");return!e||[...e].length>100||e[0]==="$"||F(e)||/[0-9a-f]{8}-[0-9a-f]{4}-|[0-9a-f]{16}|@/i.test(e)||/\d{6}/.test(Bt(e))?null:e}function _t(t,e){if(typeof t==="number"&&Number.isFinite(t))t=`${t}`;if(typeof t!=="string")return null;let n=t.trim().normalize("NFC"),r=Bt(n),i=0;for(let s=0;s<r.length;s++){let o=+r[r.length-1-s];i+=s%2?o>4?o*2-9:o*2:o}return!n||[...n].length>128||/^(?:null|undefined|0|-1|anonymous|guest|\[object object\]|none|nan|false|true|user|test|unknown|not_authenticated|distinct_id|id)$/i.test(n)||F(n)||/@|^eyJ/.test(n)||/^(?:[12]\d{9}|(?:\+?966|00966|0)5\d{8}|\+\d{8,15})$/.test(r)||/^[2-6]\d{14,15}$/.test(r)&&i%10===0||e.includes(n)?null:n}var St="0.5.0",Wt=1800000,Ne=86400000,Te=34560000,Rt=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/,$t=".datacub-no-capture,[data-datacub-no-capture]",re=["datacub_id","datacub_u","datacub_a","datacub_ss"],c,lt=!1,T={},ie=!0,oe=!0,ut=0,At=0,Q=0,tt=0,et=0,nt={},Nt=new Set,Tt,O=0,ft=0,w,rt,dt,W,P={},se=!1,Lt="",I="",It=!1,ae=null,K="pending",jt=!1,k=!1,G="",pt="",l="",E=null,L=null,q=null,g="",it=0,A=0,ce,z=0,X="",V=null,Ie=0,ot=0,gt=0,mt=0,le="",st=!0,Z,Zt=0,u=[],Ct,ue=!1,Jt="",H=!1,at=0,ht=!1,b=0,Ot=[],x=Date.now;function bt(t){if(se)console.warn(`[datacub] ${t}`)}var S=(t)=>(...e)=>{try{t(...e)}catch{}},f=(t,e,n)=>t.addEventListener(e,S(n),!0);function U(t){let e=crypto.getRandomValues(new Uint8Array(16));for(let r=5,i=t;t&&r>=0;r--,i=Math.floor(i/256))e[r]=i&255;return e[6]=e[6]&15|(t?112:64),e[8]=e[8]&63|128,Array.from(e,(r)=>(r+256).toString(16).slice(1)).join("").replace(/(.{8})(.{4})(.{4})(.{4})/,"$1-$2-$3-$4-")}function B(){let t={};try{for(let e of c.cookie.split("; ")){let n=e.indexOf("="),r=e.slice(0,n);if(r==="datacub_optout"||G&&r.endsWith(G))t[r==="datacub_optout"?r:r.slice(0,-G.length)]=decodeURIComponent(e.slice(n+1))}}catch{}return t}function m(t,e,n=pt,r=e?Te:0){try{c.cookie=`${t==="datacub_optout"?t:t+G}=${encodeURIComponent(e||"")};Path=/;Max-Age=${r};SameSite=Lax${n}${location.protocol==="https:"?";Secure":""}`}catch{}}function fe(){let t=location.hostname.split(".");return/^[\d.]+$|:/.test(location.hostname)?[]:t.slice(0,-1).map((e,n)=>`;Domain=${t.slice(n).join(".")}`)}function Ut(){if(!k)return;let t=B(),e=t.datacub_id??null;if(e!==l)l=e&&Rt.test(e)?e:U(),m("datacub_id",l),g="";E=t.datacub_u??null,L=t.datacub_a??null;let[n,r,i]=(t.datacub_ss||"").split(".");if(ce=n,z=+i,n&&Rt.test(n)&&z&&(n!==g||z>A))g=n,it=+r,A=z}function de(t,e){if(!g||t-A>Wt||t-it>Ne){if(g=U(x()),it=A=t,k)m("datacub_id",l)}else if(e&&t>A)A=t;if(k&&(ce!==g||A-z>5000))m("datacub_ss",`${g}.${it}.${A}`,pt,Wt/1000)}function N(t){clearTimeout(Ct),ue=t===0,Ct=t==null?void 0:setTimeout(S(zt),t)}function pe(t){if((t||u.length>19||c.visibilityState==="hidden")&&!ue&&!at)N(0);else if(!Ct)N(5000)}var je=new TextEncoder;function d(t,e,n,r){if(!l)return;let i=x();if(Ut(),de(i,!/^\$(?:pageleave|error|request|form_fields)$/.test(t)),_.n)e={...e,$d:_.n};let s=JSON.stringify([U(i),t,i,l,E,L,g,X||null,Ie++,+(K==="granted"),+k,V?.url,le,e,n]),o=je.encode(s).length;if(o>31000){b++;return}_.n=0,u.push([s,o]),$e(),pe(r)}function Ce(t,e){if(!l||typeof t!=="string")return;let n=Yt(t);if(!n)return bt("bad name");d(n,e&&typeof e==="object"&&!Array.isArray(e)&&M(e)||{})}function Mt(t=x()){if(ot)gt+=t-ot;ot=c.visibilityState==="visible"?t:0}var ct=()=>{O=innerWidth,ft=innerHeight,le=O<360?"xs":O<480?"s":O<768?"m":O<1280?"l":"xl",mt=Math.max(mt,scrollY+ft)};function Dt(t,e){return nt[t]=(nt[t]||0)+1,nt[t]<=e}function ge(){if(!X)return;Mt();let t=gt-At;if(st&&t<1)return;let e=c.documentElement.scrollHeight,n={$v:t,$s:e?mt/e:null};if(st)n.$e=!0;if(Q)n.$ec=Q;if(tt)n.$rq=tt;if(et)n.$rf=et;Q=tt=et=0;try{Object.assign(n,P.l?.())}catch{}st=!0,At=gt,d("$pageleave",n)}function Ft(t,e){if(!l)return;let n=location.pathname+(It?location.hash.split("?")[0]:"");if(!t&&n===Jt)return;let r=R(location.href,It,T.query!==!1);if(!r)return;Jt=n,ge();let i={};if(V)i.$p=V.path;if(t&&!e)i.$b=!0;if(i.$N=e?performance.getEntriesByType?.("navigation")[0]?.type:t?"back_forward":Tt,r.q)i.$q=r.q;if(T.title!==!1&&c.title)i.$T=v(c.title,200);V=r,X=U(x()),st=!1,gt=mt=ot=At=0,nt={},Nt.clear(),Mt(),ct(),i.$vw=O,i.$vh=ft;let s=null;if(e)try{let o=new URL(c.referrer);s=o.hostname,i.$R=R(o.href)?.path}catch{}d("$pageview",i,[r.utm,r.click_id_type,s],e)}var vt=(t)=>()=>{if(!(Z&&t==="replace"&&Tt==="push"))Tt=t;w?.(),clearTimeout(Z),Z=setTimeout(S(()=>{Z=void 0,Ft()}),100)},me=(t)=>{let e=t.closest("[data-datacub-name]")?.getAttribute("data-datacub-name");return e?D(e,100):null},he=!0;function Oe(t){let e="";for(let n=0;t&&n<10&&t!==c.body;n++,t=t.parentElement){let r=1;for(let o=t.previousElementSibling;o;o=o.previousElementSibling)if(o.localName===t.localName)r++;let i=t.id,s=t.getAttribute("data-datacub-name");e=`${t.localName}${i&&!/\d{4}|[\da-f]{8}|^:|radix-|headlessui-|mui-|ember\d|react-select/i.test(i)?`#${v(i,64)}`:""}${r>1?`:${r}`:""}${s?`[${v(s,64)}]`:""}${e&&">"}${e}`}return e.slice(-512)}function Pe(t){let e=t.querySelector(`input,textarea,select,[contenteditable],${$t}`)?"":(t.textContent||"").replace(/\s+/g," ").trim();return v(e&&e.length<101?e:t.getAttribute("aria-label")||t.getAttribute("title")||t.querySelector("img")?.getAttribute("alt")||"",100)||void 0}function qe(t,e){w?.(),rt=void 0;let n=c.activeElement,r=new MutationObserver(()=>w?.()),i=setTimeout(S(()=>{w?.();let s=e.target.closest('a[href]:not([href^="javascript:"]):not([href^="#"])');if(c.activeElement===n&&!(s&&!e.defaultPrevented)&&!(rt&&!rt.defaultPrevented))d("$deadclick",t)}),1000);w=()=>{r.disconnect(),clearTimeout(i),w=void 0},r.observe(c,{subtree:!0,childList:!0,attributes:!0,characterData:!0})}function Le(t){let e=t.target,n=t;if(!l||!(e instanceof Element)||e.closest(`${$t},input:not([type=submit]):not([type=button]),textarea,select,[contenteditable]:not([contenteditable=false])`))return;let r=e.closest("a,button,summary,input,[data-datacub-name],[role=button],[role=link],[role=menuitem],[role=tab]"),i=!r&&!/^(?:canvas|video)$/.test(e.localName)&&getComputedStyle(e).cursor==="pointer",s=r||e,o={$t:s.localName,$n:me(e),$g:Oe(s)};if(s.closest("form"))o.$o=!0;if(n.detail)o.$cx=Math.round(n.clientX/O*100),o.$cy=Math.round(n.clientY/ft*100);if((r||i)&&T.text!==!1)o.$l=Pe(s);if(r){let a=r.getAttribute("role");if(a&&/^(?:button|link|menuitem|tab)$/.test(a))o.$r=a;if(r.localName==="input")o.$y=r.type;if(r.localName==="a"&&r.hasAttribute("href"))o.$h=R(r.href)?.url;d("$click",o)}if(he&&n.detail===3&&!(s.textContent?.trim()&&getSelection()?.isCollapsed===!1))d("$rageclick",{...o});if((r||i)&&!n.metaKey&&!n.ctrlKey&&!n.shiftKey&&!s.closest("[target=_blank],[download]"))qe(o,t)}var wt=(t)=>({$f:me(t),$a:R(new URL(t.getAttribute("action")||"",location.href).href)?.url,$i:t.querySelectorAll("input,select,textarea").length});function Ue(t){let e=t.target;if(rt=t,!l||e.localName!=="form"||e.closest($t))return;d("$form_submit",wt(e))}var be=(t)=>{let e=t.target.form;return l&&e&&T.forms!==!1&&!e.closest($t)?e:null},Qt=new WeakSet;function Me(t){w?.();let e=be(t);if(e&&!Qt.has(e))Qt.add(e),d("$form_start",wt(e))}var J=new Map;function De(t){w?.();let e=be(t);if(!e)return;let n=J.get(e)||0;if(J.set(e,n+1),!n)setTimeout(S(()=>{if(Dt("i",10))d("$form_invalid",{...wt(e),$iv:J.get(e)});J.delete(e)}))}var te=(t)=>t.replace(/https?:\/\/[^\s'"<>()]+/g,(e)=>{let n=/(?::\d+){1,2}$/.exec(e)?.[0]||"";return(R(e.slice(0,e.length-n.length))?.url??"")+n});function Et(t,e,n,r,i){let s=`${r}`.startsWith(I.slice(0,-5));if(!l||T.errors===!1||t==="resource"&&(!i||s))return;Q++;let o=e&&typeof e==="object"?e:{},a=v(te(`${o.message??n??(e&&e!==o?e:"")}`).replace(/(["'\u201c\u201d\u00ab\u00bb\u2018\u2019])[^"'\u201c\u201d\u00ab\u00bb\u2018\u2019]*["'\u201c\u201d\u00ab\u00bb\u2018\u2019]/g,'"\u2026"'),200),p=typeof o.stack==="string"?v(te(o.stack.split(`
1
+ var _={n:0},kt=(t)=>t.replace(/[\u0660-\u0669\u06f0-\u06f9\uff10-\uff19]/g,(e)=>String(e.charCodeAt(0)&15)),xe=/[\s./()\u0640\u066b\u066c\u2010-\u2015\u200b-\u200f\u061c\u202a-\u202e\u2066-\u2069\ufeff-]/g,Bt=(t)=>kt(t).replace(xe,""),Se=/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b|bearer\s+\S{16,}|AKIA[0-9A-Z]{16}|xox[abprs]-[\w-]+|PRIVATE KEY|[^\s@]{1,64}@[^\s@]{1,253}\.[^\s@]{2,}|eyJ[\w-]+\.[\w-]+\.[\w-]*|\d(?:[\s./()\u0640\u066b\u066c\u2010-\u2015\u200b-\u200f\u061c\u202a-\u202e\u2066-\u2069\ufeff-]*\d){8,}|[\w+/=]{32,}/gi;function Y(t){let e="",n=0;for(let r of kt(t).matchAll(Se)){if(/^[0-9a-f]{8}-/i.test(r[0])&&r[0].length===36)continue;e+=`${t.slice(n,r.index)}[redacted]`,n=r.index+r[0].length,_.n++}return e+t.slice(n)}function F(t,e=1024){if(t=t.normalize("NFC"),t.length>256||t.trim().split(/\s+/).length>11)return _.n++,"[redacted]";return Y(t).slice(0,e).replace(/[\uD800-\uDBFF]$/,"")}var D=(t)=>/[\u0000-\u001f\u007f-\u009f\u200e\u200f\u061c\u202a-\u202e\u2066-\u2069]/.test(t),Re=/(?:passw(?:or)?d|passcode|pwd|pin|pincode|otp|otpcode|onetimecode|mfacode|2facode|tfacode|smscode|secretkey|privatekey|authcode|verificationcode|securitycode|resetcode|cvv|cvc|cardnumber|ccnumber|creditcard|pan|iban|iqama|hawiya|nationalid|nid|idnumber|ssn|token|authorization|secret|apikey|sessionid|cookie|jwt|bearer|csrf|xsrf|passport|\u0643\u0644\u0645\u0647\u0627\u0644\u0645\u0631\u0648\u0631|\u0643\u0644\u0645\u0647\u0627\u0644\u0633\u0631|\u0627\u0644\u0631\u0645\u0632\u0627\u0644\u0633\u0631\u064a|\u0627\u0644\u0631\u0642\u0645\u0627\u0644\u0633\u0631\u064a|\u0631\u0645\u0632\u0627\u0644\u062a\u062d\u0642\u0642|\u0631\u0642\u0645\u0627\u0644\u0647\u0648\u064a\u0647|\u0627\u0644\u0647\u0648\u064a\u0647\u0627\u0644\u0648\u0637\u0646\u064a\u0647|\u0627\u0644\u0627\u0642\u0627\u0645\u0647|\u0627\u0644\u0628\u0637\u0627\u0642\u0647|\u0627\u0644\u0627\u064a\u0628\u0627\u0646)$/;function Kt(t,e){let n=t.normalize("NFKD").replace(/[\p{M}\u0640]/gu,"").replace(/\u0629/g,"\u0647").replace(/\u0649/g,"\u064a").replace(/(\p{Ll})(?=\p{Lu})|(\p{N}+)/gu,"$1 $2 ").toLowerCase().split(/[^\p{L}\p{N}]+/u).filter(Boolean);while(n.length>1&&/^\p{N}+$/u.test(n[n.length-1]))n.pop();return!t||[...t].length>200||/\./.test(t)||D(t)||/^(?:__proto__|constructor|prototype)$/.test(t)||e&&/^(?:\$|(?:distinct_id|person_id|project_id|timestamp|uuid|ip|api_key)$)/.test(t)||Re.test(n.join(""))&&!/^(?:japan|span|timespan|lifespan|wingspan|saucepan|spin|chopin|android)$/.test(n[n.length-1])||n.some((r)=>/^(?:password|passwd|pwd|passcode|otp|pin|secret|iqama|ssn|cvv|cvc|iban)$/.test(r))}function M(t,e=0){if(typeof t==="string")return F(t);if(typeof t==="number")return Number.isFinite(t)?Number.isInteger(t)&&Y(`${t}`)!==`${t}`?"[redacted]":t:void 0;if(typeof t==="boolean"||t===null)return t;if(t instanceof Date)return Number.isNaN(+t)?void 0:t.toISOString();if(typeof t!=="object")return;if(e>2)return"[depth]";if(Array.isArray(t))return t.slice(0,100).map((i)=>M(i,e+1)).filter((i)=>i!==void 0);let n=Object.getPrototypeOf(t);if(n!==Object.prototype&&n)return;let r={};for(let[i,s]of Object.entries(t).slice(0,200)){let o=i.trim();if(Kt(o,!e))_.n++;else{let a=M(s,e+1);if(a!==void 0)r[o]=a}}return r}function Xt(t){let e=t;try{e=decodeURIComponent(t)}catch{}e=kt(e);let n=_.n;if(Y(e)!==e)return _.n=n+1,":redacted";if(/^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$/i.test(e))return":uuid";if(/^[0-9a-f]{16,}$/i.test(e))return e.length===24?":id":":hash";if(/^[\w-]{20,}$/.test(e)&&/\d/.test(e)&&/[a-z]/.test(e)&&/[A-Z]/.test(e))return":token";let r=e.replace(/\D/g,"").length;return r&&(r===e.length||r>3&&r*2>=e.length)?":id":t}var Ae=/^(?:reset|invite|sid|token|jwt|otp|code|key|state|sig(?:nature)?|auth\w*|nonce|session\w*|hash|q|query|search\w*|s|keywords?|term|text|msg|message|comments?|\w*name|e?-?mail\w*|phone|mobile|tel|address\w*|city|zip|postcode|dob|birth\w*)$/i,Ne=(t)=>/^(?:[a-z0-9][a-z0-9._~-]*|[A-Z0-9][A-Z0-9_-]*)$/.test(t)&&!(t.length>=8&&/\d/.test(t)&&/[a-z]/i.test(t)),v=(t,e)=>Y(t.normalize("NFC")).slice(0,e),Vt=(t)=>t.split("/").map((e)=>e&&Xt(e)).join("/");function R(t,e,n){let r;try{r=new URL(t)}catch{return null}let i=r.protocol;if(/^(?:mailto|tel|sms|whatsapp):$/.test(i))return{url:i,path:i};if(!/^https?:$/.test(i))return null;let s=Vt(r.pathname);if(e&&/^#!?\//.test(r.hash))s+=`#${Vt(r.hash.slice(1).split("?")[0])}`;s=s.slice(0,1024);let o={url:(r.origin+s).slice(0,2048),path:s};for(let[a,p]of r.searchParams){let h=a.toLowerCase();if(/^utm_(?:source|medium|campaign|term|content)$/.test(h)&&p)o.utm={...o.utm,[h.slice(4)]:F(p,200)};else if(/^(?:gclid|gbraid|wbraid|fbclid|ttclid|msclkid|sccid|twclid|li_fat_id)$/.test(h))o.click_id_type=h.replace(/^[gw]braid$/,"gclid");else if(n&&Object.keys(o.q||{}).length<30){let y=Xt(p);o.q??={},o.q[v(a,64)]=Kt(a,!1)||Ae.test(a)||p.length>40||!(y[0]===":"||Ne(p))?"":y===":redacted"?"":y}}return o}function Yt(t){let e=t.trim().normalize("NFC");return!e||[...e].length>100||e[0]==="$"||D(e)||/[0-9a-f]{8}-[0-9a-f]{4}-|[0-9a-f]{16}|@/i.test(e)||/\d{6}/.test(Bt(e))?null:e}function _t(t,e){if(typeof t==="number"&&Number.isFinite(t))t=`${t}`;if(typeof t!=="string")return null;let n=t.trim().normalize("NFC"),r=Bt(n),i=0;for(let s=0;s<r.length;s++){let o=+r[r.length-1-s];i+=s%2?o>4?o*2-9:o*2:o}return!n||[...n].length>128||/^(?:null|undefined|0|-1|anonymous|guest|\[object object\]|none|nan|false|true|user|test|unknown|not_authenticated|distinct_id|id)$/i.test(n)||D(n)||/@|^eyJ/.test(n)||/^(?:[12]\d{9}|(?:\+?966|00966|0)5\d{8}|\+\d{8,15})$/.test(r)||/^[2-6]\d{14,15}$/.test(r)&&i%10===0||e.includes(n)?null:n}var St="0.6.0",Wt=1800000,Te=86400000,Ie=34560000,Rt=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/,$t=".datacub-no-capture,[data-datacub-no-capture]",re=["datacub_id","datacub_u","datacub_a","datacub_ss"],c,lt=!1,T={},ie=!0,oe=!0,se,ut=0,At=0,Q=0,tt=0,et=0,nt={},Nt=new Set,Tt,O=0,ft=0,w,rt,dt,W,P={},ae=!1,Lt="",I="",It=!1,ce=null,K="pending",jt=!1,k=!1,G="",pt="",l="",E=null,L=null,q=null,g="",it=0,A=0,le,z=0,X="",V=null,je=0,ot=0,gt=0,mt=0,ue="",st=!0,Z,Zt=0,u=[],Ct,fe=!1,Jt="",H=!1,at=0,ht=!1,b=0,Ot=[],x=Date.now;function bt(t){if(ae)console.warn(`[datacub] ${t}`)}var S=(t)=>(...e)=>{try{t(...e)}catch{}},f=(t,e,n)=>t.addEventListener(e,S(n),!0);function U(t){let e=crypto.getRandomValues(new Uint8Array(16));for(let r=5,i=t;t&&r>=0;r--,i=Math.floor(i/256))e[r]=i&255;return e[6]=e[6]&15|(t?112:64),e[8]=e[8]&63|128,Array.from(e,(r)=>(r+256).toString(16).slice(1)).join("").replace(/(.{8})(.{4})(.{4})(.{4})/,"$1-$2-$3-$4-")}function B(){let t={};try{for(let e of c.cookie.split("; ")){let n=e.indexOf("="),r=e.slice(0,n);if(r==="datacub_optout"||G&&r.endsWith(G))t[r==="datacub_optout"?r:r.slice(0,-G.length)]=decodeURIComponent(e.slice(n+1))}}catch{}return t}function m(t,e,n=pt,r=e?Ie:0){try{c.cookie=`${t==="datacub_optout"?t:t+G}=${encodeURIComponent(e||"")};Path=/;Max-Age=${r};SameSite=Lax${n}${location.protocol==="https:"?";Secure":""}`}catch{}}function de(){let t=location.hostname.split(".");return/^[\d.]+$|:/.test(location.hostname)?[]:t.slice(0,-1).map((e,n)=>`;Domain=${t.slice(n).join(".")}`)}function Ut(){if(!k)return;let t=B(),e=t.datacub_id??null;if(e!==l)l=e&&Rt.test(e)?e:U(),m("datacub_id",l),g="";E=t.datacub_u??null,L=t.datacub_a??null;let[n,r,i]=(t.datacub_ss||"").split(".");if(le=n,z=+i,n&&Rt.test(n)&&z&&(n!==g||z>A))g=n,it=+r,A=z}function pe(t,e){if(!g||t-A>Wt||t-it>Te){if(g=U(x()),it=A=t,k)m("datacub_id",l)}else if(e&&t>A)A=t;if(k&&(le!==g||A-z>5000))m("datacub_ss",`${g}.${it}.${A}`,pt,Wt/1000)}function N(t){clearTimeout(Ct),fe=t===0,Ct=t==null?void 0:setTimeout(S(zt),t)}function ge(t){if((t||u.length>19||c.visibilityState==="hidden")&&!fe&&!at)N(0);else if(!Ct)N(5000)}var Ce=new TextEncoder;function d(t,e,n,r){if(!l)return;let i=x();if(Ut(),pe(i,!/^\$(?:pageleave|error|request|form_fields)$/.test(t)),_.n)e={...e,$d:_.n};let s=JSON.stringify([U(i),t,i,l,E,L,g,X||null,je++,+(K==="granted"),+k,V?.url,ue,e,n]),o=Ce.encode(s).length;if(o>31000){b++;return}_.n=0,u.push([s,o]),we(),ge(r)}function Oe(t,e){if(!l||typeof t!=="string")return;let n=Yt(t);if(!n)return bt("bad name");d(n,e&&typeof e==="object"&&!Array.isArray(e)&&M(e)||{})}function Mt(t=x()){if(ot)gt+=t-ot;ot=c.visibilityState==="visible"?t:0}var ct=()=>{O=innerWidth,ft=innerHeight,ue=O<360?"xs":O<480?"s":O<768?"m":O<1280?"l":"xl",mt=Math.max(mt,scrollY+ft)};function Ft(t,e){return nt[t]=(nt[t]||0)+1,nt[t]<=e}function me(){if(!X)return;Mt();let t=gt-At;if(st&&t<1)return;let e=c.documentElement.scrollHeight,n={$v:t,$s:e?mt/e:null};if(st)n.$e=!0;if(Q)n.$ec=Q;if(tt)n.$rq=tt;if(et)n.$rf=et;Q=tt=et=0;try{Object.assign(n,P.l?.())}catch{}st=!0,At=gt,d("$pageleave",n)}function Dt(t,e){if(!l)return;let n=location.pathname+(It?location.hash.split("?")[0]:"");if(!t&&n===Jt)return;let r=R(location.href,It,T.query!==!1);if(!r)return;Jt=n,me();let i={};if(V)i.$p=V.path;if(t&&!e)i.$b=!0;if(i.$N=e?performance.getEntriesByType?.("navigation")[0]?.type:t?"back_forward":Tt,r.q)i.$q=r.q;if(T.title!==!1&&c.title)i.$T=v(c.title,200);V=r,X=U(x()),st=!1,gt=mt=ot=At=0,nt={},Nt.clear(),Mt(),ct(),i.$vw=O,i.$vh=ft;let s=null;if(e)try{let o=new URL(c.referrer);s=o.hostname,i.$R=R(o.href)?.path}catch{}d("$pageview",i,[r.utm,r.click_id_type,s],e)}var vt=(t)=>()=>{if(!(Z&&t==="replace"&&Tt==="push"))Tt=t;w?.(),clearTimeout(Z),Z=setTimeout(S(()=>{Z=void 0,Dt()}),100)},he=(t)=>{let e=t.closest("[data-datacub-name]")?.getAttribute("data-datacub-name");return e?F(e,100):null},be=!0;function Pe(t){let e="";for(let n=0;t&&n<10&&t!==c.body;n++,t=t.parentElement){let r=1;for(let o=t.previousElementSibling;o;o=o.previousElementSibling)if(o.localName===t.localName)r++;let i=t.id,s=t.getAttribute("data-datacub-name");e=`${t.localName}${i&&!/\d{4}|[\da-f]{8}|^:|radix-|headlessui-|mui-|ember\d|react-select/i.test(i)?`#${v(i,64)}`:""}${r>1?`:${r}`:""}${s?`[${v(s,64)}]`:""}${e&&">"}${e}`}return e.slice(-512)}function qe(t){let e=t.querySelector(`input,textarea,select,[contenteditable],${$t}`)?"":(t.textContent||"").replace(/\s+/g," ").trim();return v(e&&e.length<101?e:t.getAttribute("aria-label")||t.getAttribute("title")||t.querySelector("img")?.getAttribute("alt")||"",100)||void 0}function Le(t,e){w?.(),rt=void 0;let n=c.activeElement,r=new MutationObserver(()=>w?.()),i=setTimeout(S(()=>{w?.();let s=e.target.closest('a[href]:not([href^="javascript:"]):not([href^="#"])');if(c.activeElement===n&&!(s&&!e.defaultPrevented)&&!(rt&&!rt.defaultPrevented))d("$deadclick",t)}),1000);w=()=>{r.disconnect(),clearTimeout(i),w=void 0},r.observe(c,{subtree:!0,childList:!0,attributes:!0,characterData:!0})}function Ue(t){let e=t.target,n=t;if(!l||!(e instanceof Element)||e.closest(`${$t},input:not([type=submit]):not([type=button]),textarea,select,[contenteditable]:not([contenteditable=false])`))return;let r=e.closest("a,button,summary,input,[data-datacub-name],[role=button],[role=link],[role=menuitem],[role=tab]"),i=!r&&!/^(?:canvas|video)$/.test(e.localName)&&getComputedStyle(e).cursor==="pointer",s=r||e,o={$t:s.localName,$n:he(e),$g:Pe(s)};if(s.closest("form"))o.$o=!0;if(n.detail)o.$cx=Math.round(n.clientX/O*100),o.$cy=Math.round(n.clientY/ft*100);if((r||i)&&T.text!==!1)o.$l=qe(s);if(r){let a=r.getAttribute("role");if(a&&/^(?:button|link|menuitem|tab)$/.test(a))o.$r=a;if(r.localName==="input")o.$y=r.type;if(r.localName==="a"&&r.hasAttribute("href"))o.$h=R(r.href)?.url;d("$click",o)}if(be&&n.detail===3&&!(s.textContent?.trim()&&getSelection()?.isCollapsed===!1))d("$rageclick",{...o});if((r||i)&&!n.metaKey&&!n.ctrlKey&&!n.shiftKey&&!s.closest("[target=_blank],[download]"))Le(o,t)}var wt=(t)=>({$f:he(t),$a:R(new URL(t.getAttribute("action")||"",location.href).href)?.url,$i:t.querySelectorAll("input,select,textarea").length});function Me(t){let e=t.target;if(rt=t,!l||e.localName!=="form"||e.closest($t))return;d("$form_submit",wt(e))}var ye=(t)=>{let e=t.target.form;return l&&e&&T.forms!==!1&&!e.closest($t)?e:null},Qt=new WeakSet;function Fe(t){w?.();let e=ye(t);if(e&&!Qt.has(e))Qt.add(e),d("$form_start",wt(e))}var J=new Map;function De(t){w?.();let e=ye(t);if(!e)return;let n=J.get(e)||0;if(J.set(e,n+1),!n)setTimeout(S(()=>{if(Ft("i",10))d("$form_invalid",{...wt(e),$iv:J.get(e)});J.delete(e)}))}var te=(t)=>t.replace(/https?:\/\/[^\s'"<>()]+/g,(e)=>{let n=/(?::\d+){1,2}$/.exec(e)?.[0]||"";return(R(e.slice(0,e.length-n.length))?.url??"")+n});function Et(t,e,n,r,i){let s=`${r}`.startsWith(I.slice(0,-5));if(!l||T.errors===!1||t==="resource"&&(!i||s))return;Q++;let o=e&&typeof e==="object"?e:{},a=v(te(`${o.message??n??(e&&e!==o?e:"")}`).replace(/(["'\u201c\u201d\u00ab\u00bb\u2018\u2019])[^"'\u201c\u201d\u00ab\u00bb\u2018\u2019]*["'\u201c\u201d\u00ab\u00bb\u2018\u2019]/g,'"\u2026"'),200),p=typeof o.stack==="string"?v(te(o.stack.split(`
2
2
  `).filter((y)=>/:\d+:\d+/.test(y)).slice(0,5).map((y)=>y.trim().replace(/@(?=https?:)/," ")).join(`
3
3
  `)),1000):void 0,h=`${t}${o.name}${a}${p?.split(`
4
- `)[0]}${r}`;if(Nt.has(h)||!Dt("e",20))return;Nt.add(h),d("$error",{$ek:t,$en:typeof o.name==="string"?v(o.name,64):void 0,$em:a||void 0,$es:p||void 0,$eu:r?R(`${r}`)?.url:void 0,$et:i})}function ye(t,e,n,r,i){if(!l||T.network===!1)return;let s=new URL(e,location.href).href;if(s.startsWith(I.slice(0,-5)))return;tt++;let o=x()-r,a=i==="AbortError"?"abort":i?"network_error":n>399?"http_error":o>2999&&"slow";if(!a)return;if(a!=="slow"&&a!=="abort")et++;if(Dt("r",30))d("$request",{$nm:`${t}`.toUpperCase().slice(0,10),$nu:R(s)?.url,$ns:n,$nd:o,$nk:a})}var ee=S(ye);function $e(){let t=u.length-1000;if(t>0)b+=u.splice(0,t).length}function Fe(){if(!W)try{let r=(s)=>+matchMedia(`(${s})`).matches,i=navigator;W=[screen.width,screen.height,Math.round(devicePixelRatio*100)/100,null,i.hardwareConcurrency,i.deviceMemory,i.maxTouchPoints,r("pointer:coarse")?"c":"f",r("prefers-color-scheme:dark")?"d":"l",r("prefers-reduced-motion:reduce")]}catch{W=Array(10)}let t=navigator.connection||{},e=P.h||[];return[...W,t.effectiveType,t.rtt,t.downlink,+t.saveData,e[0],e[1],-new Date().getTimezoneOffset()]}var Pt=(t,e)=>`${JSON.stringify([3,Lt,x(),St,e,ae,navigator.language,!!navigator.webdriver,Fe()]).slice(0,-1)},${t.map((n)=>n[0])}]`;function qt(t){let e=0,n=200;while(e<u.length&&e<100){if(n+=u[e][1]+1,n>t)break;e++}return u.splice(0,e||1)}var xt=!1;async function zt(){if(N(),H)xt=!0;if(H||ht||!u.length||!navigator.onLine)return;H=!0;let t=qt(30720),e=b;b=0;let n=0;try{let r=await dt(I,{method:"POST",body:Pt(t,e),keepalive:!0,credentials:"omit",referrerPolicy:"no-referrer"}),i=r.status;if(i===401||i===403)ht=!0,u=[];else if(i===429||i>499)n=Math.min(+(r.headers.get("Retry-After")||0),3600)*1000||-1;else if(at=0,i>299)b+=t.length+e;else{let s=await r.json().catch(()=>0);if(s.directives?.includes("rotate_anon_id"))Ht();if(s.feedback)yt()}}catch{n=-1}H=!1;try{if(n&&l){if(u=t.concat(u),b+=e,$e(),++at<11)N(n>0?n:Math.random()*Math.min(1000*2**at,300000))}else if(u.length)pe(xt);xt=!1}catch{}}function ne(){if(w?.(),ge(),N(),!H&&typeof Request==="function"&&"keepalive"in Request.prototype){let t=61440;while(u.length&&!ht&&t>2048){let e=qt(t),n=b,r=Pt(e,n);t-=r.length,b=0;let i=()=>{u=e.concat(u),b+=n,N(1000)};try{dt(I,{method:"POST",body:r,keepalive:!0,credentials:"omit",referrerPolicy:"no-referrer"}).catch(i)}catch{i();break}}}else{let t=61440;while(u.length&&!ht&&navigator.sendBeacon){let e=qt(t);if(navigator.sendBeacon(I,Pt(e,b)))b=0;else{if(u=e.concat(u),e.length<2)break;t/=2}}}if(u.length)N(1000)}function we(t){K=t?"granted":"not_required";for(let n of fe().reverse())if(m("datacub_tld","1",n,9),B().datacub_tld){m("datacub_tld","",n),pt=n;break}let e=B().datacub_id;if(l=e&&Rt.test(e)?e:U(),m("datacub_id",l),k=B().datacub_id===l,t){for(let n of["",pt])m("datacub_optout","",n);d("$consent",{$m:/^(?:banner|settings|api|cmp)$/.test(`${t.method}`)?t.method:"api",$P:typeof t.policyVersion==="string"?D(t.policyVersion,64):null})}if(q)ve(...q);if(q=null,Ft(!0,!0),ie&&!P.v)P.v=St,P.e=(n,r)=>n==="$form_fields"&&T.forms!==!1&&d(n,r),P.f=wt,window.__datacub=P,ke(`sdk/insights-${St}.min.js`,"sha384-7xNcWolajp48vRTTBdYbGMF2VDBSxZ5qtqZeoosFSuy8Os18qOd9cEUDuSCp9I9z")}function ke(t,e){try{let n=c.createElement("script");if(n.src=I.slice(0,-5)+t,n.async=!0,n.referrerPolicy="no-referrer",e)n.integrity=e,n.crossOrigin="anonymous";n.setAttribute("fetchpriority","low"),(c.head||c.documentElement).append(n)}catch{}}function yt(t){if(!oe||!l||ut===1)return;if(t)ut=t;if(!c.querySelector('script[src*="/v1/feedback.js"]'))ke("feedback.js")}var ze=()=>{let t=ut;return ut=1,t!==1&&(t||[])};function He(t={}){if(!l&&(!jt||t.overrideGPC))we(t)}function _e(){K="denied",N(),u=[];for(let t of re)for(let e of["",...fe()])m(t,"",e);l=g=X="",E=L=q=V=null,k=!1,m("datacub_optout","1")}function ve(t,e,n){if(Ut(),E&&E!==t)Ht();if(e!==L&&k)m("datacub_a",e);if(L=e,E!==t){if(E=t,k)m("datacub_u",t);n.$A=l}for(let r in n)return d(n.$A?"$identify":"$set",n,0,!0)}function Ge(t,e){if(t&&typeof t==="object")e=t,t=e.id??e.userId??e.user_id;let n=[l,g,X],r=_t(t,n),i=e?.account==null?null:_t(e.account,n);if(!r||e?.account!=null&&!i)return bt("bad id");let s=e&&M(e)||{};for(let o in s){let a=/^(?:account|id|user_?id|(email)|(?:full_?)?(name)|(phone)(?:_?number)?)$/i.exec(o);if(a){let p=a[1]||a[2]||a[3];if(p)s[`$${p.toLowerCase()}`]=e[o];delete s[o]}}if(l)ve(r,i,s);else if(K==="pending")q=[r,i,s]}function Ht(){if(q=null,!l)return;if(zt(),l=U(),E=L=null,g="",k){m("datacub_id",l);for(let t of re.slice(1))m(t,"")}}function Ve(t,e={}){if(se=/^(?:localhost|127\.0\.0\.1|\[::1\])$|\.(?:localhost|test)$/.test(location.hostname),lt||typeof t!=="string")return;if(/^sk_/.test(t))return console.error("[datacub] refused a secret key. Use your project ID.");let n;try{n=new URL(e.apiHost||"https://in.datacub.to",location.href)}catch{}if(!/^(?:pk_(?:live|test)_[A-Za-z0-9]{24,48}|[a-z0-9]{8})$/.test(t))return bt("init: bad key");if(!n||n.username||n.password||!(n.protocol==="https:"||n.protocol==="http:"&&/^(?:localhost|127\.0\.0\.1)$/.test(n.hostname)))return bt("init: bad apiHost");if(lt=!0,Lt=t,G=`_${t.replace(/^pk_[a-z]+_/,"").slice(0,8)}`,I=`${n.origin}${n.pathname.replace(/\/+$/,"")}/v1/batch`,It=e.hashRouting===!0,ae=typeof e.release==="string"&&!F(e.release)?e.release.slice(0,64):null,T=e.capture&&typeof e.capture==="object"&&e.capture||{},ie=e.insights!==!1,oe=e.feedback!==!1,f(c,"click",(r)=>r.target?.closest?.("[data-datacub-feedback]")&&yt(["feedback",[]])),dt=fetch,jt=navigator.globalPrivacyControl===!0,jt||B().datacub_optout)_e();else if(!e.requireConsent)we();if(he=e.rageClicks!==!1,e.autocapture!==!1)f(c,"click",Le),f(c,"submit",Ue),f(c,"input",Me),f(c,"invalid",De);for(let r of["pointerdown","keydown","scroll"])f(c,r,(i)=>{let s=x();if(i.target===c)ct();if(r==="scroll")w?.();if(g&&c.visibilityState==="visible"&&s-Zt>5000)Zt=s,Ut(),de(s,!0)});f(c,"visibilitychange",()=>{if(Mt(),c.visibilityState==="hidden")ne()}),ct(),f(window,"resize",ct),f(window,"pagehide",ne),f(window,"pageshow",(r)=>r.persisted&&Ft(!0)),f(window,"online",zt),f(window,"popstate",vt("pop")),f(window,"hashchange",vt("hash"));for(let r of["pushState","replaceState"]){let i=history[r];history[r]=function(...s){i.apply(this,s),vt(r==="pushState"?"push":"replace")()}}try{f(window,"error",(o)=>o instanceof ErrorEvent?Et("js",o.error,o.message,o.filename):Et("resource",0,"",o.target.src||o.target.href,o.target.localName)),f(window,"unhandledrejection",(o)=>Et("rejection",o.reason)),window.fetch=function(...o){let a=dt.apply(this,o);try{let p=x(),h=o[0],y=`${h.url||h}`,Gt=o[1]?.method||h.method||"GET";return a.then((j)=>{try{ee(Gt,j.url||y,j.type==="opaque"?200:j.status,p)}catch{}return j},(j)=>{throw ee(Gt,y,0,p,j?.name||"Error"),j})}catch{}return a};let r=XMLHttpRequest.prototype,{open:i,send:s}=r;r.open=function(...o){return this._x=o,i.apply(this,o)},r.send=function(...o){if(this._x&&!this._t)for(let a of["load","error","abort","timeout"])f(this,a,()=>ye(this._x?.[0],`${this._x?.[1]}`,this.status,this._t,a==="load"?"":a==="abort"?"AbortError":"TypeError"));return this._t=x(),s.apply(this,o)}}catch{}}var C=(t)=>S((...e)=>{if(typeof window>"u")return;if(lt)t(...e);else if(Ot.length<100)Ot.push([t,e])}),Be={init:S((t,e)=>{if(typeof window>"u"||!globalThis.crypto?.getRandomValues)return;c=document;let n=S(()=>{Ve(t,e);for(let[r,i]of Ot.splice(0))if(lt)r(...i)});if(c.prerendering)f(c,"prerenderingchange",n);else n()}),track:C(Ce),identify:C(Ge),reset:C(Ht),consent:{grant:C(He),revoke:C(_e)},ask:C((...t)=>yt(["ask",t])),feedback:C(()=>yt(["feedback",[]])),_fb:()=>[K,k,Lt,I,l,E,g,d,ze]},We=Be;export{St as VERSION,We as default};
4
+ `)[0]}${r}`;if(Nt.has(h)||!Ft("e",20))return;Nt.add(h),d("$error",{$ek:t,$en:typeof o.name==="string"?v(o.name,64):void 0,$em:a||void 0,$es:p||void 0,$eu:r?R(`${r}`)?.url:void 0,$et:i})}function $e(t,e,n,r,i){if(!l||T.network===!1)return;let s=new URL(e,location.href).href;if(s.startsWith(I.slice(0,-5)))return;tt++;let o=x()-r,a=i==="AbortError"?"abort":i?"network_error":n>399?"http_error":o>2999&&"slow";if(!a)return;if(a!=="slow"&&a!=="abort")et++;if(Ft("r",30))d("$request",{$nm:`${t}`.toUpperCase().slice(0,10),$nu:R(s)?.url,$ns:n,$nd:o,$nk:a})}var ee=S($e);function we(){let t=u.length-1000;if(t>0)b+=u.splice(0,t).length}function ze(){if(!W)try{let r=(s)=>+matchMedia(`(${s})`).matches,i=navigator;W=[screen.width,screen.height,Math.round(devicePixelRatio*100)/100,null,i.hardwareConcurrency,i.deviceMemory,i.maxTouchPoints,r("pointer:coarse")?"c":"f",r("prefers-color-scheme:dark")?"d":"l",r("prefers-reduced-motion:reduce")]}catch{W=Array(10)}let t=navigator.connection||{},e=P.h||[];return[...W,t.effectiveType,t.rtt,t.downlink,+t.saveData,e[0],e[1],-new Date().getTimezoneOffset()]}var Pt=(t,e)=>`${JSON.stringify([3,Lt,x(),St,e,ce,navigator.language,!!navigator.webdriver,ze()]).slice(0,-1)},${t.map((n)=>n[0])}]`;function qt(t){let e=0,n=200;while(e<u.length&&e<100){if(n+=u[e][1]+1,n>t)break;e++}return u.splice(0,e||1)}var xt=!1;async function zt(){if(N(),H)xt=!0;if(H||ht||!u.length||!navigator.onLine)return;H=!0;let t=qt(30720),e=b;b=0;let n=0;try{let r=await dt(I,{method:"POST",body:Pt(t,e),keepalive:!0,credentials:"omit",referrerPolicy:"no-referrer"}),i=r.status;if(i===401||i===403)ht=!0,u=[];else if(i===429||i>499)n=Math.min(+(r.headers.get("Retry-After")||0),3600)*1000||-1;else if(at=0,i>299)b+=t.length+e;else{let s=await r.json().catch(()=>0);if(s.directives?.includes("rotate_anon_id"))Ht();if(s.feedback)yt()}}catch{n=-1}H=!1;try{if(n&&l){if(u=t.concat(u),b+=e,we(),++at<11)N(n>0?n:Math.random()*Math.min(1000*2**at,300000))}else if(u.length)ge(xt);xt=!1}catch{}}function ne(){if(w?.(),me(),N(),!H&&typeof Request==="function"&&"keepalive"in Request.prototype){let t=61440;while(u.length&&!ht&&t>2048){let e=qt(t),n=b,r=Pt(e,n);t-=r.length,b=0;let i=()=>{u=e.concat(u),b+=n,N(1000)};try{dt(I,{method:"POST",body:r,keepalive:!0,credentials:"omit",referrerPolicy:"no-referrer"}).catch(i)}catch{i();break}}}else{let t=61440;while(u.length&&!ht&&navigator.sendBeacon){let e=qt(t);if(navigator.sendBeacon(I,Pt(e,b)))b=0;else{if(u=e.concat(u),e.length<2)break;t/=2}}}if(u.length)N(1000)}function ke(t){K=t?"granted":"not_required";for(let n of de().reverse())if(m("datacub_tld","1",n,9),B().datacub_tld){m("datacub_tld","",n),pt=n;break}let e=B().datacub_id;if(l=e&&Rt.test(e)?e:U(),m("datacub_id",l),k=B().datacub_id===l,t){for(let n of["",pt])m("datacub_optout","",n);d("$consent",{$m:/^(?:banner|settings|api|cmp)$/.test(`${t.method}`)?t.method:"api",$P:typeof t.policyVersion==="string"?F(t.policyVersion,64):null})}if(q)Ee(...q);if(q=null,Dt(!0,!0),ie&&!P.v)P.v=St,P.e=(n,r)=>n==="$form_fields"&&T.forms!==!1&&d(n,r),P.f=wt,window.__datacub=P,_e(`sdk/insights-${St}.min.js`,"sha384-7xNcWolajp48vRTTBdYbGMF2VDBSxZ5qtqZeoosFSuy8Os18qOd9cEUDuSCp9I9z")}function _e(t,e){try{let n=c.createElement("script");if(n.src=I.slice(0,-5)+t,n.async=!0,n.referrerPolicy="no-referrer",e)n.integrity=e,n.crossOrigin="anonymous";n.setAttribute("fetchpriority","low"),(c.head||c.documentElement).append(n)}catch{}}function yt(t){if(!oe||!l||ut===1)return;if(t)ut=t;if(!c.querySelector('script[src*="/v1/feedback.js"]'))_e("feedback.js")}var He=()=>{let t=ut;return ut=1,t!==1&&(t||[])};function Ge(t={}){if(!l&&(!jt||t.overrideGPC))ke(t)}function ve(){K="denied",N(),u=[];for(let t of re)for(let e of["",...de()])m(t,"",e);l=g=X="",E=L=q=V=null,k=!1,m("datacub_optout","1")}function Ee(t,e,n){if(Ut(),E&&E!==t)Ht();if(e!==L&&k)m("datacub_a",e);if(L=e,E!==t){if(E=t,k)m("datacub_u",t);n.$A=l}for(let r in n)return d(n.$A?"$identify":"$set",n,0,!0)}function Ve(t,e){if(t&&typeof t==="object")e=t,t=e.id??e.userId??e.user_id;let n=[l,g,X],r=_t(t,n),i=e?.account==null?null:_t(e.account,n);if(!r||e?.account!=null&&!i)return bt("bad id");let s=e&&M(e)||{};for(let o in s){let a=/^(?:account|id|user_?id|(email)|(?:full_?)?(name)|(phone)(?:_?number)?)$/i.exec(o);if(a){let p=a[1]||a[2]||a[3];if(p)s[`$${p.toLowerCase()}`]=e[o];delete s[o]}}if(l)Ee(r,i,s);else if(K==="pending")q=[r,i,s]}function Ht(){if(q=null,!l)return;if(zt(),l=U(),E=L=null,g="",k){m("datacub_id",l);for(let t of re.slice(1))m(t,"")}}function Be(t,e={}){if(ae=/^(?:localhost|127\.0\.0\.1|\[::1\])$|\.(?:localhost|test)$/.test(location.hostname),lt||typeof t!=="string")return;if(/^sk_/.test(t))return console.error("[datacub] refused a secret key. Use your project ID.");let n;try{n=new URL(e.apiHost||"https://in.datacub.to",location.href)}catch{}if(!/^(?:pk_(?:live|test)_[A-Za-z0-9]{24,48}|[a-z0-9]{8})$/.test(t))return bt("init: bad key");if(!n||n.username||n.password||!(n.protocol==="https:"||n.protocol==="http:"&&/^(?:localhost|127\.0\.0\.1)$/.test(n.hostname)))return bt("init: bad apiHost");if(lt=!0,Lt=t,G=`_${t.replace(/^pk_[a-z]+_/,"").slice(0,8)}`,I=`${n.origin}${n.pathname.replace(/\/+$/,"")}/v1/batch`,It=e.hashRouting===!0,ce=typeof e.release==="string"&&!D(e.release)?e.release.slice(0,64):null,T=e.capture&&typeof e.capture==="object"&&e.capture||{},ie=e.insights!==!1,oe=e.feedback!==!1,se=e.feedback?.look,f(c,"click",(r)=>r.target?.closest?.("[data-datacub-feedback]")&&yt(["feedback",[]])),dt=fetch,jt=navigator.globalPrivacyControl===!0,jt||B().datacub_optout)ve();else if(!e.requireConsent)ke();if(be=e.rageClicks!==!1,e.autocapture!==!1)f(c,"click",Ue),f(c,"submit",Me),f(c,"input",Fe),f(c,"invalid",De);for(let r of["pointerdown","keydown","scroll"])f(c,r,(i)=>{let s=x();if(i.target===c)ct();if(r==="scroll")w?.();if(g&&c.visibilityState==="visible"&&s-Zt>5000)Zt=s,Ut(),pe(s,!0)});f(c,"visibilitychange",()=>{if(Mt(),c.visibilityState==="hidden")ne()}),ct(),f(window,"resize",ct),f(window,"pagehide",ne),f(window,"pageshow",(r)=>r.persisted&&Dt(!0)),f(window,"online",zt),f(window,"popstate",vt("pop")),f(window,"hashchange",vt("hash"));for(let r of["pushState","replaceState"]){let i=history[r];history[r]=function(...s){i.apply(this,s),vt(r==="pushState"?"push":"replace")()}}try{f(window,"error",(o)=>o instanceof ErrorEvent?Et("js",o.error,o.message,o.filename):Et("resource",0,"",o.target.src||o.target.href,o.target.localName)),f(window,"unhandledrejection",(o)=>Et("rejection",o.reason)),window.fetch=function(...o){let a=dt.apply(this,o);try{let p=x(),h=o[0],y=`${h.url||h}`,Gt=o[1]?.method||h.method||"GET";return a.then((j)=>{try{ee(Gt,j.url||y,j.type==="opaque"?200:j.status,p)}catch{}return j},(j)=>{throw ee(Gt,y,0,p,j?.name||"Error"),j})}catch{}return a};let r=XMLHttpRequest.prototype,{open:i,send:s}=r;r.open=function(...o){return this._x=o,i.apply(this,o)},r.send=function(...o){if(this._x&&!this._t)for(let a of["load","error","abort","timeout"])f(this,a,()=>$e(this._x?.[0],`${this._x?.[1]}`,this.status,this._t,a==="load"?"":a==="abort"?"AbortError":"TypeError"));return this._t=x(),s.apply(this,o)}}catch{}}var C=(t)=>S((...e)=>{if(typeof window>"u")return;if(lt)t(...e);else if(Ot.length<100)Ot.push([t,e])}),Ke={init:S((t,e)=>{if(typeof window>"u"||!globalThis.crypto?.getRandomValues)return;c=document;let n=S(()=>{Be(t,e);for(let[r,i]of Ot.splice(0))if(lt)r(...i)});if(c.prerendering)f(c,"prerenderingchange",n);else n()}),track:C(Oe),identify:C(Ve),reset:C(Ht),consent:{grant:C(Ge),revoke:C(ve)},ask:C((...t)=>yt(["ask",t])),feedback:C(()=>yt(["feedback",[]])),_fb:()=>[K,k,Lt,I,l,E,g,d,He,se]},Ze=Ke;export{St as VERSION,Ze as default};
package/dist/feedback.js CHANGED
@@ -1,26 +1,27 @@
1
- (()=>{var Y={n:0},J=(o)=>o.replace(/[\u0660-\u0669\u06f0-\u06f9\uff10-\uff19]/g,(t)=>String(t.charCodeAt(0)&15));var pe=/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b|bearer\s+\S{16,}|AKIA[0-9A-Z]{16}|xox[abprs]-[\w-]+|PRIVATE KEY|[^\s@]{1,64}@[^\s@]{1,253}\.[^\s@]{2,}|eyJ[\w-]+\.[\w-]+\.[\w-]*|\d(?:[\s./()\u0640\u066b\u066c\u2010-\u2015\u200b-\u200f\u061c\u202a-\u202e\u2066-\u2069\ufeff-]*\d){8,}|[\w+/=]{32,}/gi;function ue(o){let t="",c=0;for(let r of J(o).matchAll(pe)){if(/^[0-9a-f]{8}-/i.test(r[0])&&r[0].length===36)continue;t+=`${o.slice(c,r.index)}[redacted]`,c=r.index+r[0].length,Y.n++}return t+o.slice(c)}function Q(o){let t=o;try{t=decodeURIComponent(o)}catch{}t=J(t);let c=Y.n;if(ue(t)!==t)return Y.n=c+1,":redacted";if(/^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$/i.test(t))return":uuid";if(/^[0-9a-f]{16,}$/i.test(t))return t.length===24?":id":":hash";if(/^[\w-]{20,}$/.test(t)&&/\d/.test(t)&&/[a-z]/.test(t)&&/[A-Z]/.test(t))return":token";let r=t.replace(/\D/g,"").length;return r&&(r===t.length||r>3&&r*2>=t.length)?":id":o}var X={en:{close:"Close",send:"Send",sending:"Sending",thanks:"Thanks for sharing!",failed:"Could not send. Try again.",yes:"Yes",no:"No",low:"Not likely",high:"Very likely",type:"Type your answer",general:"What\u2019s on your mind?",tell:"Tell us anything"},ar:{close:"\u0625\u063a\u0644\u0627\u0642",send:"\u0625\u0631\u0633\u0627\u0644",sending:"\u062c\u0627\u0631\u064d \u0627\u0644\u0625\u0631\u0633\u0627\u0644",thanks:"\u0634\u0643\u0631\u064b\u0627 \u0639\u0644\u0649 \u0645\u0634\u0627\u0631\u0643\u062a\u0643!",failed:"\u062a\u0639\u0630\u0651\u0631 \u0627\u0644\u0625\u0631\u0633\u0627\u0644\u060c \u062d\u0627\u0648\u0644 \u0645\u0631\u0629 \u062b\u0627\u0646\u064a\u0629.",yes:"\u0646\u0639\u0645",no:"\u0644\u0627",low:"\u063a\u064a\u0631 \u0645\u062d\u062a\u0645\u0644",high:"\u0645\u062d\u062a\u0645\u0644 \u062c\u062f\u064b\u0627",type:"\u0627\u0643\u062a\u0628 \u0625\u062c\u0627\u0628\u062a\u0643",general:"\u0645\u0627 \u0627\u0644\u0630\u064a \u064a\u062f\u0648\u0631 \u0641\u064a \u0628\u0627\u0644\u0643\u061f",tell:"\u0627\u0643\u062a\u0628 \u0645\u0627 \u062a\u0631\u064a\u062f"}},ee="--bg:#1c1c1f;--fg:#fafafa;--mut:#a1a1aa;--opt:#2a2a2e;--opt-h:#333338;--edge:rgba(255,255,255,.08);--x:#8b8b93;--line:#55555c",te=`
1
+ (()=>{var W={n:0},oe=(o)=>o.replace(/[\u0660-\u0669\u06f0-\u06f9\uff10-\uff19]/g,(t)=>String(t.charCodeAt(0)&15));var Se=/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b|bearer\s+\S{16,}|AKIA[0-9A-Z]{16}|xox[abprs]-[\w-]+|PRIVATE KEY|[^\s@]{1,64}@[^\s@]{1,253}\.[^\s@]{2,}|eyJ[\w-]+\.[\w-]+\.[\w-]*|\d(?:[\s./()\u0640\u066b\u066c\u2010-\u2015\u200b-\u200f\u061c\u202a-\u202e\u2066-\u2069\ufeff-]*\d){8,}|[\w+/=]{32,}/gi;function $e(o){let t="",a=0;for(let r of oe(o).matchAll(Se)){if(/^[0-9a-f]{8}-/i.test(r[0])&&r[0].length===36)continue;t+=`${o.slice(a,r.index)}[redacted]`,a=r.index+r[0].length,W.n++}return t+o.slice(a)}function re(o){let t=o;try{t=decodeURIComponent(o)}catch{}t=oe(t);let a=W.n;if($e(t)!==t)return W.n=a+1,":redacted";if(/^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$/i.test(t))return":uuid";if(/^[0-9a-f]{16,}$/i.test(t))return t.length===24?":id":":hash";if(/^[\w-]{20,}$/.test(t)&&/\d/.test(t)&&/[a-z]/.test(t)&&/[A-Z]/.test(t))return":token";let r=t.replace(/\D/g,"").length;return r&&(r===t.length||r>3&&r*2>=t.length)?":id":o}var se={en:{close:"Close",send:"Send",sending:"Sending",thanks:"Thanks for sharing!",failed:"Could not send. Try again.",yes:"Yes",no:"No",low:"Not likely",high:"Very likely",type:"Type your answer",general:"What\u2019s on your mind?",tell:"Tell us anything"},ar:{close:"\u0625\u063a\u0644\u0627\u0642",send:"\u0625\u0631\u0633\u0627\u0644",sending:"\u062c\u0627\u0631\u064d \u0627\u0644\u0625\u0631\u0633\u0627\u0644",thanks:"\u0634\u0643\u0631\u064b\u0627 \u0639\u0644\u0649 \u0645\u0634\u0627\u0631\u0643\u062a\u0643!",failed:"\u062a\u0639\u0630\u0651\u0631 \u0627\u0644\u0625\u0631\u0633\u0627\u0644\u060c \u062d\u0627\u0648\u0644 \u0645\u0631\u0629 \u062b\u0627\u0646\u064a\u0629.",yes:"\u0646\u0639\u0645",no:"\u0644\u0627",low:"\u063a\u064a\u0631 \u0645\u062d\u062a\u0645\u0644",high:"\u0645\u062d\u062a\u0645\u0644 \u062c\u062f\u064b\u0627",type:"\u0627\u0643\u062a\u0628 \u0625\u062c\u0627\u0628\u062a\u0643",general:"\u0645\u0627 \u0627\u0644\u0630\u064a \u064a\u062f\u0648\u0631 \u0641\u064a \u0628\u0627\u0644\u0643\u061f",tell:"\u0627\u0643\u062a\u0628 \u0645\u0627 \u062a\u0631\u064a\u062f"}},ae="--bg:#1c1c1f;--fg:#fafafa;--mut:#a1a1aa;--opt:#2a2a2e;--opt-h:#333338;--edge:rgba(255,255,255,.08);--x:#8b8b93;--line:#55555c",Q='system-ui,-apple-system,"Segoe UI","SF Arabic","Noto Sans Arabic",Tahoma,sans-serif',le={system:Q,serif:'ui-serif,Georgia,Cambria,"Times New Roman","Noto Naskh Arabic","Geeza Pro",serif',rounded:`ui-rounded,"SF Pro Rounded",Nunito,"Varela Round",${Q}`},de={none:[0,0],small:[6,4],medium:[12,8],large:[16,10]},ce={small:[320,13,12],medium:[360,14,16],large:[400,15,20]},ue=`
2
2
  :host{all:initial}
3
3
  *{box-sizing:border-box;margin:0}
4
4
  .w{--a:#1f1f1f;--on:#fff;--bg:#fff;--fg:#18181b;--mut:#71717a;--opt:#f4f4f5;--opt-h:#ebebee;--edge:rgba(24,24,27,.07);--x:#a1a1aa;--line:#d4d4d8;
5
- position:fixed;z-index:2147483000;bottom:16px;right:16px;width:360px;max-width:calc(100vw - 24px);
6
- font:14px/1.45 system-ui,-apple-system,"Segoe UI","SF Arabic","Noto Sans Arabic",Tahoma,sans-serif;color:var(--fg);-webkit-font-smoothing:antialiased;transition:bottom .2s}
7
- .w.dk{${ee}}
8
- @media (prefers-color-scheme:dark){.w.au{${ee}}}
5
+ --ff:${Q};--fs:14px;--r:16px;--ri:10px;--pad:16px;
6
+ position:fixed;z-index:2147483000;bottom:16px;right:16px;width:var(--wd,360px);max-width:calc(100vw - 24px);
7
+ font-family:var(--ff);font-size:var(--fs);line-height:1.45;color:var(--fg);-webkit-font-smoothing:antialiased;transition:bottom .2s}
8
+ .w.dk{${ae}}
9
+ @media (prefers-color-scheme:dark){.w.au{${ae}}}
9
10
  .w.s{right:auto;left:16px}
10
11
  .w.p{position:relative;inset:auto;bottom:auto;right:auto;left:auto;width:100%}
11
- .c{position:relative;background:var(--bg);border-radius:16px;padding:16px;box-shadow:0 0 0 1px var(--edge),0 12px 32px -8px rgba(24,24,27,.22),0 2px 6px rgba(24,24,27,.06);
12
+ .c{position:relative;background:var(--bg);border-radius:var(--r);padding:var(--pad);box-shadow:0 0 0 1px var(--edge),0 12px 32px -8px rgba(24,24,27,.22),0 2px 6px rgba(24,24,27,.06);
12
13
  animation:in .32s cubic-bezier(.2,.9,.25,1) both;transform-origin:bottom}
13
14
  .c.o{animation:out .18s ease-in both}
14
15
  .c.q{animation:none}
15
16
  @keyframes in{from{opacity:0;transform:translateY(10px) scale(.98)}}
16
17
  @keyframes out{to{opacity:0;transform:translateY(6px) scale(.98)}}
17
- .t{display:block;width:100%;font-family:inherit;font-weight:600;font-size:15px;line-height:1.35;padding:0;padding-inline-end:28px;color:var(--fg);overflow-wrap:anywhere;background:none;border:0;resize:none;min-height:0;max-height:none;box-shadow:none}
18
- .x{position:absolute;top:10px;inset-inline-end:10px;width:28px;height:28px;border:0;border-radius:8px;background:transparent;color:var(--x);cursor:pointer;display:grid;place-items:center;transition:background .15s,color .15s}
18
+ .t{display:block;width:100%;font-family:inherit;font-weight:600;font-size:calc(var(--fs) + 1px);line-height:1.35;padding:0;padding-inline-end:28px;color:var(--fg);overflow-wrap:anywhere;background:none;border:0;resize:none;min-height:0;max-height:none;box-shadow:none}
19
+ .x{position:absolute;top:10px;inset-inline-end:10px;width:28px;height:28px;border:0;border-radius:var(--ri);background:transparent;color:var(--x);cursor:pointer;display:grid;place-items:center;transition:background .15s,color .15s}
19
20
  .x:hover{background:var(--opt);color:var(--fg)}
20
21
  button,input{font:inherit;color:inherit;-webkit-tap-highlight-color:transparent}
21
22
  button:focus-visible,textarea:focus-visible{outline:2px solid var(--a);outline-offset:2px}
22
23
  .g{display:flex;flex-direction:column;gap:6px;margin-top:12px}
23
- .o1{position:relative;display:flex;align-items:center;gap:10px;min-height:40px;width:100%;padding:8px 12px;border:0;border-radius:10px;background:var(--opt);text-align:start;cursor:pointer;
24
+ .o1{position:relative;display:flex;align-items:center;gap:10px;min-height:40px;width:100%;padding:8px 12px;border:0;border-radius:var(--ri);background:var(--opt);text-align:start;cursor:pointer;
24
25
  transition:background .15s,box-shadow .15s,transform .12s}
25
26
  .o1:hover{background:var(--opt-h)}
26
27
  .o1:active{transform:scale(.985)}
@@ -33,20 +34,20 @@ transition:background .15s,box-shadow .15s,transform .12s}
33
34
  .th .o1{justify-content:center;flex:1}
34
35
  .th svg{width:20px;height:20px}
35
36
  .n{display:grid;grid-template-columns:repeat(11,1fr);gap:4px;margin-top:12px;direction:ltr}
36
- .n .o1{min-height:36px;padding:0;justify-content:center;font-variant-numeric:tabular-nums;font-size:13px}
37
+ .n .o1{min-height:36px;padding:0;justify-content:center;font-variant-numeric:tabular-nums;font-size:calc(var(--fs) - 1px)}
37
38
  .n .o1[aria-pressed=true]{background:var(--a);color:var(--on);box-shadow:none}
38
39
  .nl{display:flex;justify-content:space-between;margin-top:6px;font-size:12px;color:var(--mut)}
39
40
  .f{display:grid;grid-template-rows:0fr;transition:grid-template-rows .28s cubic-bezier(.2,.9,.25,1)}
40
41
  .f.on{grid-template-rows:1fr}
41
42
  .f>div{overflow:hidden;min-height:0}
42
43
  .fi{padding-top:12px}
43
- textarea{display:block;width:100%;min-height:76px;max-height:180px;resize:vertical;padding:10px 12px;border:0;border-radius:10px;background:var(--opt);font:inherit;color:var(--fg);
44
+ textarea{display:block;width:100%;min-height:76px;max-height:180px;resize:vertical;padding:10px 12px;border:0;border-radius:var(--ri);background:var(--opt);font:inherit;color:var(--fg);
44
45
  box-shadow:inset 0 0 0 1px transparent;transition:box-shadow .15s,background .15s}
45
46
  textarea:focus{background:var(--bg);box-shadow:inset 0 0 0 1.5px var(--a);outline:0}
46
47
  textarea::placeholder,input::placeholder{color:var(--x)}
47
48
  .r{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:10px}
48
49
  .e{font-size:12px;color:#d1453b}
49
- .b{margin-inline-start:auto;height:34px;padding:0 14px;border:0;border-radius:10px;background:var(--a);color:var(--on);font-weight:600;cursor:pointer;display:inline-flex;align-items:center;gap:8px;transition:opacity .15s,transform .12s}
50
+ .b{margin-inline-start:auto;height:34px;padding:0 14px;border:0;border-radius:var(--ri);background:var(--a);color:var(--on);font-weight:600;cursor:pointer;display:inline-flex;align-items:center;gap:8px;transition:opacity .15s,transform .12s}
50
51
  .b:active{transform:scale(.97)}
51
52
  .b[disabled]{opacity:.45;cursor:default}
52
53
  .b[aria-busy=true]{opacity:.7}
@@ -56,9 +57,9 @@ textarea::placeholder,input::placeholder{color:var(--x)}
56
57
  .k svg{flex:none;width:28px;height:28px;color:var(--a)}
57
58
  .k path{stroke-dasharray:24;stroke-dashoffset:24;animation:ck .4s .1s ease-out forwards}
58
59
  @keyframes ck{to{stroke-dashoffset:0}}
59
- .k strong{color:var(--fg);font-size:15px;font-weight:600}
60
+ .k strong{color:var(--fg);font-size:calc(var(--fs) + 1px);font-weight:600}
60
61
  .sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
61
62
  @media (max-width:480px){.w:not(.p){bottom:max(12px,env(safe-area-inset-bottom));left:12px;right:12px;width:auto;max-width:none}
62
63
  .o1{min-height:44px}.n .o1{min-height:40px}}
63
64
  @media (prefers-reduced-motion:reduce){*,.c,.k{animation-duration:.01ms!important;transition-duration:.01ms!important}}
64
- `,ne="http://www.w3.org/2000/svg",V={x:"M4 4l8 8M12 4l-8 8",check:"M3.5 8.5l3 3 6-7",plus:"M8 3.5v9M3.5 8h9",up:"M7 10v10H4V10h3zm0 0l4-7c1.3 0 2.2 1.1 2 2.4L12.4 9H18a2 2 0 0 1 2 2.3l-1.2 6.9A2 2 0 0 1 16.8 20H7",down:"M17 14V4h3v10h-3zm0 0l-4 7c-1.3 0-2.2-1.1-2-2.4l.6-3.6H6a2 2 0 0 1-2-2.3l1.2-6.9A2 2 0 0 1 7.2 4H17"},q={};function F(o,t=16,c=1.6){let r=document.createElementNS(ne,"svg");r.setAttribute("viewBox",`0 0 ${t} ${t}`),r.setAttribute("aria-hidden","true"),r.setAttribute("fill","none");let a=document.createElementNS(ne,"path");return a.setAttribute("d",o),a.setAttribute("stroke","currentColor"),a.setAttribute("stroke-width",String(c)),a.setAttribute("stroke-linecap","round"),a.setAttribute("stroke-linejoin","round"),r.append(a),r}function d(o,t,c){let r=document.createElement(o);if(t)r.className=t;if(c)r.textContent=c;return r}var U=null;function fe(o){try{if(U??=new CSSStyleSheet,!U.cssRules.length)U.replaceSync(te+(q.css??""));o.adoptedStyleSheets=[U]}catch{o.append(d("style",void 0,te+(q.css??"")))}}var re=(o)=>{let t=Number.parseInt(o.slice(1),16),[c,r,a]=[t>>16&255,t>>8&255,t&255].map((l)=>{let u=l/255;return u<=0.03928?u/12.92:((u+0.055)/1.055)**2.4});return 0.2126*c+0.7152*r+0.0722*a},ge=(o)=>re(o)>0.4?"#18181b":"#fff";function me(o,t){let c=/^#[0-9a-f]{6}$/i.test(t.accent)?t.accent:"#1f1f1f";if((t.theme==="dark"||t.theme==="auto"&&typeof matchMedia==="function"&&matchMedia("(prefers-color-scheme: dark)").matches)&&re(c)<0.05)c="#fafafa";if(o.style.setProperty("--a",c),o.style.setProperty("--on",ge(c)),t.theme==="dark")o.classList.add("dk");if(t.theme==="auto")o.classList.add("au")}function he(o,t,c,r){fe(o);let a=X[t.lang]??X.en,l=r.edit,u=d("div",`w${c.position==="start"?" s":""}${r.preview||r.inline||l?" p":""}${l?" ed":""}`);u.dir=t.lang==="ar"?"rtl":"ltr",u.lang=t.lang,me(u,c);let p=d("div",r.quiet||l?"c q":"c"),E=`datacub-fb-${Math.random().toString(36).slice(2,8)}`;p.setAttribute("role",r.preview||r.inline||l?"group":"dialog"),p.setAttribute("aria-labelledby",E);let x=d("p","sr");x.setAttribute("aria-live","polite");let b=d("button","x");if(b.type="button",b.setAttribute("aria-label",a.close),b.append(F(V.x)),l)b.tabIndex=-1,b.setAttribute("aria-hidden","true");let S;if(l)S=q.title(t,l,p);else S=d("p","t",t.type==="general"?a.general:t.title);S.id=E,p.append(b,S),u.append(p,x),o.append(u);let y=null,w=!1,T=!1,D=t.type==="general"?a.tell:t.followup,v=(e)=>!!t.followup&&(!t.followupOn||e!==null&&t.followupOn.includes(e)),k=t.type==="text"||t.type==="general",_=[],C=null,L=(e)=>{if(T)return;if(T=!0,C)visualViewport?.removeEventListener("resize",C);p.classList.add("o"),setTimeout(()=>u.remove(),200),r.done?.(e)},A=d("div",`f${k||l&&t.followup!=null?" on":""}`),O=d("div"),R=d("div","fi"),f=d("textarea");f.maxLength=1000,f.placeholder=t.type==="text"?a.type:D??a.type,f.setAttribute("aria-label",t.type==="text"?t.title:D??a.type);let M=d("div","r"),z=d("span","e");z.setAttribute("role","status");let m=d("button","b",a.send);if(m.type="button",M.append(z,m),l&&t.followup!=null&&t.type!=="text")R.append(q.followup(t,l)),f.placeholder=a.type;if(R.append(f,M),O.append(R),A.append(O),!k&&!D)A.hidden=!0;if(l)f.disabled=!0,m.disabled=!0,m.tabIndex=-1;let H=()=>{if(l)return;m.disabled=k?!f.value.trim():!y};f.addEventListener("input",H);let P=async()=>{if(w||m.disabled||l)return;w=!0,m.setAttribute("aria-busy","true"),m.textContent="",m.append(d("span","sp"),document.createTextNode(a.sending)),z.textContent="";try{await r.send(y,(v(y)||k)&&f.value.trim()?f.value.trim():null)}catch{w=!1,m.removeAttribute("aria-busy"),m.textContent=a.send,z.textContent=a.failed;return}let e=d("div","k");e.setAttribute("role","status"),e.append(F("M7 16.5l5.5 5.5L25 9.5",32,2.4),d("strong",void 0,a.thanks));let i=p.offsetHeight;if(p.replaceChildren(e),!matchMedia("(prefers-reduced-motion: reduce)").matches)p.animate?.([{height:`${i}px`},{height:`${p.offsetHeight}px`}],{duration:280,easing:"cubic-bezier(.2,.9,.25,1)"});if(!r.preview&&!r.inline)setTimeout(()=>L(!0),2400)};m.addEventListener("click",P),f.addEventListener("keydown",(e)=>{if(e.key==="Enter"&&(e.metaKey||e.ctrlKey))P()});let K=(e)=>{y=e;for(let s of _)s.setAttribute("aria-pressed",String(s.dataset.id===e));if(H(),!v(e))return void P();let i=!A.classList.contains("on");if(A.classList.add("on"),i&&!r.preview)setTimeout(()=>f.focus({preventScroll:!0}),120)},j=(e,i,s="o1",h)=>{let g=d("button",s);if(g.type="button",g.dataset.id=e,g.setAttribute("aria-pressed","false"),h)g.append(h),g.setAttribute("aria-label",i);else{let I=d("span","d");I.append(F(V.check,16,2.4)),g.append(I,d("span",void 0,i))}if(l)g.tabIndex=-1;else g.addEventListener("click",()=>!w&&K(e));return _.push(g),g};if(t.type==="choice"&&l)p.append(q.choices(t,l));else if(t.type==="choice"){let e=d("div","g");e.setAttribute("role","group"),e.setAttribute("aria-labelledby",E);for(let i of t.options??[])e.append(j(i.id,i.label));p.append(e)}else if(t.type==="thumbs"){let e=d("div","th");e.setAttribute("role","group"),e.setAttribute("aria-labelledby",E),e.append(j("up",a.yes,"o1",F(V.up,24)),j("down",a.no,"o1",F(V.down,24))),p.append(e)}else if(t.type==="nps"){let e=d("div","n");e.setAttribute("role","group"),e.setAttribute("aria-labelledby",E);for(let s=0;s<=10;s++)e.append(j(String(s),String(s),"o1",d("span",void 0,String(s))));let i=d("div","nl");i.append(d("span",void 0,a.low),d("span",void 0,a.high)),p.append(e,i)}p.append(A),H();let n=()=>{if(!y||w||k||l)return;w=!0,r.send(y,v(y)&&f.value.trim()?f.value.trim():null).catch(()=>{})};if(b.addEventListener("click",()=>{if(l)return;n(),L(!!y||w)}),addEventListener("pagehide",n),u.addEventListener("keydown",(e)=>{if(e.key==="Escape"&&!l)e.stopPropagation(),b.click()}),!r.preview&&!r.inline&&!l&&typeof visualViewport<"u"&&visualViewport){let e=visualViewport;C=()=>{let i=innerHeight-e.height-e.offsetTop;u.style.bottom=innerWidth<=480&&i>40?`${i+12}px`:""},e.addEventListener("resize",C)}if(!r.preview&&!l)x.textContent=t.type==="general"?a.general:t.title;if(r.focus)setTimeout(()=>(k?f:_[0])?.focus(),50);if(l?.focus)q.focus(l,p);return{close:()=>L(w)}}var ie=60000,oe=!1;function be(){let o=document.activeElement;return document.visibilityState!=="visible"||!!o?.closest?.("input,textarea,select,[contenteditable]:not([contenteditable=false])")||!!document.querySelector("dialog[open],[aria-modal=true]")}function se(o){if(oe||typeof window>"u"||!o?._fb)return;let t=o._fb,c=t()[8],r=c?c():[];if(!r)return;oe=!0;let a=[],l={accent:"#1f1f1f",position:"end"},u="",p=0,E=0,x=null,b=!1,S=!1,y=new Set,w=()=>{let[,n,e,i,s,h,g,I]=t();return n&&s?{key:e,base:i.replace(/batch$/,"feedback"),anon:s,user:h??null,sid:g||null,emit:I}:null},T=async(n,e)=>{let i=await fetch(n,{method:"POST",body:JSON.stringify(e),credentials:"omit",keepalive:!0});if(!i.ok)throw Error(String(i.status));return i.json()},D=()=>{let n=document.createElement("div");return n.setAttribute("data-datacub-feedback-widget",""),document.body.append(n),n};async function v(){let n=w();if(!n){k();return}let e=`${n.anon}|${n.user??""}`;if(e===u||Date.now()<E)return;u=e;try{let i=await T(n.base,{api_key:n.key,anon_id:n.anon,user_id:n.user});a=i.questions??[];let s=i.settings;l={accent:s.accent,position:s.position,theme:s.theme??"light"}}catch(i){u="",E=/^4/.test(i?.message)?Number.POSITIVE_INFINITY:Date.now()+Math.min(1000*2**++p,300000);return}p=0,f()}function k(){S=!0,x?.close(),S=!1;for(let n of y)clearTimeout(n);y.clear()}function _(){let n=w();if(!n||x)return;let e=document.activeElement,i=/^ar\b/i.test(document.documentElement.lang)?"ar":"en";C({lang:i,type:"general",title:""},null,n,e)}function C(n,e,i,s,h){let g=D();if(h)h.append(g);let I=g.attachShadow({mode:"open"}),W=crypto.randomUUID?.()??"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(N)=>(+N^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+N/4).toString(16)),G=e?{$question_id:e.id,$version:e.version}:{};x=he(I,n,l,{focus:!e,inline:!!h,send:async(N,le)=>{let de={api_key:i.key,id:W,question:e?.id??null,version:e?.version??null,anon_id:i.anon,user_id:i.user,session_id:i.sid,choice:N,text:le,path:location.pathname.split("/").map(Q).join("/")};for(let B=0;;B++)try{await T(`${i.base}/answer`,de);break}catch(Z){if(B>=2||/^4/.test(Z.message))throw Z;await new Promise((ce)=>setTimeout(ce,800*2**B))}i.emit("$feedback_answered",{...G,$response_id:W,$choice:N},{},!0)},done:(N)=>{if(x=null,g.remove(),s?.focus?.(),e&&!N&&!S)T(`${i.base}/seen`,{api_key:i.key,anon_id:i.anon,question:e.id,kind:"dismissed"}).catch(()=>{}),i.emit("$feedback_dismissed",G,{},!0)}})}async function L(n,e,i){let s=w();if(!s||x||b)return;if(!i&&n.q.delivery?.waitForIdle!==!1&&be()){if(Date.now()<e)A(()=>L(n,e,i),2000);return}try{if(!(await T(`${s.base}/seen`,{api_key:s.key,anon_id:s.anon,question:n.id,kind:"shown",user_id:s.user})).ok||x||b)return}catch{return}b=!0,a=a.filter((h)=>h.id!==n.id),s.emit("$feedback_shown",{$question_id:n.id,$version:n.version},{},!0),C(n.q,n,s,null,i)}function A(n,e){let i=setTimeout(()=>{y.delete(i),n()},e);y.add(i)}let O=(n)=>A(()=>L(n,Date.now()+ie),(n.q.trigger.delay??0)*1000);function R(n,e){return e.endsWith("*")?n.startsWith(e.slice(0,-1)):n===e||n===`${e}/`}function f(){let n=location.pathname;for(let e of a)if(e.q.trigger.kind==="page"&&R(n,e.q.trigger.path??""))O(e);for(let e of document.querySelectorAll("[data-datacub-ask]")){let i=a.find((s)=>s.id===e.getAttribute("data-datacub-ask")&&s.q.trigger.kind==="manual");if(i&&!e.querySelector("[data-datacub-feedback-widget]"))L(i,Date.now(),e)}}let M=(n,e)=>{let i=o[n];o[n]=(...s)=>{i(...s);try{e(...s)}catch{}}};M("track",(n)=>{for(let e of a)if(e.q.trigger.kind==="event"&&e.q.trigger.event===String(n).trim())O(e)}),M("identify",()=>setTimeout(v,0)),M("reset",()=>setTimeout(v,0));let z=o.consent.grant;o.consent.grant=(...n)=>{z(...n),setTimeout(v,0)};let m=Promise.resolve();o.ask=(n,e)=>void m.then(()=>{let i=a.find((h)=>h.id===n&&h.q.trigger.kind==="manual"),s=null;try{s=typeof e?.into==="string"?document.querySelector(e.into):e?.into??null}catch{}if(i)L(i,Date.now()+ie,s instanceof Element?s:null)}),o.feedback=_,document.addEventListener("click",(n)=>{if(n.target?.closest?.("[data-datacub-feedback]"))_()});let H=location.pathname,P=()=>setTimeout(()=>{if(location.pathname===H)return;H=location.pathname,b=!1,f()},150);for(let n of["pushState","replaceState"]){let e=history[n];history[n]=function(...i){e.apply(this,i),P()}}addEventListener("popstate",P),setInterval(()=>{if(w())v();else if(u)u="",k()},1000),m=v();let[K,j]=r;if(K==="feedback")_();else if(K==="ask")o.ask(...j)}var ae=(o=0)=>{let t=window.datacub;if(t?._fb)se(t);else if(o<100)setTimeout(()=>ae(o+1),100)};ae();})();
65
+ `,pe="http://www.w3.org/2000/svg",U={x:"M4 4l8 8M12 4l-8 8",check:"M3.5 8.5l3 3 6-7",plus:"M8 3.5v9M3.5 8h9",up:"M7 10v10H4V10h3zm0 0l4-7c1.3 0 2.2 1.1 2 2.4L12.4 9H18a2 2 0 0 1 2 2.3l-1.2 6.9A2 2 0 0 1 16.8 20H7",down:"M17 14V4h3v10h-3zm0 0l-4 7c-1.3 0-2.2-1.1-2-2.4l.6-3.6H6a2 2 0 0 1-2-2.3l1.2-6.9A2 2 0 0 1 7.2 4H17"},F={};function K(o,t=16,a=1.6){let r=document.createElementNS(pe,"svg");r.setAttribute("viewBox",`0 0 ${t} ${t}`),r.setAttribute("aria-hidden","true"),r.setAttribute("fill","none");let l=document.createElementNS(pe,"path");return l.setAttribute("d",o),l.setAttribute("stroke","currentColor"),l.setAttribute("stroke-width",String(a)),l.setAttribute("stroke-linecap","round"),l.setAttribute("stroke-linejoin","round"),r.append(l),r}function u(o,t,a){let r=document.createElement(o);if(t)r.className=t;if(a)r.textContent=a;return r}var B=null;function Ee(o){try{if(B??=new CSSStyleSheet,!B.cssRules.length)B.replaceSync(ue+(F.css??""));o.adoptedStyleSheets=[B]}catch{o.append(u("style",void 0,ue+(F.css??"")))}}var X=(o)=>[1,3,5].map((t)=>Number.parseInt(o.slice(t,t+2),16)),fe=(o)=>{let[t,a,r]=X(o).map((l)=>{let s=l/255;return s<=0.03928?s/12.92:((s+0.055)/1.055)**2.4});return 0.2126*t+0.7152*a+0.0722*r},G=(o,t)=>{let[a,r]=[fe(o),fe(t)].sort((l,s)=>s-l);return(a+0.05)/(r+0.05)},ee="#18181b",ge="#fafafa",me=(o,t="#ffffff")=>G(o,t)>=G(o,ee)?t:ee,q=(o,t,a)=>{let r=X(t);return`#${X(o).map((l,s)=>Math.round(l*a+r[s]*(1-a)).toString(16).padStart(2,"0")).join("")}`},Z=(o)=>typeof o==="string"&&/^#[0-9a-f]{6}$/i.test(o)?o:null,J=(o,t,a)=>typeof t==="string"&&Object.hasOwn(o,t)?t:a;function Le(o,t){let a=(v,_)=>o.style.setProperty(v,_),r=t.theme==="dark"||t.theme==="auto"&&typeof matchMedia==="function"&&matchMedia("(prefers-color-scheme: dark)").matches;if(t.theme==="dark")o.classList.add("dk");if(t.theme==="auto")o.classList.add("au");let l=Z(t.background),s=l??(r?"#1c1c1f":"#ffffff"),c=Z(t.text);if(c&&G(c,s)<4.5)c=null;if(l)c??=me(s,ge),a("--bg",s),a("--mut",q(c,s,0.62)),a("--opt",q(c,s,0.06)),a("--opt-h",q(c,s,0.1)),a("--edge",q(c,s,0.1)),a("--x",q(c,s,0.45)),a("--line",q(c,s,0.25));if(c)a("--fg",c);let p=Z(t.accent)??"#1f1f1f";if(G(p,s)<1.5)p=c??(r?ge:ee);a("--a",p),a("--on",me(p));let k=J({...le,site:0},t.font,"system");if(k==="site"){let v=typeof getComputedStyle==="function"&&getComputedStyle(document.body).fontFamily;if(v)a("--ff",v)}else a("--ff",le[k]);let[w,m]=de[J(de,t.radius,"large")];a("--r",`${w}px`),a("--ri",`${m}px`);let[S,b,h]=ce[J(ce,t.size,"medium")];a("--wd",`${S}px`),a("--fs",`${b}px`),a("--pad",`${h}px`)}function Te(o,t,a,r){Ee(o);let l=se[t.lang]??se.en,s=r.edit,c=u("div",`w${a.position==="start"?" s":""}${r.preview||r.inline||s?" p":""}${s?" ed":""}`);c.dir=t.lang==="ar"?"rtl":"ltr",c.lang=t.lang,Le(c,a);let p=u("div",r.quiet||s?"c q":"c"),k=`datacub-fb-${Math.random().toString(36).slice(2,8)}`;p.setAttribute("role",r.preview||r.inline||s?"group":"dialog"),p.setAttribute("aria-labelledby",k);let w=u("p","sr");w.setAttribute("aria-live","polite");let m=u("button","x");if(m.type="button",m.setAttribute("aria-label",l.close),m.append(K(U.x)),s)m.tabIndex=-1,m.setAttribute("aria-hidden","true");let S;if(s)S=F.title(t,s,p);else S=u("p","t",t.type==="general"?l.general:t.title);S.id=k,p.append(m,S),c.append(p,w),o.append(c);let b=null,h=!1,v=!1,_=t.type==="general"?l.tell:t.followup,E=(e)=>!!t.followup&&(!t.followupOn||e!==null&&t.followupOn.includes(e)),L=t.type==="text"||t.type==="general",C=[],N=null,T=(e)=>{if(v)return;if(v=!0,N)visualViewport?.removeEventListener("resize",N);p.classList.add("o"),setTimeout(()=>c.remove(),200),r.done?.(e)},A=u("div",`f${L||s&&t.followup!=null?" on":""}`),O=u("div"),D=u("div","fi"),f=u("textarea");f.maxLength=1000,f.placeholder=t.type==="text"?l.type:_??l.type,f.setAttribute("aria-label",t.type==="text"?t.title:_??l.type);let z=u("div","r"),P=u("span","e");P.setAttribute("role","status");let y=u("button","b",l.send);if(y.type="button",z.append(P,y),s&&t.followup!=null&&t.type!=="text")D.append(F.followup(t,s)),f.placeholder=l.type;if(D.append(f,z),O.append(D),A.append(O),!L&&!_)A.hidden=!0;if(s)f.disabled=!0,y.disabled=!0,y.tabIndex=-1;let j=()=>{if(s)return;y.disabled=L?!f.value.trim():!b};f.addEventListener("input",j);let I=async()=>{if(h||y.disabled||s)return;h=!0,y.setAttribute("aria-busy","true"),y.textContent="",y.append(u("span","sp"),document.createTextNode(l.sending)),P.textContent="";try{await r.send(b,(E(b)||L)&&f.value.trim()?f.value.trim():null)}catch{h=!1,y.removeAttribute("aria-busy"),y.textContent=l.send,P.textContent=l.failed;return}let e=u("div","k");e.setAttribute("role","status"),e.append(K("M7 16.5l5.5 5.5L25 9.5",32,2.4),u("strong",void 0,l.thanks));let i=p.offsetHeight;if(p.replaceChildren(e),!matchMedia("(prefers-reduced-motion: reduce)").matches)p.animate?.([{height:`${i}px`},{height:`${p.offsetHeight}px`}],{duration:280,easing:"cubic-bezier(.2,.9,.25,1)"});if(!r.preview&&!r.inline)setTimeout(()=>T(!0),2400)};y.addEventListener("click",I),f.addEventListener("keydown",(e)=>{if(e.key==="Enter"&&(e.metaKey||e.ctrlKey))I()});let V=(e)=>{b=e;for(let d of C)d.setAttribute("aria-pressed",String(d.dataset.id===e));if(j(),!E(e))return void I();let i=!A.classList.contains("on");if(A.classList.add("on"),i&&!r.preview)setTimeout(()=>f.focus({preventScroll:!0}),120)},H=(e,i,d="o1",x)=>{let g=u("button",d);if(g.type="button",g.dataset.id=e,g.setAttribute("aria-pressed","false"),x)g.append(x),g.setAttribute("aria-label",i);else{let R=u("span","d");R.append(K(U.check,16,2.4)),g.append(R,u("span",void 0,i))}if(s)g.tabIndex=-1;else g.addEventListener("click",()=>!h&&V(e));return C.push(g),g};if(t.type==="choice"&&s)p.append(F.choices(t,s));else if(t.type==="choice"){let e=u("div","g");e.setAttribute("role","group"),e.setAttribute("aria-labelledby",k);for(let i of t.options??[])e.append(H(i.id,i.label));p.append(e)}else if(t.type==="thumbs"){let e=u("div","th");e.setAttribute("role","group"),e.setAttribute("aria-labelledby",k),e.append(H("up",l.yes,"o1",K(U.up,24)),H("down",l.no,"o1",K(U.down,24))),p.append(e)}else if(t.type==="nps"){let e=u("div","n");e.setAttribute("role","group"),e.setAttribute("aria-labelledby",k);for(let d=0;d<=10;d++)e.append(H(String(d),String(d),"o1",u("span",void 0,String(d))));let i=u("div","nl");i.append(u("span",void 0,l.low),u("span",void 0,l.high)),p.append(e,i)}p.append(A),j();let n=()=>{if(!b||h||L||s)return;h=!0,r.send(b,E(b)&&f.value.trim()?f.value.trim():null).catch(()=>{})};if(m.addEventListener("click",()=>{if(s)return;n(),T(!!b||h)}),addEventListener("pagehide",n),c.addEventListener("keydown",(e)=>{if(e.key==="Escape"&&!s)e.stopPropagation(),m.click()}),!r.preview&&!r.inline&&!s&&typeof visualViewport<"u"&&visualViewport){let e=visualViewport;N=()=>{let i=innerHeight-e.height-e.offsetTop;c.style.bottom=innerWidth<=480&&i>40?`${i+12}px`:""},e.addEventListener("resize",N)}if(!r.preview&&!s)w.textContent=t.type==="general"?l.general:t.title;if(r.focus)setTimeout(()=>(L?f:C[0])?.focus(),50);if(s?.focus)F.focus(s,p);return{close:()=>T(h)}}var be=60000,he=!1;function Ae(){let o=document.activeElement;return document.visibilityState!=="visible"||!!o?.closest?.("input,textarea,select,[contenteditable]:not([contenteditable=false])")||!!document.querySelector("dialog[open],[aria-modal=true]")}function ye(o){if(he||typeof window>"u"||!o?._fb)return;let t=o._fb,a=t()[8],r=a?a():[];if(!r)return;he=!0;let l=[],s={accent:"#1f1f1f",position:"end"},c="",p=0,k=0,w=null,m=!1,S=!1,b=new Set,h=()=>{let[,n,e,i,d,x,g,R]=t();return n&&d?{key:e,base:i.replace(/batch$/,"feedback"),anon:d,user:x??null,sid:g||null,emit:R}:null},v=async(n,e)=>{let i=await fetch(n,{method:"POST",body:JSON.stringify(e),credentials:"omit",keepalive:!0});if(!i.ok)throw Error(String(i.status));return i.json()},_=()=>{let n=document.createElement("div");return n.setAttribute("data-datacub-feedback-widget",""),document.body.append(n),n};async function E(){let n=h();if(!n){L();return}let e=`${n.anon}|${n.user??""}`;if(e===c||Date.now()<k)return;c=e;try{let i=await v(n.base,{api_key:n.key,anon_id:n.anon,user_id:n.user});l=i.questions??[];let d=t()[9];s={theme:"light",...i.settings,...d&&typeof d==="object"?d:{}}}catch(i){c="",k=/^4/.test(i?.message)?Number.POSITIVE_INFINITY:Date.now()+Math.min(1000*2**++p,300000);return}p=0,f()}function L(){S=!0,w?.close(),S=!1;for(let n of b)clearTimeout(n);b.clear()}function C(){let n=h();if(!n||w)return;let e=document.activeElement,i=/^ar\b/i.test(document.documentElement.lang)?"ar":"en";N({lang:i,type:"general",title:""},null,n,e)}function N(n,e,i,d,x){let g=_();if(x)x.append(g);let R=g.attachShadow({mode:"open"}),te=crypto.randomUUID?.()??"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(M)=>(+M^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+M/4).toString(16)),ne=e?{$question_id:e.id,$version:e.version}:{};w=Te(R,n,s,{focus:!e,inline:!!x,send:async(M,we)=>{let ve={api_key:i.key,id:te,question:e?.id??null,version:e?.version??null,anon_id:i.anon,user_id:i.user,session_id:i.sid,choice:M,text:we,path:location.pathname.split("/").map(re).join("/")};for(let Y=0;;Y++)try{await v(`${i.base}/answer`,ve);break}catch(ie){if(Y>=2||/^4/.test(ie.message))throw ie;await new Promise((ke)=>setTimeout(ke,800*2**Y))}i.emit("$feedback_answered",{...ne,$response_id:te,$choice:M},{},!0)},done:(M)=>{if(w=null,g.remove(),d?.focus?.(),e&&!M&&!S)v(`${i.base}/seen`,{api_key:i.key,anon_id:i.anon,question:e.id,kind:"dismissed"}).catch(()=>{}),i.emit("$feedback_dismissed",ne,{},!0)}})}async function T(n,e,i){let d=h();if(!d||w||m)return;if(!i&&n.q.delivery?.waitForIdle!==!1&&Ae()){if(Date.now()<e)A(()=>T(n,e,i),2000);return}try{if(!(await v(`${d.base}/seen`,{api_key:d.key,anon_id:d.anon,question:n.id,kind:"shown",user_id:d.user})).ok||w||m)return}catch{return}m=!0,l=l.filter((x)=>x.id!==n.id),d.emit("$feedback_shown",{$question_id:n.id,$version:n.version},{},!0),N(n.q,n,d,null,i)}function A(n,e){let i=setTimeout(()=>{b.delete(i),n()},e);b.add(i)}let O=(n)=>A(()=>T(n,Date.now()+be),(n.q.trigger.delay??0)*1000);function D(n,e){return e.endsWith("*")?n.startsWith(e.slice(0,-1)):n===e||n===`${e}/`}function f(){let n=location.pathname;for(let e of l)if(e.q.trigger.kind==="page"&&D(n,e.q.trigger.path??""))O(e);for(let e of document.querySelectorAll("[data-datacub-ask]")){let i=l.find((d)=>d.id===e.getAttribute("data-datacub-ask")&&d.q.trigger.kind==="manual");if(i&&!e.querySelector("[data-datacub-feedback-widget]"))T(i,Date.now(),e)}}let z=(n,e)=>{let i=o[n];o[n]=(...d)=>{i(...d);try{e(...d)}catch{}}};z("track",(n)=>{for(let e of l)if(e.q.trigger.kind==="event"&&e.q.trigger.event===String(n).trim())O(e)}),z("identify",()=>setTimeout(E,0)),z("reset",()=>setTimeout(E,0));let P=o.consent.grant;o.consent.grant=(...n)=>{P(...n),setTimeout(E,0)};let y=Promise.resolve();o.ask=(n,e)=>void y.then(()=>{let i=l.find((x)=>x.id===n&&x.q.trigger.kind==="manual"),d=null;try{d=typeof e?.into==="string"?document.querySelector(e.into):e?.into??null}catch{}if(i)T(i,Date.now()+be,d instanceof Element?d:null)}),o.feedback=C,document.addEventListener("click",(n)=>{if(n.target?.closest?.("[data-datacub-feedback]"))C()});let j=location.pathname,I=()=>setTimeout(()=>{if(location.pathname===j)return;j=location.pathname,m=!1,f()},150);for(let n of["pushState","replaceState"]){let e=history[n];history[n]=function(...i){e.apply(this,i),I()}}addEventListener("popstate",I),setInterval(()=>{if(h())E();else if(c)c="",L()},1000),y=E();let[V,H]=r;if(V==="feedback")C();else if(V==="ask")o.ask(...H)}var xe=(o=0)=>{let t=window.datacub;if(t?._fb)ye(t);else if(o<100)setTimeout(()=>xe(o+1),100)};xe();})();
package/dist/feedback.mjs CHANGED
@@ -1,26 +1,27 @@
1
- var Y={n:0},J=(r)=>r.replace(/[\u0660-\u0669\u06f0-\u06f9\uff10-\uff19]/g,(t)=>String(t.charCodeAt(0)&15));var de=/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b|bearer\s+\S{16,}|AKIA[0-9A-Z]{16}|xox[abprs]-[\w-]+|PRIVATE KEY|[^\s@]{1,64}@[^\s@]{1,253}\.[^\s@]{2,}|eyJ[\w-]+\.[\w-]+\.[\w-]*|\d(?:[\s./()\u0640\u066b\u066c\u2010-\u2015\u200b-\u200f\u061c\u202a-\u202e\u2066-\u2069\ufeff-]*\d){8,}|[\w+/=]{32,}/gi;function ce(r){let t="",c=0;for(let o of J(r).matchAll(de)){if(/^[0-9a-f]{8}-/i.test(o[0])&&o[0].length===36)continue;t+=`${r.slice(c,o.index)}[redacted]`,c=o.index+o[0].length,Y.n++}return t+r.slice(c)}function Q(r){let t=r;try{t=decodeURIComponent(r)}catch{}t=J(t);let c=Y.n;if(ce(t)!==t)return Y.n=c+1,":redacted";if(/^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$/i.test(t))return":uuid";if(/^[0-9a-f]{16,}$/i.test(t))return t.length===24?":id":":hash";if(/^[\w-]{20,}$/.test(t)&&/\d/.test(t)&&/[a-z]/.test(t)&&/[A-Z]/.test(t))return":token";let o=t.replace(/\D/g,"").length;return o&&(o===t.length||o>3&&o*2>=t.length)?":id":r}var X={en:{close:"Close",send:"Send",sending:"Sending",thanks:"Thanks for sharing!",failed:"Could not send. Try again.",yes:"Yes",no:"No",low:"Not likely",high:"Very likely",type:"Type your answer",general:"What\u2019s on your mind?",tell:"Tell us anything"},ar:{close:"\u0625\u063a\u0644\u0627\u0642",send:"\u0625\u0631\u0633\u0627\u0644",sending:"\u062c\u0627\u0631\u064d \u0627\u0644\u0625\u0631\u0633\u0627\u0644",thanks:"\u0634\u0643\u0631\u064b\u0627 \u0639\u0644\u0649 \u0645\u0634\u0627\u0631\u0643\u062a\u0643!",failed:"\u062a\u0639\u0630\u0651\u0631 \u0627\u0644\u0625\u0631\u0633\u0627\u0644\u060c \u062d\u0627\u0648\u0644 \u0645\u0631\u0629 \u062b\u0627\u0646\u064a\u0629.",yes:"\u0646\u0639\u0645",no:"\u0644\u0627",low:"\u063a\u064a\u0631 \u0645\u062d\u062a\u0645\u0644",high:"\u0645\u062d\u062a\u0645\u0644 \u062c\u062f\u064b\u0627",type:"\u0627\u0643\u062a\u0628 \u0625\u062c\u0627\u0628\u062a\u0643",general:"\u0645\u0627 \u0627\u0644\u0630\u064a \u064a\u062f\u0648\u0631 \u0641\u064a \u0628\u0627\u0644\u0643\u061f",tell:"\u0627\u0643\u062a\u0628 \u0645\u0627 \u062a\u0631\u064a\u062f"}},ee="--bg:#1c1c1f;--fg:#fafafa;--mut:#a1a1aa;--opt:#2a2a2e;--opt-h:#333338;--edge:rgba(255,255,255,.08);--x:#8b8b93;--line:#55555c",te=`
1
+ var W={n:0},oe=(o)=>o.replace(/[\u0660-\u0669\u06f0-\u06f9\uff10-\uff19]/g,(t)=>String(t.charCodeAt(0)&15));var ve=/\b[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b|bearer\s+\S{16,}|AKIA[0-9A-Z]{16}|xox[abprs]-[\w-]+|PRIVATE KEY|[^\s@]{1,64}@[^\s@]{1,253}\.[^\s@]{2,}|eyJ[\w-]+\.[\w-]+\.[\w-]*|\d(?:[\s./()\u0640\u066b\u066c\u2010-\u2015\u200b-\u200f\u061c\u202a-\u202e\u2066-\u2069\ufeff-]*\d){8,}|[\w+/=]{32,}/gi;function ke(o){let t="",a=0;for(let r of oe(o).matchAll(ve)){if(/^[0-9a-f]{8}-/i.test(r[0])&&r[0].length===36)continue;t+=`${o.slice(a,r.index)}[redacted]`,a=r.index+r[0].length,W.n++}return t+o.slice(a)}function re(o){let t=o;try{t=decodeURIComponent(o)}catch{}t=oe(t);let a=W.n;if(ke(t)!==t)return W.n=a+1,":redacted";if(/^[0-9a-f]{8}(?:-[0-9a-f]{4}){3}-[0-9a-f]{12}$/i.test(t))return":uuid";if(/^[0-9a-f]{16,}$/i.test(t))return t.length===24?":id":":hash";if(/^[\w-]{20,}$/.test(t)&&/\d/.test(t)&&/[a-z]/.test(t)&&/[A-Z]/.test(t))return":token";let r=t.replace(/\D/g,"").length;return r&&(r===t.length||r>3&&r*2>=t.length)?":id":o}var se={en:{close:"Close",send:"Send",sending:"Sending",thanks:"Thanks for sharing!",failed:"Could not send. Try again.",yes:"Yes",no:"No",low:"Not likely",high:"Very likely",type:"Type your answer",general:"What\u2019s on your mind?",tell:"Tell us anything"},ar:{close:"\u0625\u063a\u0644\u0627\u0642",send:"\u0625\u0631\u0633\u0627\u0644",sending:"\u062c\u0627\u0631\u064d \u0627\u0644\u0625\u0631\u0633\u0627\u0644",thanks:"\u0634\u0643\u0631\u064b\u0627 \u0639\u0644\u0649 \u0645\u0634\u0627\u0631\u0643\u062a\u0643!",failed:"\u062a\u0639\u0630\u0651\u0631 \u0627\u0644\u0625\u0631\u0633\u0627\u0644\u060c \u062d\u0627\u0648\u0644 \u0645\u0631\u0629 \u062b\u0627\u0646\u064a\u0629.",yes:"\u0646\u0639\u0645",no:"\u0644\u0627",low:"\u063a\u064a\u0631 \u0645\u062d\u062a\u0645\u0644",high:"\u0645\u062d\u062a\u0645\u0644 \u062c\u062f\u064b\u0627",type:"\u0627\u0643\u062a\u0628 \u0625\u062c\u0627\u0628\u062a\u0643",general:"\u0645\u0627 \u0627\u0644\u0630\u064a \u064a\u062f\u0648\u0631 \u0641\u064a \u0628\u0627\u0644\u0643\u061f",tell:"\u0627\u0643\u062a\u0628 \u0645\u0627 \u062a\u0631\u064a\u062f"}},ae="--bg:#1c1c1f;--fg:#fafafa;--mut:#a1a1aa;--opt:#2a2a2e;--opt-h:#333338;--edge:rgba(255,255,255,.08);--x:#8b8b93;--line:#55555c",Q='system-ui,-apple-system,"Segoe UI","SF Arabic","Noto Sans Arabic",Tahoma,sans-serif',le={system:Q,serif:'ui-serif,Georgia,Cambria,"Times New Roman","Noto Naskh Arabic","Geeza Pro",serif',rounded:`ui-rounded,"SF Pro Rounded",Nunito,"Varela Round",${Q}`},de={none:[0,0],small:[6,4],medium:[12,8],large:[16,10]},ce={small:[320,13,12],medium:[360,14,16],large:[400,15,20]},ue=`
2
2
  :host{all:initial}
3
3
  *{box-sizing:border-box;margin:0}
4
4
  .w{--a:#1f1f1f;--on:#fff;--bg:#fff;--fg:#18181b;--mut:#71717a;--opt:#f4f4f5;--opt-h:#ebebee;--edge:rgba(24,24,27,.07);--x:#a1a1aa;--line:#d4d4d8;
5
- position:fixed;z-index:2147483000;bottom:16px;right:16px;width:360px;max-width:calc(100vw - 24px);
6
- font:14px/1.45 system-ui,-apple-system,"Segoe UI","SF Arabic","Noto Sans Arabic",Tahoma,sans-serif;color:var(--fg);-webkit-font-smoothing:antialiased;transition:bottom .2s}
7
- .w.dk{${ee}}
8
- @media (prefers-color-scheme:dark){.w.au{${ee}}}
5
+ --ff:${Q};--fs:14px;--r:16px;--ri:10px;--pad:16px;
6
+ position:fixed;z-index:2147483000;bottom:16px;right:16px;width:var(--wd,360px);max-width:calc(100vw - 24px);
7
+ font-family:var(--ff);font-size:var(--fs);line-height:1.45;color:var(--fg);-webkit-font-smoothing:antialiased;transition:bottom .2s}
8
+ .w.dk{${ae}}
9
+ @media (prefers-color-scheme:dark){.w.au{${ae}}}
9
10
  .w.s{right:auto;left:16px}
10
11
  .w.p{position:relative;inset:auto;bottom:auto;right:auto;left:auto;width:100%}
11
- .c{position:relative;background:var(--bg);border-radius:16px;padding:16px;box-shadow:0 0 0 1px var(--edge),0 12px 32px -8px rgba(24,24,27,.22),0 2px 6px rgba(24,24,27,.06);
12
+ .c{position:relative;background:var(--bg);border-radius:var(--r);padding:var(--pad);box-shadow:0 0 0 1px var(--edge),0 12px 32px -8px rgba(24,24,27,.22),0 2px 6px rgba(24,24,27,.06);
12
13
  animation:in .32s cubic-bezier(.2,.9,.25,1) both;transform-origin:bottom}
13
14
  .c.o{animation:out .18s ease-in both}
14
15
  .c.q{animation:none}
15
16
  @keyframes in{from{opacity:0;transform:translateY(10px) scale(.98)}}
16
17
  @keyframes out{to{opacity:0;transform:translateY(6px) scale(.98)}}
17
- .t{display:block;width:100%;font-family:inherit;font-weight:600;font-size:15px;line-height:1.35;padding:0;padding-inline-end:28px;color:var(--fg);overflow-wrap:anywhere;background:none;border:0;resize:none;min-height:0;max-height:none;box-shadow:none}
18
- .x{position:absolute;top:10px;inset-inline-end:10px;width:28px;height:28px;border:0;border-radius:8px;background:transparent;color:var(--x);cursor:pointer;display:grid;place-items:center;transition:background .15s,color .15s}
18
+ .t{display:block;width:100%;font-family:inherit;font-weight:600;font-size:calc(var(--fs) + 1px);line-height:1.35;padding:0;padding-inline-end:28px;color:var(--fg);overflow-wrap:anywhere;background:none;border:0;resize:none;min-height:0;max-height:none;box-shadow:none}
19
+ .x{position:absolute;top:10px;inset-inline-end:10px;width:28px;height:28px;border:0;border-radius:var(--ri);background:transparent;color:var(--x);cursor:pointer;display:grid;place-items:center;transition:background .15s,color .15s}
19
20
  .x:hover{background:var(--opt);color:var(--fg)}
20
21
  button,input{font:inherit;color:inherit;-webkit-tap-highlight-color:transparent}
21
22
  button:focus-visible,textarea:focus-visible{outline:2px solid var(--a);outline-offset:2px}
22
23
  .g{display:flex;flex-direction:column;gap:6px;margin-top:12px}
23
- .o1{position:relative;display:flex;align-items:center;gap:10px;min-height:40px;width:100%;padding:8px 12px;border:0;border-radius:10px;background:var(--opt);text-align:start;cursor:pointer;
24
+ .o1{position:relative;display:flex;align-items:center;gap:10px;min-height:40px;width:100%;padding:8px 12px;border:0;border-radius:var(--ri);background:var(--opt);text-align:start;cursor:pointer;
24
25
  transition:background .15s,box-shadow .15s,transform .12s}
25
26
  .o1:hover{background:var(--opt-h)}
26
27
  .o1:active{transform:scale(.985)}
@@ -33,20 +34,20 @@ transition:background .15s,box-shadow .15s,transform .12s}
33
34
  .th .o1{justify-content:center;flex:1}
34
35
  .th svg{width:20px;height:20px}
35
36
  .n{display:grid;grid-template-columns:repeat(11,1fr);gap:4px;margin-top:12px;direction:ltr}
36
- .n .o1{min-height:36px;padding:0;justify-content:center;font-variant-numeric:tabular-nums;font-size:13px}
37
+ .n .o1{min-height:36px;padding:0;justify-content:center;font-variant-numeric:tabular-nums;font-size:calc(var(--fs) - 1px)}
37
38
  .n .o1[aria-pressed=true]{background:var(--a);color:var(--on);box-shadow:none}
38
39
  .nl{display:flex;justify-content:space-between;margin-top:6px;font-size:12px;color:var(--mut)}
39
40
  .f{display:grid;grid-template-rows:0fr;transition:grid-template-rows .28s cubic-bezier(.2,.9,.25,1)}
40
41
  .f.on{grid-template-rows:1fr}
41
42
  .f>div{overflow:hidden;min-height:0}
42
43
  .fi{padding-top:12px}
43
- textarea{display:block;width:100%;min-height:76px;max-height:180px;resize:vertical;padding:10px 12px;border:0;border-radius:10px;background:var(--opt);font:inherit;color:var(--fg);
44
+ textarea{display:block;width:100%;min-height:76px;max-height:180px;resize:vertical;padding:10px 12px;border:0;border-radius:var(--ri);background:var(--opt);font:inherit;color:var(--fg);
44
45
  box-shadow:inset 0 0 0 1px transparent;transition:box-shadow .15s,background .15s}
45
46
  textarea:focus{background:var(--bg);box-shadow:inset 0 0 0 1.5px var(--a);outline:0}
46
47
  textarea::placeholder,input::placeholder{color:var(--x)}
47
48
  .r{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:10px}
48
49
  .e{font-size:12px;color:#d1453b}
49
- .b{margin-inline-start:auto;height:34px;padding:0 14px;border:0;border-radius:10px;background:var(--a);color:var(--on);font-weight:600;cursor:pointer;display:inline-flex;align-items:center;gap:8px;transition:opacity .15s,transform .12s}
50
+ .b{margin-inline-start:auto;height:34px;padding:0 14px;border:0;border-radius:var(--ri);background:var(--a);color:var(--on);font-weight:600;cursor:pointer;display:inline-flex;align-items:center;gap:8px;transition:opacity .15s,transform .12s}
50
51
  .b:active{transform:scale(.97)}
51
52
  .b[disabled]{opacity:.45;cursor:default}
52
53
  .b[aria-busy=true]{opacity:.7}
@@ -56,9 +57,9 @@ textarea::placeholder,input::placeholder{color:var(--x)}
56
57
  .k svg{flex:none;width:28px;height:28px;color:var(--a)}
57
58
  .k path{stroke-dasharray:24;stroke-dashoffset:24;animation:ck .4s .1s ease-out forwards}
58
59
  @keyframes ck{to{stroke-dashoffset:0}}
59
- .k strong{color:var(--fg);font-size:15px;font-weight:600}
60
+ .k strong{color:var(--fg);font-size:calc(var(--fs) + 1px);font-weight:600}
60
61
  .sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
61
62
  @media (max-width:480px){.w:not(.p){bottom:max(12px,env(safe-area-inset-bottom));left:12px;right:12px;width:auto;max-width:none}
62
63
  .o1{min-height:44px}.n .o1{min-height:40px}}
63
64
  @media (prefers-reduced-motion:reduce){*,.c,.k{animation-duration:.01ms!important;transition-duration:.01ms!important}}
64
- `,ne="http://www.w3.org/2000/svg",V={x:"M4 4l8 8M12 4l-8 8",check:"M3.5 8.5l3 3 6-7",plus:"M8 3.5v9M3.5 8h9",up:"M7 10v10H4V10h3zm0 0l4-7c1.3 0 2.2 1.1 2 2.4L12.4 9H18a2 2 0 0 1 2 2.3l-1.2 6.9A2 2 0 0 1 16.8 20H7",down:"M17 14V4h3v10h-3zm0 0l-4 7c-1.3 0-2.2-1.1-2-2.4l.6-3.6H6a2 2 0 0 1-2-2.3l1.2-6.9A2 2 0 0 1 7.2 4H17"},q={};function F(r,t=16,c=1.6){let o=document.createElementNS(ne,"svg");o.setAttribute("viewBox",`0 0 ${t} ${t}`),o.setAttribute("aria-hidden","true"),o.setAttribute("fill","none");let a=document.createElementNS(ne,"path");return a.setAttribute("d",r),a.setAttribute("stroke","currentColor"),a.setAttribute("stroke-width",String(c)),a.setAttribute("stroke-linecap","round"),a.setAttribute("stroke-linejoin","round"),o.append(a),o}function d(r,t,c){let o=document.createElement(r);if(t)o.className=t;if(c)o.textContent=c;return o}var U=null;function pe(r){try{if(U??=new CSSStyleSheet,!U.cssRules.length)U.replaceSync(te+(q.css??""));r.adoptedStyleSheets=[U]}catch{r.append(d("style",void 0,te+(q.css??"")))}}var re=(r)=>{let t=Number.parseInt(r.slice(1),16),[c,o,a]=[t>>16&255,t>>8&255,t&255].map((l)=>{let u=l/255;return u<=0.03928?u/12.92:((u+0.055)/1.055)**2.4});return 0.2126*c+0.7152*o+0.0722*a},ue=(r)=>re(r)>0.4?"#18181b":"#fff";function fe(r,t){let c=/^#[0-9a-f]{6}$/i.test(t.accent)?t.accent:"#1f1f1f";if((t.theme==="dark"||t.theme==="auto"&&typeof matchMedia==="function"&&matchMedia("(prefers-color-scheme: dark)").matches)&&re(c)<0.05)c="#fafafa";if(r.style.setProperty("--a",c),r.style.setProperty("--on",ue(c)),t.theme==="dark")r.classList.add("dk");if(t.theme==="auto")r.classList.add("au")}function ge(r,t,c,o){pe(r);let a=X[t.lang]??X.en,l=o.edit,u=d("div",`w${c.position==="start"?" s":""}${o.preview||o.inline||l?" p":""}${l?" ed":""}`);u.dir=t.lang==="ar"?"rtl":"ltr",u.lang=t.lang,fe(u,c);let p=d("div",o.quiet||l?"c q":"c"),E=`datacub-fb-${Math.random().toString(36).slice(2,8)}`;p.setAttribute("role",o.preview||o.inline||l?"group":"dialog"),p.setAttribute("aria-labelledby",E);let w=d("p","sr");w.setAttribute("aria-live","polite");let b=d("button","x");if(b.type="button",b.setAttribute("aria-label",a.close),b.append(F(V.x)),l)b.tabIndex=-1,b.setAttribute("aria-hidden","true");let S;if(l)S=q.title(t,l,p);else S=d("p","t",t.type==="general"?a.general:t.title);S.id=E,p.append(b,S),u.append(p,w),r.append(u);let y=null,x=!1,T=!1,D=t.type==="general"?a.tell:t.followup,v=(e)=>!!t.followup&&(!t.followupOn||e!==null&&t.followupOn.includes(e)),k=t.type==="text"||t.type==="general",_=[],C=null,L=(e)=>{if(T)return;if(T=!0,C)visualViewport?.removeEventListener("resize",C);p.classList.add("o"),setTimeout(()=>u.remove(),200),o.done?.(e)},A=d("div",`f${k||l&&t.followup!=null?" on":""}`),O=d("div"),R=d("div","fi"),f=d("textarea");f.maxLength=1000,f.placeholder=t.type==="text"?a.type:D??a.type,f.setAttribute("aria-label",t.type==="text"?t.title:D??a.type);let M=d("div","r"),z=d("span","e");z.setAttribute("role","status");let m=d("button","b",a.send);if(m.type="button",M.append(z,m),l&&t.followup!=null&&t.type!=="text")R.append(q.followup(t,l)),f.placeholder=a.type;if(R.append(f,M),O.append(R),A.append(O),!k&&!D)A.hidden=!0;if(l)f.disabled=!0,m.disabled=!0,m.tabIndex=-1;let H=()=>{if(l)return;m.disabled=k?!f.value.trim():!y};f.addEventListener("input",H);let P=async()=>{if(x||m.disabled||l)return;x=!0,m.setAttribute("aria-busy","true"),m.textContent="",m.append(d("span","sp"),document.createTextNode(a.sending)),z.textContent="";try{await o.send(y,(v(y)||k)&&f.value.trim()?f.value.trim():null)}catch{x=!1,m.removeAttribute("aria-busy"),m.textContent=a.send,z.textContent=a.failed;return}let e=d("div","k");e.setAttribute("role","status"),e.append(F("M7 16.5l5.5 5.5L25 9.5",32,2.4),d("strong",void 0,a.thanks));let i=p.offsetHeight;if(p.replaceChildren(e),!matchMedia("(prefers-reduced-motion: reduce)").matches)p.animate?.([{height:`${i}px`},{height:`${p.offsetHeight}px`}],{duration:280,easing:"cubic-bezier(.2,.9,.25,1)"});if(!o.preview&&!o.inline)setTimeout(()=>L(!0),2400)};m.addEventListener("click",P),f.addEventListener("keydown",(e)=>{if(e.key==="Enter"&&(e.metaKey||e.ctrlKey))P()});let K=(e)=>{y=e;for(let s of _)s.setAttribute("aria-pressed",String(s.dataset.id===e));if(H(),!v(e))return void P();let i=!A.classList.contains("on");if(A.classList.add("on"),i&&!o.preview)setTimeout(()=>f.focus({preventScroll:!0}),120)},j=(e,i,s="o1",h)=>{let g=d("button",s);if(g.type="button",g.dataset.id=e,g.setAttribute("aria-pressed","false"),h)g.append(h),g.setAttribute("aria-label",i);else{let I=d("span","d");I.append(F(V.check,16,2.4)),g.append(I,d("span",void 0,i))}if(l)g.tabIndex=-1;else g.addEventListener("click",()=>!x&&K(e));return _.push(g),g};if(t.type==="choice"&&l)p.append(q.choices(t,l));else if(t.type==="choice"){let e=d("div","g");e.setAttribute("role","group"),e.setAttribute("aria-labelledby",E);for(let i of t.options??[])e.append(j(i.id,i.label));p.append(e)}else if(t.type==="thumbs"){let e=d("div","th");e.setAttribute("role","group"),e.setAttribute("aria-labelledby",E),e.append(j("up",a.yes,"o1",F(V.up,24)),j("down",a.no,"o1",F(V.down,24))),p.append(e)}else if(t.type==="nps"){let e=d("div","n");e.setAttribute("role","group"),e.setAttribute("aria-labelledby",E);for(let s=0;s<=10;s++)e.append(j(String(s),String(s),"o1",d("span",void 0,String(s))));let i=d("div","nl");i.append(d("span",void 0,a.low),d("span",void 0,a.high)),p.append(e,i)}p.append(A),H();let n=()=>{if(!y||x||k||l)return;x=!0,o.send(y,v(y)&&f.value.trim()?f.value.trim():null).catch(()=>{})};if(b.addEventListener("click",()=>{if(l)return;n(),L(!!y||x)}),addEventListener("pagehide",n),u.addEventListener("keydown",(e)=>{if(e.key==="Escape"&&!l)e.stopPropagation(),b.click()}),!o.preview&&!o.inline&&!l&&typeof visualViewport<"u"&&visualViewport){let e=visualViewport;C=()=>{let i=innerHeight-e.height-e.offsetTop;u.style.bottom=innerWidth<=480&&i>40?`${i+12}px`:""},e.addEventListener("resize",C)}if(!o.preview&&!l)w.textContent=t.type==="general"?a.general:t.title;if(o.focus)setTimeout(()=>(k?f:_[0])?.focus(),50);if(l?.focus)q.focus(l,p);return{close:()=>L(x)}}var ie=60000,oe=!1;function me(){let r=document.activeElement;return document.visibilityState!=="visible"||!!r?.closest?.("input,textarea,select,[contenteditable]:not([contenteditable=false])")||!!document.querySelector("dialog[open],[aria-modal=true]")}function ye(r){if(oe||typeof window>"u"||!r?._fb)return;let t=r._fb,c=t()[8],o=c?c():[];if(!o)return;oe=!0;let a=[],l={accent:"#1f1f1f",position:"end"},u="",p=0,E=0,w=null,b=!1,S=!1,y=new Set,x=()=>{let[,n,e,i,s,h,g,I]=t();return n&&s?{key:e,base:i.replace(/batch$/,"feedback"),anon:s,user:h??null,sid:g||null,emit:I}:null},T=async(n,e)=>{let i=await fetch(n,{method:"POST",body:JSON.stringify(e),credentials:"omit",keepalive:!0});if(!i.ok)throw Error(String(i.status));return i.json()},D=()=>{let n=document.createElement("div");return n.setAttribute("data-datacub-feedback-widget",""),document.body.append(n),n};async function v(){let n=x();if(!n){k();return}let e=`${n.anon}|${n.user??""}`;if(e===u||Date.now()<E)return;u=e;try{let i=await T(n.base,{api_key:n.key,anon_id:n.anon,user_id:n.user});a=i.questions??[];let s=i.settings;l={accent:s.accent,position:s.position,theme:s.theme??"light"}}catch(i){u="",E=/^4/.test(i?.message)?Number.POSITIVE_INFINITY:Date.now()+Math.min(1000*2**++p,300000);return}p=0,f()}function k(){S=!0,w?.close(),S=!1;for(let n of y)clearTimeout(n);y.clear()}function _(){let n=x();if(!n||w)return;let e=document.activeElement,i=/^ar\b/i.test(document.documentElement.lang)?"ar":"en";C({lang:i,type:"general",title:""},null,n,e)}function C(n,e,i,s,h){let g=D();if(h)h.append(g);let I=g.attachShadow({mode:"open"}),W=crypto.randomUUID?.()??"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(N)=>(+N^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+N/4).toString(16)),G=e?{$question_id:e.id,$version:e.version}:{};w=ge(I,n,l,{focus:!e,inline:!!h,send:async(N,se)=>{let ae={api_key:i.key,id:W,question:e?.id??null,version:e?.version??null,anon_id:i.anon,user_id:i.user,session_id:i.sid,choice:N,text:se,path:location.pathname.split("/").map(Q).join("/")};for(let B=0;;B++)try{await T(`${i.base}/answer`,ae);break}catch(Z){if(B>=2||/^4/.test(Z.message))throw Z;await new Promise((le)=>setTimeout(le,800*2**B))}i.emit("$feedback_answered",{...G,$response_id:W,$choice:N},{},!0)},done:(N)=>{if(w=null,g.remove(),s?.focus?.(),e&&!N&&!S)T(`${i.base}/seen`,{api_key:i.key,anon_id:i.anon,question:e.id,kind:"dismissed"}).catch(()=>{}),i.emit("$feedback_dismissed",G,{},!0)}})}async function L(n,e,i){let s=x();if(!s||w||b)return;if(!i&&n.q.delivery?.waitForIdle!==!1&&me()){if(Date.now()<e)A(()=>L(n,e,i),2000);return}try{if(!(await T(`${s.base}/seen`,{api_key:s.key,anon_id:s.anon,question:n.id,kind:"shown",user_id:s.user})).ok||w||b)return}catch{return}b=!0,a=a.filter((h)=>h.id!==n.id),s.emit("$feedback_shown",{$question_id:n.id,$version:n.version},{},!0),C(n.q,n,s,null,i)}function A(n,e){let i=setTimeout(()=>{y.delete(i),n()},e);y.add(i)}let O=(n)=>A(()=>L(n,Date.now()+ie),(n.q.trigger.delay??0)*1000);function R(n,e){return e.endsWith("*")?n.startsWith(e.slice(0,-1)):n===e||n===`${e}/`}function f(){let n=location.pathname;for(let e of a)if(e.q.trigger.kind==="page"&&R(n,e.q.trigger.path??""))O(e);for(let e of document.querySelectorAll("[data-datacub-ask]")){let i=a.find((s)=>s.id===e.getAttribute("data-datacub-ask")&&s.q.trigger.kind==="manual");if(i&&!e.querySelector("[data-datacub-feedback-widget]"))L(i,Date.now(),e)}}let M=(n,e)=>{let i=r[n];r[n]=(...s)=>{i(...s);try{e(...s)}catch{}}};M("track",(n)=>{for(let e of a)if(e.q.trigger.kind==="event"&&e.q.trigger.event===String(n).trim())O(e)}),M("identify",()=>setTimeout(v,0)),M("reset",()=>setTimeout(v,0));let z=r.consent.grant;r.consent.grant=(...n)=>{z(...n),setTimeout(v,0)};let m=Promise.resolve();r.ask=(n,e)=>void m.then(()=>{let i=a.find((h)=>h.id===n&&h.q.trigger.kind==="manual"),s=null;try{s=typeof e?.into==="string"?document.querySelector(e.into):e?.into??null}catch{}if(i)L(i,Date.now()+ie,s instanceof Element?s:null)}),r.feedback=_,document.addEventListener("click",(n)=>{if(n.target?.closest?.("[data-datacub-feedback]"))_()});let H=location.pathname,P=()=>setTimeout(()=>{if(location.pathname===H)return;H=location.pathname,b=!1,f()},150);for(let n of["pushState","replaceState"]){let e=history[n];history[n]=function(...i){e.apply(this,i),P()}}addEventListener("popstate",P),setInterval(()=>{if(x())v();else if(u)u="",k()},1000),m=v();let[K,j]=o;if(K==="feedback")_();else if(K==="ask")r.ask(...j)}export{V as ICONS,d as el,F as icon,ge as mount,q as parts,ye as start};
65
+ `,pe="http://www.w3.org/2000/svg",U={x:"M4 4l8 8M12 4l-8 8",check:"M3.5 8.5l3 3 6-7",plus:"M8 3.5v9M3.5 8h9",up:"M7 10v10H4V10h3zm0 0l4-7c1.3 0 2.2 1.1 2 2.4L12.4 9H18a2 2 0 0 1 2 2.3l-1.2 6.9A2 2 0 0 1 16.8 20H7",down:"M17 14V4h3v10h-3zm0 0l-4 7c-1.3 0-2.2-1.1-2-2.4l.6-3.6H6a2 2 0 0 1-2-2.3l1.2-6.9A2 2 0 0 1 7.2 4H17"},F={};function K(o,t=16,a=1.6){let r=document.createElementNS(pe,"svg");r.setAttribute("viewBox",`0 0 ${t} ${t}`),r.setAttribute("aria-hidden","true"),r.setAttribute("fill","none");let l=document.createElementNS(pe,"path");return l.setAttribute("d",o),l.setAttribute("stroke","currentColor"),l.setAttribute("stroke-width",String(a)),l.setAttribute("stroke-linecap","round"),l.setAttribute("stroke-linejoin","round"),r.append(l),r}function u(o,t,a){let r=document.createElement(o);if(t)r.className=t;if(a)r.textContent=a;return r}var B=null;function Se(o){try{if(B??=new CSSStyleSheet,!B.cssRules.length)B.replaceSync(ue+(F.css??""));o.adoptedStyleSheets=[B]}catch{o.append(u("style",void 0,ue+(F.css??"")))}}var X=(o)=>[1,3,5].map((t)=>Number.parseInt(o.slice(t,t+2),16)),fe=(o)=>{let[t,a,r]=X(o).map((l)=>{let s=l/255;return s<=0.03928?s/12.92:((s+0.055)/1.055)**2.4});return 0.2126*t+0.7152*a+0.0722*r},G=(o,t)=>{let[a,r]=[fe(o),fe(t)].sort((l,s)=>s-l);return(a+0.05)/(r+0.05)},ee="#18181b",ge="#fafafa",me=(o,t="#ffffff")=>G(o,t)>=G(o,ee)?t:ee,q=(o,t,a)=>{let r=X(t);return`#${X(o).map((l,s)=>Math.round(l*a+r[s]*(1-a)).toString(16).padStart(2,"0")).join("")}`},Z=(o)=>typeof o==="string"&&/^#[0-9a-f]{6}$/i.test(o)?o:null,J=(o,t,a)=>typeof t==="string"&&Object.hasOwn(o,t)?t:a;function $e(o,t){let a=(v,_)=>o.style.setProperty(v,_),r=t.theme==="dark"||t.theme==="auto"&&typeof matchMedia==="function"&&matchMedia("(prefers-color-scheme: dark)").matches;if(t.theme==="dark")o.classList.add("dk");if(t.theme==="auto")o.classList.add("au");let l=Z(t.background),s=l??(r?"#1c1c1f":"#ffffff"),c=Z(t.text);if(c&&G(c,s)<4.5)c=null;if(l)c??=me(s,ge),a("--bg",s),a("--mut",q(c,s,0.62)),a("--opt",q(c,s,0.06)),a("--opt-h",q(c,s,0.1)),a("--edge",q(c,s,0.1)),a("--x",q(c,s,0.45)),a("--line",q(c,s,0.25));if(c)a("--fg",c);let p=Z(t.accent)??"#1f1f1f";if(G(p,s)<1.5)p=c??(r?ge:ee);a("--a",p),a("--on",me(p));let k=J({...le,site:0},t.font,"system");if(k==="site"){let v=typeof getComputedStyle==="function"&&getComputedStyle(document.body).fontFamily;if(v)a("--ff",v)}else a("--ff",le[k]);let[w,m]=de[J(de,t.radius,"large")];a("--r",`${w}px`),a("--ri",`${m}px`);let[S,b,h]=ce[J(ce,t.size,"medium")];a("--wd",`${S}px`),a("--fs",`${b}px`),a("--pad",`${h}px`)}function Ee(o,t,a,r){Se(o);let l=se[t.lang]??se.en,s=r.edit,c=u("div",`w${a.position==="start"?" s":""}${r.preview||r.inline||s?" p":""}${s?" ed":""}`);c.dir=t.lang==="ar"?"rtl":"ltr",c.lang=t.lang,$e(c,a);let p=u("div",r.quiet||s?"c q":"c"),k=`datacub-fb-${Math.random().toString(36).slice(2,8)}`;p.setAttribute("role",r.preview||r.inline||s?"group":"dialog"),p.setAttribute("aria-labelledby",k);let w=u("p","sr");w.setAttribute("aria-live","polite");let m=u("button","x");if(m.type="button",m.setAttribute("aria-label",l.close),m.append(K(U.x)),s)m.tabIndex=-1,m.setAttribute("aria-hidden","true");let S;if(s)S=F.title(t,s,p);else S=u("p","t",t.type==="general"?l.general:t.title);S.id=k,p.append(m,S),c.append(p,w),o.append(c);let b=null,h=!1,v=!1,_=t.type==="general"?l.tell:t.followup,E=(e)=>!!t.followup&&(!t.followupOn||e!==null&&t.followupOn.includes(e)),L=t.type==="text"||t.type==="general",C=[],N=null,A=(e)=>{if(v)return;if(v=!0,N)visualViewport?.removeEventListener("resize",N);p.classList.add("o"),setTimeout(()=>c.remove(),200),r.done?.(e)},T=u("div",`f${L||s&&t.followup!=null?" on":""}`),O=u("div"),D=u("div","fi"),f=u("textarea");f.maxLength=1000,f.placeholder=t.type==="text"?l.type:_??l.type,f.setAttribute("aria-label",t.type==="text"?t.title:_??l.type);let z=u("div","r"),j=u("span","e");j.setAttribute("role","status");let y=u("button","b",l.send);if(y.type="button",z.append(j,y),s&&t.followup!=null&&t.type!=="text")D.append(F.followup(t,s)),f.placeholder=l.type;if(D.append(f,z),O.append(D),T.append(O),!L&&!_)T.hidden=!0;if(s)f.disabled=!0,y.disabled=!0,y.tabIndex=-1;let I=()=>{if(s)return;y.disabled=L?!f.value.trim():!b};f.addEventListener("input",I);let P=async()=>{if(h||y.disabled||s)return;h=!0,y.setAttribute("aria-busy","true"),y.textContent="",y.append(u("span","sp"),document.createTextNode(l.sending)),j.textContent="";try{await r.send(b,(E(b)||L)&&f.value.trim()?f.value.trim():null)}catch{h=!1,y.removeAttribute("aria-busy"),y.textContent=l.send,j.textContent=l.failed;return}let e=u("div","k");e.setAttribute("role","status"),e.append(K("M7 16.5l5.5 5.5L25 9.5",32,2.4),u("strong",void 0,l.thanks));let i=p.offsetHeight;if(p.replaceChildren(e),!matchMedia("(prefers-reduced-motion: reduce)").matches)p.animate?.([{height:`${i}px`},{height:`${p.offsetHeight}px`}],{duration:280,easing:"cubic-bezier(.2,.9,.25,1)"});if(!r.preview&&!r.inline)setTimeout(()=>A(!0),2400)};y.addEventListener("click",P),f.addEventListener("keydown",(e)=>{if(e.key==="Enter"&&(e.metaKey||e.ctrlKey))P()});let V=(e)=>{b=e;for(let d of C)d.setAttribute("aria-pressed",String(d.dataset.id===e));if(I(),!E(e))return void P();let i=!T.classList.contains("on");if(T.classList.add("on"),i&&!r.preview)setTimeout(()=>f.focus({preventScroll:!0}),120)},H=(e,i,d="o1",x)=>{let g=u("button",d);if(g.type="button",g.dataset.id=e,g.setAttribute("aria-pressed","false"),x)g.append(x),g.setAttribute("aria-label",i);else{let R=u("span","d");R.append(K(U.check,16,2.4)),g.append(R,u("span",void 0,i))}if(s)g.tabIndex=-1;else g.addEventListener("click",()=>!h&&V(e));return C.push(g),g};if(t.type==="choice"&&s)p.append(F.choices(t,s));else if(t.type==="choice"){let e=u("div","g");e.setAttribute("role","group"),e.setAttribute("aria-labelledby",k);for(let i of t.options??[])e.append(H(i.id,i.label));p.append(e)}else if(t.type==="thumbs"){let e=u("div","th");e.setAttribute("role","group"),e.setAttribute("aria-labelledby",k),e.append(H("up",l.yes,"o1",K(U.up,24)),H("down",l.no,"o1",K(U.down,24))),p.append(e)}else if(t.type==="nps"){let e=u("div","n");e.setAttribute("role","group"),e.setAttribute("aria-labelledby",k);for(let d=0;d<=10;d++)e.append(H(String(d),String(d),"o1",u("span",void 0,String(d))));let i=u("div","nl");i.append(u("span",void 0,l.low),u("span",void 0,l.high)),p.append(e,i)}p.append(T),I();let n=()=>{if(!b||h||L||s)return;h=!0,r.send(b,E(b)&&f.value.trim()?f.value.trim():null).catch(()=>{})};if(m.addEventListener("click",()=>{if(s)return;n(),A(!!b||h)}),addEventListener("pagehide",n),c.addEventListener("keydown",(e)=>{if(e.key==="Escape"&&!s)e.stopPropagation(),m.click()}),!r.preview&&!r.inline&&!s&&typeof visualViewport<"u"&&visualViewport){let e=visualViewport;N=()=>{let i=innerHeight-e.height-e.offsetTop;c.style.bottom=innerWidth<=480&&i>40?`${i+12}px`:""},e.addEventListener("resize",N)}if(!r.preview&&!s)w.textContent=t.type==="general"?l.general:t.title;if(r.focus)setTimeout(()=>(L?f:C[0])?.focus(),50);if(s?.focus)F.focus(s,p);return{close:()=>A(h)}}var be=60000,he=!1;function Le(){let o=document.activeElement;return document.visibilityState!=="visible"||!!o?.closest?.("input,textarea,select,[contenteditable]:not([contenteditable=false])")||!!document.querySelector("dialog[open],[aria-modal=true]")}function _e(o){if(he||typeof window>"u"||!o?._fb)return;let t=o._fb,a=t()[8],r=a?a():[];if(!r)return;he=!0;let l=[],s={accent:"#1f1f1f",position:"end"},c="",p=0,k=0,w=null,m=!1,S=!1,b=new Set,h=()=>{let[,n,e,i,d,x,g,R]=t();return n&&d?{key:e,base:i.replace(/batch$/,"feedback"),anon:d,user:x??null,sid:g||null,emit:R}:null},v=async(n,e)=>{let i=await fetch(n,{method:"POST",body:JSON.stringify(e),credentials:"omit",keepalive:!0});if(!i.ok)throw Error(String(i.status));return i.json()},_=()=>{let n=document.createElement("div");return n.setAttribute("data-datacub-feedback-widget",""),document.body.append(n),n};async function E(){let n=h();if(!n){L();return}let e=`${n.anon}|${n.user??""}`;if(e===c||Date.now()<k)return;c=e;try{let i=await v(n.base,{api_key:n.key,anon_id:n.anon,user_id:n.user});l=i.questions??[];let d=t()[9];s={theme:"light",...i.settings,...d&&typeof d==="object"?d:{}}}catch(i){c="",k=/^4/.test(i?.message)?Number.POSITIVE_INFINITY:Date.now()+Math.min(1000*2**++p,300000);return}p=0,f()}function L(){S=!0,w?.close(),S=!1;for(let n of b)clearTimeout(n);b.clear()}function C(){let n=h();if(!n||w)return;let e=document.activeElement,i=/^ar\b/i.test(document.documentElement.lang)?"ar":"en";N({lang:i,type:"general",title:""},null,n,e)}function N(n,e,i,d,x){let g=_();if(x)x.append(g);let R=g.attachShadow({mode:"open"}),te=crypto.randomUUID?.()??"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(M)=>(+M^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+M/4).toString(16)),ne=e?{$question_id:e.id,$version:e.version}:{};w=Ee(R,n,s,{focus:!e,inline:!!x,send:async(M,ye)=>{let xe={api_key:i.key,id:te,question:e?.id??null,version:e?.version??null,anon_id:i.anon,user_id:i.user,session_id:i.sid,choice:M,text:ye,path:location.pathname.split("/").map(re).join("/")};for(let Y=0;;Y++)try{await v(`${i.base}/answer`,xe);break}catch(ie){if(Y>=2||/^4/.test(ie.message))throw ie;await new Promise((we)=>setTimeout(we,800*2**Y))}i.emit("$feedback_answered",{...ne,$response_id:te,$choice:M},{},!0)},done:(M)=>{if(w=null,g.remove(),d?.focus?.(),e&&!M&&!S)v(`${i.base}/seen`,{api_key:i.key,anon_id:i.anon,question:e.id,kind:"dismissed"}).catch(()=>{}),i.emit("$feedback_dismissed",ne,{},!0)}})}async function A(n,e,i){let d=h();if(!d||w||m)return;if(!i&&n.q.delivery?.waitForIdle!==!1&&Le()){if(Date.now()<e)T(()=>A(n,e,i),2000);return}try{if(!(await v(`${d.base}/seen`,{api_key:d.key,anon_id:d.anon,question:n.id,kind:"shown",user_id:d.user})).ok||w||m)return}catch{return}m=!0,l=l.filter((x)=>x.id!==n.id),d.emit("$feedback_shown",{$question_id:n.id,$version:n.version},{},!0),N(n.q,n,d,null,i)}function T(n,e){let i=setTimeout(()=>{b.delete(i),n()},e);b.add(i)}let O=(n)=>T(()=>A(n,Date.now()+be),(n.q.trigger.delay??0)*1000);function D(n,e){return e.endsWith("*")?n.startsWith(e.slice(0,-1)):n===e||n===`${e}/`}function f(){let n=location.pathname;for(let e of l)if(e.q.trigger.kind==="page"&&D(n,e.q.trigger.path??""))O(e);for(let e of document.querySelectorAll("[data-datacub-ask]")){let i=l.find((d)=>d.id===e.getAttribute("data-datacub-ask")&&d.q.trigger.kind==="manual");if(i&&!e.querySelector("[data-datacub-feedback-widget]"))A(i,Date.now(),e)}}let z=(n,e)=>{let i=o[n];o[n]=(...d)=>{i(...d);try{e(...d)}catch{}}};z("track",(n)=>{for(let e of l)if(e.q.trigger.kind==="event"&&e.q.trigger.event===String(n).trim())O(e)}),z("identify",()=>setTimeout(E,0)),z("reset",()=>setTimeout(E,0));let j=o.consent.grant;o.consent.grant=(...n)=>{j(...n),setTimeout(E,0)};let y=Promise.resolve();o.ask=(n,e)=>void y.then(()=>{let i=l.find((x)=>x.id===n&&x.q.trigger.kind==="manual"),d=null;try{d=typeof e?.into==="string"?document.querySelector(e.into):e?.into??null}catch{}if(i)A(i,Date.now()+be,d instanceof Element?d:null)}),o.feedback=C,document.addEventListener("click",(n)=>{if(n.target?.closest?.("[data-datacub-feedback]"))C()});let I=location.pathname,P=()=>setTimeout(()=>{if(location.pathname===I)return;I=location.pathname,m=!1,f()},150);for(let n of["pushState","replaceState"]){let e=history[n];history[n]=function(...i){e.apply(this,i),P()}}addEventListener("popstate",P),setInterval(()=>{if(h())E();else if(c)c="",L()},1000),y=E();let[V,H]=r;if(V==="feedback")C();else if(V==="ask")o.ask(...H)}export{U as ICONS,G as contrast,u as el,K as icon,Ee as mount,F as parts,_e as start};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datacub/web",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "datacub product analytics for websites. One line to install, private by default.",
5
5
  "keywords": [
6
6
  "analytics",
@@ -1,9 +1,30 @@
1
- // datacub web SDK 0.5.0, for the script tag. Save as datacub.d.ts in your project: `datacub` is then typed.
2
- export declare const VERSION = "0.5.0";
1
+ // datacub web SDK 0.6.0, for the script tag. Save as datacub.d.ts in your project: `datacub` is then typed.
2
+ export declare const VERSION = "0.6.0";
3
3
  export type Property = string | number | boolean | null | Date | Property[] | {
4
4
  [key: string]: Property;
5
5
  };
6
6
  export type Properties = Record<string, Property>;
7
+ /**
8
+ * How the card looks: set in datacub (Feedback, Appearance), or in code with
9
+ * `datacub.init(id, { feedback: { look } })`, which wins. Every value is checked; one that is not a
10
+ * known word or a #rrggbb colour is ignored, and colours that would be hard to read are replaced.
11
+ */
12
+ export interface FeedbackLook {
13
+ /** the brand colour: buttons, the chosen answer, focus rings. #rrggbb */
14
+ accent?: string;
15
+ /** the bottom corner: 'end' right, 'start' left */
16
+ position?: 'end' | 'start';
17
+ /** 'auto' follows the visitor's system */
18
+ theme?: 'light' | 'dark' | 'auto';
19
+ /** 'site' uses the page's own font */
20
+ font?: 'system' | 'site' | 'serif' | 'rounded';
21
+ radius?: 'none' | 'small' | 'medium' | 'large';
22
+ size?: 'small' | 'medium' | 'large';
23
+ /** card colour, in place of the theme's. #rrggbb */
24
+ background?: string | null;
25
+ /** text colour; ignored when it does not read well on the card. #rrggbb */
26
+ text?: string | null;
27
+ }
7
28
  export interface InitOptions {
8
29
  /** Ingestion origin or first-party proxy path. Default https://in.datacub.to */
9
30
  apiHost?: string;
@@ -29,9 +50,12 @@ export interface InitOptions {
29
50
  /**
30
51
  * The feedback widget, loaded from apiHost only when the project has a live question or the page
31
52
  * opens the "Send feedback" card, and only while tracking. Default true; false never loads it
32
- * (data-feedback="off" on the script tag).
53
+ * (data-feedback="off" on the script tag). `{ look }` styles the card in code, over the look set
54
+ * in datacub: `{ look: { theme: 'dark', font: 'site', radius: 'small' } }`.
33
55
  */
34
- feedback?: boolean;
56
+ feedback?: boolean | {
57
+ look?: FeedbackLook;
58
+ };
35
59
  /** Turn kinds of capture off on this site. The project's settings in datacub can turn them off too. */
36
60
  capture?: Capture;
37
61
  }
@@ -1,3 +1,5 @@
1
+ import type { FeedbackLook } from './index.ts';
2
+ export type { FeedbackLook };
1
3
  type Lang = 'ar' | 'en';
2
4
  export type CardType = 'choice' | 'thumbs' | 'text' | 'nps' | 'general';
3
5
  export interface Card {
@@ -11,10 +13,9 @@ export interface Card {
11
13
  followup?: string | null;
12
14
  followupOn?: string[] | null;
13
15
  }
14
- export interface Look {
16
+ export interface Look extends FeedbackLook {
15
17
  accent: string;
16
18
  position: 'end' | 'start';
17
- theme?: 'light' | 'dark' | 'auto';
18
19
  }
19
20
  /** An editor edits the card itself: the same card, with its words as fields. */
20
21
  export interface Edit {
@@ -62,6 +63,8 @@ export interface Parts {
62
63
  export declare const parts: Partial<Parts>;
63
64
  export declare function icon(d: string, box?: number, width?: number): SVGSVGElement;
64
65
  export declare function el<K extends keyof HTMLElementTagNameMap>(tag: K, cls?: string, text?: string): HTMLElementTagNameMap[K];
66
+ /** WCAG contrast ratio of two #rrggbb colours, 1 to 21. */
67
+ export declare const contrast: (a: string, b: string) => number;
65
68
  export interface Mounted {
66
69
  close(): void;
67
70
  }
@@ -81,4 +84,3 @@ export declare function mount(root: ShadowRoot, card: Card, look: Look, o: {
81
84
  }): Mounted;
82
85
  /** Start the widget for this SDK client; the script build calls it with window.datacub. */
83
86
  export declare function start(datacub: Client): void;
84
- export {};
package/types/index.d.ts CHANGED
@@ -1,8 +1,29 @@
1
- export declare const VERSION = "0.5.0";
1
+ export declare const VERSION = "0.6.0";
2
2
  export type Property = string | number | boolean | null | Date | Property[] | {
3
3
  [key: string]: Property;
4
4
  };
5
5
  export type Properties = Record<string, Property>;
6
+ /**
7
+ * How the card looks: set in datacub (Feedback, Appearance), or in code with
8
+ * `datacub.init(id, { feedback: { look } })`, which wins. Every value is checked; one that is not a
9
+ * known word or a #rrggbb colour is ignored, and colours that would be hard to read are replaced.
10
+ */
11
+ export interface FeedbackLook {
12
+ /** the brand colour: buttons, the chosen answer, focus rings. #rrggbb */
13
+ accent?: string;
14
+ /** the bottom corner: 'end' right, 'start' left */
15
+ position?: 'end' | 'start';
16
+ /** 'auto' follows the visitor's system */
17
+ theme?: 'light' | 'dark' | 'auto';
18
+ /** 'site' uses the page's own font */
19
+ font?: 'system' | 'site' | 'serif' | 'rounded';
20
+ radius?: 'none' | 'small' | 'medium' | 'large';
21
+ size?: 'small' | 'medium' | 'large';
22
+ /** card colour, in place of the theme's. #rrggbb */
23
+ background?: string | null;
24
+ /** text colour; ignored when it does not read well on the card. #rrggbb */
25
+ text?: string | null;
26
+ }
6
27
  export interface InitOptions {
7
28
  /** Ingestion origin or first-party proxy path. Default https://in.datacub.to */
8
29
  apiHost?: string;
@@ -28,9 +49,12 @@ export interface InitOptions {
28
49
  /**
29
50
  * The feedback widget, loaded from apiHost only when the project has a live question or the page
30
51
  * opens the "Send feedback" card, and only while tracking. Default true; false never loads it
31
- * (data-feedback="off" on the script tag).
52
+ * (data-feedback="off" on the script tag). `{ look }` styles the card in code, over the look set
53
+ * in datacub: `{ look: { theme: 'dark', font: 'site', radius: 'small' } }`.
32
54
  */
33
- feedback?: boolean;
55
+ feedback?: boolean | {
56
+ look?: FeedbackLook;
57
+ };
34
58
  /** Turn kinds of capture off on this site. The project's settings in datacub can turn them off too. */
35
59
  capture?: Capture;
36
60
  }