@datacub/web 0.6.0 → 0.7.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.7.0](https://github.com/datacub/sdk/compare/web-v0.6.0...web-v0.7.0) (2026-11-24)
4
+
5
+
6
+ ### Features
7
+
8
+ * **web:** much more feedback card look ([#10](https://github.com/datacub/sdk/issues/10)) ([d0f1d20](https://github.com/datacub/sdk/commit/d0f1d2007a0fd899e3dcafef47b083202a5fdabd))
9
+
3
10
  ## [0.6.0](https://github.com/datacub/sdk/compare/web-v0.5.0...web-v0.6.0) (2026-11-24)
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)),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(`
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,""),Te=/\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(Te)){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 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)||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 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(Kt(o,!e))_.n++;else{let a=D(s,e+1);if(a!==void 0)r[o]=a}}return r}function Yt(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 Ce=/^(?: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,Oe=(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),Wt=(t)=>t.split("/").map((e)=>e&&Yt(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=Wt(r.pathname);if(e&&/^#!?\//.test(r.hash))s+=`#${Wt(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,d]of r.searchParams){let g=a.toLowerCase();if(/^utm_(?:source|medium|campaign|term|content)$/.test(g)&&d)o.utm={...o.utm,[g.slice(4)]:H(d,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=Yt(d);o.q??={},o.q[v(a,64)]=Kt(a,!1)||Ce.test(a)||d.length>40||!(m[0]===":"||Oe(d))?"":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 At="0.7.0",Jt=1800000,Ie=86400000,Ne=34560000,Ct=/^[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,dt=!1,C={},se=!0,ae=!0,ce,ft=0,Ot=0,et=0,nt=0,rt=0,it={},It=new Set,Nt,j=0,pt=0,w,ot,gt,J,q={},le=!1,Mt="",O="",jt=!1,ue=null,K="pending",qt=!1,k=!1,V="",mt="",l="",E=null,L=null,P=null,b="",st=0,T=0,de,B=0,Y="",W=null,je=0,at=0,bt=0,ht=0,fe="",ct=!0,Q,Qt=0,u=[],Pt,pe=!1,te="",G=!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{}},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 X(){let t={};try{for(let e of c.cookie.split("; ")){let n=e.indexOf("="),r=e.slice(0,n);if(r==="datacub_optout"||V&&r.endsWith(V))t[r==="datacub_optout"?r:r.slice(0,-V.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+V}=${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&&Ct.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(de=n,B=+i,n&&Ct.test(n)&&B&&(n!==b||B>T))b=n,st=+r,T=B}function me(t,e){if(!b||t-T>Jt||t-st>Ie){if(b=U(x()),st=T=t,k)h("datacub_id",l)}else if(e&&t>T)T=t;if(k&&(de!==b||T-B>5000))h("datacub_ss",`${b}.${st}.${T}`,mt,Jt/1000)}function A(t){clearTimeout(Pt),pe=t===0,Pt=t==null?void 0:setTimeout(S(Gt),t)}function be(t){if((t||u.length>19||c.visibilityState==="hidden")&&!pe&&!lt)A(0);else if(!Pt)A(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,Y||null,je++,+(K==="granted"),+k,W?.url,fe,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,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 he(){if(!Y)return;Ht();let t=bt-Ot;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,Ot=bt,p("$pageleave",n)}function Bt(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,C.query!==!1);if(!r)return;te=n,he();let i={};if(W)i.$p=W.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(C.title!==!1&&c.title)i.$T=v(c.title,200);W=r,Y=U(x()),ct=!1,bt=ht=at=Ot=0,it={},It.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,Bt()}),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 Fe(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: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)&&C.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]"))Fe(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&&C.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(O.slice(0,-5));if(!l||C.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),d=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
- `)),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 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{}}})();
3
+ `)),1000):void 0,g=`${t}${o.name}${a}${d?.split(`
4
+ `)[0]}${r}`;if(It.has(g)||!zt("e",20))return;It.add(g),p("$error",{$ek:t,$en:typeof o.name==="string"?v(o.name,64):void 0,$em:a||void 0,$es:d||void 0,$eu:r?R(`${r}`)?.url:void 0,$et:i})}function ke(t,e,n,r,i){if(!l||C.network===!1)return;let s=new URL(e,location.href).href;if(s.startsWith(O.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 Be(){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,Mt,x(),At,e,ue,navigator.language,!!navigator.webdriver,Be()]).slice(0,-1)},${t.map((n)=>n[0])}]`;function Ft(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 Tt=!1;async function Gt(){if(A(),G)Tt=!0;if(G||yt||!u.length||!navigator.onLine)return;G=!0;let t=Ft(30720),e=y;y=0;let n=0;try{let r=await gt(O,{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"))Vt();if(s.feedback)$t()}}catch{n=-1}G=!1;try{if(n&&l){if(u=t.concat(u),y+=e,_e(),++lt<11)A(n>0?n:Math.random()*Math.min(1000*2**lt,300000))}else if(u.length)be(Tt);Tt=!1}catch{}}function ie(){if(w?.(),he(),A(),!G&&typeof Request==="function"&&"keepalive"in Request.prototype){let t=61440;while(u.length&&!yt&&t>2048){let e=Ft(t),n=y,r=Ut(e,n);t-=r.length,y=0;let i=()=>{u=e.concat(u),y+=n,A(1000)};try{gt(O,{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=Ft(t);if(navigator.sendBeacon(O,Ut(e,y)))y=0;else{if(u=e.concat(u),e.length<2)break;t/=2}}}if(u.length)A(1000)}function ve(t){K=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&&Ct.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,Bt(!0,!0),se&&!q.v)q.v=At,q.e=(n,r)=>n==="$form_fields"&&C.forms!==!1&&p(n,r),q.f=_t,window.__datacub=q,Ee(`sdk/insights-${At}.min.js`,"sha384-7xNcWolajp48vRTTBdYbGMF2VDBSxZ5qtqZeoosFSuy8Os18qOd9cEUDuSCp9I9z")}function Ee(t,e){try{let n=c.createElement("script");if(n.src=O.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||ft===1)return;if(t)ft=t;if(!c.querySelector('script[src*="/v1/feedback.js"]'))Ee("feedback.js")}var Ge=()=>{let t=ft;return ft=1,t!==1&&(t||[])};function Ve(t={}){if(!l&&(!qt||t.overrideGPC))ve(t)}function xe(){K="denied",A(),u=[];for(let t of oe)for(let e of["",...ge()])h(t,"",e);l=b=Y="",E=L=P=W=null,k=!1,h("datacub_optout","1")}function Se(t,e,n){if(Dt(),E&&E!==t)Vt();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 We(t,e){if(t&&typeof t==="object")e=t,t=e.id??e.userId??e.user_id;let n=[l,b,Y],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 d=a[1]||a[2]||a[3];if(d)s[`$${d.toLowerCase()}`]=e[o];delete s[o]}}if(l)Se(r,i,s);else if(K==="pending")P=[r,i,s]}function Vt(){if(P=null,!l)return;if(Gt(),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),dt||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(dt=!0,Mt=t,V=`_${t.replace(/^pk_[a-z]+_/,"").slice(0,8)}`,O=`${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,C=e.capture&&typeof e.capture==="object"&&e.capture||{},se=e.insights!==!1,ae=e.feedback!==!1,ce=e.feedback?.look,f(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)f(c,"click",Me),f(c,"submit",De),f(c,"input",He),f(c,"invalid",ze);for(let r of["pointerdown","keydown","scroll"])f(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)});f(c,"visibilitychange",()=>{if(Ht(),c.visibilityState==="hidden")ie()}),ut(),f(window,"resize",ut),f(window,"pagehide",ie),f(window,"pageshow",(r)=>r.persisted&&Bt(!0)),f(window,"online",Gt),f(window,"popstate",St("pop")),f(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{f(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)),f(window,"unhandledrejection",(o)=>Rt("rejection",o.reason)),window.fetch=function(...o){let a=gt.apply(this,o);try{let d=x(),g=o[0],m=`${g.url||g}`,M=o[1]?.method||g.method||"GET";return a.then((I)=>{try{re(M,I.url||m,I.type==="opaque"?200:I.status,d)}catch{}return I},(I)=>{throw re(M,m,0,d,I?.name||"Error"),I})}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,()=>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(dt)t(...e);else if(Lt.length<100)Lt.push([t,e])}),Ke={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(dt)r(...i)});if(c.prerendering)f(c,"prerenderingchange",n);else n()}),track:N(Pe),identify:N(We),reset:N(Vt),consent:{grant:N(Ve),revoke:N(xe)},ask:N((...t)=>$t(["ask",t])),feedback:N(()=>$t(["feedback",[]])),_fb:()=>[K,k,Mt,O,l,E,b,p,Ge,ce]},F=Ke;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=F.init;F.init=(o,a)=>{let d=a?.apiHost||r;return i(o,d?{...a,apiHost:d}:a)},vt.datacub=F;let s=n?.id||n?.key;if(s)F.init(s,{apiHost:n.apiHost,requireConsent:n.requireConsent!=null,feedback:n.feedback!=="off"});for(let o of t)try{let[a,...d]=o,g=String(a).split(".").reduce((m,M)=>m&&Object.hasOwn(m,M)?m[M]:void 0,F);if(typeof g==="function")g(...d)}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)),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(`
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,Vt=(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 K(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 M(t,e=1024){if(t=t.normalize("NFC"),t.length>256||t.trim().split(/\s+/).length>11)return _.n++,"[redacted]";return K(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 Wt(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 F(t,e=0){if(typeof t==="string")return M(t);if(typeof t==="number")return Number.isFinite(t)?Number.isInteger(t)&&K(`${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(Wt(o,!e))_.n++;else{let a=F(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(K(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 Te=/^(?: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)=>K(t.normalize("NFC")).slice(0,e),Gt=(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=Gt(r.pathname);if(e&&/^#!?\//.test(r.hash))s+=`#${Gt(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 b=a.toLowerCase();if(/^utm_(?:source|medium|campaign|term|content)$/.test(b)&&p)o.utm={...o.utm,[b.slice(4)]:M(p,200)};else if(/^(?:gclid|gbraid|wbraid|fbclid|ttclid|msclkid|sccid|twclid|li_fat_id)$/.test(b))o.click_id_type=b.replace(/^[gw]braid$/,"gclid");else if(n&&Object.keys(o.q||{}).length<30){let y=Xt(p);o.q??={},o.q[v(a,64)]=Wt(a,!1)||Te.test(a)||p.length>40||!(y[0]===":"||Ae(p))?"":y===":redacted"?"":y}}return o}function Kt(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(Vt(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=Vt(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.7.0",Yt=1800000,Ne=86400000,Ce=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"],l,ct=!1,N={},ie=!0,oe=!0,se,ut=0,Tt=0,Q=0,tt=0,et=0,nt={},At=new Set,Nt,O=0,dt=0,w,rt,ft,Y,P={},ae=!1,Lt="",C="",Ct=!1,le=null,W="pending",jt=!1,k=!1,B="",pt="",c="",E=null,L=null,q=null,g="",it=0,T=0,ce,z=0,X="",G=null,je=0,ot=0,gt=0,mt=0,ue="",st=!0,Z,Zt=0,u=[],It,de=!1,Jt="",H=!1,at=0,bt=!1,h=0,Ot=[],x=Date.now;function ht(t){if(ae)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 V(){let t={};try{for(let e of l.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 m(t,e,n=pt,r=e?Ce:0){try{l.cookie=`${t==="datacub_optout"?t:t+B}=${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=V(),e=t.datacub_id??null;if(e!==c)c=e&&Rt.test(e)?e:U(),m("datacub_id",c),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>T))g=n,it=+r,T=z}function pe(t,e){if(!g||t-T>Yt||t-it>Ne){if(g=U(x()),it=T=t,k)m("datacub_id",c)}else if(e&&t>T)T=t;if(k&&(ce!==g||T-z>5000))m("datacub_ss",`${g}.${it}.${T}`,pt,Yt/1000)}function A(t){clearTimeout(It),de=t===0,It=t==null?void 0:setTimeout(S(zt),t)}function ge(t){if((t||u.length>19||l.visibilityState==="hidden")&&!de&&!at)A(0);else if(!It)A(5000)}var Ie=new TextEncoder;function f(t,e,n,r){if(!c)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,c,E,L,g,X||null,je++,+(W==="granted"),+k,G?.url,ue,e,n]),o=Ie.encode(s).length;if(o>31000){h++;return}_.n=0,u.push([s,o]),we(),ge(r)}function Oe(t,e){if(!c||typeof t!=="string")return;let n=Kt(t);if(!n)return ht("bad name");f(n,e&&typeof e==="object"&&!Array.isArray(e)&&F(e)||{})}function Ft(t=x()){if(ot)gt+=t-ot;ot=l.visibilityState==="visible"?t:0}var lt=()=>{O=innerWidth,dt=innerHeight,ue=O<360?"xs":O<480?"s":O<768?"m":O<1280?"l":"xl",mt=Math.max(mt,scrollY+dt)};function Mt(t,e){return nt[t]=(nt[t]||0)+1,nt[t]<=e}function me(){if(!X)return;Ft();let t=gt-Tt;if(st&&t<1)return;let e=l.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,Tt=gt,f("$pageleave",n)}function Dt(t,e){if(!c)return;let n=location.pathname+(Ct?location.hash.split("?")[0]:"");if(!t&&n===Jt)return;let r=R(location.href,Ct,N.query!==!1);if(!r)return;Jt=n,me();let i={};if(G)i.$p=G.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(N.title!==!1&&l.title)i.$T=v(l.title,200);G=r,X=U(x()),st=!1,gt=mt=ot=Tt=0,nt={},At.clear(),Ft(),lt(),i.$vw=O,i.$vh=dt;let s=null;if(e)try{let o=new URL(l.referrer);s=o.hostname,i.$R=R(o.href)?.path}catch{}f("$pageview",i,[r.utm,r.click_id_type,s],e)}var vt=(t)=>()=>{if(!(Z&&t==="replace"&&Nt==="push"))Nt=t;w?.(),clearTimeout(Z),Z=setTimeout(S(()=>{Z=void 0,Dt()}),100)},be=(t)=>{let e=t.closest("[data-datacub-name]")?.getAttribute("data-datacub-name");return e?M(e,100):null},he=!0;function Pe(t){let e="";for(let n=0;t&&n<10&&t!==l.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=l.activeElement,r=new MutationObserver(()=>w?.()),i=setTimeout(S(()=>{w?.();let s=e.target.closest('a[href]:not([href^="javascript:"]):not([href^="#"])');if(l.activeElement===n&&!(s&&!e.defaultPrevented)&&!(rt&&!rt.defaultPrevented))f("$deadclick",t)}),1000);w=()=>{r.disconnect(),clearTimeout(i),w=void 0},r.observe(l,{subtree:!0,childList:!0,attributes:!0,characterData:!0})}function Ue(t){let e=t.target,n=t;if(!c||!(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:be(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/dt*100);if((r||i)&&N.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;f("$click",o)}if(he&&n.detail===3&&!(s.textContent?.trim()&&getSelection()?.isCollapsed===!1))f("$rageclick",{...o});if((r||i)&&!n.metaKey&&!n.ctrlKey&&!n.shiftKey&&!s.closest("[target=_blank],[download]"))Le(o,t)}var wt=(t)=>({$f:be(t),$a:R(new URL(t.getAttribute("action")||"",location.href).href)?.url,$i:t.querySelectorAll("input,select,textarea").length});function Fe(t){let e=t.target;if(rt=t,!c||e.localName!=="form"||e.closest($t))return;f("$form_submit",wt(e))}var ye=(t)=>{let e=t.target.form;return c&&e&&N.forms!==!1&&!e.closest($t)?e:null},Qt=new WeakSet;function Me(t){w?.();let e=ye(t);if(e&&!Qt.has(e))Qt.add(e),f("$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(Mt("i",10))f("$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(C.slice(0,-5));if(!c||N.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
- `)),1000):void 0,h=`${t}${o.name}${a}${p?.split(`
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};
3
+ `)),1000):void 0,b=`${t}${o.name}${a}${p?.split(`
4
+ `)[0]}${r}`;if(At.has(b)||!Mt("e",20))return;At.add(b),f("$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(!c||N.network===!1)return;let s=new URL(e,location.href).href;if(s.startsWith(C.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(Mt("r",30))f("$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)h+=u.splice(0,t).length}function ze(){if(!Y)try{let r=(s)=>+matchMedia(`(${s})`).matches,i=navigator;Y=[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{Y=Array(10)}let t=navigator.connection||{},e=P.h||[];return[...Y,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,le,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(A(),H)xt=!0;if(H||bt||!u.length||!navigator.onLine)return;H=!0;let t=qt(30720),e=h;h=0;let n=0;try{let r=await ft(C,{method:"POST",body:Pt(t,e),keepalive:!0,credentials:"omit",referrerPolicy:"no-referrer"}),i=r.status;if(i===401||i===403)bt=!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)h+=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&&c){if(u=t.concat(u),h+=e,we(),++at<11)A(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(),A(),!H&&typeof Request==="function"&&"keepalive"in Request.prototype){let t=61440;while(u.length&&!bt&&t>2048){let e=qt(t),n=h,r=Pt(e,n);t-=r.length,h=0;let i=()=>{u=e.concat(u),h+=n,A(1000)};try{ft(C,{method:"POST",body:r,keepalive:!0,credentials:"omit",referrerPolicy:"no-referrer"}).catch(i)}catch{i();break}}}else{let t=61440;while(u.length&&!bt&&navigator.sendBeacon){let e=qt(t);if(navigator.sendBeacon(C,Pt(e,h)))h=0;else{if(u=e.concat(u),e.length<2)break;t/=2}}}if(u.length)A(1000)}function ke(t){W=t?"granted":"not_required";for(let n of fe().reverse())if(m("datacub_tld","1",n,9),V().datacub_tld){m("datacub_tld","",n),pt=n;break}let e=V().datacub_id;if(c=e&&Rt.test(e)?e:U(),m("datacub_id",c),k=V().datacub_id===c,t){for(let n of["",pt])m("datacub_optout","",n);f("$consent",{$m:/^(?:banner|settings|api|cmp)$/.test(`${t.method}`)?t.method:"api",$P:typeof t.policyVersion==="string"?M(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"&&N.forms!==!1&&f(n,r),P.f=wt,window.__datacub=P,_e(`sdk/insights-${St}.min.js`,"sha384-7xNcWolajp48vRTTBdYbGMF2VDBSxZ5qtqZeoosFSuy8Os18qOd9cEUDuSCp9I9z")}function _e(t,e){try{let n=l.createElement("script");if(n.src=C.slice(0,-5)+t,n.async=!0,n.referrerPolicy="no-referrer",e)n.integrity=e,n.crossOrigin="anonymous";n.setAttribute("fetchpriority","low"),(l.head||l.documentElement).append(n)}catch{}}function yt(t){if(!oe||!c||ut===1)return;if(t)ut=t;if(!l.querySelector('script[src*="/v1/feedback.js"]'))_e("feedback.js")}var He=()=>{let t=ut;return ut=1,t!==1&&(t||[])};function Be(t={}){if(!c&&(!jt||t.overrideGPC))ke(t)}function ve(){W="denied",A(),u=[];for(let t of re)for(let e of["",...fe()])m(t,"",e);c=g=X="",E=L=q=G=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=c}for(let r in n)return f(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=[c,g,X],r=_t(t,n),i=e?.account==null?null:_t(e.account,n);if(!r||e?.account!=null&&!i)return ht("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 p=a[1]||a[2]||a[3];if(p)s[`$${p.toLowerCase()}`]=e[o];delete s[o]}}if(c)Ee(r,i,s);else if(W==="pending")q=[r,i,s]}function Ht(){if(q=null,!c)return;if(zt(),c=U(),E=L=null,g="",k){m("datacub_id",c);for(let t of re.slice(1))m(t,"")}}function Ve(t,e={}){if(ae=/^(?:localhost|127\.0\.0\.1|\[::1\])$|\.(?:localhost|test)$/.test(location.hostname),ct||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 ht("init: bad key");if(!n||n.username||n.password||!(n.protocol==="https:"||n.protocol==="http:"&&/^(?:localhost|127\.0\.0\.1)$/.test(n.hostname)))return ht("init: bad apiHost");if(ct=!0,Lt=t,B=`_${t.replace(/^pk_[a-z]+_/,"").slice(0,8)}`,C=`${n.origin}${n.pathname.replace(/\/+$/,"")}/v1/batch`,Ct=e.hashRouting===!0,le=typeof e.release==="string"&&!D(e.release)?e.release.slice(0,64):null,N=e.capture&&typeof e.capture==="object"&&e.capture||{},ie=e.insights!==!1,oe=e.feedback!==!1,se=e.feedback?.look,d(l,"click",(r)=>r.target?.closest?.("[data-datacub-feedback]")&&yt(["feedback",[]])),ft=fetch,jt=navigator.globalPrivacyControl===!0,jt||V().datacub_optout)ve();else if(!e.requireConsent)ke();if(he=e.rageClicks!==!1,e.autocapture!==!1)d(l,"click",Ue),d(l,"submit",Fe),d(l,"input",Me),d(l,"invalid",De);for(let r of["pointerdown","keydown","scroll"])d(l,r,(i)=>{let s=x();if(i.target===l)lt();if(r==="scroll")w?.();if(g&&l.visibilityState==="visible"&&s-Zt>5000)Zt=s,Ut(),pe(s,!0)});d(l,"visibilitychange",()=>{if(Ft(),l.visibilityState==="hidden")ne()}),lt(),d(window,"resize",lt),d(window,"pagehide",ne),d(window,"pageshow",(r)=>r.persisted&&Dt(!0)),d(window,"online",zt),d(window,"popstate",vt("pop")),d(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{d(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)),d(window,"unhandledrejection",(o)=>Et("rejection",o.reason)),window.fetch=function(...o){let a=ft.apply(this,o);try{let p=x(),b=o[0],y=`${b.url||b}`,Bt=o[1]?.method||b.method||"GET";return a.then((j)=>{try{ee(Bt,j.url||y,j.type==="opaque"?200:j.status,p)}catch{}return j},(j)=>{throw ee(Bt,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"])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 I=(t)=>S((...e)=>{if(typeof window>"u")return;if(ct)t(...e);else if(Ot.length<100)Ot.push([t,e])}),We={init:S((t,e)=>{if(typeof window>"u"||!globalThis.crypto?.getRandomValues)return;l=document;let n=S(()=>{Ve(t,e);for(let[r,i]of Ot.splice(0))if(ct)r(...i)});if(l.prerendering)d(l,"prerenderingchange",n);else n()}),track:I(Oe),identify:I(Ge),reset:I(Ht),consent:{grant:I(Be),revoke:I(ve)},ask:I((...t)=>yt(["ask",t])),feedback:I(()=>yt(["feedback",[]])),_fb:()=>[W,k,Lt,C,c,E,g,f,He,se]},Ze=We;export{St as VERSION,Ze as default};
package/dist/feedback.js CHANGED
@@ -1,55 +1,60 @@
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=`
1
+ (()=>{var it={n:0},at=(r)=>r.replace(/[\u0660-\u0669\u06f0-\u06f9\uff10-\uff19]/g,(t)=>String(t.charCodeAt(0)&15));var Mt=/\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 zt(r){let t="",e=0;for(let s of at(r).matchAll(Mt)){if(/^[0-9a-f]{8}-/i.test(s[0])&&s[0].length===36)continue;t+=`${r.slice(e,s.index)}[redacted]`,e=s.index+s[0].length,it.n++}return t+r.slice(e)}function lt(r){let t=r;try{t=decodeURIComponent(r)}catch{}t=at(t);let e=it.n;if(zt(t)!==t)return it.n=e+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 s=t.replace(/\D/g,"").length;return s&&(s===t.length||s>3&&s*2>=t.length)?":id":r}var ct={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"}},dt="--bg:#1c1c1f;--fg:#fafafa;--mut:#a1a1aa;--opt:#2a2a2e;--opt-h:#333338;--edge:#2e2e33;--x:#8b8b93;--line:#55555c",Y='system-ui,-apple-system,"Segoe UI","SF Arabic","Noto Sans Arabic",Tahoma,sans-serif',pt={system:Y,serif:'ui-serif,Georgia,Cambria,"Times New Roman","Noto Naskh Arabic","Geeza Pro",serif',rounded:`ui-rounded,"SF Pro Rounded",Nunito,"Varela Round",${Y}`},ut={none:[0,0],small:[6,4],medium:[12,8],large:[16,10]},ft={small:[320,13,12],medium:[360,14,16],large:[400,15,20]},gt=`
2
2
  :host{all:initial}
3
3
  *{box-sizing:border-box;margin:0}
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
- --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}}}
10
- .w.s{right:auto;left:16px}
4
+ .w{--a:#1f1f1f;--on:#fff;--bg:#fff;--fg:#18181b;--mut:#71717a;--opt:#f4f4f5;--opt-h:#ebebee;--edge:#e4e4e7;--x:#a1a1aa;--line:#d4d4d8;
5
+ --ff:${Y};--fs:14px;--r:12px;--ri:8px;--pad:16px;--gap:6px;--mt:12px;--sx:24px;
6
+ --tc:var(--fg);--xc:var(--x);--ot:inherit;--ob:transparent;--sel:var(--a);--son:var(--on);--btn:var(--a);--bt:var(--on);
7
+ position:fixed;z-index:var(--z,2147483000);bottom:var(--oy,16px);right:var(--ox,16px);width:var(--wd,360px);max-width:calc(100vw - 24px);
8
+ font-family:var(--ff);font-size:var(--fs);font-weight:var(--fw,400);line-height:1.45;color:var(--fg);-webkit-font-smoothing:antialiased;transition:bottom .2s}
9
+ .w.dk{${dt}}
10
+ @media (prefers-color-scheme:dark){.w.au{${dt}}}
11
+ .w.s{right:auto;left:var(--ox,16px);--sx:-24px}
11
12
  .w.p{position:relative;inset:auto;bottom:auto;right:auto;left:auto;width:100%}
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);
13
+ .c{position:relative;background:var(--bg);border-radius:var(--r);padding:var(--pad);box-shadow:0 0 0 var(--bw,1px) var(--edge),var(--sh,0 1px 3px rgba(24,24,27,.06));
13
14
  animation:in .32s cubic-bezier(.2,.9,.25,1) both;transform-origin:bottom}
15
+ .af .c{animation-name:fd}.al .c{animation-name:sl}.a0 .c{animation:none}
16
+ @keyframes fd{from{opacity:0}}
17
+ @keyframes sl{from{opacity:0;transform:translateX(var(--sx))}}
14
18
  .c.o{animation:out .18s ease-in both}
15
19
  .c.q{animation:none}
16
20
  @keyframes in{from{opacity:0;transform:translateY(10px) scale(.98)}}
17
21
  @keyframes out{to{opacity:0;transform:translateY(6px) scale(.98)}}
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}
22
+ .t{display:block;width:100%;font-family:inherit;font-weight:var(--tw,600);font-size:calc(var(--fs) + var(--ts,1px));line-height:1.35;padding:0;padding-inline-end:28px;color:var(--tc);overflow-wrap:anywhere;background:none;border:0;resize:none;min-height:0;max-height:none;box-shadow:none}
23
+ .x{position:absolute;top:10px;inset-inline-end:10px;width:28px;height:28px;border:0;border-radius:var(--ri);background:transparent;color:var(--xc);cursor:pointer;display:grid;place-items:center;transition:background .15s,color .15s}
20
24
  .x:hover{background:var(--opt);color:var(--fg)}
21
25
  button,input{font:inherit;color:inherit;-webkit-tap-highlight-color:transparent}
22
26
  button:focus-visible,textarea:focus-visible{outline:2px solid var(--a);outline-offset:2px}
23
- .g{display:flex;flex-direction:column;gap:6px;margin-top:12px}
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;
27
+ .g{display:flex;flex-direction:column;gap:var(--gap);margin-top:var(--mt)}
28
+ .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);color:var(--ot);box-shadow:inset 0 0 0 1px var(--ob);text-align:start;cursor:pointer;
25
29
  transition:background .15s,box-shadow .15s,transform .12s}
26
30
  .o1:hover{background:var(--opt-h)}
27
31
  .o1:active{transform:scale(.985)}
28
- .o1[aria-pressed=true]{background:var(--bg);box-shadow:inset 0 0 0 1.5px var(--a)}
32
+ .o1[aria-pressed=true]{background:var(--bg);box-shadow:inset 0 0 0 1.5px var(--sel)}
29
33
  .d{flex:none;width:16px;height:16px;border-radius:50%;box-shadow:inset 0 0 0 1.5px var(--line);display:grid;place-items:center;transition:box-shadow .15s,background .15s}
30
- .o1[aria-pressed=true] .d{background:var(--a);box-shadow:none}
31
- .d svg{width:10px;height:10px;color:var(--on);transform:scale(0);transition:transform .2s cubic-bezier(.3,1.6,.5,1)}
34
+ .o1[aria-pressed=true] .d{background:var(--sel);box-shadow:none}
35
+ .d svg{width:10px;height:10px;color:var(--son);transform:scale(0);transition:transform .2s cubic-bezier(.3,1.6,.5,1)}
32
36
  .o1[aria-pressed=true] .d svg{transform:scale(1)}
33
- .th{display:flex;gap:8px;margin-top:12px}
37
+ .th{display:flex;gap:8px;margin-top:var(--mt)}
34
38
  .th .o1{justify-content:center;flex:1}
35
- .th svg{width:20px;height:20px}
36
- .n{display:grid;grid-template-columns:repeat(11,1fr);gap:4px;margin-top:12px;direction:ltr}
39
+ .th svg{width:20px;height:20px}.em{font-size:20px;line-height:1}
40
+ .n{display:grid;grid-template-columns:repeat(11,1fr);gap:4px;margin-top:var(--mt);direction:ltr}
37
41
  .n .o1{min-height:36px;padding:0;justify-content:center;font-variant-numeric:tabular-nums;font-size:calc(var(--fs) - 1px)}
38
- .n .o1[aria-pressed=true]{background:var(--a);color:var(--on);box-shadow:none}
39
- .nl{display:flex;justify-content:space-between;margin-top:6px;font-size:12px;color:var(--mut)}
42
+ .n .o1[aria-pressed=true]{background:var(--sel);color:var(--son);box-shadow:none}
43
+ .tr .n .o1:nth-child(-n+7){--opt:var(--lo)}.tr .n .o1:nth-child(n+8){--opt:var(--mi)}.tr .n .o1:nth-child(n+10){--opt:var(--hi)}
44
+ .nl{display:flex;justify-content:space-between;direction:ltr;margin-top:6px;font-size:12px;color:var(--mut)}
40
45
  .f{display:grid;grid-template-rows:0fr;transition:grid-template-rows .28s cubic-bezier(.2,.9,.25,1)}
41
46
  .f.on{grid-template-rows:1fr}
42
47
  .f>div{overflow:hidden;min-height:0}
43
- .fi{padding-top:12px}
48
+ .fi{padding-top:var(--mt)}
44
49
  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);
45
50
  box-shadow:inset 0 0 0 1px transparent;transition:box-shadow .15s,background .15s}
46
51
  textarea:focus{background:var(--bg);box-shadow:inset 0 0 0 1.5px var(--a);outline:0}
47
52
  textarea::placeholder,input::placeholder{color:var(--x)}
48
53
  .r{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:10px}
49
54
  .e{font-size:12px;color:#d1453b}
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}
55
+ .b{margin-inline-start:auto;height:34px;padding:0 14px;border:0;border-radius:var(--ri);background:var(--btn);color:var(--bt);font-weight:600;cursor:pointer;display:inline-flex;align-items:center;gap:8px;transition:opacity .15s,transform .12s}
51
56
  .b:active{transform:scale(.97)}
52
- .b[disabled]{opacity:.45;cursor:default}
57
+ .b[disabled]{opacity:.6;cursor:default}
53
58
  .b[aria-busy=true]{opacity:.7}
54
59
  .sp{width:14px;height:14px;border-radius:50%;border:2px solid currentColor;border-inline-end-color:transparent;animation:sp .7s linear infinite}
55
60
  @keyframes sp{to{transform:rotate(1turn)}}
@@ -57,9 +62,10 @@ textarea::placeholder,input::placeholder{color:var(--x)}
57
62
  .k svg{flex:none;width:28px;height:28px;color:var(--a)}
58
63
  .k path{stroke-dasharray:24;stroke-dashoffset:24;animation:ck .4s .1s ease-out forwards}
59
64
  @keyframes ck{to{stroke-dashoffset:0}}
60
- .k strong{color:var(--fg);font-size:calc(var(--fs) + 1px);font-weight:600}
65
+ .k strong{color:var(--tc);font-size:calc(var(--fs) + 1px);font-weight:600}
66
+ .ce .t{text-align:center;padding-inline:28px}.ce .k{justify-content:center}
61
67
  .sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
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}
68
+ @media (max-width:480px){.w:not(.p){bottom:max(var(--oy,12px),env(safe-area-inset-bottom));left:12px;right:12px;width:auto;max-width:none}
63
69
  .o1{min-height:44px}.n .o1{min-height:40px}}
64
70
  @media (prefers-reduced-motion:reduce){*,.c,.k{animation-duration:.01ms!important;transition-duration:.01ms!important}}
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();})();
71
+ `,mt="http://www.w3.org/2000/svg",tt={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"},bt="M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18zM9 9.5v.5M15 9.5v.5",ht={thumbs:[tt.up,tt.down],faces:[`${bt}M8.5 14s1.3 2 3.5 2 3.5-2 3.5-2`,`${bt}M8.5 16.5s1.3-2 3.5-2 3.5 2 3.5 2`],emoji:[],words:[]},W={};function G(r,t=16,e=1.6){let s=document.createElementNS(mt,"svg");s.setAttribute("viewBox",`0 0 ${t} ${t}`),s.setAttribute("aria-hidden","true"),s.setAttribute("fill","none");let l=document.createElementNS(mt,"path");return l.setAttribute("d",r),l.setAttribute("stroke","currentColor"),l.setAttribute("stroke-width",String(e)),l.setAttribute("stroke-linecap","round"),l.setAttribute("stroke-linejoin","round"),s.append(l),s}function u(r,t,e){let s=document.createElement(r);if(t)s.className=t;if(e)s.textContent=e;return s}var Z=null;function It(r){try{if(Z??=new CSSStyleSheet,!Z.cssRules.length)Z.replaceSync(gt+(W.css??""));r.adoptedStyleSheets=[Z]}catch{r.append(u("style",void 0,gt+(W.css??"")))}}var ot=(r)=>[1,3,5].map((t)=>Number.parseInt(r.slice(t,t+2),16)),xt=(r)=>{let[t,e,s]=ot(r).map((l)=>{let y=l/255;return y<=0.03928?y/12.92:((y+0.055)/1.055)**2.4});return 0.2126*t+0.7152*e+0.0722*s},et=(r,t)=>{let[e,s]=[xt(r),xt(t)].sort((l,y)=>y-l);return(e+0.05)/(s+0.05)},rt="#18181b",J="#fafafa",U=(r,t="#ffffff")=>et(r,t)>=et(r,rt)?t:rt,I=(r,t,e)=>{let s=ot(t);return`#${ot(r).map((l,y)=>Math.round(l*e+s[y]*(1-e)).toString(16).padStart(2,"0")).join("")}`},yt=(r)=>typeof r==="string"&&/^#[0-9a-f]{6}$/i.test(r)?r:null,_=(r,t,e)=>typeof t==="string"&&Object.hasOwn(r,t)?t:e,jt=["accent","background","text","title","option","optionText","optionBorder","selected","button","buttonText","close","border"],wt={none:"none",soft:"",medium:"0 12px 32px -8px rgba(24,24,27,.22),0 2px 6px rgba(24,24,27,.06)",strong:"0 24px 48px -12px rgba(24,24,27,.38),0 4px 10px rgba(24,24,27,.1)"},vt={compact:[-4,4,8],regular:[0,6,12],roomy:[4,8,16]},kt={small:0,regular:1,large:4},X={regular:400,medium:500,semibold:600,bold:700},$t={top:2147483000,high:99999,normal:999},St={rise:"",fade:"af",slide:"al",none:"a0"},Q=(r,t,e)=>typeof r==="number"&&Number.isInteger(r)&&r>=t&&r<=e?r:null;function Ht(r,t){let e=(i,a)=>r.style.setProperty(i,String(a)),s=(i)=>i&&r.classList.add(i),l=t.theme==="dark"||t.theme==="auto"&&typeof matchMedia==="function"&&matchMedia("(prefers-color-scheme: dark)").matches;if(t.theme==="dark")s("dk");if(t.theme==="auto")s("au");let y=(t.theme==="auto"&&l?t.dark:t)??{},f=Object.fromEntries(jt.map((i)=>[i,yt(y[i])])),d=(i,a,n=4.5)=>i&&et(i,a)>=n?i:null,k=f.background,c=k??(l?"#1c1c1f":"#ffffff"),g=d(f.text,c);if(k)g??=U(c,J),e("--bg",c),e("--mut",I(g,c,0.62)),e("--opt",I(g,c,0.06)),e("--opt-h",I(g,c,0.1)),e("--edge",I(g,c,0.1)),e("--x",I(g,c,0.45)),e("--line",I(g,c,0.25));if(g)e("--fg",g);let M=g??(l?J:rt),m=f.accent??yt(t.accent)??"#1f1f1f";if(et(m,c)<1.5)m=M;e("--a",m),e("--on",U(m));let E=d(f.title,c,3);if(E)e("--tc",E);let v=d(f.close,c,3);if(v)e("--xc",v);let b=f.option;if(b)e("--opt",b),e("--opt-h",I(U(b,J),b,0.08));let T=d(f.optionText,b??c)??(b&&!d(M,b)?U(b,J):null);if(T)e("--ot",T);if(f.optionBorder)e("--ob",f.optionBorder);let j=d(f.selected,c,1.5)??m;e("--sel",j),e("--son",U(j));let A=f.button??m;if(e("--btn",A),e("--bt",d(f.buttonText,A)??U(A)),f.border)e("--edge",f.border);let L=Q(t.borderWidth,0,4);if(L!==null)e("--bw",`${L}px`);let N=wt[_(wt,t.shadow,"soft")];if(N)e("--sh",N);let C=_({...pt,site:0,custom:0},t.font,"site"),R=typeof t.fontName==="string"&&/^[\p{L}\p{N} -]{1,40}$/u.test(t.fontName);if(C==="site"){let i=typeof getComputedStyle==="function"&&getComputedStyle(document.body).fontFamily;if(i)e("--ff",i)}else if(C==="custom")e("--ff",R?`"${t.fontName}",${Y}`:Y);else e("--ff",pt[C]);let[H,D]=ut[_(ut,t.radius,"medium")];e("--r",`${H}px`),e("--ri",`${D}px`);let[P,h,K]=ft[_(ft,t.size,"medium")],[O,w,F]=vt[_(vt,t.density,"regular")];e("--wd",`${Q(t.width,280,480)??P}px`),e("--fs",`${h}px`),e("--pad",`${K+O}px`),e("--gap",`${w}px`),e("--mt",`${F}px`),e("--ts",`${kt[_(kt,t.titleSize,"regular")]}px`),e("--tw",X[_(X,t.titleWeight,"semibold")]),e("--fw",X[_(X,t.bodyWeight,"regular")]),e("--z",$t[_($t,t.layer,"top")]);let q=Q(t.offsetX,0,160),o=Q(t.offsetY,0,160);if(q!==null)e("--ox",`${q}px`);if(o!==null)e("--oy",`${o}px`);if(s(St[_(St,t.animation,"rise")]),t.align==="center")s("ce");if(t.scale==="traffic")s("tr"),e("--lo",I("#e5484d",c,0.18)),e("--mi",I("#f5a524",c,0.2)),e("--hi",I("#30a46c",c,0.18))}function Pt(r,t,e,s){It(r);let l=ct[t.lang]??ct.en,y=typeof e.sendLabel==="string"?e.sendLabel.trim():"",f=y&&y.length<=20&&!/[\p{Cc}\u202a-\u202e\u2066-\u2069]/u.test(y)?y:l.send,d=s.edit,k=u("div",`w${e.position==="start"?" s":""}${s.preview||s.inline||d?" p":""}${d?" ed":""}`);k.dir=t.lang==="ar"?"rtl":"ltr",k.lang=t.lang,Ht(k,e);let c=u("div",s.quiet||d?"c q":"c"),g=`datacub-fb-${Math.random().toString(36).slice(2,8)}`;c.setAttribute("role",s.preview||s.inline||d?"group":"dialog"),c.setAttribute("aria-labelledby",g);let M=u("p","sr");M.setAttribute("aria-live","polite");let m=u("button","x");if(m.type="button",m.setAttribute("aria-label",l.close),m.append(G(tt.x)),d)m.tabIndex=-1,m.setAttribute("aria-hidden","true");let E;if(d)E=W.title(t,d,c);else E=u("p","t",t.type==="general"?l.general:t.title);E.id=g,c.append(m,E),k.append(c,M),r.append(k);let v=null,b=!1,T=!1,j=t.type==="general"?l.tell:t.followup,A=(n)=>!!t.followup&&(!t.followupOn||n!==null&&t.followupOn.includes(n)),L=t.type==="text"||t.type==="general",N=[],C=null,R=(n)=>{if(T)return;if(T=!0,C)visualViewport?.removeEventListener("resize",C);c.classList.add("o"),setTimeout(()=>k.remove(),200),s.done?.(n)},H=u("div",`f${L||d&&t.followup!=null?" on":""}`),D=u("div"),P=u("div","fi"),h=u("textarea");h.maxLength=1000,h.placeholder=t.type==="text"?l.type:j??l.type,h.setAttribute("aria-label",t.type==="text"?t.title:j??l.type);let K=u("div","r"),O=u("span","e");O.setAttribute("role","status");let w=u("button","b",f);if(w.type="button",K.append(O,w),d&&t.followup!=null&&t.type!=="text")P.append(W.followup(t,d)),h.placeholder=l.type;if(P.append(h,K),D.append(P),H.append(D),!L&&!j)H.hidden=!0;if(d)h.disabled=!0,w.disabled=!0,w.tabIndex=-1;let F=()=>{if(d)return;w.disabled=L?!h.value.trim():!v};h.addEventListener("input",F);let q=async()=>{if(b||w.disabled||d)return;b=!0,w.setAttribute("aria-busy","true"),w.textContent="",w.append(u("span","sp"),document.createTextNode(l.sending)),O.textContent="";try{await s.send(v,(A(v)||L)&&h.value.trim()?h.value.trim():null)}catch{b=!1,w.removeAttribute("aria-busy"),w.textContent=f,O.textContent=l.failed;return}let n=u("div","k");n.setAttribute("role","status"),n.append(G("M7 16.5l5.5 5.5L25 9.5",32,2.4),u("strong",void 0,l.thanks));let p=c.offsetHeight;if(c.replaceChildren(n),!matchMedia("(prefers-reduced-motion: reduce)").matches)c.animate?.([{height:`${p}px`},{height:`${c.offsetHeight}px`}],{duration:280,easing:"cubic-bezier(.2,.9,.25,1)"});if(!s.preview&&!s.inline)setTimeout(()=>R(!0),2400)};w.addEventListener("click",q),h.addEventListener("keydown",(n)=>{if(n.key==="Enter"&&(n.metaKey||n.ctrlKey))q()});let o=(n)=>{v=n;for(let x of N)x.setAttribute("aria-pressed",String(x.dataset.id===n));if(F(),!A(n))return void q();let p=!H.classList.contains("on");if(H.classList.add("on"),p&&!s.preview)setTimeout(()=>h.focus({preventScroll:!0}),120)},i=(n,p,x="o1",z)=>{let S=u("button",x);if(S.type="button",S.dataset.id=n,S.setAttribute("aria-pressed","false"),z)S.append(z),S.setAttribute("aria-label",p);else{let B=u("span","d");B.append(G(tt.check,16,2.4)),S.append(B,u("span",void 0,p))}if(d)S.tabIndex=-1;else S.addEventListener("click",()=>!b&&o(n));return N.push(S),S};if(t.type==="choice"&&d)c.append(W.choices(t,d));else if(t.type==="choice"){let n=u("div","g");n.setAttribute("role","group"),n.setAttribute("aria-labelledby",g);for(let p of t.options??[])n.append(i(p.id,p.label));c.append(n)}else if(t.type==="thumbs"){let n=u("div","th");n.setAttribute("role","group"),n.setAttribute("aria-labelledby",g);let p=_(ht,e.icons,"thumbs"),x=(z)=>p==="words"?u("span",void 0,z?l.no:l.yes):p==="emoji"?u("span","em",z?"\uD83D\uDC4E":"\uD83D\uDC4D"):G(ht[p][z],24);n.append(i("up",l.yes,"o1",x(0)),i("down",l.no,"o1",x(1))),c.append(n)}else if(t.type==="nps"){let n=u("div","n");n.setAttribute("role","group"),n.setAttribute("aria-labelledby",g);for(let x=0;x<=10;x++)n.append(i(String(x),String(x),"o1",u("span",void 0,String(x))));let p=u("div","nl");p.append(u("span",void 0,l.low),u("span",void 0,l.high)),c.append(n,p)}c.append(H),F();let a=()=>{if(!v||b||L||d)return;b=!0,s.send(v,A(v)&&h.value.trim()?h.value.trim():null).catch(()=>{})};if(m.addEventListener("click",()=>{if(d)return;a(),R(!!v||b)}),addEventListener("pagehide",a),k.addEventListener("keydown",(n)=>{if(n.key==="Escape"&&!d)n.stopPropagation(),m.click()}),!s.preview&&!s.inline&&!d&&typeof visualViewport<"u"&&visualViewport){let n=visualViewport;C=()=>{let p=innerHeight-n.height-n.offsetTop;k.style.bottom=innerWidth<=480&&p>40?`${p+12}px`:""},n.addEventListener("resize",C)}if(!s.preview&&!d)M.textContent=t.type==="general"?l.general:t.title;if(s.focus)setTimeout(()=>(L?h:N[0])?.focus(),50);if(d?.focus)W.focus(d,c);return{close:()=>R(b)}}var Et=60000,Lt=!1;function Ot(){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 Tt(r){if(Lt||typeof window>"u"||!r?._fb)return;let t=r._fb,e=t()[8],s=e?e():[];if(!s)return;Lt=!0;let l=[],y={accent:"#1f1f1f",position:"end"},f="",d=0,k=0,c=null,g=!1,M=!1,m=new Set,E=()=>{let[,o,i,a,n,p,x,z]=t();return o&&n?{key:i,base:a.replace(/batch$/,"feedback"),anon:n,user:p??null,sid:x||null,emit:z}:null},v=async(o,i)=>{let a=await fetch(o,{method:"POST",body:JSON.stringify(i),credentials:"omit",keepalive:!0});if(!a.ok)throw Error(String(a.status));return a.json()},b=()=>{let o=document.createElement("div");return o.setAttribute("data-datacub-feedback-widget",""),document.body.append(o),o};async function T(){let o=E();if(!o){j();return}let i=`${o.anon}|${o.user??""}`;if(i===f||Date.now()<k)return;f=i;try{let a=await v(o.base,{api_key:o.key,anon_id:o.anon,user_id:o.user});l=a.questions??[];let n=t()[9];y={theme:"light",...a.settings,...n&&typeof n==="object"?n:{}}}catch(a){f="",k=/^4/.test(a?.message)?Number.POSITIVE_INFINITY:Date.now()+Math.min(1000*2**++d,300000);return}d=0,D()}function j(){M=!0,c?.close(),M=!1;for(let o of m)clearTimeout(o);m.clear()}function A(){let o=E();if(!o||c)return;let i=document.activeElement,a=/^ar\b/i.test(document.documentElement.lang)?"ar":"en";L({lang:a,type:"general",title:""},null,o,i)}function L(o,i,a,n,p){let x=b();if(p)p.append(x);let z=x.attachShadow({mode:"open"}),S=crypto.randomUUID?.()??"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(V)=>(+V^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+V/4).toString(16)),B=i?{$question_id:i.id,$version:i.version}:{};c=Pt(z,o,y,{focus:!i,inline:!!p,send:async(V,Nt)=>{let Ct={api_key:a.key,id:S,question:i?.id??null,version:i?.version??null,anon_id:a.anon,user_id:a.user,session_id:a.sid,choice:V,text:Nt,path:location.pathname.split("/").map(lt).join("/")};for(let nt=0;;nt++)try{await v(`${a.base}/answer`,Ct);break}catch(st){if(nt>=2||/^4/.test(st.message))throw st;await new Promise((_t)=>setTimeout(_t,800*2**nt))}a.emit("$feedback_answered",{...B,$response_id:S,$choice:V},{},!0)},done:(V)=>{if(c=null,x.remove(),n?.focus?.(),i&&!V&&!M)v(`${a.base}/seen`,{api_key:a.key,anon_id:a.anon,question:i.id,kind:"dismissed"}).catch(()=>{}),a.emit("$feedback_dismissed",B,{},!0)}})}async function N(o,i,a){let n=E();if(!n||c||g)return;if(!a&&o.q.delivery?.waitForIdle!==!1&&Ot()){if(Date.now()<i)C(()=>N(o,i,a),2000);return}try{if(!(await v(`${n.base}/seen`,{api_key:n.key,anon_id:n.anon,question:o.id,kind:"shown",user_id:n.user})).ok||c||g)return}catch{return}g=!0,l=l.filter((p)=>p.id!==o.id),n.emit("$feedback_shown",{$question_id:o.id,$version:o.version},{},!0),L(o.q,o,n,null,a)}function C(o,i){let a=setTimeout(()=>{m.delete(a),o()},i);m.add(a)}let R=(o)=>C(()=>N(o,Date.now()+Et),(o.q.trigger.delay??0)*1000);function H(o,i){return i.endsWith("*")?o.startsWith(i.slice(0,-1)):o===i||o===`${i}/`}function D(){let o=location.pathname;for(let i of l)if(i.q.trigger.kind==="page"&&H(o,i.q.trigger.path??""))R(i);for(let i of document.querySelectorAll("[data-datacub-ask]")){let a=l.find((n)=>n.id===i.getAttribute("data-datacub-ask")&&n.q.trigger.kind==="manual");if(a&&!i.querySelector("[data-datacub-feedback-widget]"))N(a,Date.now(),i)}}let P=(o,i)=>{let a=r[o];r[o]=(...n)=>{a(...n);try{i(...n)}catch{}}};P("track",(o)=>{for(let i of l)if(i.q.trigger.kind==="event"&&i.q.trigger.event===String(o).trim())R(i)}),P("identify",()=>setTimeout(T,0)),P("reset",()=>setTimeout(T,0));let h=r.consent.grant;r.consent.grant=(...o)=>{h(...o),setTimeout(T,0)};let K=Promise.resolve();r.ask=(o,i)=>void K.then(()=>{let a=l.find((p)=>p.id===o&&p.q.trigger.kind==="manual"),n=null;try{n=typeof i?.into==="string"?document.querySelector(i.into):i?.into??null}catch{}if(a)N(a,Date.now()+Et,n instanceof Element?n:null)}),r.feedback=A,document.addEventListener("click",(o)=>{if(o.target?.closest?.("[data-datacub-feedback]"))A()});let O=location.pathname,w=()=>setTimeout(()=>{if(location.pathname===O)return;O=location.pathname,g=!1,D()},150);for(let o of["pushState","replaceState"]){let i=history[o];history[o]=function(...a){i.apply(this,a),w()}}addEventListener("popstate",w),setInterval(()=>{if(E())T();else if(f)f="",j()},1000),K=T();let[F,q]=s;if(F==="feedback")A();else if(F==="ask")r.ask(...q)}var At=(r=0)=>{let t=window.datacub;if(t?._fb)Tt(t);else if(r<100)setTimeout(()=>At(r+1),100)};At();})();
package/dist/feedback.mjs CHANGED
@@ -1,55 +1,60 @@
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=`
1
+ var it={n:0},at=(r)=>r.replace(/[\u0660-\u0669\u06f0-\u06f9\uff10-\uff19]/g,(t)=>String(t.charCodeAt(0)&15));var Ct=/\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 _t(r){let t="",e=0;for(let s of at(r).matchAll(Ct)){if(/^[0-9a-f]{8}-/i.test(s[0])&&s[0].length===36)continue;t+=`${r.slice(e,s.index)}[redacted]`,e=s.index+s[0].length,it.n++}return t+r.slice(e)}function lt(r){let t=r;try{t=decodeURIComponent(r)}catch{}t=at(t);let e=it.n;if(_t(t)!==t)return it.n=e+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 s=t.replace(/\D/g,"").length;return s&&(s===t.length||s>3&&s*2>=t.length)?":id":r}var ct={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"}},dt="--bg:#1c1c1f;--fg:#fafafa;--mut:#a1a1aa;--opt:#2a2a2e;--opt-h:#333338;--edge:#2e2e33;--x:#8b8b93;--line:#55555c",Y='system-ui,-apple-system,"Segoe UI","SF Arabic","Noto Sans Arabic",Tahoma,sans-serif',pt={system:Y,serif:'ui-serif,Georgia,Cambria,"Times New Roman","Noto Naskh Arabic","Geeza Pro",serif',rounded:`ui-rounded,"SF Pro Rounded",Nunito,"Varela Round",${Y}`},ut={none:[0,0],small:[6,4],medium:[12,8],large:[16,10]},ft={small:[320,13,12],medium:[360,14,16],large:[400,15,20]},gt=`
2
2
  :host{all:initial}
3
3
  *{box-sizing:border-box;margin:0}
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
- --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}}}
10
- .w.s{right:auto;left:16px}
4
+ .w{--a:#1f1f1f;--on:#fff;--bg:#fff;--fg:#18181b;--mut:#71717a;--opt:#f4f4f5;--opt-h:#ebebee;--edge:#e4e4e7;--x:#a1a1aa;--line:#d4d4d8;
5
+ --ff:${Y};--fs:14px;--r:12px;--ri:8px;--pad:16px;--gap:6px;--mt:12px;--sx:24px;
6
+ --tc:var(--fg);--xc:var(--x);--ot:inherit;--ob:transparent;--sel:var(--a);--son:var(--on);--btn:var(--a);--bt:var(--on);
7
+ position:fixed;z-index:var(--z,2147483000);bottom:var(--oy,16px);right:var(--ox,16px);width:var(--wd,360px);max-width:calc(100vw - 24px);
8
+ font-family:var(--ff);font-size:var(--fs);font-weight:var(--fw,400);line-height:1.45;color:var(--fg);-webkit-font-smoothing:antialiased;transition:bottom .2s}
9
+ .w.dk{${dt}}
10
+ @media (prefers-color-scheme:dark){.w.au{${dt}}}
11
+ .w.s{right:auto;left:var(--ox,16px);--sx:-24px}
11
12
  .w.p{position:relative;inset:auto;bottom:auto;right:auto;left:auto;width:100%}
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);
13
+ .c{position:relative;background:var(--bg);border-radius:var(--r);padding:var(--pad);box-shadow:0 0 0 var(--bw,1px) var(--edge),var(--sh,0 1px 3px rgba(24,24,27,.06));
13
14
  animation:in .32s cubic-bezier(.2,.9,.25,1) both;transform-origin:bottom}
15
+ .af .c{animation-name:fd}.al .c{animation-name:sl}.a0 .c{animation:none}
16
+ @keyframes fd{from{opacity:0}}
17
+ @keyframes sl{from{opacity:0;transform:translateX(var(--sx))}}
14
18
  .c.o{animation:out .18s ease-in both}
15
19
  .c.q{animation:none}
16
20
  @keyframes in{from{opacity:0;transform:translateY(10px) scale(.98)}}
17
21
  @keyframes out{to{opacity:0;transform:translateY(6px) scale(.98)}}
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}
22
+ .t{display:block;width:100%;font-family:inherit;font-weight:var(--tw,600);font-size:calc(var(--fs) + var(--ts,1px));line-height:1.35;padding:0;padding-inline-end:28px;color:var(--tc);overflow-wrap:anywhere;background:none;border:0;resize:none;min-height:0;max-height:none;box-shadow:none}
23
+ .x{position:absolute;top:10px;inset-inline-end:10px;width:28px;height:28px;border:0;border-radius:var(--ri);background:transparent;color:var(--xc);cursor:pointer;display:grid;place-items:center;transition:background .15s,color .15s}
20
24
  .x:hover{background:var(--opt);color:var(--fg)}
21
25
  button,input{font:inherit;color:inherit;-webkit-tap-highlight-color:transparent}
22
26
  button:focus-visible,textarea:focus-visible{outline:2px solid var(--a);outline-offset:2px}
23
- .g{display:flex;flex-direction:column;gap:6px;margin-top:12px}
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;
27
+ .g{display:flex;flex-direction:column;gap:var(--gap);margin-top:var(--mt)}
28
+ .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);color:var(--ot);box-shadow:inset 0 0 0 1px var(--ob);text-align:start;cursor:pointer;
25
29
  transition:background .15s,box-shadow .15s,transform .12s}
