@datacub/web 0.6.0 → 0.8.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 +14 -0
- package/dist/datacub.js +3 -3
- package/dist/datacub.mjs +4 -4
- package/dist/feedback.js +33 -27
- package/dist/feedback.mjs +33 -27
- package/package.json +1 -1
- package/types/datacub.d.ts +88 -6
- package/types/index.d.ts +87 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.8.0](https://github.com/datacub/sdk/compare/web-v0.7.0...web-v0.8.0) (2026-11-28)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* **web:** datacub.feedback.shown, send and dismissed for your own feedback ui ([#12](https://github.com/datacub/sdk/issues/12)) ([641c87a](https://github.com/datacub/sdk/commit/641c87a177237d05b537f7d73a12e11f19c13a21))
|
|
9
|
+
|
|
10
|
+
## [0.7.0](https://github.com/datacub/sdk/compare/web-v0.6.0...web-v0.7.0) (2026-11-24)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Features
|
|
14
|
+
|
|
15
|
+
* **web:** much more feedback card look ([#10](https://github.com/datacub/sdk/issues/10)) ([d0f1d20](https://github.com/datacub/sdk/commit/d0f1d2007a0fd899e3dcafef47b083202a5fdabd))
|
|
16
|
+
|
|
3
17
|
## [0.6.0](https://github.com/datacub/sdk/compare/web-v0.5.0...web-v0.6.0) (2026-11-24)
|
|
4
18
|
|
|
5
19
|
|
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 v={n:0},xt=(t)=>t.replace(/[\u0660-\u0669\u06f0-\u06f9\uff10-\uff19]/g,(e)=>String(e.charCodeAt(0)&15)),Te=/[\s./()\u0640\u066b\u066c\u2010-\u2015\u200b-\u200f\u061c\u202a-\u202e\u2066-\u2069\ufeff-]/g,Jt=(t)=>xt(t).replace(Te,""),Oe=/\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 J(t){let e="",n=0;for(let i of xt(t).matchAll(Oe)){if(/^[0-9a-f]{8}-/i.test(i[0])&&i[0].length===36)continue;e+=`${t.slice(n,i.index)}[redacted]`,n=i.index+i[0].length,v.n++}return e+t.slice(n)}function z(t,e=1024){if(t=t.normalize("NFC"),t.length>256||t.trim().split(/\s+/).length>11)return v.n++,"[redacted]";return J(t).slice(0,e).replace(/[\uD800-\uDBFF]$/,"")}var B=(t)=>/[\u0000-\u001f\u007f-\u009f\u200e\u200f\u061c\u202a-\u202e\u2066-\u2069]/.test(t),Ie=/(?: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 Zt(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)||B(t)||/^(?:__proto__|constructor|prototype)$/.test(t)||e&&/^(?:\$|(?:distinct_id|person_id|project_id|timestamp|uuid|ip|api_key)$)/.test(t)||Ie.test(n.join(""))&&!/^(?:japan|span|timespan|lifespan|wingspan|saucepan|spin|chopin|android)$/.test(n[n.length-1])||n.some((i)=>/^(?:password|passwd|pwd|passcode|otp|pin|secret|iqama|ssn|cvv|cvc|iban)$/.test(i))}function H(t,e=0){if(typeof t==="string")return z(t);if(typeof t==="number")return Number.isFinite(t)?Number.isInteger(t)&&J(`${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((r)=>H(r,e+1)).filter((r)=>r!==void 0);let n=Object.getPrototypeOf(t);if(n!==Object.prototype&&n)return;let i={};for(let[r,s]of Object.entries(t).slice(0,200)){let o=r.trim();if(Zt(o,!e))v.n++;else{let a=H(s,e+1);if(a!==void 0)i[o]=a}}return i}function Qt(t){let e=t;try{e=decodeURIComponent(t)}catch{}e=xt(e);let n=v.n;if(J(e)!==e)return v.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 i=e.replace(/\D/g,"").length;return i&&(i===e.length||i>3&&i*2>=e.length)?":id":t}var Pe=/^(?: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,je=(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)),E=(t,e)=>J(t.normalize("NFC")).slice(0,e),Yt=(t)=>t.split("/").map((e)=>e&&Qt(e)).join("/");function q(t,e,n){let i;try{i=new URL(t)}catch{return null}let r=i.protocol;if(/^(?:mailto|tel|sms|whatsapp):$/.test(r))return{url:r,path:r};if(!/^https?:$/.test(r))return null;let s=Yt(i.pathname);if(e&&/^#!?\//.test(i.hash))s+=`#${Yt(i.hash.slice(1).split("?")[0])}`;s=s.slice(0,1024);let o={url:(i.origin+s).slice(0,2048),path:s};for(let[a,d]of i.searchParams){let g=a.toLowerCase();if(/^utm_(?:source|medium|campaign|term|content)$/.test(g)&&d)o.utm={...o.utm,[g.slice(4)]:z(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=Qt(d);o.q??={},o.q[E(a,64)]=Zt(a,!1)||Pe.test(a)||d.length>40||!(m[0]===":"||je(d))?"":m===":redacted"?"":m}}return o}function te(t){let e=t.trim().normalize("NFC");return!e||[...e].length>100||e[0]==="$"||B(e)||/[0-9a-f]{8}-[0-9a-f]{4}-|[0-9a-f]{16}|@/i.test(e)||/\d{6}/.test(Jt(e))?null:e}function St(t,e){if(typeof t==="number"&&Number.isFinite(t))t=`${t}`;if(typeof t!=="string")return null;let n=t.trim().normalize("NFC"),i=Jt(n),r=0;for(let s=0;s<i.length;s++){let o=+i[i.length-1-s];r+=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)||B(n)||/@|^eyJ/.test(n)||/^(?:[12]\d{9}|(?:\+?966|00966|0)5\d{8}|\+\d{8,15})$/.test(i)||/^[2-6]\d{14,15}$/.test(i)&&r%10===0||e.includes(n)?null:n}var Pt="0.8.0",ee=1800000,Ce=86400000,Ne=34560000,jt=/^[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]",ce=["datacub_id","datacub_u","datacub_a","datacub_ss"],c,dt=!1,O={},le=!0,ue=!0,de,ft=0,Ct=0,et=0,nt=0,it=0,rt={},Nt=new Set,Lt,j=0,pt=0,k,ot,gt,Z,C={},fe=!1,_t="",S="",Ft=!1,pe=null,K="pending",Ut=!1,_=!1,W="",mt="",l="",w=null,U=null,L=null,b="",st=0,A=0,ge,G=0,Y="",F=null,Le=0,at=0,bt=0,ht=0,me="",ct=!0,Q,ne=0,u=[],Mt,be=!1,ie="",V=!1,lt=0,yt=!1,y=0,Dt=[],x=Date.now;function wt(t){if(fe)console.warn(`[datacub] ${t}`)}var R=(t)=>(...e)=>{try{t(...e)}catch{}},f=(t,e,n)=>t.addEventListener(e,R(n),!0);function N(t){let e=crypto.getRandomValues(new Uint8Array(16));for(let i=5,r=t;t&&i>=0;i--,r=Math.floor(r/256))e[i]=r&255;return e[6]=e[6]&15|(t?112:64),e[8]=e[8]&63|128,Array.from(e,(i)=>(i+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("="),i=e.slice(0,n);if(i==="datacub_optout"||W&&i.endsWith(W))t[i==="datacub_optout"?i:i.slice(0,-W.length)]=decodeURIComponent(e.slice(n+1))}}catch{}return t}function h(t,e,n=mt,i=e?Ne:0){try{c.cookie=`${t==="datacub_optout"?t:t+W}=${encodeURIComponent(e||"")};Path=/;Max-Age=${i};SameSite=Lax${n}${location.protocol==="https:"?";Secure":""}`}catch{}}function he(){let t=location.hostname.split(".");return/^[\d.]+$|:/.test(location.hostname)?[]:t.slice(0,-1).map((e,n)=>`;Domain=${t.slice(n).join(".")}`)}function Bt(){if(!_)return;let t=X(),e=t.datacub_id??null;if(e!==l)l=e&&jt.test(e)?e:N(),h("datacub_id",l),b="";w=t.datacub_u??null,U=t.datacub_a??null;let[n,i,r]=(t.datacub_ss||"").split(".");if(ge=n,G=+r,n&&jt.test(n)&&G&&(n!==b||G>A))b=n,st=+i,A=G}function ye(t,e){if(!b||t-A>ee||t-st>Ce){if(b=N(x()),st=A=t,_)h("datacub_id",l)}else if(e&&t>A)A=t;if(_&&(ge!==b||A-G>5000))h("datacub_ss",`${b}.${st}.${A}`,mt,ee/1000)}function T(t){clearTimeout(Mt),be=t===0,Mt=t==null?void 0:setTimeout(R(Xt),t)}function we(t){if((t||u.length>19||c.visibilityState==="hidden")&&!be&&!lt)T(0);else if(!Mt)T(5000)}var Fe=new TextEncoder;function p(t,e,n,i){if(!l)return;let r=x();if(Bt(),ye(r,!/^\$(?:pageleave|error|request|form_fields)$/.test(t)),v.n)e={...e,$d:v.n};let s=JSON.stringify([N(r),t,r,l,w,U,b,Y||null,Le++,+(K==="granted"),+_,F?.url,me,e,n]),o=Fe.encode(s).length;if(o>31000){y++;return}v.n=0,u.push([s,o]),xe(),we(i)}function Ue(t,e){if(!l||typeof t!=="string")return;let n=te(t);if(!n)return wt("bad name");p(n,e&&typeof e==="object"&&!Array.isArray(e)&&H(e)||{})}function Gt(t=x()){if(at)bt+=t-at;at=c.visibilityState==="visible"?t:0}var ut=()=>{j=innerWidth,pt=innerHeight,me=j<360?"xs":j<480?"s":j<768?"m":j<1280?"l":"xl",ht=Math.max(ht,scrollY+pt)};function Vt(t,e){return rt[t]=(rt[t]||0)+1,rt[t]<=e}function $e(){if(!Y)return;Gt();let t=bt-Ct;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(it)n.$rf=it;et=nt=it=0;try{Object.assign(n,C.l?.())}catch{}ct=!0,Ct=bt,p("$pageleave",n)}function Wt(t,e){if(!l)return;let n=location.pathname+(Ft?location.hash.split("?")[0]:"");if(!t&&n===ie)return;let i=q(location.href,Ft,O.query!==!1);if(!i)return;ie=n,$e();let r={};if(F)r.$p=F.path;if(t&&!e)r.$b=!0;if(r.$N=e?performance.getEntriesByType?.("navigation")[0]?.type:t?"back_forward":Lt,i.q)r.$q=i.q;if(O.title!==!1&&c.title)r.$T=E(c.title,200);F=i,Y=N(x()),ct=!1,bt=ht=at=Ct=0,rt={},Nt.clear(),Gt(),ut(),r.$vw=j,r.$vh=pt;let s=null;if(e)try{let o=new URL(c.referrer);s=o.hostname,r.$R=q(o.href)?.path}catch{}p("$pageview",r,[i.utm,i.click_id_type,s],e)}var Rt=(t)=>()=>{if(!(Q&&t==="replace"&&Lt==="push"))Lt=t;k?.(),clearTimeout(Q),Q=setTimeout(R(()=>{Q=void 0,Wt()}),100)},ke=(t)=>{let e=t.closest("[data-datacub-name]")?.getAttribute("data-datacub-name");return e?z(e,100):null},_e=!0;function Me(t){let e="";for(let n=0;t&&n<10&&t!==c.body;n++,t=t.parentElement){let i=1;for(let o=t.previousElementSibling;o;o=o.previousElementSibling)if(o.localName===t.localName)i++;let r=t.id,s=t.getAttribute("data-datacub-name");e=`${t.localName}${r&&!/\d{4}|[\da-f]{8}|^:|radix-|headlessui-|mui-|ember\d|react-select/i.test(r)?`#${E(r,64)}`:""}${i>1?`:${i}`:""}${s?`[${E(s,64)}]`:""}${e&&">"}${e}`}return e.slice(-512)}function De(t){let e=t.querySelector(`input,textarea,select,[contenteditable],${kt}`)?"":(t.textContent||"").replace(/\s+/g," ").trim();return E(e&&e.length<101?e:t.getAttribute("aria-label")||t.getAttribute("title")||t.querySelector("img")?.getAttribute("alt")||"",100)||void 0}function He(t,e){k?.(),ot=void 0;let n=c.activeElement,i=new MutationObserver(()=>k?.()),r=setTimeout(R(()=>{k?.();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);k=()=>{i.disconnect(),clearTimeout(r),k=void 0},i.observe(c,{subtree:!0,childList:!0,attributes:!0,characterData:!0})}function ze(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 i=e.closest("a,button,summary,input,[data-datacub-name],[role=button],[role=link],[role=menuitem],[role=tab]"),r=!i&&!/^(?:canvas|video)$/.test(e.localName)&&getComputedStyle(e).cursor==="pointer",s=i||e,o={$t:s.localName,$n:ke(e),$g:Me(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((i||r)&&O.text!==!1)o.$l=De(s);if(i){let a=i.getAttribute("role");if(a&&/^(?:button|link|menuitem|tab)$/.test(a))o.$r=a;if(i.localName==="input")o.$y=i.type;if(i.localName==="a"&&i.hasAttribute("href"))o.$h=q(i.href)?.url;p("$click",o)}if(_e&&n.detail===3&&!(s.textContent?.trim()&&getSelection()?.isCollapsed===!1))p("$rageclick",{...o});if((i||r)&&!n.metaKey&&!n.ctrlKey&&!n.shiftKey&&!s.closest("[target=_blank],[download]"))He(o,t)}var vt=(t)=>({$f:ke(t),$a:q(new URL(t.getAttribute("action")||"",location.href).href)?.url,$i:t.querySelectorAll("input,select,textarea").length});function Be(t){let e=t.target;if(ot=t,!l||e.localName!=="form"||e.closest(kt))return;p("$form_submit",vt(e))}var ve=(t)=>{let e=t.target.form;return l&&e&&O.forms!==!1&&!e.closest(kt)?e:null},re=new WeakSet;function Ge(t){k?.();let e=ve(t);if(e&&!re.has(e))re.add(e),p("$form_start",vt(e))}var tt=new Map;function Ve(t){k?.();let e=ve(t);if(!e)return;let n=tt.get(e)||0;if(tt.set(e,n+1),!n)setTimeout(R(()=>{if(Vt("i",10))p("$form_invalid",{...vt(e),$iv:tt.get(e)});tt.delete(e)}))}var oe=(t)=>t.replace(/https?:\/\/[^\s'"<>()]+/g,(e)=>{let n=/(?::\d+){1,2}$/.exec(e)?.[0]||"";return(q(e.slice(0,e.length-n.length))?.url??"")+n});function qt(t,e,n,i,r){let s=`${i}`.startsWith(S.slice(0,-5));if(!l||O.errors===!1||t==="resource"&&(!r||s))return;et++;let o=e&&typeof e==="object"?e:{},a=E(oe(`${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"?E(oe(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}${
|
|
4
|
-
`)[0]}${
|
|
3
|
+
`)),1000):void 0,g=`${t}${o.name}${a}${d?.split(`
|
|
4
|
+
`)[0]}${i}`;if(Nt.has(g)||!Vt("e",20))return;Nt.add(g),p("$error",{$ek:t,$en:typeof o.name==="string"?E(o.name,64):void 0,$em:a||void 0,$es:d||void 0,$eu:i?q(`${i}`)?.url:void 0,$et:r})}function Ee(t,e,n,i,r){if(!l||O.network===!1)return;let s=new URL(e,location.href).href;if(s.startsWith(S.slice(0,-5)))return;nt++;let o=x()-i,a=r==="AbortError"?"abort":r?"network_error":n>399?"http_error":o>2999&&"slow";if(!a)return;if(a!=="slow"&&a!=="abort")it++;if(Vt("r",30))p("$request",{$nm:`${t}`.toUpperCase().slice(0,10),$nu:q(s)?.url,$ns:n,$nd:o,$nk:a})}var se=R(Ee);function xe(){let t=u.length-1000;if(t>0)y+=u.splice(0,t).length}function We(){if(!Z)try{let i=(s)=>+matchMedia(`(${s})`).matches,r=navigator;Z=[screen.width,screen.height,Math.round(devicePixelRatio*100)/100,null,r.hardwareConcurrency,r.deviceMemory,r.maxTouchPoints,i("pointer:coarse")?"c":"f",i("prefers-color-scheme:dark")?"d":"l",i("prefers-reduced-motion:reduce")]}catch{Z=Array(10)}let t=navigator.connection||{},e=C.h||[];return[...Z,t.effectiveType,t.rtt,t.downlink,+t.saveData,e[0],e[1],-new Date().getTimezoneOffset()]}var Ht=(t,e)=>`${JSON.stringify([3,_t,x(),Pt,e,pe,navigator.language,!!navigator.webdriver,We()]).slice(0,-1)},${t.map((n)=>n[0])}]`;function zt(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 Xt(){if(T(),V)At=!0;if(V||yt||!u.length||!navigator.onLine)return;V=!0;let t=zt(30720),e=y;y=0;let n=0;try{let i=await gt(S,{method:"POST",body:Ht(t,e),keepalive:!0,credentials:"omit",referrerPolicy:"no-referrer"}),r=i.status;if(r===401||r===403)yt=!0,u=[];else if(r===429||r>499)n=Math.min(+(i.headers.get("Retry-After")||0),3600)*1000||-1;else if(lt=0,r>299)y+=t.length+e;else{let s=await i.json().catch(()=>0);if(s.directives?.includes("rotate_anon_id"))Kt();if(s.feedback)$t()}}catch{n=-1}V=!1;try{if(n&&l){if(u=t.concat(u),y+=e,xe(),++lt<11)T(n>0?n:Math.random()*Math.min(1000*2**lt,300000))}else if(u.length)we(At);At=!1}catch{}}function ae(){if(k?.(),$e(),T(),!V&&typeof Request==="function"&&"keepalive"in Request.prototype){let t=61440;while(u.length&&!yt&&t>2048){let e=zt(t),n=y,i=Ht(e,n);t-=i.length,y=0;let r=()=>{u=e.concat(u),y+=n,T(1000)};try{gt(S,{method:"POST",body:i,keepalive:!0,credentials:"omit",referrerPolicy:"no-referrer"}).catch(r)}catch{r();break}}}else{let t=61440;while(u.length&&!yt&&navigator.sendBeacon){let e=zt(t);if(navigator.sendBeacon(S,Ht(e,y)))y=0;else{if(u=e.concat(u),e.length<2)break;t/=2}}}if(u.length)T(1000)}function Se(t){K=t?"granted":"not_required";for(let n of he().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&&jt.test(e)?e:N(),h("datacub_id",l),_=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"?z(t.policyVersion,64):null})}if(L)Ae(...L);if(L=null,Wt(!0,!0),le&&!C.v)C.v=Pt,C.e=(n,i)=>n==="$form_fields"&&O.forms!==!1&&p(n,i),C.f=vt,window.__datacub=C,Re(`sdk/insights-${Pt}.min.js`,"sha384-7xNcWolajp48vRTTBdYbGMF2VDBSxZ5qtqZeoosFSuy8Os18qOd9cEUDuSCp9I9z")}function Re(t,e){try{let n=c.createElement("script");if(n.src=S.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(!ue||!l||ft===1)return;if(t)ft=t;if(!c.querySelector('script[src*="/v1/feedback.js"]'))Re("feedback.js")}var Xe=()=>{let t=ft;return ft=1,t!==1&&(t||[])};function Ke(t={}){if(!l&&(!Ut||t.overrideGPC))Se(t)}function qe(){K="denied",T(),u=[];for(let t of ce)for(let e of["",...he()])h(t,"",e);l=b=Y="",w=U=L=F=null,_=!1,h("datacub_optout","1")}function Ae(t,e,n){if(Bt(),w&&w!==t)Kt();if(e!==U&&_)h("datacub_a",e);if(U=e,w!==t){if(w=t,_)h("datacub_u",t);n.$A=l}for(let i in n)return p(n.$A?"$identify":"$set",n,0,!0)}function Ye(t,e){if(t&&typeof t==="object")e=t,t=e.id??e.userId??e.user_id;let n=[l,b,Y],i=St(t,n),r=e?.account==null?null:St(e.account,n);if(!i||e?.account!=null&&!r)return wt("bad id");let s=e&&H(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)Ae(i,r,s);else if(K==="pending")L=[i,r,s]}function Kt(){if(L=null,!l)return;if(Xt(),l=N(),w=U=null,b="",_){h("datacub_id",l);for(let t of ce.slice(1))h(t,"")}}function Je(t,e={}){if(fe=/^(?: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,_t=t,W=`_${t.replace(/^pk_[a-z]+_/,"").slice(0,8)}`,S=`${n.origin}${n.pathname.replace(/\/+$/,"")}/v1/batch`,Ft=e.hashRouting===!0,pe=typeof e.release==="string"&&!B(e.release)?e.release.slice(0,64):null,O=e.capture&&typeof e.capture==="object"&&e.capture||{},le=e.insights!==!1,ue=e.feedback!==!1,de=e.feedback?.look,f(c,"click",(i)=>i.target?.closest?.("[data-datacub-feedback]")&&$t(["feedback",[]])),gt=fetch,Ut=navigator.globalPrivacyControl===!0,Ut||X().datacub_optout)qe();else if(!e.requireConsent)Se();if(_e=e.rageClicks!==!1,e.autocapture!==!1)f(c,"click",ze),f(c,"submit",Be),f(c,"input",Ge),f(c,"invalid",Ve);for(let i of["pointerdown","keydown","scroll"])f(c,i,(r)=>{let s=x();if(r.target===c)ut();if(i==="scroll")k?.();if(b&&c.visibilityState==="visible"&&s-ne>5000)ne=s,Bt(),ye(s,!0)});f(c,"visibilitychange",()=>{if(Gt(),c.visibilityState==="hidden")ae()}),ut(),f(window,"resize",ut),f(window,"pagehide",ae),f(window,"pageshow",(i)=>i.persisted&&Wt(!0)),f(window,"online",Xt),f(window,"popstate",Rt("pop")),f(window,"hashchange",Rt("hash"));for(let i of["pushState","replaceState"]){let r=history[i];history[i]=function(...s){r.apply(this,s),Rt(i==="pushState"?"push":"replace")()}}try{f(window,"error",(o)=>o instanceof ErrorEvent?qt("js",o.error,o.message,o.filename):qt("resource",0,"",o.target.src||o.target.href,o.target.localName)),f(window,"unhandledrejection",(o)=>qt("rejection",o.reason)),window.fetch=function(...o){let a=gt.apply(this,o);try{let d=x(),g=o[0],m=`${g.url||g}`,D=o[1]?.method||g.method||"GET";return a.then((I)=>{try{se(D,I.url||m,I.type==="opaque"?200:I.status,d)}catch{}return I},(I)=>{throw se(D,m,0,d,I?.name||"Error"),I})}catch{}return a};let i=XMLHttpRequest.prototype,{open:r,send:s}=i;i.open=function(...o){return this._x=o,r.apply(this,o)},i.send=function(...o){if(this._x&&!this._t)for(let a of["load","error","abort","timeout"])f(this,a,()=>Ee(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 P=(t)=>R((...e)=>{if(typeof window>"u")return;if(dt)t(...e);else if(Dt.length<100)Dt.push([t,e])}),Tt=(t,e)=>l?fetch(S.replace(/batch$/,`feedback${t}`),{method:"POST",body:JSON.stringify({api_key:_t,anon_id:l,...e}),credentials:"omit",keepalive:!0}).then((n)=>n.ok?n.json():{}).catch(()=>({})):Promise.resolve({}),Ot=(t,e)=>t?{$question_id:t,$version:e.version}:{},It=(t,e,n)=>(t.ok&&p(e,n,{},!0),!!t.ok),Ze={init:R((t,e)=>{if(typeof window>"u"||!globalThis.crypto?.getRandomValues)return;c=document;let n=R(()=>{Je(t,e);for(let[i,r]of Dt.splice(0))if(dt)i(...r)});if(c.prerendering)f(c,"prerenderingchange",n);else n()}),track:P(Ue),identify:P(Ye),reset:P(Kt),consent:{grant:P(Ke),revoke:P(qe)},ask:P((...t)=>$t(["ask",t])),feedback:Object.assign(P(()=>$t(["feedback",[]])),{shown:(t)=>Tt("/seen",{question:t,kind:"shown",user_id:w}).then((e)=>It(e,"$feedback_shown",Ot(t,e))),send:(t)=>{let e=N();return Tt("/answer",{id:e,question:t?.question??null,version:null,user_id:w,session_id:b||null,choice:t?.choice??null,text:t?.text??null,path:F?.path??null}).then((n)=>It(n,"$feedback_answered",{...Ot(t.question,n),$response_id:e,$choice:t.choice??null}))},dismissed:(t)=>void Tt("/seen",{question:t,kind:"dismissed"}).then((e)=>It(e,"$feedback_dismissed",Ot(t,e)))}),_fb:()=>[K,_,_t,S,l,w,b,p,Xe,de]},M=Ze;var Et=window;if(!Et.datacub?._fb){let t=Array.isArray(Et.datacub)?Et.datacub:[],e=document.currentScript,n=e?.dataset,i=e?.src?new URL(e.src).origin:void 0,r=M.init;M.init=(o,a)=>{let d=a?.apiHost||i;return r(o,d?{...a,apiHost:d}:a)},Et.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,...d]=o,g=String(a).split(".").reduce((m,D)=>m&&Object.hasOwn(m,D)?m[D]:void 0,M);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(`
|
|
2
|
-
`).filter((
|
|
3
|
-
`)),1000):void 0,
|
|
4
|
-
`)[0]}${
|
|
1
|
+
var v={n:0},_e=(e)=>e.replace(/[\u0660-\u0669\u06f0-\u06f9\uff10-\uff19]/g,(t)=>String(t.charCodeAt(0)&15)),Tt=/[\s./()\u0640\u066b\u066c\u2010-\u2015\u200b-\u200f\u061c\u202a-\u202e\u2066-\u2069\ufeff-]/g,Ke=(e)=>_e(e).replace(Tt,""),At=/\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(e){let t="",n=0;for(let i of _e(e).matchAll(At)){if(/^[0-9a-f]{8}-/i.test(i[0])&&i[0].length===36)continue;t+=`${e.slice(n,i.index)}[redacted]`,n=i.index+i[0].length,v.n++}return t+e.slice(n)}function D(e,t=1024){if(e=e.normalize("NFC"),e.length>256||e.trim().split(/\s+/).length>11)return v.n++,"[redacted]";return K(e).slice(0,t).replace(/[\uD800-\uDBFF]$/,"")}var z=(e)=>/[\u0000-\u001f\u007f-\u009f\u200e\u200f\u061c\u202a-\u202e\u2066-\u2069]/.test(e),qt=/(?: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 Ye(e,t){let n=e.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!e||[...e].length>200||/\./.test(e)||z(e)||/^(?:__proto__|constructor|prototype)$/.test(e)||t&&/^(?:\$|(?:distinct_id|person_id|project_id|timestamp|uuid|ip|api_key)$)/.test(e)||qt.test(n.join(""))&&!/^(?:japan|span|timespan|lifespan|wingspan|saucepan|spin|chopin|android)$/.test(n[n.length-1])||n.some((i)=>/^(?:password|passwd|pwd|passcode|otp|pin|secret|iqama|ssn|cvv|cvc|iban)$/.test(i))}function M(e,t=0){if(typeof e==="string")return D(e);if(typeof e==="number")return Number.isFinite(e)?Number.isInteger(e)&&K(`${e}`)!==`${e}`?"[redacted]":e:void 0;if(typeof e==="boolean"||e===null)return e;if(e instanceof Date)return Number.isNaN(+e)?void 0:e.toISOString();if(typeof e!=="object")return;if(t>2)return"[depth]";if(Array.isArray(e))return e.slice(0,100).map((r)=>M(r,t+1)).filter((r)=>r!==void 0);let n=Object.getPrototypeOf(e);if(n!==Object.prototype&&n)return;let i={};for(let[r,s]of Object.entries(e).slice(0,200)){let o=r.trim();if(Ye(o,!t))v.n++;else{let a=M(s,t+1);if(a!==void 0)i[o]=a}}return i}function Je(e){let t=e;try{t=decodeURIComponent(e)}catch{}t=_e(t);let n=v.n;if(K(t)!==t)return v.n=n+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 i=t.replace(/\D/g,"").length;return i&&(i===t.length||i>3&&i*2>=t.length)?":id":e}var Pt=/^(?: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,It=(e)=>/^(?:[a-z0-9][a-z0-9._~-]*|[A-Z0-9][A-Z0-9_-]*)$/.test(e)&&!(e.length>=8&&/\d/.test(e)&&/[a-z]/i.test(e)),E=(e,t)=>K(e.normalize("NFC")).slice(0,t),Xe=(e)=>e.split("/").map((t)=>t&&Je(t)).join("/");function T(e,t,n){let i;try{i=new URL(e)}catch{return null}let r=i.protocol;if(/^(?:mailto|tel|sms|whatsapp):$/.test(r))return{url:r,path:r};if(!/^https?:$/.test(r))return null;let s=Xe(i.pathname);if(t&&/^#!?\//.test(i.hash))s+=`#${Xe(i.hash.slice(1).split("?")[0])}`;s=s.slice(0,1024);let o={url:(i.origin+s).slice(0,2048),path:s};for(let[a,p]of i.searchParams){let b=a.toLowerCase();if(/^utm_(?:source|medium|campaign|term|content)$/.test(b)&&p)o.utm={...o.utm,[b.slice(4)]:D(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 w=Je(p);o.q??={},o.q[E(a,64)]=Ye(a,!1)||Pt.test(a)||p.length>40||!(w[0]===":"||It(p))?"":w===":redacted"?"":w}}return o}function Ze(e){let t=e.trim().normalize("NFC");return!t||[...t].length>100||t[0]==="$"||z(t)||/[0-9a-f]{8}-[0-9a-f]{4}-|[0-9a-f]{16}|@/i.test(t)||/\d{6}/.test(Ke(t))?null:t}function ve(e,t){if(typeof e==="number"&&Number.isFinite(e))e=`${e}`;if(typeof e!=="string")return null;let n=e.trim().normalize("NFC"),i=Ke(n),r=0;for(let s=0;s<i.length;s++){let o=+i[i.length-1-s];r+=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(i)||/^[2-6]\d{14,15}$/.test(i)&&r%10===0||t.includes(n)?null:n}var qe="0.8.0",Qe=1800000,Nt=86400000,jt=34560000,Pe=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/,$e=".datacub-no-capture,[data-datacub-no-capture]",st=["datacub_id","datacub_u","datacub_a","datacub_ss"],l,ce=!1,P={},at=!0,lt=!0,ct,ue=0,Ie=0,Q=0,ee=0,te=0,ne={},Ne=new Set,je,j=0,de=0,k,ie,fe,Y,O={},ut=!1,we="",S="",Oe=!1,dt=null,W="pending",Ce=!1,_=!1,G="",pe="",c="",y=null,U=null,L=null,g="",re=0,A=0,ft,H=0,X="",F=null,Ot=0,oe=0,ge=0,me=0,pt="",se=!0,J,et=0,u=[],Le,gt=!1,tt="",B=!1,ae=0,be=!1,h=0,Fe=[],x=Date.now;function he(e){if(ut)console.warn(`[datacub] ${e}`)}var R=(e)=>(...t)=>{try{e(...t)}catch{}},d=(e,t,n)=>e.addEventListener(t,R(n),!0);function C(e){let t=crypto.getRandomValues(new Uint8Array(16));for(let i=5,r=e;e&&i>=0;i--,r=Math.floor(r/256))t[i]=r&255;return t[6]=t[6]&15|(e?112:64),t[8]=t[8]&63|128,Array.from(t,(i)=>(i+256).toString(16).slice(1)).join("").replace(/(.{8})(.{4})(.{4})(.{4})/,"$1-$2-$3-$4-")}function V(){let e={};try{for(let t of l.cookie.split("; ")){let n=t.indexOf("="),i=t.slice(0,n);if(i==="datacub_optout"||G&&i.endsWith(G))e[i==="datacub_optout"?i:i.slice(0,-G.length)]=decodeURIComponent(t.slice(n+1))}}catch{}return e}function m(e,t,n=pe,i=t?jt:0){try{l.cookie=`${e==="datacub_optout"?e:e+G}=${encodeURIComponent(t||"")};Path=/;Max-Age=${i};SameSite=Lax${n}${location.protocol==="https:"?";Secure":""}`}catch{}}function mt(){let e=location.hostname.split(".");return/^[\d.]+$|:/.test(location.hostname)?[]:e.slice(0,-1).map((t,n)=>`;Domain=${e.slice(n).join(".")}`)}function De(){if(!_)return;let e=V(),t=e.datacub_id??null;if(t!==c)c=t&&Pe.test(t)?t:C(),m("datacub_id",c),g="";y=e.datacub_u??null,U=e.datacub_a??null;let[n,i,r]=(e.datacub_ss||"").split(".");if(ft=n,H=+r,n&&Pe.test(n)&&H&&(n!==g||H>A))g=n,re=+i,A=H}function bt(e,t){if(!g||e-A>Qe||e-re>Nt){if(g=C(x()),re=A=e,_)m("datacub_id",c)}else if(t&&e>A)A=e;if(_&&(ft!==g||A-H>5000))m("datacub_ss",`${g}.${re}.${A}`,pe,Qe/1000)}function q(e){clearTimeout(Le),gt=e===0,Le=e==null?void 0:setTimeout(R(Ge),e)}function ht(e){if((e||u.length>19||l.visibilityState==="hidden")&&!gt&&!ae)q(0);else if(!Le)q(5000)}var Ct=new TextEncoder;function f(e,t,n,i){if(!c)return;let r=x();if(De(),bt(r,!/^\$(?:pageleave|error|request|form_fields)$/.test(e)),v.n)t={...t,$d:v.n};let s=JSON.stringify([C(r),e,r,c,y,U,g,X||null,Ot++,+(W==="granted"),+_,F?.url,pt,t,n]),o=Ct.encode(s).length;if(o>31000){h++;return}v.n=0,u.push([s,o]),vt(),ht(i)}function Lt(e,t){if(!c||typeof e!=="string")return;let n=Ze(e);if(!n)return he("bad name");f(n,t&&typeof t==="object"&&!Array.isArray(t)&&M(t)||{})}function ze(e=x()){if(oe)ge+=e-oe;oe=l.visibilityState==="visible"?e:0}var le=()=>{j=innerWidth,de=innerHeight,pt=j<360?"xs":j<480?"s":j<768?"m":j<1280?"l":"xl",me=Math.max(me,scrollY+de)};function He(e,t){return ne[e]=(ne[e]||0)+1,ne[e]<=t}function yt(){if(!X)return;ze();let e=ge-Ie;if(se&&e<1)return;let t=l.documentElement.scrollHeight,n={$v:e,$s:t?me/t:null};if(se)n.$e=!0;if(Q)n.$ec=Q;if(ee)n.$rq=ee;if(te)n.$rf=te;Q=ee=te=0;try{Object.assign(n,O.l?.())}catch{}se=!0,Ie=ge,f("$pageleave",n)}function Be(e,t){if(!c)return;let n=location.pathname+(Oe?location.hash.split("?")[0]:"");if(!e&&n===tt)return;let i=T(location.href,Oe,P.query!==!1);if(!i)return;tt=n,yt();let r={};if(F)r.$p=F.path;if(e&&!t)r.$b=!0;if(r.$N=t?performance.getEntriesByType?.("navigation")[0]?.type:e?"back_forward":je,i.q)r.$q=i.q;if(P.title!==!1&&l.title)r.$T=E(l.title,200);F=i,X=C(x()),se=!1,ge=me=oe=Ie=0,ne={},Ne.clear(),ze(),le(),r.$vw=j,r.$vh=de;let s=null;if(t)try{let o=new URL(l.referrer);s=o.hostname,r.$R=T(o.href)?.path}catch{}f("$pageview",r,[i.utm,i.click_id_type,s],t)}var Ee=(e)=>()=>{if(!(J&&e==="replace"&&je==="push"))je=e;k?.(),clearTimeout(J),J=setTimeout(R(()=>{J=void 0,Be()}),100)},$t=(e)=>{let t=e.closest("[data-datacub-name]")?.getAttribute("data-datacub-name");return t?D(t,100):null},wt=!0;function Ft(e){let t="";for(let n=0;e&&n<10&&e!==l.body;n++,e=e.parentElement){let i=1;for(let o=e.previousElementSibling;o;o=o.previousElementSibling)if(o.localName===e.localName)i++;let r=e.id,s=e.getAttribute("data-datacub-name");t=`${e.localName}${r&&!/\d{4}|[\da-f]{8}|^:|radix-|headlessui-|mui-|ember\d|react-select/i.test(r)?`#${E(r,64)}`:""}${i>1?`:${i}`:""}${s?`[${E(s,64)}]`:""}${t&&">"}${t}`}return t.slice(-512)}function Ut(e){let t=e.querySelector(`input,textarea,select,[contenteditable],${$e}`)?"":(e.textContent||"").replace(/\s+/g," ").trim();return E(t&&t.length<101?t:e.getAttribute("aria-label")||e.getAttribute("title")||e.querySelector("img")?.getAttribute("alt")||"",100)||void 0}function Mt(e,t){k?.(),ie=void 0;let n=l.activeElement,i=new MutationObserver(()=>k?.()),r=setTimeout(R(()=>{k?.();let s=t.target.closest('a[href]:not([href^="javascript:"]):not([href^="#"])');if(l.activeElement===n&&!(s&&!t.defaultPrevented)&&!(ie&&!ie.defaultPrevented))f("$deadclick",e)}),1000);k=()=>{i.disconnect(),clearTimeout(r),k=void 0},i.observe(l,{subtree:!0,childList:!0,attributes:!0,characterData:!0})}function Dt(e){let t=e.target,n=e;if(!c||!(t instanceof Element)||t.closest(`${$e},input:not([type=submit]):not([type=button]),textarea,select,[contenteditable]:not([contenteditable=false])`))return;let i=t.closest("a,button,summary,input,[data-datacub-name],[role=button],[role=link],[role=menuitem],[role=tab]"),r=!i&&!/^(?:canvas|video)$/.test(t.localName)&&getComputedStyle(t).cursor==="pointer",s=i||t,o={$t:s.localName,$n:$t(t),$g:Ft(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/de*100);if((i||r)&&P.text!==!1)o.$l=Ut(s);if(i){let a=i.getAttribute("role");if(a&&/^(?:button|link|menuitem|tab)$/.test(a))o.$r=a;if(i.localName==="input")o.$y=i.type;if(i.localName==="a"&&i.hasAttribute("href"))o.$h=T(i.href)?.url;f("$click",o)}if(wt&&n.detail===3&&!(s.textContent?.trim()&&getSelection()?.isCollapsed===!1))f("$rageclick",{...o});if((i||r)&&!n.metaKey&&!n.ctrlKey&&!n.shiftKey&&!s.closest("[target=_blank],[download]"))Mt(o,e)}var ke=(e)=>({$f:$t(e),$a:T(new URL(e.getAttribute("action")||"",location.href).href)?.url,$i:e.querySelectorAll("input,select,textarea").length});function zt(e){let t=e.target;if(ie=e,!c||t.localName!=="form"||t.closest($e))return;f("$form_submit",ke(t))}var kt=(e)=>{let t=e.target.form;return c&&t&&P.forms!==!1&&!t.closest($e)?t:null},nt=new WeakSet;function Ht(e){k?.();let t=kt(e);if(t&&!nt.has(t))nt.add(t),f("$form_start",ke(t))}var Z=new Map;function Bt(e){k?.();let t=kt(e);if(!t)return;let n=Z.get(t)||0;if(Z.set(t,n+1),!n)setTimeout(R(()=>{if(He("i",10))f("$form_invalid",{...ke(t),$iv:Z.get(t)});Z.delete(t)}))}var it=(e)=>e.replace(/https?:\/\/[^\s'"<>()]+/g,(t)=>{let n=/(?::\d+){1,2}$/.exec(t)?.[0]||"";return(T(t.slice(0,t.length-n.length))?.url??"")+n});function xe(e,t,n,i,r){let s=`${i}`.startsWith(S.slice(0,-5));if(!c||P.errors===!1||e==="resource"&&(!r||s))return;Q++;let o=t&&typeof t==="object"?t:{},a=E(it(`${o.message??n??(t&&t!==o?t:"")}`).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"?E(it(o.stack.split(`
|
|
2
|
+
`).filter((w)=>/:\d+:\d+/.test(w)).slice(0,5).map((w)=>w.trim().replace(/@(?=https?:)/," ")).join(`
|
|
3
|
+
`)),1000):void 0,b=`${e}${o.name}${a}${p?.split(`
|
|
4
|
+
`)[0]}${i}`;if(Ne.has(b)||!He("e",20))return;Ne.add(b),f("$error",{$ek:e,$en:typeof o.name==="string"?E(o.name,64):void 0,$em:a||void 0,$es:p||void 0,$eu:i?T(`${i}`)?.url:void 0,$et:r})}function _t(e,t,n,i,r){if(!c||P.network===!1)return;let s=new URL(t,location.href).href;if(s.startsWith(S.slice(0,-5)))return;ee++;let o=x()-i,a=r==="AbortError"?"abort":r?"network_error":n>399?"http_error":o>2999&&"slow";if(!a)return;if(a!=="slow"&&a!=="abort")te++;if(He("r",30))f("$request",{$nm:`${e}`.toUpperCase().slice(0,10),$nu:T(s)?.url,$ns:n,$nd:o,$nk:a})}var rt=R(_t);function vt(){let e=u.length-1000;if(e>0)h+=u.splice(0,e).length}function Gt(){if(!Y)try{let i=(s)=>+matchMedia(`(${s})`).matches,r=navigator;Y=[screen.width,screen.height,Math.round(devicePixelRatio*100)/100,null,r.hardwareConcurrency,r.deviceMemory,r.maxTouchPoints,i("pointer:coarse")?"c":"f",i("prefers-color-scheme:dark")?"d":"l",i("prefers-reduced-motion:reduce")]}catch{Y=Array(10)}let e=navigator.connection||{},t=O.h||[];return[...Y,e.effectiveType,e.rtt,e.downlink,+e.saveData,t[0],t[1],-new Date().getTimezoneOffset()]}var Ue=(e,t)=>`${JSON.stringify([3,we,x(),qe,t,dt,navigator.language,!!navigator.webdriver,Gt()]).slice(0,-1)},${e.map((n)=>n[0])}]`;function Me(e){let t=0,n=200;while(t<u.length&&t<100){if(n+=u[t][1]+1,n>e)break;t++}return u.splice(0,t||1)}var Se=!1;async function Ge(){if(q(),B)Se=!0;if(B||be||!u.length||!navigator.onLine)return;B=!0;let e=Me(30720),t=h;h=0;let n=0;try{let i=await fe(S,{method:"POST",body:Ue(e,t),keepalive:!0,credentials:"omit",referrerPolicy:"no-referrer"}),r=i.status;if(r===401||r===403)be=!0,u=[];else if(r===429||r>499)n=Math.min(+(i.headers.get("Retry-After")||0),3600)*1000||-1;else if(ae=0,r>299)h+=e.length+t;else{let s=await i.json().catch(()=>0);if(s.directives?.includes("rotate_anon_id"))Ve();if(s.feedback)ye()}}catch{n=-1}B=!1;try{if(n&&c){if(u=e.concat(u),h+=t,vt(),++ae<11)q(n>0?n:Math.random()*Math.min(1000*2**ae,300000))}else if(u.length)ht(Se);Se=!1}catch{}}function ot(){if(k?.(),yt(),q(),!B&&typeof Request==="function"&&"keepalive"in Request.prototype){let e=61440;while(u.length&&!be&&e>2048){let t=Me(e),n=h,i=Ue(t,n);e-=i.length,h=0;let r=()=>{u=t.concat(u),h+=n,q(1000)};try{fe(S,{method:"POST",body:i,keepalive:!0,credentials:"omit",referrerPolicy:"no-referrer"}).catch(r)}catch{r();break}}}else{let e=61440;while(u.length&&!be&&navigator.sendBeacon){let t=Me(e);if(navigator.sendBeacon(S,Ue(t,h)))h=0;else{if(u=t.concat(u),t.length<2)break;e/=2}}}if(u.length)q(1000)}function Et(e){W=e?"granted":"not_required";for(let n of mt().reverse())if(m("datacub_tld","1",n,9),V().datacub_tld){m("datacub_tld","",n),pe=n;break}let t=V().datacub_id;if(c=t&&Pe.test(t)?t:C(),m("datacub_id",c),_=V().datacub_id===c,e){for(let n of["",pe])m("datacub_optout","",n);f("$consent",{$m:/^(?:banner|settings|api|cmp)$/.test(`${e.method}`)?e.method:"api",$P:typeof e.policyVersion==="string"?D(e.policyVersion,64):null})}if(L)Rt(...L);if(L=null,Be(!0,!0),at&&!O.v)O.v=qe,O.e=(n,i)=>n==="$form_fields"&&P.forms!==!1&&f(n,i),O.f=ke,window.__datacub=O,xt(`sdk/insights-${qe}.min.js`,"sha384-7xNcWolajp48vRTTBdYbGMF2VDBSxZ5qtqZeoosFSuy8Os18qOd9cEUDuSCp9I9z")}function xt(e,t){try{let n=l.createElement("script");if(n.src=S.slice(0,-5)+e,n.async=!0,n.referrerPolicy="no-referrer",t)n.integrity=t,n.crossOrigin="anonymous";n.setAttribute("fetchpriority","low"),(l.head||l.documentElement).append(n)}catch{}}function ye(e){if(!lt||!c||ue===1)return;if(e)ue=e;if(!l.querySelector('script[src*="/v1/feedback.js"]'))xt("feedback.js")}var Vt=()=>{let e=ue;return ue=1,e!==1&&(e||[])};function Wt(e={}){if(!c&&(!Ce||e.overrideGPC))Et(e)}function St(){W="denied",q(),u=[];for(let e of st)for(let t of["",...mt()])m(e,"",t);c=g=X="",y=U=L=F=null,_=!1,m("datacub_optout","1")}function Rt(e,t,n){if(De(),y&&y!==e)Ve();if(t!==U&&_)m("datacub_a",t);if(U=t,y!==e){if(y=e,_)m("datacub_u",e);n.$A=c}for(let i in n)return f(n.$A?"$identify":"$set",n,0,!0)}function Xt(e,t){if(e&&typeof e==="object")t=e,e=t.id??t.userId??t.user_id;let n=[c,g,X],i=ve(e,n),r=t?.account==null?null:ve(t.account,n);if(!i||t?.account!=null&&!r)return he("bad id");let s=t&&M(t)||{};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()}`]=t[o];delete s[o]}}if(c)Rt(i,r,s);else if(W==="pending")L=[i,r,s]}function Ve(){if(L=null,!c)return;if(Ge(),c=C(),y=U=null,g="",_){m("datacub_id",c);for(let e of st.slice(1))m(e,"")}}function Kt(e,t={}){if(ut=/^(?:localhost|127\.0\.0\.1|\[::1\])$|\.(?:localhost|test)$/.test(location.hostname),ce||typeof e!=="string")return;if(/^sk_/.test(e))return console.error("[datacub] refused a secret key. Use your project ID.");let n;try{n=new URL(t.apiHost||"https://in.datacub.to",location.href)}catch{}if(!/^(?:pk_(?:live|test)_[A-Za-z0-9]{24,48}|[a-z0-9]{8})$/.test(e))return he("init: bad key");if(!n||n.username||n.password||!(n.protocol==="https:"||n.protocol==="http:"&&/^(?:localhost|127\.0\.0\.1)$/.test(n.hostname)))return he("init: bad apiHost");if(ce=!0,we=e,G=`_${e.replace(/^pk_[a-z]+_/,"").slice(0,8)}`,S=`${n.origin}${n.pathname.replace(/\/+$/,"")}/v1/batch`,Oe=t.hashRouting===!0,dt=typeof t.release==="string"&&!z(t.release)?t.release.slice(0,64):null,P=t.capture&&typeof t.capture==="object"&&t.capture||{},at=t.insights!==!1,lt=t.feedback!==!1,ct=t.feedback?.look,d(l,"click",(i)=>i.target?.closest?.("[data-datacub-feedback]")&&ye(["feedback",[]])),fe=fetch,Ce=navigator.globalPrivacyControl===!0,Ce||V().datacub_optout)St();else if(!t.requireConsent)Et();if(wt=t.rageClicks!==!1,t.autocapture!==!1)d(l,"click",Dt),d(l,"submit",zt),d(l,"input",Ht),d(l,"invalid",Bt);for(let i of["pointerdown","keydown","scroll"])d(l,i,(r)=>{let s=x();if(r.target===l)le();if(i==="scroll")k?.();if(g&&l.visibilityState==="visible"&&s-et>5000)et=s,De(),bt(s,!0)});d(l,"visibilitychange",()=>{if(ze(),l.visibilityState==="hidden")ot()}),le(),d(window,"resize",le),d(window,"pagehide",ot),d(window,"pageshow",(i)=>i.persisted&&Be(!0)),d(window,"online",Ge),d(window,"popstate",Ee("pop")),d(window,"hashchange",Ee("hash"));for(let i of["pushState","replaceState"]){let r=history[i];history[i]=function(...s){r.apply(this,s),Ee(i==="pushState"?"push":"replace")()}}try{d(window,"error",(o)=>o instanceof ErrorEvent?xe("js",o.error,o.message,o.filename):xe("resource",0,"",o.target.src||o.target.href,o.target.localName)),d(window,"unhandledrejection",(o)=>xe("rejection",o.reason)),window.fetch=function(...o){let a=fe.apply(this,o);try{let p=x(),b=o[0],w=`${b.url||b}`,We=o[1]?.method||b.method||"GET";return a.then((I)=>{try{rt(We,I.url||w,I.type==="opaque"?200:I.status,p)}catch{}return I},(I)=>{throw rt(We,w,0,p,I?.name||"Error"),I})}catch{}return a};let i=XMLHttpRequest.prototype,{open:r,send:s}=i;i.open=function(...o){return this._x=o,r.apply(this,o)},i.send=function(...o){if(this._x&&!this._t)for(let a of["load","error","abort","timeout"])d(this,a,()=>_t(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=(e)=>R((...t)=>{if(typeof window>"u")return;if(ce)e(...t);else if(Fe.length<100)Fe.push([e,t])}),Re=(e,t)=>c?fetch(S.replace(/batch$/,`feedback${e}`),{method:"POST",body:JSON.stringify({api_key:we,anon_id:c,...t}),credentials:"omit",keepalive:!0}).then((n)=>n.ok?n.json():{}).catch(()=>({})):Promise.resolve({}),Te=(e,t)=>e?{$question_id:e,$version:t.version}:{},Ae=(e,t,n)=>(e.ok&&f(t,n,{},!0),!!e.ok),Yt={init:R((e,t)=>{if(typeof window>"u"||!globalThis.crypto?.getRandomValues)return;l=document;let n=R(()=>{Kt(e,t);for(let[i,r]of Fe.splice(0))if(ce)i(...r)});if(l.prerendering)d(l,"prerenderingchange",n);else n()}),track:N(Lt),identify:N(Xt),reset:N(Ve),consent:{grant:N(Wt),revoke:N(St)},ask:N((...e)=>ye(["ask",e])),feedback:Object.assign(N(()=>ye(["feedback",[]])),{shown:(e)=>Re("/seen",{question:e,kind:"shown",user_id:y}).then((t)=>Ae(t,"$feedback_shown",Te(e,t))),send:(e)=>{let t=C();return Re("/answer",{id:t,question:e?.question??null,version:null,user_id:y,session_id:g||null,choice:e?.choice??null,text:e?.text??null,path:F?.path??null}).then((n)=>Ae(n,"$feedback_answered",{...Te(e.question,n),$response_id:t,$choice:e.choice??null}))},dismissed:(e)=>void Re("/seen",{question:e,kind:"dismissed"}).then((t)=>Ae(t,"$feedback_dismissed",Te(e,t)))}),_fb:()=>[W,_,we,S,c,y,g,f,Vt,ct]},en=Yt;export{qe as VERSION,en as default};
|
package/dist/feedback.js
CHANGED
|
@@ -1,55 +1,60 @@
|
|
|
1
|
-
(()=>{var
|
|
1
|
+
(()=>{var it={n:0},at=(o)=>o.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(o){let t="",e=0;for(let s of at(o).matchAll(Mt)){if(/^[0-9a-f]{8}-/i.test(s[0])&&s[0].length===36)continue;t+=`${o.slice(e,s.index)}[redacted]`,e=s.index+s[0].length,it.n++}return t+o.slice(e)}function lt(o){let t=o;try{t=decodeURIComponent(o)}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":o}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
|
|
5
|
-
--ff:${
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
.
|
|
9
|
-
|
|
10
|
-
.w.
|
|
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),
|
|
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(--
|
|
19
|
-
.x{position:absolute;top:10px;inset-inline-end:10px;width:28px;height:28px;border:0;border-radius:var(--ri);background:transparent;color:var(--
|
|
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:
|
|
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(--
|
|
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(--
|
|
31
|
-
.d svg{width:10px;height:10px;color:var(--
|
|
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:
|
|
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:
|
|
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(--
|
|
39
|
-
.
|
|
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:
|
|
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(--
|
|
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:.
|
|
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(--
|
|
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(o,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",o),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(o,t,e){let s=document.createElement(o);if(t)s.className=t;if(e)s.textContent=e;return s}var Z=null;function jt(o){try{if(Z??=new CSSStyleSheet,!Z.cssRules.length)Z.replaceSync(gt+(W.css??""));o.adoptedStyleSheets=[Z]}catch{o.append(u("style",void 0,gt+(W.css??"")))}}var ot=(o)=>[1,3,5].map((t)=>Number.parseInt(o.slice(t,t+2),16)),xt=(o)=>{let[t,e,s]=ot(o).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=(o,t)=>{let[e,s]=[xt(o),xt(t)].sort((l,y)=>y-l);return(e+0.05)/(s+0.05)},rt="#18181b",J="#fafafa",U=(o,t="#ffffff")=>et(o,t)>=et(o,rt)?t:rt,j=(o,t,e)=>{let s=ot(t);return`#${ot(o).map((l,y)=>Math.round(l*e+s[y]*(1-e)).toString(16).padStart(2,"0")).join("")}`},yt=(o)=>typeof o==="string"&&/^#[0-9a-f]{6}$/i.test(o)?o:null,_=(o,t,e)=>typeof t==="string"&&Object.hasOwn(o,t)?t:e,It=["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=(o,t,e)=>typeof o==="number"&&Number.isInteger(o)&&o>=t&&o<=e?o:null;function Ht(o,t){let e=(i,a)=>o.style.setProperty(i,String(a)),s=(i)=>i&&o.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(It.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",j(g,c,0.62)),e("--opt",j(g,c,0.06)),e("--opt-h",j(g,c,0.1)),e("--edge",j(g,c,0.1)),e("--x",j(g,c,0.45)),e("--line",j(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",j(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 I=d(f.selected,c,1.5)??m;e("--sel",I),e("--son",U(I));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),r=Q(t.offsetY,0,160);if(q!==null)e("--ox",`${q}px`);if(r!==null)e("--oy",`${r}px`);if(s(St[_(St,t.animation,"rise")]),t.align==="center")s("ce");if(t.scale==="traffic")s("tr"),e("--lo",j("#e5484d",c,0.18)),e("--mi",j("#f5a524",c,0.2)),e("--hi",j("#30a46c",c,0.18))}function Ot(o,t,e,s){jt(o);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),o.append(k);let v=null,b=!1,T=!1,I=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:I??l.type,h.setAttribute("aria-label",t.type==="text"?t.title:I??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&&!I)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 r=(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&&r(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 Pt(){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 Tt(o){if(Lt||typeof window>"u"||!o?._fb)return;let t=o._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[,r,i,a,n,p,x,z]=t();return r&&n?{key:i,base:a.replace(/batch$/,"feedback"),anon:n,user:p??null,sid:x||null,emit:z}:null},v=async(r,i)=>{let a=await fetch(r,{method:"POST",body:JSON.stringify(i),credentials:"omit",keepalive:!0});if(!a.ok)throw Error(String(a.status));return a.json()},b=()=>{let r=document.createElement("div");return r.setAttribute("data-datacub-feedback-widget",""),document.body.append(r),r};async function T(){let r=E();if(!r){I();return}let i=`${r.anon}|${r.user??""}`;if(i===f||Date.now()<k)return;f=i;try{let a=await v(r.base,{api_key:r.key,anon_id:r.anon,user_id:r.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 I(){M=!0,c?.close(),M=!1;for(let r of m)clearTimeout(r);m.clear()}function A(){let r=E();if(!r||c)return;let i=document.activeElement,a=/^ar\b/i.test(document.documentElement.lang)?"ar":"en";L({lang:a,type:"general",title:""},null,r,i)}function L(r,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=Ot(z,r,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(r,i,a){let n=E();if(!n||c||g)return;if(!a&&r.q.delivery?.waitForIdle!==!1&&Pt()){if(Date.now()<i)C(()=>N(r,i,a),2000);return}try{if(!(await v(`${n.base}/seen`,{api_key:n.key,anon_id:n.anon,question:r.id,kind:"shown",user_id:n.user})).ok||c||g)return}catch{return}g=!0,l=l.filter((p)=>p.id!==r.id),n.emit("$feedback_shown",{$question_id:r.id,$version:r.version},{},!0),L(r.q,r,n,null,a)}function C(r,i){let a=setTimeout(()=>{m.delete(a),r()},i);m.add(a)}let R=(r)=>C(()=>N(r,Date.now()+Et),(r.q.trigger.delay??0)*1000);function H(r,i){return i.endsWith("*")?r.startsWith(i.slice(0,-1)):r===i||r===`${i}/`}function D(){let r=location.pathname;for(let i of l)if(i.q.trigger.kind==="page"&&H(r,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=(r,i)=>{let a=o[r];o[r]=(...n)=>{a(...n);try{i(...n)}catch{}}};O("track",(r)=>{for(let i of l)if(i.q.trigger.kind==="event"&&i.q.trigger.event===String(r).trim())R(i)}),O("identify",()=>setTimeout(T,0)),O("reset",()=>setTimeout(T,0));let h=o.consent.grant;o.consent.grant=(...r)=>{h(...r),setTimeout(T,0)};let K=Promise.resolve();o.ask=(r,i)=>void K.then(()=>{let a=l.find((p)=>p.id===r&&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)}),o.feedback=Object.assign(A,o.feedback),document.addEventListener("click",(r)=>{if(r.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 r of["pushState","replaceState"]){let i=history[r];history[r]=function(...a){i.apply(this,a),w()}}addEventListener("popstate",w),setInterval(()=>{if(E())T();else if(f)f="",I()},1000),K=T();let[F,q]=s;if(F==="feedback")A();else if(F==="ask")o.ask(...q)}var At=(o=0)=>{let t=window.datacub;if(t?._fb)Tt(t);else if(o<100)setTimeout(()=>At(o+1),100)};At();})();
|
package/dist/feedback.mjs
CHANGED
|
@@ -1,55 +1,60 @@
|
|
|
1
|
-
var
|
|
1
|
+
var ie={n:0},ae=(r)=>r.replace(/[\u0660-\u0669\u06f0-\u06f9\uff10-\uff19]/g,(e)=>String(e.charCodeAt(0)&15));var Ce=/\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(r){let e="",t=0;for(let s of ae(r).matchAll(Ce)){if(/^[0-9a-f]{8}-/i.test(s[0])&&s[0].length===36)continue;e+=`${r.slice(t,s.index)}[redacted]`,t=s.index+s[0].length,ie.n++}return e+r.slice(t)}function le(r){let e=r;try{e=decodeURIComponent(r)}catch{}e=ae(e);let t=ie.n;if(_e(e)!==e)return ie.n=t+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 s=e.replace(/\D/g,"").length;return s&&(s===e.length||s>3&&s*2>=e.length)?":id":r}var ce={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"}},de="--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',pe={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}`},ue={none:[0,0],small:[6,4],medium:[12,8],large:[16,10]},fe={small:[320,13,12],medium:[360,14,16],large:[400,15,20]},ge=`
|
|
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
|
|
5
|
-
--ff:${
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
.
|
|
9
|
-
|
|
10
|
-
.w.
|
|
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{${de}}
|
|
10
|
+
@media (prefers-color-scheme:dark){.w.au{${de}}}
|
|
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),
|
|
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(--
|
|
19
|
-
.x{position:absolute;top:10px;inset-inline-end:10px;width:28px;height:28px;border:0;border-radius:var(--ri);background:transparent;color:var(--
|
|
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:
|
|
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(--
|
|
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(--
|
|
31
|
-
.d svg{width:10px;height:10px;color:var(--
|
|
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:
|
|
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:
|
|
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(--
|
|
39
|
-
.
|
|
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:
|
|
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(--
|
|
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:.
|
|
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(--
|
|
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
|
+
`,me="http://www.w3.org/2000/svg",ee={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"},be="M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18zM9 9.5v.5M15 9.5v.5",he={thumbs:[ee.up,ee.down],faces:[`${be}M8.5 14s1.3 2 3.5 2 3.5-2 3.5-2`,`${be}M8.5 16.5s1.3-2 3.5-2 3.5 2 3.5 2`],emoji:[],words:[]},W={};function G(r,e=16,t=1.6){let s=document.createElementNS(me,"svg");s.setAttribute("viewBox",`0 0 ${e} ${e}`),s.setAttribute("aria-hidden","true"),s.setAttribute("fill","none");let l=document.createElementNS(me,"path");return l.setAttribute("d",r),l.setAttribute("stroke","currentColor"),l.setAttribute("stroke-width",String(t)),l.setAttribute("stroke-linecap","round"),l.setAttribute("stroke-linejoin","round"),s.append(l),s}function u(r,e,t){let s=document.createElement(r);if(e)s.className=e;if(t)s.textContent=t;return s}var Z=null;function Me(r){try{if(Z??=new CSSStyleSheet,!Z.cssRules.length)Z.replaceSync(ge+(W.css??""));r.adoptedStyleSheets=[Z]}catch{r.append(u("style",void 0,ge+(W.css??"")))}}var oe=(r)=>[1,3,5].map((e)=>Number.parseInt(r.slice(e,e+2),16)),xe=(r)=>{let[e,t,s]=oe(r).map((l)=>{let y=l/255;return y<=0.03928?y/12.92:((y+0.055)/1.055)**2.4});return 0.2126*e+0.7152*t+0.0722*s},te=(r,e)=>{let[t,s]=[xe(r),xe(e)].sort((l,y)=>y-l);return(t+0.05)/(s+0.05)},re="#18181b",J="#fafafa",U=(r,e="#ffffff")=>te(r,e)>=te(r,re)?e:re,j=(r,e,t)=>{let s=oe(e);return`#${oe(r).map((l,y)=>Math.round(l*t+s[y]*(1-t)).toString(16).padStart(2,"0")).join("")}`},ye=(r)=>typeof r==="string"&&/^#[0-9a-f]{6}$/i.test(r)?r:null,_=(r,e,t)=>typeof e==="string"&&Object.hasOwn(r,e)?e:t,ze=["accent","background","text","title","option","optionText","optionBorder","selected","button","buttonText","close","border"],we={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)"},ve={compact:[-4,4,8],regular:[0,6,12],roomy:[4,8,16]},ke={small:0,regular:1,large:4},X={regular:400,medium:500,semibold:600,bold:700},$e={top:2147483000,high:99999,normal:999},Se={rise:"",fade:"af",slide:"al",none:"a0"},Q=(r,e,t)=>typeof r==="number"&&Number.isInteger(r)&&r>=e&&r<=t?r:null;function je(r,e){let t=(i,a)=>r.style.setProperty(i,String(a)),s=(i)=>i&&r.classList.add(i),l=e.theme==="dark"||e.theme==="auto"&&typeof matchMedia==="function"&&matchMedia("(prefers-color-scheme: dark)").matches;if(e.theme==="dark")s("dk");if(e.theme==="auto")s("au");let y=(e.theme==="auto"&&l?e.dark:e)??{},f=Object.fromEntries(ze.map((i)=>[i,ye(y[i])])),d=(i,a,n=4.5)=>i&&te(i,a)>=n?i:null,k=f.background,c=k??(l?"#1c1c1f":"#ffffff"),g=d(f.text,c);if(k)g??=U(c,J),t("--bg",c),t("--mut",j(g,c,0.62)),t("--opt",j(g,c,0.06)),t("--opt-h",j(g,c,0.1)),t("--edge",j(g,c,0.1)),t("--x",j(g,c,0.45)),t("--line",j(g,c,0.25));if(g)t("--fg",g);let M=g??(l?J:re),m=f.accent??ye(e.accent)??"#1f1f1f";if(te(m,c)<1.5)m=M;t("--a",m),t("--on",U(m));let E=d(f.title,c,3);if(E)t("--tc",E);let v=d(f.close,c,3);if(v)t("--xc",v);let b=f.option;if(b)t("--opt",b),t("--opt-h",j(U(b,J),b,0.08));let T=d(f.optionText,b??c)??(b&&!d(M,b)?U(b,J):null);if(T)t("--ot",T);if(f.optionBorder)t("--ob",f.optionBorder);let I=d(f.selected,c,1.5)??m;t("--sel",I),t("--son",U(I));let A=f.button??m;if(t("--btn",A),t("--bt",d(f.buttonText,A)??U(A)),f.border)t("--edge",f.border);let L=Q(e.borderWidth,0,4);if(L!==null)t("--bw",`${L}px`);let N=we[_(we,e.shadow,"soft")];if(N)t("--sh",N);let C=_({...pe,site:0,custom:0},e.font,"site"),R=typeof e.fontName==="string"&&/^[\p{L}\p{N} -]{1,40}$/u.test(e.fontName);if(C==="site"){let i=typeof getComputedStyle==="function"&&getComputedStyle(document.body).fontFamily;if(i)t("--ff",i)}else if(C==="custom")t("--ff",R?`"${e.fontName}",${Y}`:Y);else t("--ff",pe[C]);let[H,D]=ue[_(ue,e.radius,"medium")];t("--r",`${H}px`),t("--ri",`${D}px`);let[O,h,K]=fe[_(fe,e.size,"medium")],[P,w,F]=ve[_(ve,e.density,"regular")];t("--wd",`${Q(e.width,280,480)??O}px`),t("--fs",`${h}px`),t("--pad",`${K+P}px`),t("--gap",`${w}px`),t("--mt",`${F}px`),t("--ts",`${ke[_(ke,e.titleSize,"regular")]}px`),t("--tw",X[_(X,e.titleWeight,"semibold")]),t("--fw",X[_(X,e.bodyWeight,"regular")]),t("--z",$e[_($e,e.layer,"top")]);let q=Q(e.offsetX,0,160),o=Q(e.offsetY,0,160);if(q!==null)t("--ox",`${q}px`);if(o!==null)t("--oy",`${o}px`);if(s(Se[_(Se,e.animation,"rise")]),e.align==="center")s("ce");if(e.scale==="traffic")s("tr"),t("--lo",j("#e5484d",c,0.18)),t("--mi",j("#f5a524",c,0.2)),t("--hi",j("#30a46c",c,0.18))}function Ie(r,e,t,s){Me(r);let l=ce[e.lang]??ce.en,y=typeof t.sendLabel==="string"?t.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${t.position==="start"?" s":""}${s.preview||s.inline||d?" p":""}${d?" ed":""}`);k.dir=e.lang==="ar"?"rtl":"ltr",k.lang=e.lang,je(k,t);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(ee.x)),d)m.tabIndex=-1,m.setAttribute("aria-hidden","true");let E;if(d)E=W.title(e,d,c);else E=u("p","t",e.type==="general"?l.general:e.title);E.id=g,c.append(m,E),k.append(c,M),r.append(k);let v=null,b=!1,T=!1,I=e.type==="general"?l.tell:e.followup,A=(n)=>!!e.followup&&(!e.followupOn||n!==null&&e.followupOn.includes(n)),L=e.type==="text"||e.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&&e.followup!=null?" on":""}`),D=u("div"),O=u("div","fi"),h=u("textarea");h.maxLength=1000,h.placeholder=e.type==="text"?l.type:I??l.type,h.setAttribute("aria-label",e.type==="text"?e.title:I??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&&e.followup!=null&&e.type!=="text")O.append(W.followup(e,d)),h.placeholder=l.type;if(O.append(h,K),D.append(O),H.append(D),!L&&!I)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(ee.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(e.type==="choice"&&d)c.append(W.choices(e,d));else if(e.type==="choice"){let n=u("div","g");n.setAttribute("role","group"),n.setAttribute("aria-labelledby",g);for(let p of e.options??[])n.append(i(p.id,p.label));c.append(n)}else if(e.type==="thumbs"){let n=u("div","th");n.setAttribute("role","group"),n.setAttribute("aria-labelledby",g);let p=_(he,t.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(he[p][z],24);n.append(i("up",l.yes,"o1",x(0)),i("down",l.no,"o1",x(1))),c.append(n)}else if(e.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=e.type==="general"?l.general:e.title;if(s.focus)setTimeout(()=>(L?h:N[0])?.focus(),50);if(d?.focus)W.focus(d,c);return{close:()=>R(b)}}var Ee=60000,Le=!1;function He(){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 Re(r){if(Le||typeof window>"u"||!r?._fb)return;let e=r._fb,t=e()[8],s=t?t():[];if(!s)return;Le=!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]=e();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){I();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=e()[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 I(){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=Ie(z,o,y,{focus:!i,inline:!!p,send:async(V,Te)=>{let Ae={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:Te,path:location.pathname.split("/").map(le).join("/")};for(let ne=0;;ne++)try{await v(`${a.base}/answer`,Ae);break}catch(se){if(ne>=2||/^4/.test(se.message))throw se;await new Promise((Ne)=>setTimeout(Ne,800*2**ne))}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&&He()){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()+Ee),(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()+Ee,n instanceof Element?n:null)}),r.feedback=Object.assign(A,r.feedback),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="",I()},1000),K=T();let[F,q]=s;if(F==="feedback")A();else if(F==="ask")r.ask(...q)}export{ee as ICONS,te as contrast,u as el,G as icon,Ie as mount,W as parts,Re as start};
|
package/package.json
CHANGED
package/types/datacub.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// datacub web SDK 0.
|
|
2
|
-
export declare const VERSION = "0.
|
|
1
|
+
// datacub web SDK 0.8.0, for the script tag. Save as datacub.d.ts in your project: `datacub` is then typed.
|
|
2
|
+
export declare const VERSION = "0.8.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'
|
|
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 */
|
|
@@ -93,6 +151,27 @@ export interface GrantOptions {
|
|
|
93
151
|
/** Only from an explicit user action: lets a grant override Global Privacy Control. */
|
|
94
152
|
overrideGPC?: boolean;
|
|
95
153
|
}
|
|
154
|
+
/** Your own feedback UI: datacub stores and counts it the same as its own card. */
|
|
155
|
+
export interface FeedbackApi {
|
|
156
|
+
(): void;
|
|
157
|
+
/**
|
|
158
|
+
* Call before you show a question from Feedback. true: datacub's limits allow it now, and it
|
|
159
|
+
* counts as shown. false: not now (limits, audience, paused, before consent) or offline.
|
|
160
|
+
*/
|
|
161
|
+
shown(questionId: string): Promise<boolean>;
|
|
162
|
+
/**
|
|
163
|
+
* Store an answer. With question: choice is one of its answer ids (a score '0' to '10', 'yes' or
|
|
164
|
+
* 'no'), text the written answer or follow-up. Without: general feedback, text required, choice
|
|
165
|
+
* optionally 'idea', 'problem' or 'confusing'. false when refused or offline.
|
|
166
|
+
*/
|
|
167
|
+
send(answer: {
|
|
168
|
+
question?: string;
|
|
169
|
+
choice?: string;
|
|
170
|
+
text?: string;
|
|
171
|
+
}): Promise<boolean>;
|
|
172
|
+
/** The person closed the question without answering: it is not offered to them again. */
|
|
173
|
+
dismissed(questionId: string): void;
|
|
174
|
+
}
|
|
96
175
|
export interface DatacubClient {
|
|
97
176
|
init(publicKey: string, options?: InitOptions): void;
|
|
98
177
|
track(event: string, properties?: Properties): void;
|
|
@@ -112,8 +191,11 @@ export interface DatacubClient {
|
|
|
112
191
|
ask?(questionId: string, options?: {
|
|
113
192
|
into?: Element | string;
|
|
114
193
|
}): void;
|
|
115
|
-
/**
|
|
116
|
-
|
|
194
|
+
/**
|
|
195
|
+
* Open the "Send feedback" card (the feedback widget loads first when it is not on the page yet).
|
|
196
|
+
* With your own feedback UI, use its methods instead: shown, send and dismissed.
|
|
197
|
+
*/
|
|
198
|
+
feedback?: FeedbackApi;
|
|
117
199
|
/**
|
|
118
200
|
* Added by the script-tag flags module (/v1/flags.js; with npm, import flag from @datacub/web/flags): is this feature flag on for this
|
|
119
201
|
* visitor? false when it is off, unknown, or cannot be decided (before consent, offline).
|
package/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.8.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'
|
|
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 */
|
|
@@ -92,6 +150,27 @@ export interface GrantOptions {
|
|
|
92
150
|
/** Only from an explicit user action: lets a grant override Global Privacy Control. */
|
|
93
151
|
overrideGPC?: boolean;
|
|
94
152
|
}
|
|
153
|
+
/** Your own feedback UI: datacub stores and counts it the same as its own card. */
|
|
154
|
+
export interface FeedbackApi {
|
|
155
|
+
(): void;
|
|
156
|
+
/**
|
|
157
|
+
* Call before you show a question from Feedback. true: datacub's limits allow it now, and it
|
|
158
|
+
* counts as shown. false: not now (limits, audience, paused, before consent) or offline.
|
|
159
|
+
*/
|
|
160
|
+
shown(questionId: string): Promise<boolean>;
|
|
161
|
+
/**
|
|
162
|
+
* Store an answer. With question: choice is one of its answer ids (a score '0' to '10', 'yes' or
|
|
163
|
+
* 'no'), text the written answer or follow-up. Without: general feedback, text required, choice
|
|
164
|
+
* optionally 'idea', 'problem' or 'confusing'. false when refused or offline.
|
|
165
|
+
*/
|
|
166
|
+
send(answer: {
|
|
167
|
+
question?: string;
|
|
168
|
+
choice?: string;
|
|
169
|
+
text?: string;
|
|
170
|
+
}): Promise<boolean>;
|
|
171
|
+
/** The person closed the question without answering: it is not offered to them again. */
|
|
172
|
+
dismissed(questionId: string): void;
|
|
173
|
+
}
|
|
95
174
|
export interface DatacubClient {
|
|
96
175
|
init(publicKey: string, options?: InitOptions): void;
|
|
97
176
|
track(event: string, properties?: Properties): void;
|
|
@@ -111,8 +190,11 @@ export interface DatacubClient {
|
|
|
111
190
|
ask?(questionId: string, options?: {
|
|
112
191
|
into?: Element | string;
|
|
113
192
|
}): void;
|
|
114
|
-
/**
|
|
115
|
-
|
|
193
|
+
/**
|
|
194
|
+
* Open the "Send feedback" card (the feedback widget loads first when it is not on the page yet).
|
|
195
|
+
* With your own feedback UI, use its methods instead: shown, send and dismissed.
|
|
196
|
+
*/
|
|
197
|
+
feedback?: FeedbackApi;
|
|
116
198
|
/**
|
|
117
199
|
* Added by the script-tag flags module (/v1/flags.js; with npm, import flag from @datacub/web/flags): is this feature flag on for this
|
|
118
200
|
* visitor? false when it is off, unknown, or cannot be decided (before consent, offline).
|