26
30
  .o1:hover{background:var(--opt-h)}
27
31
  .o1:active{transform:scale(.985)}
28
- .o1[aria-pressed=true]{background:var(--bg);box-shadow:inset 0 0 0 1.5px var(--a)}
32
+ .o1[aria-pressed=true]{background:var(--bg);box-shadow:inset 0 0 0 1.5px var(--sel)}
29
33
  .d{flex:none;width:16px;height:16px;border-radius:50%;box-shadow:inset 0 0 0 1.5px var(--line);display:grid;place-items:center;transition:box-shadow .15s,background .15s}
30
- .o1[aria-pressed=true] .d{background:var(--a);box-shadow:none}
31
- .d svg{width:10px;height:10px;color:var(--on);transform:scale(0);transition:transform .2s cubic-bezier(.3,1.6,.5,1)}
34
+ .o1[aria-pressed=true] .d{background:var(--sel);box-shadow:none}
35
+ .d svg{width:10px;height:10px;color:var(--son);transform:scale(0);transition:transform .2s cubic-bezier(.3,1.6,.5,1)}
32
36
  .o1[aria-pressed=true] .d svg{transform:scale(1)}
33
- .th{display:flex;gap:8px;margin-top:12px}
37
+ .th{display:flex;gap:8px;margin-top:var(--mt)}
34
38
  .th .o1{justify-content:center;flex:1}
35
- .th svg{width:20px;height:20px}
36
- .n{display:grid;grid-template-columns:repeat(11,1fr);gap:4px;margin-top:12px;direction:ltr}
39
+ .th svg{width:20px;height:20px}.em{font-size:20px;line-height:1}
40
+ .n{display:grid;grid-template-columns:repeat(11,1fr);gap:4px;margin-top:var(--mt);direction:ltr}
37
41
  .n .o1{min-height:36px;padding:0;justify-content:center;font-variant-numeric:tabular-nums;font-size:calc(var(--fs) - 1px)}
38
- .n .o1[aria-pressed=true]{background:var(--a);color:var(--on);box-shadow:none}
39
- .nl{display:flex;justify-content:space-between;margin-top:6px;font-size:12px;color:var(--mut)}
42
+ .n .o1[aria-pressed=true]{background:var(--sel);color:var(--son);box-shadow:none}
43
+ .tr .n .o1:nth-child(-n+7){--opt:var(--lo)}.tr .n .o1:nth-child(n+8){--opt:var(--mi)}.tr .n .o1:nth-child(n+10){--opt:var(--hi)}
44
+ .nl{display:flex;justify-content:space-between;direction:ltr;margin-top:6px;font-size:12px;color:var(--mut)}
40
45
  .f{display:grid;grid-template-rows:0fr;transition:grid-template-rows .28s cubic-bezier(.2,.9,.25,1)}
41
46
  .f.on{grid-template-rows:1fr}
42
47
  .f>div{overflow:hidden;min-height:0}
43
- .fi{padding-top:12px}
48
+ .fi{padding-top:var(--mt)}
44
49
  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);
45
50
  box-shadow:inset 0 0 0 1px transparent;transition:box-shadow .15s,background .15s}
46
51
  textarea:focus{background:var(--bg);box-shadow:inset 0 0 0 1.5px var(--a);outline:0}
47
52
  textarea::placeholder,input::placeholder{color:var(--x)}
48
53
  .r{display:flex;align-items:center;justify-content:space-between;gap:8px;margin-top:10px}
49
54
  .e{font-size:12px;color:#d1453b}
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}
55
+ .b{margin-inline-start:auto;height:34px;padding:0 14px;border:0;border-radius:var(--ri);background:var(--btn);color:var(--bt);font-weight:600;cursor:pointer;display:inline-flex;align-items:center;gap:8px;transition:opacity .15s,transform .12s}
51
56
  .b:active{transform:scale(.97)}
52
- .b[disabled]{opacity:.45;cursor:default}
57
+ .b[disabled]{opacity:.6;cursor:default}
53
58
  .b[aria-busy=true]{opacity:.7}
54
59
  .sp{width:14px;height:14px;border-radius:50%;border:2px solid currentColor;border-inline-end-color:transparent;animation:sp .7s linear infinite}
55
60
  @keyframes sp{to{transform:rotate(1turn)}}
@@ -57,9 +62,10 @@ textarea::placeholder,input::placeholder{color:var(--x)}
57
62
  .k svg{flex:none;width:28px;height:28px;color:var(--a)}
58
63
  .k path{stroke-dasharray:24;stroke-dashoffset:24;animation:ck .4s .1s ease-out forwards}
59
64
  @keyframes ck{to{stroke-dashoffset:0}}
60
- .k strong{color:var(--fg);font-size:calc(var(--fs) + 1px);font-weight:600}
65
+ .k strong{color:var(--tc);font-size:calc(var(--fs) + 1px);font-weight:600}
66
+ .ce .t{text-align:center;padding-inline:28px}.ce .k{justify-content:center}
61
67
  .sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
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}
68
+ @media (max-width:480px){.w:not(.p){bottom:max(var(--oy,12px),env(safe-area-inset-bottom));left:12px;right:12px;width:auto;max-width:none}
63
69
  .o1{min-height:44px}.n .o1{min-height:40px}}
64
70
  @media (prefers-reduced-motion:reduce){*,.c,.k{animation-duration:.01ms!important;transition-duration:.01ms!important}}
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};
71
+ `,mt="http://www.w3.org/2000/svg",tt={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"},bt="M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18zM9 9.5v.5M15 9.5v.5",ht={thumbs:[tt.up,tt.down],faces:[`${bt}M8.5 14s1.3 2 3.5 2 3.5-2 3.5-2`,`${bt}M8.5 16.5s1.3-2 3.5-2 3.5 2 3.5 2`],emoji:[],words:[]},W={};function G(r,t=16,e=1.6){let s=document.createElementNS(mt,"svg");s.setAttribute("viewBox",`0 0 ${t} ${t}`),s.setAttribute("aria-hidden","true"),s.setAttribute("fill","none");let l=document.createElementNS(mt,"path");return l.setAttribute("d",r),l.setAttribute("stroke","currentColor"),l.setAttribute("stroke-width",String(e)),l.setAttribute("stroke-linecap","round"),l.setAttribute("stroke-linejoin","round"),s.append(l),s}function u(r,t,e){let s=document.createElement(r);if(t)s.className=t;if(e)s.textContent=e;return s}var Z=null;function Mt(r){try{if(Z??=new CSSStyleSheet,!Z.cssRules.length)Z.replaceSync(gt+(W.css??""));r.adoptedStyleSheets=[Z]}catch{r.append(u("style",void 0,gt+(W.css??"")))}}var ot=(r)=>[1,3,5].map((t)=>Number.parseInt(r.slice(t,t+2),16)),xt=(r)=>{let[t,e,s]=ot(r).map((l)=>{let y=l/255;return y<=0.03928?y/12.92:((y+0.055)/1.055)**2.4});return 0.2126*t+0.7152*e+0.0722*s},et=(r,t)=>{let[e,s]=[xt(r),xt(t)].sort((l,y)=>y-l);return(e+0.05)/(s+0.05)},rt="#18181b",J="#fafafa",U=(r,t="#ffffff")=>et(r,t)>=et(r,rt)?t:rt,I=(r,t,e)=>{let s=ot(t);return`#${ot(r).map((l,y)=>Math.round(l*e+s[y]*(1-e)).toString(16).padStart(2,"0")).join("")}`},yt=(r)=>typeof r==="string"&&/^#[0-9a-f]{6}$/i.test(r)?r:null,_=(r,t,e)=>typeof t==="string"&&Object.hasOwn(r,t)?t:e,zt=["accent","background","text","title","option","optionText","optionBorder","selected","button","buttonText","close","border"],wt={none:"none",soft:"",medium:"0 12px 32px -8px rgba(24,24,27,.22),0 2px 6px rgba(24,24,27,.06)",strong:"0 24px 48px -12px rgba(24,24,27,.38),0 4px 10px rgba(24,24,27,.1)"},vt={compact:[-4,4,8],regular:[0,6,12],roomy:[4,8,16]},kt={small:0,regular:1,large:4},X={regular:400,medium:500,semibold:600,bold:700},$t={top:2147483000,high:99999,normal:999},St={rise:"",fade:"af",slide:"al",none:"a0"},Q=(r,t,e)=>typeof r==="number"&&Number.isInteger(r)&&r>=t&&r<=e?r:null;function It(r,t){let e=(i,a)=>r.style.setProperty(i,String(a)),s=(i)=>i&&r.classList.add(i),l=t.theme==="dark"||t.theme==="auto"&&typeof matchMedia==="function"&&matchMedia("(prefers-color-scheme: dark)").matches;if(t.theme==="dark")s("dk");if(t.theme==="auto")s("au");let y=(t.theme==="auto"&&l?t.dark:t)??{},f=Object.fromEntries(zt.map((i)=>[i,yt(y[i])])),d=(i,a,n=4.5)=>i&&et(i,a)>=n?i:null,k=f.background,c=k??(l?"#1c1c1f":"#ffffff"),g=d(f.text,c);if(k)g??=U(c,J),e("--bg",c),e("--mut",I(g,c,0.62)),e("--opt",I(g,c,0.06)),e("--opt-h",I(g,c,0.1)),e("--edge",I(g,c,0.1)),e("--x",I(g,c,0.45)),e("--line",I(g,c,0.25));if(g)e("--fg",g);let M=g??(l?J:rt),m=f.accent??yt(t.accent)??"#1f1f1f";if(et(m,c)<1.5)m=M;e("--a",m),e("--on",U(m));let E=d(f.title,c,3);if(E)e("--tc",E);let v=d(f.close,c,3);if(v)e("--xc",v);let b=f.option;if(b)e("--opt",b),e("--opt-h",I(U(b,J),b,0.08));let T=d(f.optionText,b??c)??(b&&!d(M,b)?U(b,J):null);if(T)e("--ot",T);if(f.optionBorder)e("--ob",f.optionBorder);let j=d(f.selected,c,1.5)??m;e("--sel",j),e("--son",U(j));let A=f.button??m;if(e("--btn",A),e("--bt",d(f.buttonText,A)??U(A)),f.border)e("--edge",f.border);let L=Q(t.borderWidth,0,4);if(L!==null)e("--bw",`${L}px`);let N=wt[_(wt,t.shadow,"soft")];if(N)e("--sh",N);let C=_({...pt,site:0,custom:0},t.font,"site"),R=typeof t.fontName==="string"&&/^[\p{L}\p{N} -]{1,40}$/u.test(t.fontName);if(C==="site"){let i=typeof getComputedStyle==="function"&&getComputedStyle(document.body).fontFamily;if(i)e("--ff",i)}else if(C==="custom")e("--ff",R?`"${t.fontName}",${Y}`:Y);else e("--ff",pt[C]);let[H,D]=ut[_(ut,t.radius,"medium")];e("--r",`${H}px`),e("--ri",`${D}px`);let[O,h,K]=ft[_(ft,t.size,"medium")],[P,w,F]=vt[_(vt,t.density,"regular")];e("--wd",`${Q(t.width,280,480)??O}px`),e("--fs",`${h}px`),e("--pad",`${K+P}px`),e("--gap",`${w}px`),e("--mt",`${F}px`),e("--ts",`${kt[_(kt,t.titleSize,"regular")]}px`),e("--tw",X[_(X,t.titleWeight,"semibold")]),e("--fw",X[_(X,t.bodyWeight,"regular")]),e("--z",$t[_($t,t.layer,"top")]);let q=Q(t.offsetX,0,160),o=Q(t.offsetY,0,160);if(q!==null)e("--ox",`${q}px`);if(o!==null)e("--oy",`${o}px`);if(s(St[_(St,t.animation,"rise")]),t.align==="center")s("ce");if(t.scale==="traffic")s("tr"),e("--lo",I("#e5484d",c,0.18)),e("--mi",I("#f5a524",c,0.2)),e("--hi",I("#30a46c",c,0.18))}function jt(r,t,e,s){Mt(r);let l=ct[t.lang]??ct.en,y=typeof e.sendLabel==="string"?e.sendLabel.trim():"",f=y&&y.length<=20&&!/[\p{Cc}\u202a-\u202e\u2066-\u2069]/u.test(y)?y:l.send,d=s.edit,k=u("div",`w${e.position==="start"?" s":""}${s.preview||s.inline||d?" p":""}${d?" ed":""}`);k.dir=t.lang==="ar"?"rtl":"ltr",k.lang=t.lang,It(k,e);let c=u("div",s.quiet||d?"c q":"c"),g=`datacub-fb-${Math.random().toString(36).slice(2,8)}`;c.setAttribute("role",s.preview||s.inline||d?"group":"dialog"),c.setAttribute("aria-labelledby",g);let M=u("p","sr");M.setAttribute("aria-live","polite");let m=u("button","x");if(m.type="button",m.setAttribute("aria-label",l.close),m.append(G(tt.x)),d)m.tabIndex=-1,m.setAttribute("aria-hidden","true");let E;if(d)E=W.title(t,d,c);else E=u("p","t",t.type==="general"?l.general:t.title);E.id=g,c.append(m,E),k.append(c,M),r.append(k);let v=null,b=!1,T=!1,j=t.type==="general"?l.tell:t.followup,A=(n)=>!!t.followup&&(!t.followupOn||n!==null&&t.followupOn.includes(n)),L=t.type==="text"||t.type==="general",N=[],C=null,R=(n)=>{if(T)return;if(T=!0,C)visualViewport?.removeEventListener("resize",C);c.classList.add("o"),setTimeout(()=>k.remove(),200),s.done?.(n)},H=u("div",`f${L||d&&t.followup!=null?" on":""}`),D=u("div"),O=u("div","fi"),h=u("textarea");h.maxLength=1000,h.placeholder=t.type==="text"?l.type:j??l.type,h.setAttribute("aria-label",t.type==="text"?t.title:j??l.type);let K=u("div","r"),P=u("span","e");P.setAttribute("role","status");let w=u("button","b",f);if(w.type="button",K.append(P,w),d&&t.followup!=null&&t.type!=="text")O.append(W.followup(t,d)),h.placeholder=l.type;if(O.append(h,K),D.append(O),H.append(D),!L&&!j)H.hidden=!0;if(d)h.disabled=!0,w.disabled=!0,w.tabIndex=-1;let F=()=>{if(d)return;w.disabled=L?!h.value.trim():!v};h.addEventListener("input",F);let q=async()=>{if(b||w.disabled||d)return;b=!0,w.setAttribute("aria-busy","true"),w.textContent="",w.append(u("span","sp"),document.createTextNode(l.sending)),P.textContent="";try{await s.send(v,(A(v)||L)&&h.value.trim()?h.value.trim():null)}catch{b=!1,w.removeAttribute("aria-busy"),w.textContent=f,P.textContent=l.failed;return}let n=u("div","k");n.setAttribute("role","status"),n.append(G("M7 16.5l5.5 5.5L25 9.5",32,2.4),u("strong",void 0,l.thanks));let p=c.offsetHeight;if(c.replaceChildren(n),!matchMedia("(prefers-reduced-motion: reduce)").matches)c.animate?.([{height:`${p}px`},{height:`${c.offsetHeight}px`}],{duration:280,easing:"cubic-bezier(.2,.9,.25,1)"});if(!s.preview&&!s.inline)setTimeout(()=>R(!0),2400)};w.addEventListener("click",q),h.addEventListener("keydown",(n)=>{if(n.key==="Enter"&&(n.metaKey||n.ctrlKey))q()});let o=(n)=>{v=n;for(let x of N)x.setAttribute("aria-pressed",String(x.dataset.id===n));if(F(),!A(n))return void q();let p=!H.classList.contains("on");if(H.classList.add("on"),p&&!s.preview)setTimeout(()=>h.focus({preventScroll:!0}),120)},i=(n,p,x="o1",z)=>{let S=u("button",x);if(S.type="button",S.dataset.id=n,S.setAttribute("aria-pressed","false"),z)S.append(z),S.setAttribute("aria-label",p);else{let B=u("span","d");B.append(G(tt.check,16,2.4)),S.append(B,u("span",void 0,p))}if(d)S.tabIndex=-1;else S.addEventListener("click",()=>!b&&o(n));return N.push(S),S};if(t.type==="choice"&&d)c.append(W.choices(t,d));else if(t.type==="choice"){let n=u("div","g");n.setAttribute("role","group"),n.setAttribute("aria-labelledby",g);for(let p of t.options??[])n.append(i(p.id,p.label));c.append(n)}else if(t.type==="thumbs"){let n=u("div","th");n.setAttribute("role","group"),n.setAttribute("aria-labelledby",g);let p=_(ht,e.icons,"thumbs"),x=(z)=>p==="words"?u("span",void 0,z?l.no:l.yes):p==="emoji"?u("span","em",z?"\uD83D\uDC4E":"\uD83D\uDC4D"):G(ht[p][z],24);n.append(i("up",l.yes,"o1",x(0)),i("down",l.no,"o1",x(1))),c.append(n)}else if(t.type==="nps"){let n=u("div","n");n.setAttribute("role","group"),n.setAttribute("aria-labelledby",g);for(let x=0;x<=10;x++)n.append(i(String(x),String(x),"o1",u("span",void 0,String(x))));let p=u("div","nl");p.append(u("span",void 0,l.low),u("span",void 0,l.high)),c.append(n,p)}c.append(H),F();let a=()=>{if(!v||b||L||d)return;b=!0,s.send(v,A(v)&&h.value.trim()?h.value.trim():null).catch(()=>{})};if(m.addEventListener("click",()=>{if(d)return;a(),R(!!v||b)}),addEventListener("pagehide",a),k.addEventListener("keydown",(n)=>{if(n.key==="Escape"&&!d)n.stopPropagation(),m.click()}),!s.preview&&!s.inline&&!d&&typeof visualViewport<"u"&&visualViewport){let n=visualViewport;C=()=>{let p=innerHeight-n.height-n.offsetTop;k.style.bottom=innerWidth<=480&&p>40?`${p+12}px`:""},n.addEventListener("resize",C)}if(!s.preview&&!d)M.textContent=t.type==="general"?l.general:t.title;if(s.focus)setTimeout(()=>(L?h:N[0])?.focus(),50);if(d?.focus)W.focus(d,c);return{close:()=>R(b)}}var Et=60000,Lt=!1;function Ht(){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 Rt(r){if(Lt||typeof window>"u"||!r?._fb)return;let t=r._fb,e=t()[8],s=e?e():[];if(!s)return;Lt=!0;let l=[],y={accent:"#1f1f1f",position:"end"},f="",d=0,k=0,c=null,g=!1,M=!1,m=new Set,E=()=>{let[,o,i,a,n,p,x,z]=t();return o&&n?{key:i,base:a.replace(/batch$/,"feedback"),anon:n,user:p??null,sid:x||null,emit:z}:null},v=async(o,i)=>{let a=await fetch(o,{method:"POST",body:JSON.stringify(i),credentials:"omit",keepalive:!0});if(!a.ok)throw Error(String(a.status));return a.json()},b=()=>{let o=document.createElement("div");return o.setAttribute("data-datacub-feedback-widget",""),document.body.append(o),o};async function T(){let o=E();if(!o){j();return}let i=`${o.anon}|${o.user??""}`;if(i===f||Date.now()<k)return;f=i;try{let a=await v(o.base,{api_key:o.key,anon_id:o.anon,user_id:o.user});l=a.questions??[];let n=t()[9];y={theme:"light",...a.settings,...n&&typeof n==="object"?n:{}}}catch(a){f="",k=/^4/.test(a?.message)?Number.POSITIVE_INFINITY:Date.now()+Math.min(1000*2**++d,300000);return}d=0,D()}function j(){M=!0,c?.close(),M=!1;for(let o of m)clearTimeout(o);m.clear()}function A(){let o=E();if(!o||c)return;let i=document.activeElement,a=/^ar\b/i.test(document.documentElement.lang)?"ar":"en";L({lang:a,type:"general",title:""},null,o,i)}function L(o,i,a,n,p){let x=b();if(p)p.append(x);let z=x.attachShadow({mode:"open"}),S=crypto.randomUUID?.()??"10000000-1000-4000-8000-100000000000".replace(/[018]/g,(V)=>(+V^crypto.getRandomValues(new Uint8Array(1))[0]&15>>+V/4).toString(16)),B=i?{$question_id:i.id,$version:i.version}:{};c=jt(z,o,y,{focus:!i,inline:!!p,send:async(V,Tt)=>{let At={api_key:a.key,id:S,question:i?.id??null,version:i?.version??null,anon_id:a.anon,user_id:a.user,session_id:a.sid,choice:V,text:Tt,path:location.pathname.split("/").map(lt).join("/")};for(let nt=0;;nt++)try{await v(`${a.base}/answer`,At);break}catch(st){if(nt>=2||/^4/.test(st.message))throw st;await new Promise((Nt)=>setTimeout(Nt,800*2**nt))}a.emit("$feedback_answered",{...B,$response_id:S,$choice:V},{},!0)},done:(V)=>{if(c=null,x.remove(),n?.focus?.(),i&&!V&&!M)v(`${a.base}/seen`,{api_key:a.key,anon_id:a.anon,question:i.id,kind:"dismissed"}).catch(()=>{}),a.emit("$feedback_dismissed",B,{},!0)}})}async function N(o,i,a){let n=E();if(!n||c||g)return;if(!a&&o.q.delivery?.waitForIdle!==!1&&Ht()){if(Date.now()<i)C(()=>N(o,i,a),2000);return}try{if(!(await v(`${n.base}/seen`,{api_key:n.key,anon_id:n.anon,question:o.id,kind:"shown",user_id:n.user})).ok||c||g)return}catch{return}g=!0,l=l.filter((p)=>p.id!==o.id),n.emit("$feedback_shown",{$question_id:o.id,$version:o.version},{},!0),L(o.q,o,n,null,a)}function C(o,i){let a=setTimeout(()=>{m.delete(a),o()},i);m.add(a)}let R=(o)=>C(()=>N(o,Date.now()+Et),(o.q.trigger.delay??0)*1000);function H(o,i){return i.endsWith("*")?o.startsWith(i.slice(0,-1)):o===i||o===`${i}/`}function D(){let o=location.pathname;for(let i of l)if(i.q.trigger.kind==="page"&&H(o,i.q.trigger.path??""))R(i);for(let i of document.querySelectorAll("[data-datacub-ask]")){let a=l.find((n)=>n.id===i.getAttribute("data-datacub-ask")&&n.q.trigger.kind==="manual");if(a&&!i.querySelector("[data-datacub-feedback-widget]"))N(a,Date.now(),i)}}let O=(o,i)=>{let a=r[o];r[o]=(...n)=>{a(...n);try{i(...n)}catch{}}};O("track",(o)=>{for(let i of l)if(i.q.trigger.kind==="event"&&i.q.trigger.event===String(o).trim())R(i)}),O("identify",()=>setTimeout(T,0)),O("reset",()=>setTimeout(T,0));let h=r.consent.grant;r.consent.grant=(...o)=>{h(...o),setTimeout(T,0)};let K=Promise.resolve();r.ask=(o,i)=>void K.then(()=>{let a=l.find((p)=>p.id===o&&p.q.trigger.kind==="manual"),n=null;try{n=typeof i?.into==="string"?document.querySelector(i.into):i?.into??null}catch{}if(a)N(a,Date.now()+Et,n instanceof Element?n:null)}),r.feedback=A,document.addEventListener("click",(o)=>{if(o.target?.closest?.("[data-datacub-feedback]"))A()});let P=location.pathname,w=()=>setTimeout(()=>{if(location.pathname===P)return;P=location.pathname,g=!1,D()},150);for(let o of["pushState","replaceState"]){let i=history[o];history[o]=function(...a){i.apply(this,a),w()}}addEventListener("popstate",w),setInterval(()=>{if(E())T();else if(f)f="",j()},1000),K=T();let[F,q]=s;if(F==="feedback")A();else if(F==="ask")r.ask(...q)}export{tt as ICONS,et as contrast,u as el,G as icon,jt as mount,W as parts,Rt as start};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@datacub/web",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "datacub product analytics for websites. One line to install, private by default.",
5
5
  "keywords": [
6
6
  "analytics",
@@ -1,5 +1,5 @@
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";
1
+ // datacub web SDK 0.7.0, for the script tag. Save as datacub.d.ts in your project: `datacub` is then typed.
2
+ export declare const VERSION = "0.7.0";
3
3
  export type Property = string | number | boolean | null | Date | Property[] | {
4
4
  [key: string]: Property;
5
5
  };
@@ -16,14 +16,72 @@ export interface FeedbackLook {
16
16
  position?: 'end' | 'start';
17
17
  /** 'auto' follows the visitor's system */
18
18
  theme?: 'light' | 'dark' | 'auto';
19
- /** 'site' uses the page's own font */
20
- font?: 'system' | 'site' | 'serif' | 'rounded';
19
+ /** 'site' (the default) reads the page's own font, as the browser computed it for the body */
20
+ font?: 'system' | 'site' | 'serif' | 'rounded' | 'custom';
21
+ /** default 'medium' */
21
22
  radius?: 'none' | 'small' | 'medium' | 'large';
22
23
  size?: 'small' | 'medium' | 'large';
23
24
  /** card colour, in place of the theme's. #rrggbb */
24
25
  background?: string | null;
25
26
  /** text colour; ignored when it does not read well on the card. #rrggbb */
26
27
  text?: string | null;
28
+ /** the send button's words in place of Send / إرسال: plain text, 1 to 20 characters */
29
+ sendLabel?: string | null;
30
+ /** the question's colour. #rrggbb */
31
+ title?: string | null;
32
+ /** answer buttons: fill, words, edge. #rrggbb */
33
+ option?: string | null;
34
+ optionText?: string | null;
35
+ optionBorder?: string | null;
36
+ /** the chosen answer, in place of the brand colour. #rrggbb */
37
+ selected?: string | null;
38
+ /** the send button and its words, in place of the brand colour. #rrggbb */
39
+ button?: string | null;
40
+ buttonText?: string | null;
41
+ /** the close icon. #rrggbb */
42
+ close?: string | null;
43
+ /** the card's edge colour and width, 0 to 4 px. #rrggbb */
44
+ border?: string | null;
45
+ borderWidth?: number | null;
46
+ /** default 'soft': a faint one */
47
+ shadow?: 'none' | 'soft' | 'medium' | 'strong';
48
+ /** card width, 280 to 480 px, in place of the size's */
49
+ width?: number | null;
50
+ /** space inside the card */
51
+ density?: 'compact' | 'regular' | 'roomy';
52
+ /** with font 'custom': a font your page already loads, letters, digits, spaces and hyphens only */
53
+ fontName?: string | null;
54
+ titleSize?: 'small' | 'regular' | 'large';
55
+ titleWeight?: 'regular' | 'medium' | 'semibold' | 'bold';
56
+ bodyWeight?: 'regular' | 'medium' | 'semibold';
57
+ align?: 'start' | 'center';
58
+ /** the yes and no buttons */
59
+ icons?: 'thumbs' | 'faces' | 'emoji' | 'words';
60
+ /** 0 to 10 scores: 'traffic' tints 0 to 6 red, 7 and 8 amber, 9 and 10 green */
61
+ scale?: 'plain' | 'traffic';
62
+ animation?: 'rise' | 'fade' | 'slide' | 'none';
63
+ /** distance from the side and the bottom of the window, 0 to 160 px (phones keep 12 px at the sides) */
64
+ offsetX?: number;
65
+ offsetY?: number;
66
+ /** 'top' above everything, 'high' above most of a page, 'normal' under the page's own popups */
67
+ layer?: 'top' | 'high' | 'normal';
68
+ /** with theme 'auto': the colours for visitors in dark mode (the brand colour carries over); the colours above are for light mode */
69
+ dark?: FeedbackColors | null;
70
+ }
71
+ /** The colours that have a dark mode version. #rrggbb */
72
+ export interface FeedbackColors {
73
+ accent?: string | null;
74
+ background?: string | null;
75
+ text?: string | null;
76
+ title?: string | null;
77
+ option?: string | null;
78
+ optionText?: string | null;
79
+ optionBorder?: string | null;
80
+ selected?: string | null;
81
+ button?: string | null;
82
+ buttonText?: string | null;
83
+ close?: string | null;
84
+ border?: string | null;
27
85
  }
28
86
  export interface InitOptions {
29
87
  /** Ingestion origin or first-party proxy path. Default https://in.datacub.to */
package/types/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export declare const VERSION = "0.6.0";
1
+ export declare const VERSION = "0.7.0";
2
2
  export type Property = string | number | boolean | null | Date | Property[] | {
3
3
  [key: string]: Property;
4
4
  };
@@ -15,14 +15,72 @@ export interface FeedbackLook {
15
15
  position?: 'end' | 'start';
16
16
  /** 'auto' follows the visitor's system */
17
17
  theme?: 'light' | 'dark' | 'auto';
18
- /** 'site' uses the page's own font */
19
- font?: 'system' | 'site' | 'serif' | 'rounded';
18
+ /** 'site' (the default) reads the page's own font, as the browser computed it for the body */
19
+ font?: 'system' | 'site' | 'serif' | 'rounded' | 'custom';
20
+ /** default 'medium' */
20
21
  radius?: 'none' | 'small' | 'medium' | 'large';
21
22
  size?: 'small' | 'medium' | 'large';
22
23
  /** card colour, in place of the theme's. #rrggbb */
23
24
  background?: string | null;
24
25
  /** text colour; ignored when it does not read well on the card. #rrggbb */
25
26
  text?: string | null;
27
+ /** the send button's words in place of Send / إرسال: plain text, 1 to 20 characters */
28
+ sendLabel?: string | null;
29
+ /** the question's colour. #rrggbb */
30
+ title?: string | null;
31
+ /** answer buttons: fill, words, edge. #rrggbb */
32
+ option?: string | null;
33
+ optionText?: string | null;
34
+ optionBorder?: string | null;
35
+ /** the chosen answer, in place of the brand colour. #rrggbb */
36
+ selected?: string | null;
37
+ /** the send button and its words, in place of the brand colour. #rrggbb */
38
+ button?: string | null;
39
+ buttonText?: string | null;
40
+ /** the close icon. #rrggbb */
41
+ close?: string | null;
42
+ /** the card's edge colour and width, 0 to 4 px. #rrggbb */
43
+ border?: string | null;
44
+ borderWidth?: number | null;
45
+ /** default 'soft': a faint one */
46
+ shadow?: 'none' | 'soft' | 'medium' | 'strong';
47
+ /** card width, 280 to 480 px, in place of the size's */
48
+ width?: number | null;
49
+ /** space inside the card */
50
+ density?: 'compact' | 'regular' | 'roomy';
51
+ /** with font 'custom': a font your page already loads, letters, digits, spaces and hyphens only */
52
+ fontName?: string | null;
53
+ titleSize?: 'small' | 'regular' | 'large';
54
+ titleWeight?: 'regular' | 'medium' | 'semibold' | 'bold';
55
+ bodyWeight?: 'regular' | 'medium' | 'semibold';
56
+ align?: 'start' | 'center';
57
+ /** the yes and no buttons */
58
+ icons?: 'thumbs' | 'faces' | 'emoji' | 'words';
59
+ /** 0 to 10 scores: 'traffic' tints 0 to 6 red, 7 and 8 amber, 9 and 10 green */
60
+ scale?: 'plain' | 'traffic';
61
+ animation?: 'rise' | 'fade' | 'slide' | 'none';
62
+ /** distance from the side and the bottom of the window, 0 to 160 px (phones keep 12 px at the sides) */
63
+ offsetX?: number;
64
+ offsetY?: number;
65
+ /** 'top' above everything, 'high' above most of a page, 'normal' under the page's own popups */
66
+ layer?: 'top' | 'high' | 'normal';
67
+ /** with theme 'auto': the colours for visitors in dark mode (the brand colour carries over); the colours above are for light mode */
68
+ dark?: FeedbackColors | null;
69
+ }
70
+ /** The colours that have a dark mode version. #rrggbb */
71
+ export interface FeedbackColors {
72
+ accent?: string | null;
73
+ background?: string | null;
74
+ text?: string | null;
75
+ title?: string | null;
76
+ option?: string | null;
77
+ optionText?: string | null;
78
+ optionBorder?: string | null;
79
+ selected?: string | null;
80
+ button?: string | null;
81
+ buttonText?: string | null;
82
+ close?: string | null;
83
+ border?: string | null;
26
84
  }
27
85
  export interface InitOptions {
28
86
  /** Ingestion origin or first-party proxy path. Default https://in.datacub.to */