@mrrocket/sdk 0.13.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,7 +2,14 @@
2
2
 
3
3
  All notable changes to this package. It follows semantic versioning; before 1.0 a minor version may change an API.
4
4
 
5
- ## 0.13.0 (not published yet)
5
+ ## 0.14.0 (not published yet)
6
+
7
+ - **Paywalls with pages:** a paywall from MRRocket › Conversion › Paywalls can have several pages (benefits, customer quotes, plans), served as the config's new `paywalls` per placement. `usePaywall().open(placement, { onPurchase, plans, onClose })` (Next.js and React Native, drawn by the provider), `mrrocket.paywall.open(…)` (script tag) show them one after another with Back and dots; the last page hands the chosen plan to `onPurchase`, where the app buys it (StoreKit/Play through RevenueCat or Adapty, Stripe Checkout). MRRocket never takes a payment; only after `onPurchase` resolves is the purchase recorded (`false`: the store sheet was cancelled, the paywall stays). Resolves with `{ outcome: "purchased" | "chosen" | "closed", plan, variant, index }`.
8
+ - **Tests per page:** a running paywall test gives each person their variant's pages (`assign`) and records `$exposure` when the paywall opens. New event `$paywall {paywall, placement, variant, page, index, action: "page" | "purchased" | "closed"}`: each page once per opening, so MRRocket shows drop-off between pages; a `purchased` counts as a test's purchase conversion.
9
+ - New module `paywall` with `createPaywallHost`, `paywallPages`, `PAYWALL_EVENT` and the types `PaywallConfig`, `PaywallPage`, `PaywallPlan`, `PaywallOptions`, `PaywallResult`; React Native `client.openPaywall`, `client.paywall`, `MRRocketFlows` takes `paywall`. The web dialog (`mountPaywall`) lives in `flows-ui` / `sdk-flows.js`; `sdk.js` stays within its 14.5 KB budget.
10
+ - Version reported in event batches: `0.14.0`.
11
+
12
+ ## 0.13.0
6
13
 
7
14
  - **Attack reports, from your server only** (`@mrrocket/sdk/next/server`, `watchRequest` and `reportSuspiciousRequest` also in `@mrrocket/sdk/next/proxy`): `reportFailedLogin({ userId, account, ip, reason })`, `reportAuthDenied({ status, path, ip, userId })`, `reportSuspiciousRequest({ path, query, ip, reason })` and `watchRequest(request)` for `proxy.ts`, which reads the path and query and reports only what looks like SQL injection, XSS, path traversal or a scanner's path (`/.env`, `/.git`, `/wp-admin`, `/phpmyadmin` …); an ordinary request sends nothing. They send `$login_failed`, `$auth_denied` and `$suspicious_request` with the product's server key (`MRROCKET_SERVER_KEY`); MRRocket hashes the IP and the account name on arrival (a daily hash) and its Build agent puts a possible attack into Needs you as Important. Every helper resolves to `true`/`false` and never throws. `attackIn(path, query)` and `ipOf(headers)` are exported too.
8
15
  - Nothing changes in the browser: the script tag and the client bundle stay as they were.
package/README.md CHANGED
@@ -545,6 +545,40 @@ await reportAuthDenied({ status: 403, path: url.pathname, ip: ipOf(request.heade
545
545
 
546
546
  They send `$login_failed`, `$auth_denied` and `$suspicious_request` to `/api/sdk/events` with `server: true`. MRRocket hashes the IP and the account name on arrival (a hash that changes every day) and never stores them as sent. Every helper resolves to `true` or `false` and never throws. Using WorkOS or Auth0 webhooks for sign-in? Their failed sign-ins (WorkOS `authentication.*_failed`, Auth0 log types `f`, `fp`, `fu`, `limit_wc`, `limit_mu`) are read without any code; subscribe the webhook to those events.
547
547
 
548
+ ## 21. Paywalls with pages (0.14.0)
549
+
550
+ A paywall built in MRRocket › Conversion › Paywalls can have several pages, for example **1** what you get, **2** what customers say, **3** the plans. The SDK shows them one after another; the last page's button hands the chosen plan to your `onPurchase`, where your code buys it. **MRRocket never takes a payment**: in apps you buy through StoreKit or Google Play (RevenueCat, Adapty), on the web through Stripe Checkout.
551
+
552
+ ```tsx
553
+ // React Native / Expo: the provider draws it
554
+ const paywall = usePaywall();
555
+ const result = await paywall.open("onboarding_end", {
556
+ plans: storePlans, // optional: [{ id: "annual", name: "Annual", price: "$49.99" }] with your store's local prices
557
+ onPurchase: async (plan) => {
558
+ const { customerInfo } = await Purchases.purchasePackage(packages[plan.id]);
559
+ return !!customerInfo.entitlements.active.pro; // false: the person cancelled the store sheet, the paywall stays
560
+ },
561
+ });
562
+ // result.outcome: "purchased" | "chosen" (no onPurchase: buy result.plan yourself) | "closed"
563
+ ```
564
+
565
+ ```tsx
566
+ // Next.js / React
567
+ const paywall = usePaywall();
568
+ <button onClick={() => paywall.open("feature_gate", { onPurchase: (plan) => startCheckout(plan.id) })}>Upgrade</button>
569
+ ```
570
+
571
+ ```js
572
+ // Script tag
573
+ mrrocket.paywall.open("pricing_page", { onPurchase: (plan) => fetch("/checkout", { method: "POST", body: plan.id }) });
574
+ ```
575
+
576
+ - **Plans:** each plan's `id` is what you buy (the store product id or the Stripe price), as set on the plan in MRRocket. Throwing in `onPurchase` keeps the paywall open with "The purchase did not go through".
577
+ - **Tests:** a running paywall test gives each person their variant's pages (the same stable split as every test) and records `$exposure` when the paywall opens. A purchase through the paywall counts as the test's conversion, and so does a store purchase RevenueCat or Adapty report for the same user id.
578
+ - **Drop-off:** each page records `$paywall {action: "page", page, index}` the first time it shows, `purchased` and `closed` too, so MRRocket shows how many reach page 2 and 3.
579
+ - **Without pages** a paywall keeps working as texts your own paywall marks (`paywall.<placement>.headline`, `.body`, `.cta`).
580
+ - The script tag loads the paywall dialog from `sdk-flows.js` on the first `open`; `sdk.js` stays within its budget.
581
+
548
582
  ## Privacy and consent
549
583
 
550
584
  ```tsx
@@ -1,4 +1,4 @@
1
- (function(){'use strict';var $=(o,a)=>Math.round(o*(1-a/100)*100)/100,v=(o,a)=>{try{return new Intl.NumberFormat(void 0,{style:"currency",currency:a}).format(o)}catch(u){return `${o.toFixed(2)} ${a}`}},E=o=>o.kind==="contact"?"Send to the team":o.kind==="pause"?"Pause instead":o.kind==="downgrade"?"Switch plan":"Accept offer";var S="ckf-styles",j=`
1
+ (function(){'use strict';var _=(n,e)=>Math.round(n*(1-e/100)*100)/100,M=(n,e)=>{try{return new Intl.NumberFormat(void 0,{style:"currency",currency:e}).format(n)}catch(a){return `${n.toFixed(2)} ${e}`}},T=n=>n.kind==="contact"?"Send to the team":n.kind==="pause"?"Pause instead":n.kind==="downgrade"?"Switch plan":"Accept offer";var L="ckf-styles",q=`
2
2
  .ckf-root{--ckf-accent:#3f76ff;--ckf-accent-ink:#fff;--ckf-bg:#fff;--ckf-fg:#1c1d20;--ckf-muted:#5d6068;--ckf-soft:#f4f5f7;--ckf-line:#e4e5e8;--ckf-danger:#d92d20;--ckf-radius:14px;--ckf-font:inherit;--ckf-shadow:0 16px 40px -12px rgba(16,18,24,.28),0 0 0 1px rgba(16,18,24,.07)}
3
3
  .ckf-root[data-theme=dark]{--ckf-bg:#17181b;--ckf-fg:#f1f2f4;--ckf-muted:#a9acb3;--ckf-soft:#232428;--ckf-line:#2e2f35;--ckf-shadow:0 16px 40px -12px rgba(0,0,0,.6),0 0 0 1px rgba(255,255,255,.08)}
4
4
  @media (prefers-color-scheme:dark){.ckf-root[data-theme=auto]{--ckf-bg:#17181b;--ckf-fg:#f1f2f4;--ckf-muted:#a9acb3;--ckf-soft:#232428;--ckf-line:#2e2f35;--ckf-shadow:0 16px 40px -12px rgba(0,0,0,.6),0 0 0 1px rgba(255,255,255,.08)}}
@@ -56,9 +56,18 @@
56
56
  .ckf-banner{position:fixed;z-index:2147483001;left:50%;top:12px;transform:translateX(-50%);width:min(640px,calc(100vw - 24px));background:var(--ckf-bg);border-radius:12px;box-shadow:var(--ckf-shadow);padding:10px 10px 10px 16px;display:flex;align-items:center;gap:12px;animation:ckf-in .18s ease-out}
57
57
  .ckf-banner>span{flex:1;min-width:0;display:flex;flex-direction:column}
58
58
  .ckf-banner .ckf-btn{height:32px}
59
+ .ckf-pw{max-width:420px;gap:14px}
60
+ .ckf-root[data-still] :is(.ckf-scrim,.ckf-card){animation:none}
61
+ .ckf-li{display:flex;gap:10px;align-items:flex-start;margin:0}
62
+ .ckf-li::before{content:"\u2713";flex:none;width:20px;height:20px;border-radius:50%;background:color-mix(in srgb,var(--ckf-accent) 14%,var(--ckf-bg));color:var(--ckf-accent);font-size:12px;font-weight:700;display:inline-flex;align-items:center;justify-content:center}
63
+ .ckf-quote{margin:0;padding:12px 14px;border-radius:12px;background:var(--ckf-soft)}
64
+ .ckf-quote cite{display:block;margin-top:6px;font-style:normal;font-size:12px;color:var(--ckf-muted)}
65
+ .ckf-plan{justify-content:space-between;min-height:52px}
66
+ .ckf-plan span:nth-child(2){display:flex;flex-direction:column;margin-right:auto}
67
+ .ckf-plan b{font-variant-numeric:tabular-nums}
59
68
  @keyframes ckf-fade{from{opacity:0}}
60
69
  @keyframes ckf-in{from{opacity:0;transform:translateY(6px)}}
61
70
  .ckf-banner{animation-name:ckf-fade}
62
71
  @media (max-width:520px){.ckf-scrim{align-items:flex-end;padding:0}.ckf-scrim .ckf-card{max-width:none;border-radius:var(--ckf-radius) var(--ckf-radius) 0 0;max-height:92dvh}.ckf-float{right:12px;bottom:12px}}
63
72
  @media (prefers-reduced-motion:reduce){.ckf-root *{animation:none!important;transition:none!important}}
64
- `,e=(o,a={},...u)=>{let d=document.createElement(o);for(let[f,c]of Object.entries(a))c===void 0||c===false||(typeof c=="function"?d.addEventListener(f.slice(2).toLowerCase(),c):f==="className"?d.className=String(c):d.setAttribute(f,c===true?"":c));for(let f of u)(f||f==="")&&d.append(typeof f=="string"?document.createTextNode(f):f);return d},b=(o,a,u,d={})=>e("button",{type:"button",className:`ckf-btn${a==="secondary"?"":` ckf-${a}`}`,disabled:!!d.disabled,"data-ckf-id":d.id,onClick:()=>u()},o),w=(o,a)=>e("button",{type:"button",className:"ckf-x","aria-label":o,"data-ckf-id":"x",onClick:()=>a()},"\xD7"),H=(o,a)=>a>1?e("span",{className:"ckf-dots",role:"img","aria-label":`Step ${o} of ${a}`},...Array.from({length:a},(u,d)=>e("span",{className:"ckf-dot","data-on":d<o}))):e("span"),z=o=>o.type==="cancel"?`c:${o.screen}`:o.type==="step"?`s:${o.step.id}`:o.type==="checklist"?`l:${o.flow.id}`:`m:${o.message.id}`,M=(o,a={})=>{var F;if(typeof document=="undefined")return ()=>{};if(!document.getElementById(S)){let n=document.createElement("style");n.id=S,n.textContent=j,document.head.appendChild(n);}let u=e("div",{className:`ckf-root${a.className?` ${a.className}`:""}`,"data-theme":(F=a.theme)!=null?F:"auto"});a.accent&&u.style.setProperty("--ckf-accent",a.accent),document.body.appendChild(u);let d="",f=null,c="",h=null,L=n=>{var l,p;let t="ckf-title",s=n.busy,i=[];if(n.screen==="survey")i.push(e("h2",{className:"ckf-h",id:t},n.flow.question||"Why are you leaving?"),e("div",{className:"ckf-opts",role:"radiogroup","aria-labelledby":t},...n.flow.reasons.map(r=>e("button",{type:"button",role:"radio",className:"ckf-opt","aria-checked":String(n.reason===r.id),"data-ckf-id":`r:${r.id}`,onClick:()=>o.cancel.pick(r.id)},e("span",{className:"ckf-radio"}),r.label))),e("div",{className:"ckf-btns"},b("Continue","primary",o.cancel.next,{disabled:!n.reason,id:"go"}),b("Never mind, keep my plan","quiet",o.cancel.close)));else if(n.screen==="offer"&&n.offer){let r=n.offer,g=(l=n.flow.reasons.find(y=>y.id===n.reason))==null?void 0:l.label,m=false;r.kind==="discount"&&r.percent&&(m=n.price?e("div",{className:"ckf-box"},e("span",{className:"ckf-big"},v($(n.price.amount,r.percent),n.price.currency)),e("span",{className:"ckf-strike"},v(n.price.amount,n.price.currency)),e("span",{className:"ckf-small"},`/${(p=n.price.interval)!=null?p:"month"}${r.months?` for ${r.months} ${r.months===1?"month":"months"}`:""}`)):e("div",{className:"ckf-box"},e("span",{className:"ckf-big"},`${r.percent}% off`),r.months?e("span",{className:"ckf-small"},`for ${r.months} ${r.months===1?"month":"months"}`):false)),r.kind==="pause"&&r.months&&(m=e("div",{className:"ckf-box"},e("span",{},`Pause for up to ${r.months} ${r.months===1?"month":"months"}. Your data stays.`))),r.kind==="downgrade"&&r.planName&&(m=e("div",{className:"ckf-box"},e("b",{},r.planName)));let k=r.kind==="contact"?e("textarea",{className:"ckf-text",placeholder:"What would make you stay?","aria-label":"Your message",maxlength:"500","data-ckf-id":"comment",onInput:y=>c=y.target.value}):null;k&&(k.value=c),i.push(g?e("p",{className:"ckf-small"},`You said: ${g}`):false,e("h2",{className:"ckf-h",id:t},r.headline),m,k!=null?k:false,e("div",{className:"ckf-btns"},b(s?"One moment\u2026":E(r),"primary",()=>o.cancel.accept(c),{disabled:s,id:"go"}),b("No thanks, continue cancelling","quiet",o.cancel.decline,{disabled:s})));}else {let g=n.steps===1?null:e("textarea",{className:"ckf-text",placeholder:"Anything else we should know? (optional)","aria-label":"Anything else we should know? (optional)",maxlength:"500","data-ckf-id":"comment",onInput:m=>c=m.target.value});g&&(g.value=c),i.push(e("h2",{className:"ckf-h",id:t},n.flow.confirm.title),n.flow.confirm.body?e("p",{className:"ckf-p"},n.flow.confirm.body):false,g!=null?g:false,e("div",{className:"ckf-btns"},b(s?"One moment\u2026":n.flow.confirm.button,"danger",()=>o.cancel.confirm(c),{disabled:s,id:"go"}),b("Keep my plan","secondary",o.cancel.close,{disabled:s})));}return e("div",{className:"ckf-scrim",onClick:r=>r.target===r.currentTarget&&!s&&o.cancel.close()},e("div",{className:"ckf-card",role:"dialog","aria-modal":"true","aria-labelledby":t},e("div",{className:"ckf-top"},H(n.step,n.steps),w("Close",o.cancel.close)),...i,n.error?e("p",{className:"ckf-err",role:"alert"},n.error):false))},T=n=>{let t=n.step,s=e("div",{className:"ckf-card",role:"dialog","aria-modal":t.kind==="modal"?"true":void 0,"aria-labelledby":"ckf-title"},e("div",{className:"ckf-top"},n.total>1?e("p",{className:"ckf-small"},`Step ${n.index+1} of ${n.total}`):e("span"),w("Close the tour",o.onboarding.dismiss)),e("h2",{className:"ckf-h",id:"ckf-title"},t.title),t.body?e("p",{className:"ckf-p"},t.body):false,e("div",{className:"ckf-row"},b(t.button||(n.last?"Done":"Next"),"primary",o.onboarding.next,{id:"go"})));if(t.kind==="modal")return e("div",{className:"ckf-scrim"},s);let i=t.target?I(t.target):null,l=e("div",{className:"ckf-float"},s);if(i){let p=e("div",{className:"ckf-ring","aria-hidden":"true"});return h={float:l,ring:p,target:i},N(l,p,i),e("div",{},p,l)}return l},I=n=>{var s;let t=()=>document.querySelector(`[data-ck-target="${CSS.escape(n)}"]`);return /^[#.[]|[\s>:=]/.test(n)&&(s=R(n))!=null?s:t()},R=n=>{try{return document.querySelector(n)}catch(t){return null}},N=(n,t,s)=>{let i=s.getBoundingClientRect();Object.assign(t.style,{left:`${i.left-4}px`,top:`${i.top-4}px`,width:`${i.width+8}px`,height:`${i.height+8}px`});let l=Math.min(340,window.innerWidth-24),p=Math.max(12,Math.min(i.left,window.innerWidth-l-12)),r=i.bottom+12;Object.assign(n.style,{left:`${p}px`,right:"auto",width:`${l}px`}),r+200<window.innerHeight?Object.assign(n.style,{top:`${r}px`,bottom:"auto"}):Object.assign(n.style,{top:"auto",bottom:`${Math.max(12,window.innerHeight-i.top+12)}px`});},A=n=>{let t=n.items.filter(s=>s.done).length;return e("div",{className:"ckf-float"},e("div",{className:"ckf-card",role:"region","aria-labelledby":"ckf-title"},e("div",{className:"ckf-top"},e("h2",{className:"ckf-h",id:"ckf-title"},n.flow.name),w("Hide the checklist",o.onboarding.dismiss)),e("p",{className:"ckf-small"},`${t} of ${n.items.length} done`),e("div",{className:"ckf-bar",role:"progressbar","aria-valuemin":"0","aria-valuemax":String(n.items.length),"aria-valuenow":String(t)},e("i",{style:`width:${t/n.items.length*100}%`})),e("div",{className:"ckf-opts"},...n.items.map(({step:s,done:i})=>{let l=[e("span",{className:"ckf-tick","aria-hidden":"true"},i?"\u2713":""),e("span",{},e("b",{},s.title),s.body?e("span",{className:"ckf-small"},s.body):false)];return i||s.event?e("div",{className:"ckf-check","data-done":i,role:"listitem"},...l):e("button",{type:"button",className:"ckf-check","aria-label":`Mark \u201C${s.title}\u201D done`,"data-ckf-id":`i:${s.id}`,onClick:()=>o.onboarding.check(s.id)},...l)}))))},_=n=>{let t=n.message,s=t.button?b(t.button,"primary",o.message.click,{id:"go"}):false;return t.style==="banner"?e("div",{className:"ckf-banner",role:"status"},e("span",{},e("b",{},t.title),t.body?e("span",{className:"ckf-small"},t.body):false),s,w("Dismiss",o.message.dismiss)):e("div",{className:"ckf-scrim",onClick:i=>i.target===i.currentTarget&&o.message.dismiss()},e("div",{className:"ckf-card",role:"dialog","aria-modal":"true","aria-labelledby":"ckf-title"},e("div",{className:"ckf-top"},e("span"),w("Dismiss",o.message.dismiss)),e("h2",{className:"ckf-h",id:"ckf-title"},t.title),t.body?e("p",{className:"ckf-p"},t.body):false,s?e("div",{className:"ckf-row"},s):false))},C=()=>{var i,l,p,r,g;let n=o.view(),t=n?z(n):"",s=(l=(i=document.activeElement)==null?void 0:i.closest)!=null&&l.call(i,".ckf-root")?(p=document.activeElement)==null?void 0:p.getAttribute("data-ckf-id"):null;if(t&&!d&&document.activeElement instanceof HTMLElement&&!document.activeElement.closest(".ckf-root")&&(f=document.activeElement),t!==d&&!t.startsWith("c:")&&(c=""),t||(c=""),h=null,u.replaceChildren(...n?[n.type==="cancel"?L(n):n.type==="step"?T(n):n.type==="checklist"?A(n):_(n)]:[]),t!==d){let m=u.querySelector("[aria-modal=true]"),k=(r=m==null?void 0:m.querySelector("[role=radio], [data-ckf-id=go], textarea"))!=null?r:null;k==null||k.focus(),!t&&f&&(f.focus(),f=null);}else s&&((g=u.querySelector(`[data-ckf-id="${CSS.escape(s)}"]`))==null||g.focus());d=t;},O=n=>{if(n.key!=="Escape")return;let t=o.view();(t==null?void 0:t.type)==="cancel"?o.cancel.close():(t==null?void 0:t.type)==="message"?o.message.dismiss():(t==null?void 0:t.type)==="step"&&t.step.kind==="modal"&&o.onboarding.dismiss();},x=()=>{h&&N(h.float,h.ring,h.target);};document.addEventListener("keydown",O),window.addEventListener("resize",x),window.addEventListener("scroll",x,{passive:true,capture:true});let P=o.subscribe(C);return C(),()=>{P(),document.removeEventListener("keydown",O),window.removeEventListener("resize",x),window.removeEventListener("scroll",x,{capture:true}),u.remove();}};window.__mrrocketFlows={mountFlows:M};})();
73
+ `,t=(n,e={},...a)=>{let s=document.createElement(n);for(let[g,p]of Object.entries(e))p===void 0||p===false||(typeof p=="function"?s.addEventListener(g.slice(2).toLowerCase(),p):g==="className"?s.className=String(p):s.setAttribute(g,p===true?"":p));for(let g of a)(g||g==="")&&s.append(typeof g=="string"?document.createTextNode(g):g);return s},P=(n,e,a,s={})=>t("button",{type:"button",className:`ckf-btn${e==="secondary"?"":` ckf-${e}`}`,disabled:!!s.disabled,"data-ckf-id":s.id,onClick:()=>a()},n),R=(n,e)=>t("button",{type:"button",className:"ckf-x","aria-label":n,"data-ckf-id":"x",onClick:()=>e()},"\xD7"),A=(n,e)=>e>1?t("span",{className:"ckf-dots",role:"img","aria-label":`Step ${n} of ${e}`},...Array.from({length:e},(a,s)=>t("span",{className:"ckf-dot","data-on":s<n}))):t("span"),z=n=>n.type==="cancel"?`c:${n.screen}`:n.type==="step"?`s:${n.step.id}`:n.type==="checklist"?`l:${n.flow.id}`:`m:${n.message.id}`,V=n=>{var a;if(!document.getElementById(L)){let s=document.createElement("style");s.id=L,s.textContent=q,document.head.appendChild(s);}let e=t("div",{className:`ckf-root${n.className?` ${n.className}`:""}`,"data-theme":(a=n.theme)!=null?a:"auto"});return n.accent&&e.style.setProperty("--ckf-accent",n.accent),document.body.appendChild(e),e},H=(n,e={})=>{if(typeof document=="undefined")return ()=>{};let a=V(e),s="",g=null,p="",h=null,y=r=>{var m,x;let o="ckf-title",c=r.busy,f=[];if(r.screen==="survey")f.push(t("h2",{className:"ckf-h",id:o},r.flow.question||"Why are you leaving?"),t("div",{className:"ckf-opts",role:"radiogroup","aria-labelledby":o},...r.flow.reasons.map(l=>t("button",{type:"button",role:"radio",className:"ckf-opt","aria-checked":String(r.reason===l.id),"data-ckf-id":`r:${l.id}`,onClick:()=>n.cancel.pick(l.id)},t("span",{className:"ckf-radio"}),l.label))),t("div",{className:"ckf-btns"},P("Continue","primary",n.cancel.next,{disabled:!r.reason,id:"go"}),P("Never mind, keep my plan","quiet",n.cancel.close)));else if(r.screen==="offer"&&r.offer){let l=r.offer,C=(m=r.flow.reasons.find(S=>S.id===r.reason))==null?void 0:m.label,N=false;l.kind==="discount"&&l.percent&&(N=r.price?t("div",{className:"ckf-box"},t("span",{className:"ckf-big"},M(_(r.price.amount,l.percent),r.price.currency)),t("span",{className:"ckf-strike"},M(r.price.amount,r.price.currency)),t("span",{className:"ckf-small"},`/${(x=r.price.interval)!=null?x:"month"}${l.months?` for ${l.months} ${l.months===1?"month":"months"}`:""}`)):t("div",{className:"ckf-box"},t("span",{className:"ckf-big"},`${l.percent}% off`),l.months?t("span",{className:"ckf-small"},`for ${l.months} ${l.months===1?"month":"months"}`):false)),l.kind==="pause"&&l.months&&(N=t("div",{className:"ckf-box"},t("span",{},`Pause for up to ${l.months} ${l.months===1?"month":"months"}. Your data stays.`))),l.kind==="downgrade"&&l.planName&&(N=t("div",{className:"ckf-box"},t("b",{},l.planName)));let E=l.kind==="contact"?t("textarea",{className:"ckf-text",placeholder:"What would make you stay?","aria-label":"Your message",maxlength:"500","data-ckf-id":"comment",onInput:S=>p=S.target.value}):null;E&&(E.value=p),f.push(C?t("p",{className:"ckf-small"},`You said: ${C}`):false,t("h2",{className:"ckf-h",id:o},l.headline),N,E!=null?E:false,t("div",{className:"ckf-btns"},P(c?"One moment\u2026":T(l),"primary",()=>n.cancel.accept(p),{disabled:c,id:"go"}),P("No thanks, continue cancelling","quiet",n.cancel.decline,{disabled:c})));}else {let C=r.steps===1?null:t("textarea",{className:"ckf-text",placeholder:"Anything else we should know? (optional)","aria-label":"Anything else we should know? (optional)",maxlength:"500","data-ckf-id":"comment",onInput:N=>p=N.target.value});C&&(C.value=p),f.push(t("h2",{className:"ckf-h",id:o},r.flow.confirm.title),r.flow.confirm.body?t("p",{className:"ckf-p"},r.flow.confirm.body):false,C!=null?C:false,t("div",{className:"ckf-btns"},P(c?"One moment\u2026":r.flow.confirm.button,"danger",()=>n.cancel.confirm(p),{disabled:c,id:"go"}),P("Keep my plan","secondary",n.cancel.close,{disabled:c})));}return t("div",{className:"ckf-scrim",onClick:l=>l.target===l.currentTarget&&!c&&n.cancel.close()},t("div",{className:"ckf-card",role:"dialog","aria-modal":"true","aria-labelledby":o},t("div",{className:"ckf-top"},A(r.step,r.steps),R("Close",n.cancel.close)),...f,r.error?t("p",{className:"ckf-err",role:"alert"},r.error):false))},u=r=>{let o=r.step,c=t("div",{className:"ckf-card",role:"dialog","aria-modal":o.kind==="modal"?"true":void 0,"aria-labelledby":"ckf-title"},t("div",{className:"ckf-top"},r.total>1?t("p",{className:"ckf-small"},`Step ${r.index+1} of ${r.total}`):t("span"),R("Close the tour",n.onboarding.dismiss)),t("h2",{className:"ckf-h",id:"ckf-title"},o.title),o.body?t("p",{className:"ckf-p"},o.body):false,t("div",{className:"ckf-row"},P(o.button||(r.last?"Done":"Next"),"primary",n.onboarding.next,{id:"go"})));if(o.kind==="modal")return t("div",{className:"ckf-scrim"},c);let f=o.target?i(o.target):null,m=t("div",{className:"ckf-float"},c);if(f){let x=t("div",{className:"ckf-ring","aria-hidden":"true"});return h={float:m,ring:x,target:f},b(m,x,f),t("div",{},x,m)}return m},i=r=>{var c;let o=()=>document.querySelector(`[data-ck-target="${CSS.escape(r)}"]`);return /^[#.[]|[\s>:=]/.test(r)&&(c=d(r))!=null?c:o()},d=r=>{try{return document.querySelector(r)}catch(o){return null}},b=(r,o,c)=>{let f=c.getBoundingClientRect();Object.assign(o.style,{left:`${f.left-4}px`,top:`${f.top-4}px`,width:`${f.width+8}px`,height:`${f.height+8}px`});let m=Math.min(340,window.innerWidth-24),x=Math.max(12,Math.min(f.left,window.innerWidth-m-12)),l=f.bottom+12;Object.assign(r.style,{left:`${x}px`,right:"auto",width:`${m}px`}),l+200<window.innerHeight?Object.assign(r.style,{top:`${l}px`,bottom:"auto"}):Object.assign(r.style,{top:"auto",bottom:`${Math.max(12,window.innerHeight-f.top+12)}px`});},w=r=>{let o=r.items.filter(c=>c.done).length;return t("div",{className:"ckf-float"},t("div",{className:"ckf-card",role:"region","aria-labelledby":"ckf-title"},t("div",{className:"ckf-top"},t("h2",{className:"ckf-h",id:"ckf-title"},r.flow.name),R("Hide the checklist",n.onboarding.dismiss)),t("p",{className:"ckf-small"},`${o} of ${r.items.length} done`),t("div",{className:"ckf-bar",role:"progressbar","aria-valuemin":"0","aria-valuemax":String(r.items.length),"aria-valuenow":String(o)},t("i",{style:`width:${o/r.items.length*100}%`})),t("div",{className:"ckf-opts"},...r.items.map(({step:c,done:f})=>{let m=[t("span",{className:"ckf-tick","aria-hidden":"true"},f?"\u2713":""),t("span",{},t("b",{},c.title),c.body?t("span",{className:"ckf-small"},c.body):false)];return f||c.event?t("div",{className:"ckf-check","data-done":f,role:"listitem"},...m):t("button",{type:"button",className:"ckf-check","aria-label":`Mark \u201C${c.title}\u201D done`,"data-ckf-id":`i:${c.id}`,onClick:()=>n.onboarding.check(c.id)},...m)}))))},v=r=>{let o=r.message,c=o.button?P(o.button,"primary",n.message.click,{id:"go"}):false;return o.style==="banner"?t("div",{className:"ckf-banner",role:"status"},t("span",{},t("b",{},o.title),o.body?t("span",{className:"ckf-small"},o.body):false),c,R("Dismiss",n.message.dismiss)):t("div",{className:"ckf-scrim",onClick:f=>f.target===f.currentTarget&&n.message.dismiss()},t("div",{className:"ckf-card",role:"dialog","aria-modal":"true","aria-labelledby":"ckf-title"},t("div",{className:"ckf-top"},t("span"),R("Dismiss",n.message.dismiss)),t("h2",{className:"ckf-h",id:"ckf-title"},o.title),o.body?t("p",{className:"ckf-p"},o.body):false,c?t("div",{className:"ckf-row"},c):false))},F=()=>{var f,m,x,l,C;let r=n.view(),o=r?z(r):"",c=(m=(f=document.activeElement)==null?void 0:f.closest)!=null&&m.call(f,".ckf-root")?(x=document.activeElement)==null?void 0:x.getAttribute("data-ckf-id"):null;if(o&&!s&&document.activeElement instanceof HTMLElement&&!document.activeElement.closest(".ckf-root")&&(g=document.activeElement),o!==s&&!o.startsWith("c:")&&(p=""),o||(p=""),h=null,a.replaceChildren(...r?[r.type==="cancel"?y(r):r.type==="step"?u(r):r.type==="checklist"?w(r):v(r)]:[]),o!==s){let N=a.querySelector("[aria-modal=true]"),E=(l=N==null?void 0:N.querySelector("[role=radio], [data-ckf-id=go], textarea"))!=null?l:null;E==null||E.focus(),!o&&g&&(g.focus(),g=null);}else c&&((C=a.querySelector(`[data-ckf-id="${CSS.escape(c)}"]`))==null||C.focus());s=o;},k=r=>{if(r.key!=="Escape")return;let o=n.view();(o==null?void 0:o.type)==="cancel"?n.cancel.close():(o==null?void 0:o.type)==="message"?n.message.dismiss():(o==null?void 0:o.type)==="step"&&o.step.kind==="modal"&&n.onboarding.dismiss();},O=()=>{h&&b(h.float,h.ring,h.target);};document.addEventListener("keydown",k),window.addEventListener("resize",O),window.addEventListener("scroll",O,{passive:true,capture:true});let $=n.subscribe(F);return F(),()=>{$(),document.removeEventListener("keydown",k),window.removeEventListener("resize",O),window.removeEventListener("scroll",O,{capture:true}),a.remove();}},j=(n,e={})=>{if(typeof document=="undefined")return ()=>{};let a=V(e),s="",g=null,p=()=>{var w,v,F;let u=n.view(),i=u?`${u.paywall.id}:${u.index}`:"";if(i&&!s&&document.activeElement instanceof HTMLElement&&(g=document.activeElement),!u){a.replaceChildren(),a.removeAttribute("data-still"),s&&(g==null||g.focus()),s="";return}s&&a.setAttribute("data-still","");let d=u.page,b=d.kind==="plans"?t("div",{className:"ckf-opts",role:"radiogroup","aria-label":"Plans"},...u.plans.map(k=>t("button",{type:"button",role:"radio",className:"ckf-opt ckf-plan","aria-checked":String(u.plan===k.id),"data-ckf-id":`p:${k.id}`,onClick:()=>n.pick(k.id)},t("span",{className:"ckf-radio"}),t("span",{},k.name,k.note?t("span",{className:"ckf-small"},k.note):false),t("b",{},k.price)))):false;a.replaceChildren(t("div",{className:"ckf-scrim",onClick:k=>k.target===k.currentTarget&&n.close()},t("div",{className:"ckf-card ckf-pw",role:"dialog","aria-modal":"true","aria-labelledby":"ckf-title"},t("div",{className:"ckf-top"},A(u.index+1,u.total),R("Close",n.close)),t("h2",{className:"ckf-h",id:"ckf-title"},d.title),d.body?t("p",{className:"ckf-p"},d.body):false,d.kind==="benefits"&&((w=d.items)!=null&&w.length)?t("div",{className:"ckf-opts"},...d.items.map(k=>t("p",{className:"ckf-li"},k))):false,d.kind==="proof"&&((v=d.quotes)!=null&&v.length)?t("div",{className:"ckf-opts"},...d.quotes.map(k=>t("blockquote",{className:"ckf-quote"},k.text,k.by?t("cite",{},k.by):false))):false,b,u.error?t("p",{className:"ckf-err",role:"alert"},u.error):false,t("div",{className:"ckf-btns"},P(u.busy?"One moment\u2026":d.button||"Continue","primary",n.next,{disabled:u.busy||d.kind==="plans"&&!u.plan,id:"go"}),u.index?P("Back","quiet",n.back,{disabled:u.busy}):false)))),i!==s&&((F=a.querySelector("[data-ckf-id=go]"))==null||F.focus()),s=i;},h=u=>{n.view()&&u.key==="Escape"&&n.close();};document.addEventListener("keydown",h);let y=n.subscribe(p);return p(),()=>{y(),document.removeEventListener("keydown",h),a.remove();}};var D=n=>{let e=2166136261;for(let a=0;a<n.length;a++)e^=n.charCodeAt(a),e=Math.imul(e,16777619);return (e>>>0)/4294967296};var U=(n,e)=>{var p,h,y,u;let a=(h=(p=n.variants[0])==null?void 0:p.id)!=null?h:"control";if(n.winner)return n.winner;if(n.status!=="running")return a;let s=D(`${n.key}:${e}`),g=0;for(let i of n.variants)if(g+=i.weight,s<g)return i.id;return (u=(y=n.variants[n.variants.length-1])==null?void 0:y.id)!=null?u:a};var I="$paywall",W=(n,e,a)=>{var h,y;let s=e.experiment?n==null?void 0:n.experiments.find(u=>u.key===e.experiment):void 0,g=s?U(s,a):(h=e.variants[0])==null?void 0:h.id,p=(y=e.variants.find(u=>u.id===g))!=null?y:e.variants[0];return p?{variant:p.id,pages:p.pages,test:(s==null?void 0:s.status)==="running"&&!s.winner?s.key:void 0}:null},K=n=>{let e=null,a=new Set,s=()=>{for(let i of [...a])try{i();}catch(d){}},g=()=>e?{paywall:e.w.id,placement:e.w.placement,variant:e.variant}:{},p=()=>{e&&!e.seen.has(e.index)&&(e.seen.add(e.index),n.track(I,{...g(),page:e.pages[e.index].id,index:e.index,action:"page"})),s();},h=i=>{var b,w;let d=e;d&&(e=null,i.outcome==="closed"&&((w=(b=d.options).onClose)==null||w.call(b,i)),d.resolve(i),s());},y=i=>{var d;return {outcome:i,index:(d=e==null?void 0:e.index)!=null?d:0,...e?{paywall:e.w.id,variant:e.variant}:{},...i!=="closed"&&e?{plan:e.plans.find(b=>b.id===e.plan)}:{}}},u=()=>{let i=e,d=i==null?void 0:i.plans.find(b=>b.id===i.plan);if(!(!i||!d||i.busy)){if(!i.options.onPurchase)return h(y("chosen"));i.busy=true,i.error=void 0,s(),Promise.resolve().then(()=>{var b,w;return (w=(b=i.options).onPurchase)==null?void 0:w.call(b,d)}).then(b=>{if(i.busy=false,e===i){if(b===false)return s();n.track(I,{...g(),page:i.pages[i.index].id,index:i.index,plan:d.id,action:"purchased"}),h(y("purchased"));}},()=>{i.busy=false,i.error="The purchase did not go through. Please try again.",s();});}};return {open:(i,d={})=>{var o,c,f;if(e)return e.promise;let b=n.config(),w=(o=b==null?void 0:b.paywalls)==null?void 0:o.find(m=>m.placement===i),v=w?W(b,w,n.distinctId()):null;if(!w||!(v!=null&&v.pages.length))return Promise.resolve({outcome:"closed",index:0});let F=new Map(((c=d.plans)!=null?c:[]).map(m=>[m.id,m])),k=w.plans.map(m=>{var x;return (x=F.get(m.id))!=null?x:m}),O=()=>{},$=new Promise(m=>O=m),r=k.some(m=>m.id===w.highlight)?w.highlight:(f=k[0])==null?void 0:f.id;return e={w,variant:v.variant,pages:v.pages,plans:k,index:0,plan:r,busy:false,seen:new Set,options:d,resolve:O,promise:$},v.test&&n.track("$exposure",{experiment:v.test,variant:v.variant}),p(),$},view:()=>e?{paywall:e.w,variant:e.variant,page:e.pages[e.index],index:e.index,total:e.pages.length,last:e.index===e.pages.length-1,plans:e.plans,plan:e.plan,busy:e.busy,error:e.error}:null,subscribe:i=>(a.add(i),()=>a.delete(i)),next:()=>{if(!(!e||e.busy)){if(e.pages[e.index].kind==="plans"||e.index===e.pages.length-1)return u();e.index++,e.error=void 0,p();}},back:()=>{!e||e.busy||!e.index||(e.index--,e.error=void 0,s());},pick:i=>{!e||e.busy||!e.plans.some(d=>d.id===i)||(e.plan=i,e.error=void 0,s());},close:()=>{!e||e.busy||(n.track(I,{...g(),index:e.index,action:"closed"}),h(y("closed")));}}};var B=(n,e)=>{let a=K(n);return j(a,e),a};window.__mrrocketFlows={mountFlows:H,paywallHost:B};})();
@@ -1,4 +1,4 @@
1
- (function(){'use strict';var pt=Object.defineProperty;var lt=(r,a,n)=>a in r?pt(r,a,{enumerable:true,configurable:true,writable:true,value:n}):r[a]=n;var Qe=(r,a,n)=>lt(r,a+"",n);var Je=r=>r==="minutes"?"We usually reply in a few minutes":r==="day"?"We usually reply within a day":"We usually reply in a few hours",Xe=r=>{let a=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(r);if(!a)return "#ffffff";let[n,p,i]=[a[1],a[2],a[3]].map(s=>{let x=parseInt(s,16)/255;return x<=.03928?x/12.92:((x+.055)/1.055)**2.4});return .2126*n+.7152*p+.0722*i>.45?"#111214":"#ffffff"},oe=class extends Error{constructor(n,p){super(n);Qe(this,"status");this.status=p;}},L=r=>Object.entries(r).filter(a=>!!a[1]).map(([a,n])=>`${encodeURIComponent(a)}=${encodeURIComponent(n)}`).join("&"),S=async(r,a,n)=>{var i;let p;try{p=await fetch(r,{...a,signal:n,headers:a!=null&&a.body?{"content-type":"application/json"}:void 0});}catch(s){throw s.name==="AbortError"?s:new oe("Could not reach the server. Check your connection and try again.",0)}if(!p.ok){let s="";try{s=(i=(await p.json()).error)!=null?i:"";}catch(x){}throw new oe(s||(p.status===429?"Too many requests. Try again in a minute.":"Something went wrong. Please try again."),p.status)}return await p.json()},ve=r=>{let a=`${r.host}/api/sdk`,n={key:r.apiKey,distinctId:r.distinctId,user:r.user},p=(i,s,x)=>S(`${a}${i}`,{method:"POST",body:JSON.stringify({...n,...s})},x);return {list:(i,s)=>S(`${a}/feedback?${L({key:r.apiKey,distinctId:r.distinctId,board:i.board,sort:i.sort,q:i.q})}`,void 0,s),post:(i,s)=>S(`${a}/feedback/${encodeURIComponent(i)}?${L({key:r.apiKey,distinctId:r.distinctId})}`,void 0,s),roadmap:i=>S(`${a}/feedback/roadmap?${L({key:r.apiKey,distinctId:r.distinctId})}`,void 0,i),changelog:i=>S(`${a}/feedback/changelog?${L({key:r.apiKey})}`,void 0,i),submit:i=>p("/feedback",i),vote:i=>p(`/feedback/${encodeURIComponent(i)}/vote`,{}),comments:(i,s)=>S(`${a}/feedback/${encodeURIComponent(i)}/comments?${L({key:r.apiKey})}`,void 0,s),comment:(i,s)=>p(`/feedback/${encodeURIComponent(i)}/comments`,{body:s}),survey:(i,s)=>S(`${a}/surveys?${L({key:r.apiKey,distinctId:r.distinctId,url:i})}`,void 0,s),seen:i=>p(`/surveys/${encodeURIComponent(i)}/seen`,{user:void 0}),respond:(i,s)=>p(`/surveys/${encodeURIComponent(i)}/respond`,s),chat:i=>S(`${a}/messages?${L({key:r.apiKey,distinctId:r.distinctId})}`,void 0,i),sendChat:i=>p("/messages",i),articles:(i,s)=>S(`${a}/articles?${L({key:r.apiKey,q:i})}`,void 0,s),article:(i,s)=>S(`${a}/articles/${encodeURIComponent(i)}?${L({key:r.apiKey,distinctId:r.distinctId})}`,void 0,s),messengerLook:i=>S(`${a}/messenger?${L({key:r.apiKey})}`,void 0,i),rateArticle:(i,s)=>p(`/articles/${encodeURIComponent(i)}/rate`,{helpful:s})}};var Ze="ckw-styles",dt=`
1
+ (function(){'use strict';var Kt=Object.defineProperty;var qt=(r,n,o)=>n in r?Kt(r,n,{enumerable:true,configurable:true,writable:true,value:o}):r[n]=o;var zt=(r,n,o)=>qt(r,n+"",o);var Mt=r=>r==="minutes"?"We usually reply in a few minutes":r==="day"?"We usually reply within a day":"We usually reply in a few hours",Ct=r=>{let n=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(r);if(!n)return "#ffffff";let[o,l,s]=[n[1],n[2],n[3]].map(c=>{let f=parseInt(c,16)/255;return f<=.03928?f/12.92:((f+.055)/1.055)**2.4});return .2126*o+.7152*l+.0722*s>.45?"#111214":"#ffffff"},he=class extends Error{constructor(o,l){super(o);zt(this,"status");this.status=l;}},P=r=>Object.entries(r).filter(n=>!!n[1]).map(([n,o])=>`${encodeURIComponent(n)}=${encodeURIComponent(o)}`).join("&"),I=async(r,n,o)=>{var s;let l;try{l=await fetch(r,{...n,signal:o,headers:n!=null&&n.body?{"content-type":"application/json"}:void 0});}catch(c){throw c.name==="AbortError"?c:new he("Could not reach the server. Check your connection and try again.",0)}if(!l.ok){let c="";try{c=(s=(await l.json()).error)!=null?s:"";}catch(f){}throw new he(c||(l.status===429?"Too many requests. Try again in a minute.":"Something went wrong. Please try again."),l.status)}return await l.json()},qe=r=>{let n=`${r.host}/api/sdk`,o={key:r.apiKey,distinctId:r.distinctId,user:r.user},l=(s,c,f)=>I(`${n}${s}`,{method:"POST",body:JSON.stringify({...o,...c})},f);return {list:(s,c)=>I(`${n}/feedback?${P({key:r.apiKey,distinctId:r.distinctId,board:s.board,sort:s.sort,q:s.q})}`,void 0,c),post:(s,c)=>I(`${n}/feedback/${encodeURIComponent(s)}?${P({key:r.apiKey,distinctId:r.distinctId})}`,void 0,c),roadmap:s=>I(`${n}/feedback/roadmap?${P({key:r.apiKey,distinctId:r.distinctId})}`,void 0,s),changelog:s=>I(`${n}/feedback/changelog?${P({key:r.apiKey})}`,void 0,s),submit:s=>l("/feedback",s),vote:s=>l(`/feedback/${encodeURIComponent(s)}/vote`,{}),comments:(s,c)=>I(`${n}/feedback/${encodeURIComponent(s)}/comments?${P({key:r.apiKey})}`,void 0,c),comment:(s,c)=>l(`/feedback/${encodeURIComponent(s)}/comments`,{body:c}),survey:(s,c)=>I(`${n}/surveys?${P({key:r.apiKey,distinctId:r.distinctId,url:s})}`,void 0,c),seen:s=>l(`/surveys/${encodeURIComponent(s)}/seen`,{user:void 0}),respond:(s,c)=>l(`/surveys/${encodeURIComponent(s)}/respond`,c),chat:s=>I(`${n}/messages?${P({key:r.apiKey,distinctId:r.distinctId})}`,void 0,s),sendChat:s=>l("/messages",s),articles:(s,c)=>I(`${n}/articles?${P({key:r.apiKey,q:s})}`,void 0,c),article:(s,c)=>I(`${n}/articles/${encodeURIComponent(s)}?${P({key:r.apiKey,distinctId:r.distinctId})}`,void 0,c),messengerLook:s=>I(`${n}/messenger?${P({key:r.apiKey})}`,void 0,s),rateArticle:(s,c)=>l(`/articles/${encodeURIComponent(s)}/rate`,{helpful:c})}};var At="ckw-styles",_t=`
2
2
  .ckw-root{--ckw-accent:#3f76ff;--ckw-accent-ink:#fff;--ckw-bg:#fff;--ckw-bg2:#f7f7f8;--ckw-bg3:#eeeff1;--ckw-fg:#1c1d20;--ckw-fg2:#5d6068;--ckw-fg3:#8b8e96;--ckw-line:#e4e5e8;--ckw-danger:#d92d20;--ckw-shadow:0 8px 30px rgba(16,18,24,.16);--ckw-card:#fff;--ckw-col:#f5f6f7;--ckw-lift:0 1px 2px rgba(16,18,24,.06),0 0 0 1px rgba(16,18,24,.07);--ckw-raise:0 0 0 1px rgba(16,18,24,.05),0 1px 2px rgba(16,18,24,.05),0 6px 18px rgba(16,18,24,.06);--ckw-float:0 0 0 1px rgba(16,18,24,.06),0 18px 50px rgba(16,18,24,.2);
3
3
  font-size:14px;line-height:1.45;font-family:inherit;color:var(--ckw-fg);box-sizing:border-box;-webkit-font-smoothing:antialiased}
4
4
  .ckw-root[data-theme=dark]{--ckw-bg:#111214;--ckw-bg2:#1a1b1f;--ckw-bg3:#26272c;--ckw-fg:#f1f2f4;--ckw-fg2:#a9acb3;--ckw-fg3:#7a7d86;--ckw-line:#2a2b31;--ckw-shadow:0 8px 30px rgba(0,0,0,.5);--ckw-card:#1b1c20;--ckw-col:#16171a;--ckw-lift:0 0 0 1px rgba(255,255,255,.07);--ckw-raise:0 0 0 1px rgba(255,255,255,.07);--ckw-float:0 0 0 1px rgba(255,255,255,.09),0 18px 50px rgba(0,0,0,.55)}
@@ -203,47 +203,93 @@ font-size:14px;line-height:1.45;font-family:inherit;color:var(--ckw-fg);box-sizi
203
203
  .ckw-pop .ckw-row{padding:8px 0}
204
204
  .ckw-pop .ckw-form{border:0;padding:0;margin:12px 0 0}
205
205
  @media (max-width:520px){.ckw-pop{left:0!important;right:0!important;bottom:0;width:100%;max-width:100%;border-radius:12px 12px 0 0;max-height:85vh}.ckw-fab{bottom:14px}.ckw-fab[data-pos=bottom-right]{right:14px}.ckw-fab[data-pos=bottom-left]{left:14px}}
206
- /* Messenger (messenger-ui.ts) */
207
- .ckw-msgr-fab{position:fixed;bottom:20px;height:48px;padding:0 18px;gap:8px;font-size:15px;box-shadow:0 2px 4px rgba(16,18,24,.12),0 8px 24px color-mix(in srgb,var(--ckw-accent) 34%,transparent);transition:transform .16s cubic-bezier(.2,.8,.2,1)}
208
- .ckw-msgr-fab:hover{transform:scale(1.05)}
209
- .ckw-msgr-fab:active{transform:scale(.96)}
210
- .ckw-msgr-round{width:56px;height:56px;padding:0;justify-content:center}
211
- .ckw-msgr-fab .ckw-turn{animation:ckw-turn .22s cubic-bezier(.2,.8,.2,1)}
212
- @keyframes ckw-turn{from{opacity:0;transform:rotate(-70deg) scale(.6)}}
213
- .ckw-msgr-count{position:absolute;top:-2px;right:-2px;min-width:20px;height:20px;padding:0 5px;border-radius:10px;background:var(--ckw-danger);color:#fff;font-size:11px;font-weight:700;line-height:20px;text-align:center;box-shadow:0 0 0 2px var(--ckw-bg);font-variant-numeric:tabular-nums}
206
+ /* Messenger (messenger-ui.ts). Motion: one soft ease (.32,.72,0,1) for things that arrive, a quick ease-in for things that leave. */
207
+ .ckw-msgr-fab{position:fixed;bottom:20px;height:52px;padding:0 20px 0 16px;gap:8px;font-size:15px;box-shadow:0 2px 6px rgba(16,18,24,.14),0 10px 28px color-mix(in srgb,var(--ckw-accent) 38%,transparent);transition:transform .28s cubic-bezier(.32,.72,0,1),box-shadow .2s linear}
208
+ .ckw-msgr-fab:hover{transform:scale(1.06);box-shadow:0 2px 6px rgba(16,18,24,.14),0 14px 34px color-mix(in srgb,var(--ckw-accent) 46%,transparent)}
209
+ .ckw-msgr-fab:active{transform:scale(.94);transition-duration:.1s}
210
+ .ckw-msgr-round{width:60px;height:60px;padding:0;justify-content:center}
211
+ .ckw-msgr-fab-ic{position:relative;display:block;width:20px;height:20px;flex:none}
212
+ .ckw-msgr-round .ckw-msgr-fab-ic{width:28px;height:28px}
213
+ .ckw-msgr-fab-i{position:absolute;inset:0;display:flex;align-items:center;justify-content:center;transition:transform .38s cubic-bezier(.32,.72,0,1),opacity .2s linear}
214
+ .ckw-msgr-fab-i .ckw-icon{width:auto;height:auto}
215
+ .ckw-msgr-fab-i[data-i=x],.ckw-msgr-fab[data-open] .ckw-msgr-fab-i[data-i=chat]{opacity:0;transform:rotate(-90deg) scale(.4)}
216
+ .ckw-msgr-fab[data-open] .ckw-msgr-fab-i[data-i=chat]{transform:rotate(90deg) scale(.4)}
217
+ .ckw-msgr-fab[data-open] .ckw-msgr-fab-i[data-i=x]{opacity:1;transform:none}
218
+ .ckw-msgr-fab-i[data-i=x] .ckw-icon{stroke-width:2}
219
+ .ckw-msgr-count{position:absolute;top:-2px;right:-2px;min-width:20px;height:20px;padding:0 5px;border-radius:10px;background:var(--ckw-danger);color:#fff;font-size:11px;font-weight:700;line-height:20px;text-align:center;box-shadow:0 0 0 2px var(--ckw-bg);font-variant-numeric:tabular-nums;animation:ckw-badge .4s cubic-bezier(.34,1.56,.64,1)}
220
+ @keyframes ckw-badge{from{transform:scale(0)}}
214
221
  .ckw-msgr-av{width:36px;height:36px;border-radius:50%;flex:none;display:inline-flex;align-items:center;justify-content:center;background:var(--ckw-accent);color:var(--ckw-accent-ink);font-size:15px;font-weight:700;line-height:1}
215
222
  .ckw-msgr-av-sm{width:26px;height:26px;font-size:12px}
216
- .ckw-msgr-preview{position:fixed;z-index:2147483000;bottom:88px;width:320px;max-width:calc(100vw - 32px);animation:ckw-in .22s cubic-bezier(.2,.8,.2,1)}
217
- .ckw-msgr-preview[data-pos=bottom-right]{right:20px}
218
- .ckw-msgr-preview[data-pos=bottom-left]{left:20px}
219
- .ckw-msgr-preview-card{display:flex;align-items:flex-start;gap:12px;width:100%;text-align:left;padding:14px 16px;border:0;border-radius:18px;background:var(--ckw-bg);box-shadow:var(--ckw-float)}
223
+ .ckw-msgr-online{display:inline-flex;align-items:center;gap:6px;font-size:12.5px;color:var(--ckw-fg2)}
224
+ .ckw-msgr-online::before{content:"";width:7px;height:7px;border-radius:50%;background:#22c55e;box-shadow:0 0 0 3px color-mix(in srgb,#22c55e 22%,transparent);flex:none}
225
+ /* Floating cards over the closed launcher: a new answer, the hover teaser */
226
+ .ckw-msgr-preview,.ckw-msgr-teaser{position:fixed;z-index:2147483000;bottom:92px;width:320px;max-width:calc(100vw - 32px);transform-origin:bottom right;animation:ckw-rise .34s cubic-bezier(.32,.72,0,1)}
227
+ .ckw-msgr-preview[data-pos=bottom-right],.ckw-msgr-teaser[data-pos=bottom-right]{right:20px}
228
+ .ckw-msgr-preview[data-pos=bottom-left],.ckw-msgr-teaser[data-pos=bottom-left]{left:20px;transform-origin:bottom left}
229
+ .ckw-msgr-preview[data-out],.ckw-msgr-teaser[data-out]{animation:ckw-sink .16s cubic-bezier(.4,0,1,1) forwards;pointer-events:none}
230
+ @keyframes ckw-rise{from{opacity:0;transform:translateY(10px) scale(.94)}}
231
+ @keyframes ckw-sink{to{opacity:0;transform:translateY(6px) scale(.97)}}
232
+ .ckw-msgr-preview-card{display:flex;align-items:flex-start;gap:12px;width:100%;text-align:left;padding:14px 16px;border:0;border-radius:18px;background:var(--ckw-bg);box-shadow:var(--ckw-float);transition:transform .2s cubic-bezier(.32,.72,0,1)}
233
+ .ckw-msgr-preview-card:hover{transform:translateY(-2px)}
220
234
  .ckw-msgr-preview-main{display:flex;flex-direction:column;gap:2px;min-width:0}
221
235
  .ckw-msgr-preview-who{font-size:12px;font-weight:600;color:var(--ckw-fg3)}
222
236
  .ckw-msgr-preview-text{display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;white-space:pre-wrap;overflow-wrap:anywhere}
223
237
  .ckw-msgr-preview-x{position:absolute;top:-8px;right:-8px;width:24px;height:24px;border-radius:50%;border:0;background:var(--ckw-bg);color:var(--ckw-fg2);display:flex;align-items:center;justify-content:center;padding:0;box-shadow:var(--ckw-lift)}
224
- .ckw-msgr{bottom:88px;width:400px;height:min(660px,calc(100vh - 108px));max-height:none;border:0;border-radius:20px;box-shadow:var(--ckw-float);animation:ckw-pop .24s cubic-bezier(.2,.8,.2,1);transform-origin:bottom right}
238
+ .ckw-msgr-teaser{width:340px;padding:16px;border-radius:20px;background:var(--ckw-bg);box-shadow:var(--ckw-float);display:flex;flex-direction:column;gap:14px}
239
+ .ckw-msgr-teaser-top{display:flex;align-items:center;gap:12px}
240
+ .ckw-msgr-teaser-t{display:flex;flex-direction:column;gap:3px;flex:1;min-width:0}
241
+ .ckw-msgr-teaser-t b{font-size:15px;font-weight:700;letter-spacing:-.01em;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
242
+ .ckw-msgr-teaser-row{display:flex;gap:8px}
243
+ .ckw-msgr-teaser-b{flex:1;display:inline-flex;align-items:center;justify-content:center;gap:7px;height:40px;padding:0 14px;border:0;border-radius:999px;background:var(--ckw-bg3);color:var(--ckw-fg);font-size:14px;font-weight:600;white-space:nowrap;transition:transform .2s cubic-bezier(.32,.72,0,1),filter .1s linear}
244
+ .ckw-msgr-teaser-b[data-main]{flex:1.4;background:var(--ckw-accent);color:var(--ckw-accent-ink)}
245
+ .ckw-msgr-teaser-b:hover{filter:brightness(1.06)}
246
+ .ckw-msgr-teaser-b:active{transform:scale(.96)}
247
+ /* The panel */
248
+ .ckw-msgr{bottom:92px;width:400px;height:min(680px,calc(100vh - 112px));max-height:none;border:0;border-radius:22px;box-shadow:var(--ckw-float);transform-origin:bottom right;animation:ckw-msgr-in .42s cubic-bezier(.32,.72,0,1);transition:width .36s cubic-bezier(.32,.72,0,1),height .36s cubic-bezier(.32,.72,0,1)}
225
249
  .ckw-msgr[data-pos=bottom-left]{transform-origin:bottom left}
226
- @keyframes ckw-pop{from{opacity:0;transform:translateY(12px) scale(.96)}}
227
- .ckw-msgr-head{gap:10px;min-height:60px;padding:12px 12px 12px 16px;border-bottom:1px solid var(--ckw-line)}
228
- .ckw-msgr[data-view=home] .ckw-msgr-head{background:var(--ckw-accent);color:var(--ckw-accent-ink);border-bottom-color:transparent}
229
- .ckw-msgr[data-view=home] .ckw-msgr-av{background:var(--ckw-accent-ink);color:var(--ckw-accent)}
230
- .ckw-msgr[data-view=home] .ckw-msgr-x{color:inherit}
231
- .ckw-msgr[data-view=home] .ckw-msgr-x:hover{background:color-mix(in srgb,var(--ckw-accent-ink) 16%,transparent)}
232
- .ckw-msgr-head-t{flex:1}
233
- .ckw-msgr-x{width:32px;height:32px;padding:0;border-radius:10px}
234
- .ckw-msgr-brand{display:inline-flex;align-items:center;gap:10px;font-size:15px;font-weight:650;min-width:0}
250
+ .ckw-msgr[data-wide]{width:680px;height:calc(100vh - 112px);max-height:860px}
251
+ .ckw-msgr[data-still]{animation:none}
252
+ .ckw-msgr[data-out]{animation:ckw-msgr-out .2s cubic-bezier(.4,0,1,1) forwards;pointer-events:none}
253
+ @keyframes ckw-msgr-in{from{opacity:0;transform:translateY(20px) scale(.9)}}
254
+ @keyframes ckw-msgr-out{to{opacity:0;transform:translateY(14px) scale(.94)}}
255
+ .ckw-msgr-bar{position:relative;z-index:2;display:flex;align-items:center;gap:8px;padding:12px 12px 10px;background:var(--ckw-bg);flex:none;transition:background-color .25s linear,color .25s linear}
256
+ .ckw-msgr-lead,.ckw-msgr-trail{display:flex;align-items:center;gap:2px;flex:1;min-width:0}
257
+ .ckw-msgr-trail{justify-content:flex-end}
258
+ .ckw-msgr-ib{width:34px;height:34px;padding:0;flex:none;display:flex;align-items:center;justify-content:center;border:0;border-radius:50%;background:transparent;color:var(--ckw-fg2);transition:background-color .12s linear,transform .2s cubic-bezier(.32,.72,0,1)}
259
+ .ckw-msgr-ib:hover,.ckw-msgr-ib[aria-expanded=true]{background:var(--ckw-bg3);color:var(--ckw-fg)}
260
+ .ckw-msgr-ib:active{transform:scale(.9)}
261
+ .ckw-msgr-ib[aria-current=page]{color:var(--ckw-fg)}
262
+ .ckw-msgr-x{display:none}
263
+ .ckw-msgr-seg{position:relative;display:flex;padding:4px;border-radius:999px;background:var(--ckw-bg3);flex:none}
264
+ .ckw-msgr-seg-mark{position:absolute;top:4px;bottom:4px;left:0;border-radius:999px;background:var(--ckw-accent);box-shadow:0 1px 3px color-mix(in srgb,var(--ckw-accent) 40%,transparent);opacity:0;transition:transform .38s cubic-bezier(.32,.72,0,1),width .38s cubic-bezier(.32,.72,0,1),opacity .2s linear}
265
+ .ckw-msgr-seg-mark[data-on]{opacity:1}
266
+ .ckw-msgr-seg-mark[data-still]{transition:opacity .2s linear}
267
+ .ckw-msgr-seg-b{position:relative;z-index:1;display:inline-flex;align-items:center;gap:6px;height:32px;padding:0 14px;border:0;border-radius:999px;background:none;color:var(--ckw-fg2);font-size:13.5px;font-weight:650;white-space:nowrap;transition:color .25s linear}
268
+ .ckw-msgr-seg-b:hover{color:var(--ckw-fg)}
269
+ .ckw-msgr-seg-b[aria-current=page]{color:var(--ckw-accent-ink)}
270
+ .ckw-msgr-count-tab{top:8px;right:4px;min-width:0;width:7px;height:7px;padding:0;font-size:0;line-height:0;box-shadow:0 0 0 2px var(--ckw-bg3)}
271
+ .ckw-msgr-menu{position:absolute;z-index:3;top:52px;right:12px;min-width:200px;padding:6px;border-radius:14px;background:var(--ckw-bg);box-shadow:var(--ckw-float);display:flex;flex-direction:column;transform-origin:top right;animation:ckw-menu-in .2s cubic-bezier(.32,.72,0,1)}
272
+ .ckw-msgr-menu[data-out]{animation:ckw-menu-out .12s cubic-bezier(.4,0,1,1) forwards}
273
+ @keyframes ckw-menu-in{from{opacity:0;transform:translateY(-4px) scale(.94)}}
274
+ @keyframes ckw-menu-out{to{opacity:0;transform:scale(.96)}}
275
+ .ckw-msgr-menu-h{padding:6px 10px 4px;font-size:12px;font-weight:600;color:var(--ckw-fg3)}
276
+ .ckw-msgr-menu-i{display:flex;align-items:center;gap:10px;height:36px;padding:0 10px;border:0;border-radius:9px;background:none;font-size:14px;text-align:left;color:var(--ckw-fg)}
277
+ .ckw-msgr-menu-i:hover,.ckw-msgr-menu-i:focus-visible{background:var(--ckw-bg2)}
278
+ .ckw-msgr-menu-i .ckw-icon{color:var(--ckw-fg2)}
279
+ .ckw-msgr-body{display:flex;flex-direction:column;gap:12px;background:var(--ckw-bg);padding:4px 16px 16px;overscroll-behavior:contain;scrollbar-width:thin}
280
+ .ckw-msgr-enter>*{animation:ckw-view .3s cubic-bezier(.32,.72,0,1) backwards}
281
+ .ckw-msgr-enter>:nth-child(2){animation-delay:.03s}
282
+ .ckw-msgr-enter>:nth-child(3){animation-delay:.06s}
283
+ .ckw-msgr-enter>:nth-child(n+4){animation-delay:.09s}
284
+ @keyframes ckw-view{from{opacity:0;transform:translateY(8px)}}
285
+ /* Home */
286
+ .ckw-msgr-hero{display:flex;flex-direction:column;gap:8px;padding:14px 4px 10px}
287
+ .ckw-msgr-brand{display:inline-flex;align-items:center;gap:8px;font-size:13px;font-weight:600;color:var(--ckw-fg2);min-width:0}
235
288
  .ckw-msgr-brand span:last-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
236
- .ckw-msgr-who{display:flex;align-items:center;gap:10px;min-width:0;flex:1}
237
- .ckw-msgr-who-t{display:flex;flex-direction:column;min-width:0;font-weight:400}
238
- .ckw-msgr-who-t b{font-size:15px;font-weight:650;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
239
- .ckw-msgr-who-t span{font-size:12px;color:var(--ckw-fg3)}
240
- .ckw-msgr-body{display:flex;flex-direction:column;gap:12px;background:var(--ckw-bg2);padding:16px}
241
- .ckw-msgr[data-view=article] .ckw-msgr-body,.ckw-msgr[data-view=messages] .ckw-msgr-body{background:var(--ckw-bg)}
242
- .ckw-msgr-hero{margin:-16px -16px 0;padding:10px 22px 64px;background:var(--ckw-accent);color:var(--ckw-accent-ink)}
243
- .ckw-msgr-hero+*{margin-top:-52px}
244
- .ckw-msgr-hello{margin:0;font-size:26px;font-weight:700;letter-spacing:-.02em;line-height:1.2;text-wrap:balance;overflow-wrap:anywhere}
245
- .ckw-msgr-card{position:relative;display:flex;align-items:center;gap:12px;width:100%;text-align:left;padding:14px 16px;border:0;border-radius:16px;background:var(--ckw-card);box-shadow:var(--ckw-raise);transition:box-shadow .12s linear}
246
- button.ckw-msgr-card:hover{box-shadow:var(--ckw-raise),0 0 0 1px color-mix(in srgb,var(--ckw-accent) 30%,transparent)}
289
+ .ckw-msgr-hello{margin:4px 0 0;font-size:26px;font-weight:700;letter-spacing:-.025em;line-height:1.15;text-wrap:balance;overflow-wrap:anywhere}
290
+ .ckw-msgr-card{position:relative;display:flex;align-items:center;gap:12px;width:100%;text-align:left;padding:14px 16px;border:0;border-radius:16px;background:var(--ckw-card);box-shadow:0 0 0 1px var(--ckw-line),0 1px 2px rgba(16,18,24,.04);transition:box-shadow .15s linear,transform .25s cubic-bezier(.32,.72,0,1)}
291
+ button.ckw-msgr-card:hover{transform:translateY(-1px);box-shadow:0 0 0 1px color-mix(in srgb,var(--ckw-accent) 35%,var(--ckw-line)),0 6px 16px rgba(16,18,24,.06)}
292
+ button.ckw-msgr-card:active{transform:scale(.985)}
247
293
  .ckw-msgr-card-col{flex-direction:column;align-items:stretch;gap:2px;padding:8px}
248
294
  .ckw-msgr-card-main{display:flex;flex-direction:column;gap:2px;min-width:0;flex:1}
249
295
  .ckw-msgr-card-main b{font-size:15px;font-weight:650}
@@ -254,26 +300,40 @@ button.ckw-msgr-card:hover{box-shadow:var(--ckw-raise),0 0 0 1px color-mix(in sr
254
300
  .ckw-msgr-recent-row{display:flex;align-items:center;gap:12px;min-width:0}
255
301
  .ckw-msgr-recent-text{color:var(--ckw-fg);font-size:14px}
256
302
  .ckw-msgr-card .ckw-icon{color:var(--ckw-fg3)}
257
- .ckw-msgr-go{width:34px;height:34px;border-radius:50%;flex:none;display:flex;align-items:center;justify-content:center;background:color-mix(in srgb,var(--ckw-accent) 12%,transparent)}
303
+ .ckw-msgr-go{width:34px;height:34px;border-radius:50%;flex:none;display:flex;align-items:center;justify-content:center;background:color-mix(in srgb,var(--ckw-accent) 12%,transparent);transition:transform .25s cubic-bezier(.32,.72,0,1)}
304
+ button.ckw-msgr-card:hover .ckw-msgr-go{transform:translateX(2px)}
258
305
  .ckw-msgr-card .ckw-msgr-go .ckw-icon{color:var(--ckw-accent)}
259
- .ckw-msgr-badge{min-width:20px;height:20px;padding:0 6px;border-radius:10px;background:var(--ckw-danger);color:#fff;font-size:12px;font-weight:700;line-height:20px;text-align:center}
260
- .ckw-msgr-search{display:flex;align-items:center;gap:8px;height:42px;padding:0 14px;border:0;border-radius:12px;background:var(--ckw-bg2);color:var(--ckw-accent);cursor:text}
261
- .ckw-msgr[data-view=help] .ckw-msgr-search{background:var(--ckw-card);box-shadow:var(--ckw-raise)}
262
- .ckw-msgr-card-col .ckw-msgr-search{margin-bottom:4px}
263
- .ckw-msgr-search-in{flex:1;min-width:0;border:0;background:transparent;outline:none;font-size:14px;font-weight:500;color:var(--ckw-fg)}
306
+ .ckw-msgr-badge{width:8px;height:8px;flex:none;border-radius:50%;background:var(--ckw-danger);font-size:0}
307
+ /* Search */
308
+ .ckw-msgr-search{display:flex;align-items:center;gap:10px;height:46px;padding:0 14px;border:1px solid transparent;border-radius:14px;background:var(--ckw-bg2);color:var(--ckw-fg3);cursor:text;transition:border-color .15s linear,box-shadow .15s linear,background-color .15s linear}
309
+ .ckw-msgr-card-col .ckw-msgr-search{margin-bottom:4px;height:42px}
310
+ .ckw-msgr-search:focus-within{border-color:var(--ckw-accent);background:var(--ckw-bg);box-shadow:0 0 0 4px color-mix(in srgb,var(--ckw-accent) 16%,transparent);color:var(--ckw-accent)}
311
+ .ckw-msgr-search-in{flex:1;min-width:0;border:0;background:transparent;outline:none;font-size:14.5px;color:var(--ckw-fg)}
264
312
  .ckw-root .ckw-msgr-search-in:focus-visible{outline:none}
265
- .ckw-msgr-search-in::placeholder{color:var(--ckw-fg2)}
266
- .ckw-msgr-search:focus-within{box-shadow:0 0 0 2px color-mix(in srgb,var(--ckw-accent) 45%,transparent)}
267
- .ckw-msgr-art{display:flex;align-items:center;gap:8px;width:100%;text-align:left;padding:10px 8px;border:0;border-radius:10px;background:transparent;font-size:14px}
313
+ .ckw-msgr-search-in::placeholder{color:var(--ckw-fg3)}
314
+ .ckw-msgr-search-in::-webkit-search-cancel-button{display:none}
315
+ .ckw-msgr-art{display:flex;align-items:center;gap:8px;width:100%;text-align:left;padding:10px 8px;border:0;border-radius:10px;background:transparent;font-size:14px;transition:background-color .12s linear}
268
316
  .ckw-msgr-art:hover{background:var(--ckw-bg2)}
269
317
  .ckw-msgr-art-t{flex:1;min-width:0}
270
- .ckw-msgr-art .ckw-icon{color:var(--ckw-accent)}
318
+ .ckw-msgr-art .ckw-icon{color:var(--ckw-accent);transition:transform .25s cubic-bezier(.32,.72,0,1)}
319
+ .ckw-msgr-art:hover .ckw-icon{transform:translateX(2px)}
271
320
  .ckw-msgr-skel{height:40px;margin:4px 0 0}
272
- .ckw-msgr-group{display:flex;flex-direction:column;gap:6px}
273
- .ckw-msgr-group-h{margin:4px 2px 0;font-size:12px;font-weight:600;color:var(--ckw-fg3)}
321
+ /* Help */
322
+ .ckw-msgr-help-h{margin:6px 0 2px;text-align:center;font-size:16px;font-weight:700;letter-spacing:-.01em}
323
+ .ckw-msgr-hlist{display:flex;flex-direction:column;margin:0 -8px}
324
+ .ckw-msgr-hrow{display:flex;align-items:center;gap:12px;width:100%;padding:12px;border:0;border-radius:14px;background:transparent;text-align:left;transition:background-color .12s linear}
325
+ .ckw-msgr-hrow+.ckw-msgr-hrow{box-shadow:0 -1px 0 var(--ckw-line)}
326
+ .ckw-msgr-hrow:hover,.ckw-msgr-hrow:hover+.ckw-msgr-hrow{box-shadow:none}
327
+ .ckw-msgr-hrow:hover{background:var(--ckw-bg2)}
328
+ .ckw-msgr-hrow-main{display:flex;flex-direction:column;gap:3px;flex:1;min-width:0}
329
+ .ckw-msgr-hrow-main b{font-size:14.5px;font-weight:650}
330
+ .ckw-msgr-hrow-sub{font-size:13px;color:var(--ckw-fg2);display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;line-height:1.4}
331
+ .ckw-msgr-hrow-meta{font-size:12px;color:var(--ckw-fg3)}
332
+ .ckw-msgr-hrow .ckw-icon{color:var(--ckw-fg3);transition:transform .25s cubic-bezier(.32,.72,0,1),color .12s linear}
333
+ .ckw-msgr-hrow:hover .ckw-icon{color:var(--ckw-fg);transform:translateX(2px)}
274
334
  .ckw-msgr-empty{display:flex;flex-direction:column;align-items:center;gap:10px;padding:28px 8px;text-align:center;color:var(--ckw-fg2)}
275
335
  .ckw-msgr-empty p{margin:0}
276
- .ckw-msgr-doc{display:flex;flex-direction:column;gap:6px}
336
+ .ckw-msgr-doc{display:flex;flex-direction:column;gap:6px;padding-top:4px}
277
337
  .ckw-msgr-doc-t{margin:0;font-size:20px;font-weight:700;letter-spacing:-.015em;line-height:1.3}
278
338
  .ckw-msgr-doc-c{margin:0;font-size:12px;color:var(--ckw-fg3)}
279
339
  .ckw-msgr-doc-b{margin-top:8px;font-size:14px;line-height:1.6;overflow-wrap:anywhere}
@@ -289,35 +349,53 @@ button.ckw-msgr-card:hover{box-shadow:var(--ckw-raise),0 0 0 1px color-mix(in sr
289
349
  .ckw-msgr-rate{display:flex;align-items:center;justify-content:space-between;gap:8px;flex-wrap:wrap;margin-top:8px;padding:12px;border-radius:12px;background:var(--ckw-bg2);font-size:13px;color:var(--ckw-fg2)}
290
350
  .ckw-msgr-rate-b{display:flex;gap:6px}
291
351
  .ckw-msgr-ask{margin-top:6px;width:100%;height:40px;border-radius:12px}
352
+ /* Chat */
353
+ .ckw-msgr-intro{display:flex;align-items:center;gap:12px;padding:6px 2px 14px;border-bottom:1px solid var(--ckw-line)}
354
+ .ckw-msgr-intro-av .ckw-msgr-av{width:44px;height:44px;font-size:18px;box-shadow:0 4px 12px color-mix(in srgb,var(--ckw-accent) 30%,transparent)}
355
+ .ckw-msgr-intro-t{display:flex;flex-direction:column;gap:3px;min-width:0}
356
+ .ckw-msgr-intro-t b{font-size:15.5px;font-weight:700;letter-spacing:-.01em;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
292
357
  .ckw-msgr-cite{display:inline-flex;align-items:center;gap:6px;max-width:100%;padding:7px 10px;border:1px solid var(--ckw-line);border-radius:12px;background:var(--ckw-bg);font-size:13px;text-align:left}
293
358
  .ckw-msgr-cite .ckw-icon{color:var(--ckw-accent)}
294
359
  .ckw-msgr-cite span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
295
- .ckw-msgr-tabs{display:flex;border-top:1px solid var(--ckw-line);background:var(--ckw-bg);padding:2px 8px}
296
- .ckw-msgr-tab{position:relative;flex:1;display:flex;flex-direction:column;align-items:center;gap:3px;padding:8px 0 10px;border:0;background:none;color:var(--ckw-fg3);font-size:12px;font-weight:600;transition:color .1s linear}
297
- .ckw-msgr-tab:hover{color:var(--ckw-fg2)}
298
- .ckw-msgr-tab[aria-current=page]{color:var(--ckw-accent)}
299
- .ckw-msgr-tab .ckw-icon{width:20px;height:20px}
300
- .ckw-msgr-count-tab{top:4px;right:calc(50% - 24px)}
301
- .ckw-msgs{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:12px}
302
- .ckw-msg{display:flex;flex-direction:column;align-items:flex-start;gap:4px;max-width:82%}
303
- .ckw-msg[data-from=me]{align-self:flex-end;align-items:flex-end}
304
- .ckw-bubble{padding:9px 14px;border-radius:18px 18px 18px 6px;background:var(--ckw-bg3);white-space:pre-wrap;overflow-wrap:anywhere;font-size:14px;line-height:1.45;text-wrap:pretty}
360
+ .ckw-msgs{list-style:none;margin:4px 0 0;padding:0;display:flex;flex-direction:column;gap:12px}
361
+ .ckw-msg{display:flex;flex-direction:column;align-items:flex-start;gap:4px;max-width:82%;transform-origin:bottom left}
362
+ .ckw-msg[data-from=me]{align-self:flex-end;align-items:flex-end;transform-origin:bottom right}
363
+ .ckw-msg[data-new]{animation:ckw-bub .4s cubic-bezier(.32,.72,0,1)}
364
+ @keyframes ckw-bub{from{opacity:0;transform:translateY(10px) scale(.92)}}
365
+ .ckw-bubble{padding:10px 14px;border-radius:18px 18px 18px 6px;background:var(--ckw-bg3);white-space:pre-wrap;overflow-wrap:anywhere;font-size:14px;line-height:1.45;text-wrap:pretty}
305
366
  .ckw-msg[data-from=me] .ckw-bubble{background:var(--ckw-accent);color:var(--ckw-accent-ink);border-radius:18px 18px 6px 18px}
306
367
  .ckw-msg[aria-busy=true] .ckw-bubble{opacity:.7}
307
368
  .ckw-msg-meta{font-size:11px;color:var(--ckw-fg3);font-variant-numeric:tabular-nums;padding:0 6px}
369
+ .ckw-msgr-sugg{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:8px;margin-top:auto;padding-top:12px}
370
+ .ckw-msgr-sugg-b{max-width:100%;padding:9px 14px;border:1px solid var(--ckw-line);border-radius:14px;background:var(--ckw-bg);font-size:13.5px;text-align:left;color:var(--ckw-fg);transition:border-color .12s linear,color .12s linear,transform .2s cubic-bezier(.32,.72,0,1)}
371
+ .ckw-msgr-sugg-b:hover{border-color:var(--ckw-accent);color:var(--ckw-accent)}
372
+ .ckw-msgr-sugg-b:active{transform:scale(.96)}
373
+ .ckw-msgr-enter .ckw-msgr-sugg-b{animation:ckw-view .34s cubic-bezier(.32,.72,0,1) backwards}
374
+ .ckw-msgr-enter .ckw-msgr-sugg-b:nth-child(2){animation-delay:.12s}
375
+ .ckw-msgr-enter .ckw-msgr-sugg-b:nth-child(3){animation-delay:.18s}
308
376
  .ckw-msgr-note{margin:4px 0 0;text-align:center}
309
- .ckw-msgr-compose{display:flex;flex-direction:column;gap:8px;padding:10px 12px 12px;background:var(--ckw-bg)}
377
+ .ckw-msgr-compose{display:flex;flex-direction:column;gap:8px;padding:4px 14px 14px;background:var(--ckw-bg);flex:none}
310
378
  .ckw-msgr-compose .ckw-input{border:0;border-radius:12px;background:var(--ckw-bg2);min-height:38px;padding:8px 14px}
311
- .ckw-msgr-row{display:flex;gap:6px;align-items:flex-end;padding:5px 5px 5px 16px;border:1px solid var(--ckw-line);border-radius:22px;background:var(--ckw-bg);transition:border-color .1s linear}
312
- .ckw-msgr-row:focus-within{border-color:var(--ckw-accent)}
313
- .ckw-msgr-input{flex:1;min-height:32px;max-height:120px;padding:6px 0;border:0;border-radius:0;background:transparent;resize:none;field-sizing:content}
379
+ .ckw-msgr-box{display:flex;flex-direction:column;gap:2px;padding:10px 10px 8px 14px;border:1.5px solid var(--ckw-line);border-radius:16px;background:var(--ckw-bg);cursor:text;transition:border-color .15s linear,box-shadow .15s linear}
380
+ .ckw-msgr-box:focus-within{border-color:var(--ckw-accent);box-shadow:0 0 0 4px color-mix(in srgb,var(--ckw-accent) 14%,transparent)}
381
+ .ckw-msgr-input{min-height:24px;max-height:140px;padding:2px 0;border:0;border-radius:0;background:transparent;resize:none;field-sizing:content;font-size:14.5px}
314
382
  .ckw-root .ckw-msgr-input:focus-visible{outline:none}
315
- .ckw-msgr-send{width:32px;height:32px;padding:0;flex:none;display:flex;align-items:center;justify-content:center;border:0;border-radius:50%;background:var(--ckw-accent);color:var(--ckw-accent-ink);transition:opacity .1s linear}
383
+ .ckw-msgr-box-foot{display:flex;align-items:center;justify-content:space-between;gap:8px}
384
+ .ckw-msgr-hint{font-size:11.5px;color:var(--ckw-fg3);opacity:0;transition:opacity .15s linear}
385
+ .ckw-msgr-box:focus-within .ckw-msgr-hint{opacity:1}
386
+ .ckw-msgr-send{width:32px;height:32px;padding:0;flex:none;display:flex;align-items:center;justify-content:center;border:0;border-radius:50%;background:var(--ckw-accent);color:var(--ckw-accent-ink);transition:background-color .15s linear,color .15s linear,transform .25s cubic-bezier(.34,1.56,.64,1)}
387
+ .ckw-msgr-send:not(:disabled):hover{transform:scale(1.08)}
388
+ .ckw-msgr-send:not(:disabled):active{transform:scale(.9)}
316
389
  .ckw-msgr-send:disabled{background:var(--ckw-bg3);color:var(--ckw-fg3);cursor:default}
317
390
  .ckw-msgr-error{margin:0;font-size:12px;color:var(--ckw-danger)}
318
391
  .ckw-msgr .ckw-input[aria-invalid=true]{box-shadow:0 0 0 1px var(--ckw-danger)}
319
- @media (max-width:520px){.ckw-msgr{height:100dvh;bottom:0;border-radius:0}.ckw-msgr-preview{bottom:80px}}
320
- @media (prefers-reduced-motion:reduce){.ckw-msgr,.ckw-msgr-preview,.ckw-msgr-fab .ckw-turn{animation:none}.ckw-msgr-fab{transition:none}}
392
+ /* Inside MRRocket's preview: placed in its frame, not the page */
393
+ .ckw-root[data-contained]{position:absolute;inset:0;pointer-events:none;overflow:hidden}
394
+ .ckw-root[data-contained]>*{position:absolute;pointer-events:auto}
395
+ .ckw-root[data-contained] .ckw-msgr{height:min(680px,calc(100% - 112px));max-width:calc(100% - 40px)}
396
+ .ckw-root[data-contained] .ckw-msgr[data-wide]{height:calc(100% - 112px)}
397
+ @media (max-width:520px){.ckw-root:not([data-contained]) .ckw-msgr{width:100%;height:100dvh;bottom:0;border-radius:0;transform-origin:bottom center}.ckw-root:not([data-contained]) .ckw-msgr-x{display:flex}.ckw-msgr-preview,.ckw-msgr-teaser{bottom:84px}}
398
+ @media (prefers-reduced-motion:reduce){.ckw-msgr,.ckw-msgr[data-out],.ckw-msgr-preview,.ckw-msgr-teaser,.ckw-msgr-menu,.ckw-msgr-count,.ckw-msg[data-new],.ckw-msgr-enter>*,.ckw-msgr-enter .ckw-msgr-sugg-b{animation:none}.ckw-msgr-fab,.ckw-msgr-fab-i,.ckw-msgr-seg-mark,.ckw-msgr{transition:none}}
321
399
  /* Survey */
322
400
  .ckw-survey{position:fixed;z-index:2147483000;left:20px;bottom:20px;width:360px;max-width:calc(100vw - 24px);background:var(--ckw-bg);border:1px solid var(--ckw-line);border-radius:12px;box-shadow:var(--ckw-shadow);padding:14px;animation:ckw-in .2s ease-out}
323
401
  @keyframes ckw-in{from{opacity:0;transform:translateY(8px)}}
@@ -344,5 +422,5 @@ button.ckw-msgr-card:hover{box-shadow:var(--ckw-raise),0 0 0 1px color-mix(in sr
344
422
  .ckw-sv-foot{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-top:12px}
345
423
  .ckw-thanks{text-align:center;padding:14px 0;display:flex;flex-direction:column;align-items:center;gap:8px}
346
424
  .ckw-tick{width:32px;height:32px;border-radius:50%;background:var(--ckw-accent);color:var(--ckw-accent-ink);display:flex;align-items:center;justify-content:center}
347
- `,et=()=>{if(typeof document=="undefined"||document.getElementById(Ze))return;let r=document.createElement("style");r.id=Ze,r.textContent=dt,document.head.appendChild(r);};var gt=4e3,wt=8e3,kt=3e4,xt=10*6e4,mt=/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/,rt="ckw_msgr_seen",ye={visitor:"You",team:"Team",ai:"AI agent",auto:"Team"},ft=()=>{var r;try{return (r=window.localStorage.getItem(rt))!=null?r:""}catch(a){return ""}},bt=r=>{try{window.localStorage.setItem(rt,r);}catch(a){}},ze=r=>{let a=new Date(r).getTime();if(Number.isNaN(a))return "";let n=Math.max(0,Date.now()-a)/1e3;return n<60?"just now":n<3600?`${Math.floor(n/60)}m ago`:n<86400?`${Math.floor(n/3600)}h ago`:n<86400*30?`${Math.floor(n/86400)}d ago`:new Date(r).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})},t=(r,a={},...n)=>{let p=document.createElement(r);for(let[i,s]of Object.entries(a))p.setAttribute(i,s);for(let i of n)i!==null&&i!==false&&i!==void 0&&p.append(i);return p},tt="http://www.w3.org/2000/svg",z=(r,a=16)=>{let n=document.createElementNS(tt,"svg");for(let[i,s]of Object.entries({class:"ckw-icon",width:String(a),height:String(a),viewBox:"0 0 16 16",fill:"none",stroke:"currentColor","stroke-width":"1.7","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"}))n.setAttribute(i,s);let p=document.createElementNS(tt,"path");return p.setAttribute("d",r),n.appendChild(p),n},h={cross:"m4 4 8 8M12 4l-8 8",chat:"M2.5 4.5a2 2 0 0 1 2-2h7a2 2 0 0 1 2 2v4.5a2 2 0 0 1-2 2H7l-3 2.5V11a2 2 0 0 1-1.5-2z",send:"M2.5 8h10M8.5 3.5 13 8l-4.5 4.5",up:"M8 13V3M3.5 7.5 8 3l4.5 4.5",home:"M2.5 7 8 2.5 13.5 7v6a1 1 0 0 1-1 1h-3v-4h-3v4h-3a1 1 0 0 1-1-1z",help:"M8 14.5A6.5 6.5 0 1 0 8 1.5a6.5 6.5 0 0 0 0 13zM6.2 6.2a1.9 1.9 0 1 1 2.6 1.8c-.5.2-.8.6-.8 1.1v.4M8 11.6v.1",back:"M10 3.5 5.5 8l4.5 4.5",next:"M6 3.5 10.5 8 6 12.5",search:"M7 11.5a4.5 4.5 0 1 0 0-9 4.5 4.5 0 0 0 0 9zM10.5 10.5l3 3",doc:"M4 1.5h5.5l3 3V14a.5.5 0 0 1-.5.5H4a.5.5 0 0 1-.5-.5V2a.5.5 0 0 1 .5-.5zM9.5 1.5v3h3M6 8.5h4M6 11h4"},ie=(()=>{let r=null,a=()=>{var p;let n=(p=window.AudioContext)!=null?p:window.webkitAudioContext;return n?(r!=null||(r=new n),r):null};return {unlock:()=>{try{let n=a();(n==null?void 0:n.state)==="suspended"&&n.resume();}catch(n){}},play:()=>{try{let n=a();if(!n||n.state!=="running")return;let p=n.currentTime;[880,1318.5].forEach((i,s)=>{let x=n.createOscillator(),M=n.createGain(),g=p+s*.11;x.type="sine",x.frequency.value=i,M.gain.setValueAtTime(1e-4,g),M.gain.exponentialRampToValueAtTime(.12,g+.012),M.gain.exponentialRampToValueAtTime(1e-4,g+.32),x.connect(M),M.connect(n.destination),x.start(g),x.stop(g+.34);});}catch(n){}}}})(),ce=r=>r.map(a=>{let n=a.href?t("a",{href:a.href,target:"_blank",rel:"noopener noreferrer"},a.text):t("span",{},a.text);return a.code&&(n=t("code",{},n)),a.italic&&(n=t("em",{},n)),a.bold&&(n=t("strong",{},n)),n}),ut=r=>{switch(r.type){case "h2":case "h3":return t(r.type,{},...ce(r.spans));case "quote":return t("blockquote",{},...ce(r.spans));case "ul":case "ol":return t(r.type,{},...r.items.map(a=>t("li",{},...ce(a))));case "code":return t("pre",{},t("code",{},r.text));case "hr":return t("hr");default:return t("p",{},...ce(r.spans))}},ht=2500,at=r=>{let a=null,n=false,p=[],i=g=>a?g(a):p.push(g),s=new AbortController,x=g=>{var Y,G;if(a||n)return;let $=Object.fromEntries(Object.entries(r).filter(([,I])=>I!==void 0));a=vt({...g!=null?g:{},...$,accent:(Y=r.accent)!=null?Y:g==null?void 0:g.accent,theme:(G=r.theme)!=null?G:g==null?void 0:g.theme});for(let I of p.splice(0))I(a);},M=setTimeout(()=>x(null),ht);return ve({host:r.host,apiKey:r.apiKey,distinctId:r.distinctId(),user:r.user()}).messengerLook(s.signal).then(g=>x(g)).catch(()=>x(null)).finally(()=>clearTimeout(M)),{open:g=>i($=>$.open(g)),close:()=>a==null?void 0:a.close(),toggle:()=>i(g=>g.toggle()),destroy:()=>{n=true,s.abort(),clearTimeout(M),a==null||a.destroy();}}},vt=r=>{var Fe,_e,qe,Ne,De,Ue,Be,Ve,We;et();let a=(Fe=r.position)!=null?Fe:"bottom-right",n=r.title||"Chat with us",p=r.greeting||"Hi! How can we help?",i=(_e=r.askEmail)!=null?_e:true,s=(qe=r.label)!=null?qe:"",x=Je(r.replyTime),M=((Ne=n.trim()[0])!=null?Ne:"?").toUpperCase(),g=(De=r.launcher)!=null?De:true,$=(Ue=r.help)!=null?Ue:true,Y=(Be=r.sound)!=null?Be:true,G=(Ve=r.preview)!=null?Ve:true,I=()=>ve({host:r.host,apiKey:r.apiKey,distinctId:r.distinctId(),user:r.user()}),P=t("div",{class:"ckw-root","data-theme":(We=r.theme)!=null?We:"auto"});r.accent&&(P.style.setProperty("--ckw-accent",r.accent),P.style.setProperty("--ckw-accent-ink",Xe(r.accent))),document.body.appendChild(P);let b=false,m="home",w=null,Ce=false,H="",A=null,se=null,u=[],Q=false,J,O=null,v=null,E="",pe=new Set,le=null,Se=e=>{var o;return ((o=e==null?void 0:e.messages)!=null?o:[]).filter(c=>c.from!=="visitor")},Me=e=>{var o,c;return (c=(o=Se(e).at(-1))==null?void 0:o.id)!=null?c:""},de=()=>b&&m==="messages"&&document.visibilityState!=="hidden",Ae=e=>{let o=Se(e);if(se===null){let c=ft(),l=o.findIndex(d=>d.id===c);u=e.messages.some(d=>d.from==="visitor")?o.slice(l+1).filter(d=>d.from!=="auto"):[];}else {let c=o.findIndex(d=>d.id===se),l=o.slice(c+1).filter(d=>d.from!=="auto");l.length&&(Y&&ie.play(),de()||(u=[...u,...l],Q=false));}se=Me(e),w=e,de()&&ge();},ge=()=>{u=[];let e=Me(w);e&&bt(e);},X=e=>t("span",{class:`ckw-msgr-av${e?" ckw-msgr-av-sm":""}`,"aria-hidden":"true"},M),R=t("button",{type:"button",class:`ckw-fab ckw-msgr-fab${s?"":" ckw-msgr-round"}`,"data-pos":a,"aria-haspopup":"dialog"}),Z=t("div",{class:"ckw-msgr-preview","data-pos":a,role:"status"}),we=null,U=()=>{let e=z(b?h.cross:h.chat,s?18:24);we!==null&&we!==b&&e.classList.add("ckw-turn"),we=b,R.replaceChildren(e),s&&R.append(t("span",{},s)),u.length&&!b&&R.append(t("span",{class:"ckw-msgr-count","aria-hidden":"true"},String(Math.min(u.length,9)))),R.setAttribute("aria-expanded",String(b)),R.setAttribute("aria-label",b?"Close chat":u.length?`Open chat, ${u.length} new ${u.length===1?"reply":"replies"}`:"Open chat"),Ee();},Ee=()=>{let e=u.at(-1);if(!G||b||Q||!e||!g)return Z.remove();let o=t("button",{type:"button",class:"ckw-msgr-preview-x","aria-label":"Dismiss"},z(h.cross,12));o.addEventListener("click",l=>{l.stopPropagation(),Q=true,Ee();});let c=t("button",{type:"button",class:"ckw-msgr-preview-card"},X(),t("span",{class:"ckw-msgr-preview-main"},t("span",{class:"ckw-msgr-preview-who"},`${ye[e.from]}${u.length>1?` \xB7 ${u.length} new`:""}`),t("span",{class:"ckw-msgr-preview-text"},e.body)));c.addEventListener("click",()=>ne("messages")),Z.replaceChildren(c,o),Z.isConnected||P.appendChild(Z);};R.addEventListener("click",()=>{ie.unlock(),b?W():ne(u.length?"messages":"home");}),g&&P.appendChild(R);let K=t("div",{class:"ckw-pop ckw-msgr","data-pos":a,role:"dialog","aria-label":n}),B=t("div",{class:"ckw-pop-head ckw-msgr-head"}),y=t("div",{class:"ckw-pop-body ckw-msgr-body"}),Te=t("nav",{class:"ckw-msgr-tabs","aria-label":"Messenger"});K.addEventListener("click",()=>ie.unlock());let V=t("form",{class:"ckw-msgr-compose"}),ee=t("p",{class:"ckw-msgr-error",role:"alert"}),T=t("input",{class:"ckw-input",type:"email",inputmode:"email",autocomplete:"email",placeholder:"Your email (optional), so we can follow up","aria-label":"Your email (optional)",maxlength:"200"}),ke=t("div",{class:"ckw-msgr-row"}),j=t("textarea",{class:"ckw-textarea ckw-msgr-input",rows:"1",placeholder:"Write a message\u2026","aria-label":"Message",maxlength:"4000"}),xe=t("button",{type:"submit",class:"ckw-msgr-send","aria-label":"Send"},z(h.up));ke.append(j,xe),V.append(ke);let Le=t("ol",{class:"ckw-msgs","aria-live":"polite","aria-label":"Messages"}),$e=()=>{var e;return i&&!((e=r.user())!=null&&e.email)&&!(w!=null&&w.hasEmail)},me=()=>!T.value.trim()||mt.test(T.value.trim()),Ie=()=>!!j.value.trim()&&!A&&me(),te=()=>{let e=t("button",{type:"button",class:"ckw-btn ckw-btn-ghost ckw-msgr-x","aria-label":"Close messenger"},z(h.cross));return e.addEventListener("click",()=>W()),e},C=e=>{m=e,ae=-1,F(),e==="messages"?(ge(),U(),j.focus()):e==="help"&&be.focus(),N(0);},je=(e,o=false)=>{var l;let c=t("li",{class:"ckw-msg","data-from":e.from==="visitor"?"me":"them"},t("div",{class:"ckw-bubble"},e.body));o&&c.setAttribute("aria-busy","true");for(let d of (l=e.articles)!=null?l:[]){let k=t("button",{type:"button",class:"ckw-msgr-cite"},z(h.doc,14),t("span",{},d.title));k.addEventListener("click",()=>C({article:d.id})),c.append(k);}return c.append(t("span",{class:"ckw-msg-meta"},`${e.from!=="visitor"?`${ye[e.from]} \xB7 `:""}${o?"Sending\u2026":ze(e.at)}`)),c},fe=e=>{let o=t("button",{type:"button",class:"ckw-msgr-art"},t("span",{class:"ckw-msgr-art-t"},e.title),z(h.next,14));return o.addEventListener("click",()=>C({article:e.id})),o},Oe=()=>{let e=t("label",{class:"ckw-msgr-search"}),o=t("input",{class:"ckw-msgr-search-in",type:"search",placeholder:"Search for help","aria-label":"Search for help",maxlength:"200"});o.value=E;let c;return o.addEventListener("input",()=>{E=o.value,clearTimeout(c),c=setTimeout(()=>{if(m!=="help")return C("help");he(true);},250);}),o.addEventListener("keydown",l=>{l.key==="Enter"&&(l.preventDefault(),m!=="help"&&C("help"));}),e.append(o,z(h.search,16)),e},re=Oe(),be=re.querySelector("input"),ue=false,he=async(e=false)=>{if(!$||ue&&!e)return;ue=true;let o=E.trim();try{let c=await I().articles(o||void 0);if(o!==E.trim())return;v=c.articles,o||(le=c.articles.length>0);}catch(c){v=v!=null?v:[];}finally{ue=false;}F();},nt=()=>{var d;B.replaceChildren(t("span",{class:"ckw-msgr-brand"},X("sm"),t("span",{},n)),te());let e=t("div",{class:"ckw-msgr-hero"},t("p",{class:"ckw-msgr-hello"},p)),o=((d=w==null?void 0:w.messages)!=null?d:[]).at(-1),c=[e];if(o){let k=t("button",{type:"button",class:"ckw-msgr-card ckw-msgr-recent"},t("span",{class:"ckw-msgr-card-label"},"Recent message"),t("span",{class:"ckw-msgr-recent-row"},X(),t("span",{class:"ckw-msgr-card-main"},t("span",{class:"ckw-msgr-card-sub ckw-msgr-recent-text"},o.body),t("span",{class:"ckw-msgr-card-meta"},`${o.from==="visitor"?"You":ye[o.from]} \xB7 ${ze(o.at)}`)),u.length?t("span",{class:"ckw-msgr-badge"},String(u.length)):z(h.next,14)));k.addEventListener("click",()=>C("messages")),c.push(k);}let l=t("button",{type:"button",class:"ckw-msgr-card"},t("span",{class:"ckw-msgr-card-main"},t("b",{},"Send us a message"),t("span",{class:"ckw-msgr-card-sub"},x)),t("span",{class:"ckw-msgr-go"},z(h.send)));if(l.addEventListener("click",()=>C("messages")),c.push(l),$&&le!==false){let k=t("div",{class:"ckw-msgr-card ckw-msgr-card-col"},Oe()),f=(v!=null?v:[]).slice(0,4);f.length?k.append(...f.map(fe)):v===null&&k.append(t("div",{class:"ckw-skel ckw-msgr-skel"})),c.push(k);}y.replaceChildren(...c);},ot=()=>{var o;B.replaceChildren(t("span",{},"Help"),te()),be.value!==E&&(be.value=E);let e=[re];if(v===null)e.push(t("div",{class:"ckw-skel"}));else if(v.length)if(E.trim())e.push(t("div",{class:"ckw-msgr-card ckw-msgr-card-col"},...v.map(fe)));else {let c=new Map;for(let l of v)c.set(l.collection,[...(o=c.get(l.collection))!=null?o:[],l]);for(let[l,d]of c)e.push(t("section",{class:"ckw-msgr-group"},t("h3",{class:"ckw-msgr-group-h"},`${l} \xB7 ${d.length}`),t("div",{class:"ckw-msgr-card ckw-msgr-card-col"},...d.map(fe))));}else {let c=t("button",{type:"button",class:"ckw-btn ckw-btn-primary"},"Send us a message");c.addEventListener("click",()=>C("messages")),e.push(t("div",{class:"ckw-msgr-empty"},t("p",{},E.trim()?`Nothing found for \u201C${E.trim()}\u201D.`:"No help articles yet."),c));}for(y.firstChild!==re&&y.replaceChildren(re);y.childNodes.length>1;)y.lastChild.remove();y.append(...e.slice(1));},q=null,it=e=>{let o=t("button",{type:"button",class:"ckw-btn ckw-btn-ghost ckw-msgr-x","aria-label":"Back to help"},z(h.back));if(o.addEventListener("click",()=>C("help")),B.replaceChildren(o,t("span",{class:"ckw-msgr-head-t"},"Help"),te()),(q==null?void 0:q.id)===e)return y.replaceChildren(q.node);let c=t("article",{class:"ckw-msgr-doc"},t("div",{class:"ckw-skel"}));q={id:e,node:c},y.replaceChildren(c),I().article(e).then(l=>{let d=t("div",{class:"ckw-msgr-rate"}),k=()=>{if(pe.has(e))return d.replaceChildren(t("span",{},"Thanks for letting us know."));let _=t("button",{type:"button",class:"ckw-btn"},"Yes"),D=t("button",{type:"button",class:"ckw-btn"},"No"),Ye=Ge=>{pe=new Set(pe).add(e),k(),I().rateArticle(e,Ge).catch(()=>{}),Ge||C("messages");};_.addEventListener("click",()=>Ye(true)),D.addEventListener("click",()=>Ye(false)),d.replaceChildren(t("span",{},"Did this answer your question?"),t("span",{class:"ckw-msgr-rate-b"},_,D));};k();let f=t("button",{type:"button",class:"ckw-btn ckw-msgr-ask"},z(h.chat),"Still need help? Send us a message");f.addEventListener("click",()=>C("messages")),c.replaceChildren(t("p",{class:"ckw-msgr-doc-c"},l.collection),t("h2",{class:"ckw-msgr-doc-t"},l.title),t("p",{class:"ckw-msgr-doc-c"},`Updated ${ze(l.updatedAt)}`),t("div",{class:"ckw-msgr-doc-b"},...l.blocks.map(ut)),d,f);}).catch(l=>{q=null,c.replaceChildren(t("p",{class:"ckw-msgr-error"},l.message));});},ae=-1,Re="",ct=()=>{var l,d;B.replaceChildren(t("span",{class:"ckw-msgr-who"},X(),t("span",{class:"ckw-msgr-who-t"},t("b",{},n),t("span",{},x))),te());let e=(l=w==null?void 0:w.messages)!=null?l:[],o=[];if(!Ce)o.push(t("div",{class:"ckw-skel"}));else {let k=`${e.map(f=>f.id).join(",")}|${A?A.body:""}|${Math.floor(Date.now()/6e4)}`;if(k!==Re){Re=k;let f=t("li",{class:"ckw-msg","data-from":"them"},t("div",{class:"ckw-bubble"},p));Le.replaceChildren(f,...e.map(_=>je(_)),...A?[je(A,true)]:[]);}o.push(Le);}((d=w==null?void 0:w.conversation)==null?void 0:d.status)==="solved"&&!A&&o.push(t("p",{class:"ckw-fine ckw-msgr-note"},"This conversation is closed. Write to start a new one.")),(y.childNodes.length!==o.length||o.some((k,f)=>y.childNodes[f]!==k))&&y.replaceChildren(...o);let c=e.length+(A?1:0);c!==ae&&(ae=c,y.scrollTop=y.scrollHeight),ee.textContent=H,H&&!ee.isConnected?V.prepend(ee):H||ee.remove(),$e()?(me()?T.removeAttribute("aria-invalid"):T.setAttribute("aria-invalid","true"),T.isConnected||V.insertBefore(T,ke)):T.remove(),xe.disabled=!Ie();},st=()=>{let e=typeof m=="string"?m:"help",o=(c,l,d,k=0)=>{let f=t("button",{type:"button",class:"ckw-msgr-tab","aria-current":e===c?"page":"false"},z(d,18),t("span",{},l));return k&&f.append(t("span",{class:"ckw-msgr-count ckw-msgr-count-tab"},String(Math.min(k,9)))),f.addEventListener("click",()=>C(c)),f};Te.replaceChildren(o("home","Home",h.home),o("messages","Messages",h.chat,m==="messages"?0:u.length),...$&&le!==false?[o("help","Help",h.help)]:[]);},F=()=>{if(!b)return;K.dataset.view=typeof m=="string"?m:"article",m==="home"?nt():m==="messages"?ct():m==="help"?ot():it(m.article);let e=[B,y];m==="messages"&&e.push(V),e.push(Te),st(),(K.childNodes.length!==e.length||e.some((o,c)=>K.childNodes[c]!==o))&&K.replaceChildren(...e);},Ke=async()=>{O==null||O.abort(),O=new AbortController;try{Ae(await I().chat(O.signal)),H="";}catch(e){if(e.name==="AbortError")return;b&&m==="messages"&&(H=e.message);}Ce=true,F(),U(),N();};function N(e){var k,f,_;clearTimeout(J);let o=!!(w!=null&&w.messages.some(D=>D.from==="visitor"))&&((k=w==null?void 0:w.conversation)==null?void 0:k.status)!=="solved",c=(_=((f=w==null?void 0:w.messages)!=null?f:[]).filter(D=>D.from==="visitor").at(-1))==null?void 0:_.at,l=!!c&&Date.now()-new Date(c).getTime()<xt,d=e!=null?e:de()?gt:o&&l?wt:b||o?kt:0;(d||e===0)&&(J=setTimeout(()=>{Ke();},d));}document.addEventListener("visibilitychange",()=>{document.visibilityState==="visible"?N(0):clearTimeout(J);});let Pe=async()=>{let e=j.value.trim();if(!(!e||A||!me())){ie.unlock(),A={id:"pending",from:"visitor",body:e,at:new Date().toISOString()},j.value="",H="",F();try{Ae(await I().sendChat({body:e,email:$e()&&T.value.trim()?T.value.trim():void 0,url:window.location.href.slice(0,500)}));}catch(o){j.value=e,H=o.message;}A=null,F(),N();}};V.addEventListener("submit",e=>{e.preventDefault(),Pe();}),j.addEventListener("keydown",e=>{e.key==="Enter"&&!e.shiftKey&&!e.isComposing&&(e.preventDefault(),Pe());}),j.addEventListener("input",()=>xe.disabled=!Ie()),T.addEventListener("input",()=>F());function ne(e="home"){b=true,m=e==="help"&&!$?"home":e,ae=-1,Q=true,K.isConnected||P.appendChild(K),(v===null||m==="help"&&E)&&he(),F(),U(),m==="messages"&&(ge(),j.focus()),N(0);}function W(){b&&(b=false,K.remove(),U(),N(),g&&R.focus());}let He=e=>{e.key==="Escape"&&b&&W();};return document.addEventListener("keydown",He),Ke(),$&&he(),U(),{open:e=>ne(e!=null?e:"home"),close:W,toggle:()=>b?W():ne(),destroy:()=>{clearTimeout(J),O==null||O.abort(),document.removeEventListener("keydown",He),P.remove();}}};window.__mrrocketMessenger={mountMessenger:at};
425
+ `,St=()=>{if(typeof document=="undefined"||document.getElementById(At))return;let r=document.createElement("style");r.id=At,r.textContent=_t,document.head.appendChild(r);};var Bt=4e3,Ut=8e3,Dt=3e4,Yt=10*6e4,Vt=/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/,Et="ckw_msgr_seen",_e={visitor:"You",team:"Team",ai:"AI agent",auto:"Team"},Wt=()=>{var r;try{return (r=window.localStorage.getItem(Et))!=null?r:""}catch(n){return ""}},Gt=r=>{try{window.localStorage.setItem(Et,r);}catch(n){}},Be=r=>{let n=new Date(r).getTime();if(Number.isNaN(n))return "";let o=Math.max(0,Date.now()-n)/1e3;return o<60?"just now":o<3600?`${Math.floor(o/60)}m ago`:o<86400?`${Math.floor(o/3600)}h ago`:o<86400*30?`${Math.floor(o/86400)}d ago`:new Date(r).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})},t=(r,n={},...o)=>{let l=document.createElement(r);for(let[s,c]of Object.entries(n))l.setAttribute(s,c);for(let s of o)s!==null&&s!==false&&s!==void 0&&l.append(s);return l},ze="http://www.w3.org/2000/svg",v=(r,n=16)=>{let o=document.createElementNS(ze,"svg");for(let[s,c]of Object.entries({class:"ckw-icon",width:String(n),height:String(n),viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"1.75","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true"}))o.setAttribute(s,c);let l=document.createElementNS(ze,"path");return l.setAttribute("d",r),o.appendChild(l),o},b={cross:"M18 6 6 18M6 6l12 12",chat:"M7.9 20A9 9 0 1 0 4 16.1L2 22z",send:"M5 12h14M12 5l7 7-7 7",up:"M12 19V5M5 12l7-7 7 7",home:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8M3 10a2 2 0 0 1 .709-1.528l7-6a2 2 0 0 1 2.582 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",back:"m15 18-6-6 6-6",next:"m9 18 6-6-6-6",search:"M19 11a8 8 0 1 1-16 0 8 8 0 0 1 16 0zM21 21l-4.3-4.3",doc:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7zM14 2v4a2 2 0 0 0 2 2h4M10 9H8M16 13H8M16 17H8",book:"M12 7v14M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",dots:"M13 12a1 1 0 1 1-2 0 1 1 0 0 1 2 0zM13 5a1 1 0 1 1-2 0 1 1 0 0 1 2 0zM13 19a1 1 0 1 1-2 0 1 1 0 0 1 2 0z",expand:"M15 3h6v6M21 3l-7 7M3 21l7-7M9 21H3v-6",collapse:"m14 10 7-7M20 10h-6V4M3 21l7-7M4 14h6v6",minus:"M5 12h14"},Qt="M7.9 20A9 9 0 1 0 4 16.1L2 22z",Xt=(r,n)=>{let o=document.createElementNS(ze,"svg");for(let[s,c]of Object.entries({class:"ckw-icon",width:String(n),height:String(n),viewBox:"0 0 24 24",fill:"currentColor",stroke:"currentColor","stroke-width":"1.5","stroke-linejoin":"round","aria-hidden":"true"}))o.setAttribute(s,c);let l=document.createElementNS(ze,"path");return l.setAttribute("d",r),o.appendChild(l),o},ve=(()=>{let r=null,n=()=>{var l;let o=(l=window.AudioContext)!=null?l:window.webkitAudioContext;return o?(r!=null||(r=new o),r):null};return {unlock:()=>{try{let o=n();(o==null?void 0:o.state)==="suspended"&&o.resume();}catch(o){}},play:()=>{try{let o=n();if(!o||o.state!=="running")return;let l=o.currentTime;[880,1318.5].forEach((s,c)=>{let f=o.createOscillator(),j=o.createGain(),S=l+c*.11;f.type="sine",f.frequency.value=s,j.gain.setValueAtTime(1e-4,S),j.gain.exponentialRampToValueAtTime(.12,S+.012),j.gain.exponentialRampToValueAtTime(1e-4,S+.32),f.connect(j),j.connect(o.destination),f.start(S),f.stop(S+.34);});}catch(o){}}}})(),ye=r=>r.map(n=>{let o=n.href?t("a",{href:n.href,target:"_blank",rel:"noopener noreferrer"},n.text):t("span",{},n.text);return n.code&&(o=t("code",{},o)),n.italic&&(o=t("em",{},o)),n.bold&&(o=t("strong",{},o)),o}),Jt=r=>{switch(r.type){case "h2":case "h3":return t(r.type,{},...ye(r.spans));case "quote":return t("blockquote",{},...ye(r.spans));case "ul":case "ol":return t(r.type,{},...r.items.map(n=>t("li",{},...ye(n))));case "code":return t("pre",{},t("code",{},r.text));case "hr":return t("hr");default:return t("p",{},...ye(r.spans))}},Zt=2500,Tt=r=>{var S;let n=null,o=false,l=[],s=k=>n?k(n):l.push(k),c=new AbortController,f=k=>{var pe,_;if(n||o)return;let X=Object.fromEntries(Object.entries(r).filter(([,E])=>E!==void 0));n=er({...k!=null?k:{},...X,accent:(pe=r.accent)!=null?pe:k==null?void 0:k.accent,theme:(_=r.theme)!=null?_:k==null?void 0:k.theme});for(let E of l.splice(0))E(n);},j=setTimeout(()=>f(null),Zt);return ((S=r.client)!=null?S:qe({host:r.host,apiKey:r.apiKey,distinctId:r.distinctId(),user:r.user()})).messengerLook(c.signal).then(k=>f(k)).catch(()=>f(null)).finally(()=>clearTimeout(j)),{open:k=>s(X=>X.open(k)),close:()=>n==null?void 0:n.close(),toggle:()=>s(k=>k.toggle()),destroy:()=>{o=true,c.abort(),clearTimeout(j),n==null||n.destroy();}}},er=r=>{var wt,kt,mt,xt,ft,bt,ut,ht,vt,yt;St();let n=(wt=r.position)!=null?wt:"bottom-right",o=r.title||"Chat with us",l=r.greeting||"Hi! How can we help?",s=(kt=r.askEmail)!=null?kt:true,c=(mt=r.label)!=null?mt:"",f=Mt(r.replyTime),j=((xt=o.trim()[0])!=null?xt:"?").toUpperCase(),S=(ft=r.launcher)!=null?ft:true,k=(bt=r.help)!=null?bt:true,X=(ut=r.sound)!=null?ut:true,pe=(ht=r.preview)!=null?ht:true,_=()=>{var e;return (e=r.client)!=null?e:qe({host:r.host,apiKey:r.apiKey,distinctId:r.distinctId(),user:r.user()})},E=t("div",{class:"ckw-root","data-theme":(vt=r.theme)!=null?vt:"auto"});r.container&&E.setAttribute("data-contained",""),r.accent&&(E.style.setProperty("--ckw-accent",r.accent),E.style.setProperty("--ckw-accent-ink",Ct(r.accent))),((yt=r.container)!=null?yt:document.body).appendChild(E);let y=false,m="home",x=null,Ue=false,U="",T=null,Me=null,u=[],de=false,ge,B=null,z=null,N="",Ce=new Set,we=null,F=null,J=false,De=e=>{var a;return ((a=e==null?void 0:e.messages)!=null?a:[]).filter(i=>i.from!=="visitor")},Ye=e=>{var a,i;return (i=(a=De(e).at(-1))==null?void 0:a.id)!=null?i:""},Ae=()=>y&&m==="messages"&&document.visibilityState!=="hidden",Ve=e=>{let a=De(e);if(Me===null){let i=Wt(),p=a.findIndex(d=>d.id===i);u=e.messages.some(d=>d.from==="visitor")?a.slice(p+1).filter(d=>d.from!=="auto"):[];}else {let i=a.findIndex(d=>d.id===Me),p=a.slice(i+1).filter(d=>d.from!=="auto");p.length&&(X&&ve.play(),Ae()||(u=[...u,...p],de=false));}Me=Ye(e),x=e,Ae()&&Se();},Se=()=>{u=[];let e=Ye(x);e&&Gt(e);},Z=e=>t("span",{class:`ckw-msgr-av${e?" ckw-msgr-av-sm":""}`,"aria-hidden":"true"},j),V=new Map,ke=(e,a=E)=>{clearTimeout(V.get(e)),V.delete(e),e.removeAttribute("data-out"),e.isConnected||a.appendChild(e);},ee=(e,a=180)=>{!e.isConnected||V.has(e)||(e.setAttribute("data-out",""),V.set(e,setTimeout(()=>{V.delete(e),e.removeAttribute("data-out"),e.remove();},a)));},Ee=(e,a)=>{e.classList.remove(a),e.offsetWidth,e.classList.add(a);},L=t("button",{type:"button",class:`ckw-fab ckw-msgr-fab${c?"":" ckw-msgr-round"}`,"data-pos":n,"aria-haspopup":"dialog"}),Lt=t("span",{class:"ckw-msgr-fab-ic","aria-hidden":"true"},t("span",{class:"ckw-msgr-fab-i","data-i":"chat"},Xt(Qt,c?20:28)),t("span",{class:"ckw-msgr-fab-i","data-i":"x"},v(b.cross,c?16:22))),te=t("span",{class:"ckw-msgr-count","aria-hidden":"true"});L.append(Lt),c&&L.append(t("span",{},c));let Te=t("div",{class:"ckw-msgr-preview","data-pos":n,role:"status"}),re=()=>{if(L.toggleAttribute("data-open",y),u.length&&!y){let e=String(Math.min(u.length,9));te.textContent!==e&&(te.textContent=e),te.isConnected||L.append(te);}else te.remove();L.setAttribute("aria-expanded",String(y)),L.setAttribute("aria-label",y?"Close chat":u.length?`Open chat, ${u.length} new ${u.length===1?"reply":"replies"}`:"Open chat"),Ge();},We=()=>pe&&!y&&!de&&!!u.length&&S,Ge=()=>{let e=u.at(-1);if(!We()||!e)return ee(Te);me(true);let a=t("button",{type:"button",class:"ckw-msgr-preview-x","aria-label":"Dismiss"},v(b.cross,12));a.addEventListener("click",p=>{p.stopPropagation(),de=true,Ge();});let i=t("button",{type:"button",class:"ckw-msgr-preview-card"},Z(),t("span",{class:"ckw-msgr-preview-main"},t("span",{class:"ckw-msgr-preview-who"},`${_e[e.from]}${u.length>1?` \xB7 ${u.length} new`:""}`),t("span",{class:"ckw-msgr-preview-text"},e.body)));i.addEventListener("click",()=>Y("messages")),Te.replaceChildren(i,a),ke(Te);},ae=t("div",{class:"ckw-msgr-teaser","data-pos":n}),ne,$t=()=>{if(clearTimeout(ne),y||We()||!S)return;let e=t("button",{type:"button",class:"ckw-msgr-teaser-b","data-main":""},v(b.chat),t("span",{},"Chat with us"));e.addEventListener("click",()=>Y("messages"));let a=[e];if(k&&we){let i=t("button",{type:"button",class:"ckw-msgr-teaser-b"},v(b.search),t("span",{},"Search"));i.addEventListener("click",()=>Y("help")),a.push(i);}ae.replaceChildren(t("div",{class:"ckw-msgr-teaser-top"},t("span",{class:"ckw-msgr-teaser-t"},t("b",{},l),t("span",{class:"ckw-msgr-online"},f)),Z()),t("div",{class:"ckw-msgr-teaser-row"},...a)),ke(ae);};function me(e=false){if(clearTimeout(ne),e)return ee(ae,140);ne=setTimeout(()=>ee(ae,140),260);}let Qe=e=>e.pointerType==="mouse";for(let e of [L,ae])e.addEventListener("pointerenter",a=>Qe(a)&&(e===L?$t():clearTimeout(ne))),e.addEventListener("pointerleave",a=>Qe(a)&&me());L.addEventListener("click",()=>{ve.unlock(),me(true),y?Q():Y(u.length?"messages":"home");}),S&&E.appendChild(L);let $=t("div",{class:"ckw-pop ckw-msgr","data-pos":n,role:"dialog","aria-label":o}),Xe=t("div",{class:"ckw-msgr-bar"}),h=t("div",{class:"ckw-pop-body ckw-msgr-body"});$.addEventListener("click",()=>ve.unlock());let xe=t("span",{class:"ckw-msgr-lead"}),Le=t("nav",{class:"ckw-msgr-seg","aria-label":"Messenger"}),K=t("span",{class:"ckw-msgr-seg-mark","aria-hidden":"true"}),Je=(e,a,i)=>{let p=t("button",{type:"button",class:"ckw-msgr-seg-b"},v(i,15),t("span",{},a));return p.addEventListener("click",()=>{F=null,C(e);}),p},ie=Je("messages","Chat",b.chat),$e=Je("help","Help",b.book),fe=t("span",{class:"ckw-msgr-count ckw-msgr-count-tab","aria-hidden":"true"}),oe=t("button",{type:"button",class:"ckw-msgr-ib","aria-label":"More","aria-haspopup":"menu","aria-expanded":"false"},v(b.dots,18)),Ze=t("button",{type:"button",class:"ckw-msgr-ib ckw-msgr-x","aria-label":"Close messenger"},v(b.cross));Ze.addEventListener("click",()=>Q()),Xe.append(xe,Le,t("span",{class:"ckw-msgr-trail"},oe,Ze));let q=t("div",{class:"ckw-msgr-menu",role:"menu"}),Ie=()=>q.isConnected&&!q.hasAttribute("data-out"),se=()=>{oe.setAttribute("aria-expanded","false"),ee(q,120);},et=(e,a,i)=>{let p=t("button",{type:"button",class:"ckw-msgr-menu-i",role:"menuitem"},v(e,15),t("span",{},a));return p.addEventListener("click",d=>{d.stopPropagation(),se(),i();}),p};oe.addEventListener("click",e=>{var a;if(e.stopPropagation(),Ie())return se();q.replaceChildren(t("span",{class:"ckw-msgr-menu-h"},"Quick actions"),et(b.minus,"Minimize chat",()=>Q()),et(J?b.collapse:b.expand,J?"Collapse view":"Expand view",()=>{J=!J,$.toggleAttribute("data-wide",J),requestAnimationFrame(tt);})),oe.setAttribute("aria-expanded","true"),ke(q,$),(a=q.querySelector("button"))==null||a.focus();}),$.addEventListener("click",()=>Ie()&&se());function tt(){let e=m==="messages"?ie:m!=="home"?$e:null;if(!e||!e.isConnected)return K.removeAttribute("data-on");let a=!K.hasAttribute("data-on");a&&K.setAttribute("data-still",""),K.style.width=`${e.offsetWidth}px`,K.style.transform=`translateX(${e.offsetLeft}px)`,K.setAttribute("data-on",""),a&&requestAnimationFrame(()=>K.removeAttribute("data-still"));}let It=()=>{let e=(i,p)=>{let d=t("button",{type:"button",class:"ckw-msgr-ib","aria-label":p},v(b.back,18));return d.addEventListener("click",i),d};if(typeof m!="string")xe.replaceChildren(e(()=>C("help"),"Back to help"));else if(m==="help"&&F&&!N.trim())xe.replaceChildren(e(()=>{F=null,C("help");},"All collections"));else {let i=t("button",{type:"button",class:"ckw-msgr-ib","aria-label":"Home","aria-current":m==="home"?"page":"false"},v(b.home,17));i.addEventListener("click",()=>C("home")),xe.replaceChildren(i);}let a=k&&we!==false?[K,ie,$e]:[K,ie];Le.childNodes.length!==a.length&&Le.replaceChildren(...a),ie.setAttribute("aria-current",m==="messages"?"page":"false"),$e.setAttribute("aria-current",m!=="home"&&m!=="messages"?"page":"false"),u.length&&m!=="messages"?(fe.textContent=String(Math.min(u.length,9)),fe.isConnected||ie.append(fe)):fe.remove();},ce=t("form",{class:"ckw-msgr-compose"}),be=t("p",{class:"ckw-msgr-error",role:"alert"}),H=t("input",{class:"ckw-input",type:"email",inputmode:"email",autocomplete:"email",placeholder:"Your email (optional), so we can follow up","aria-label":"Your email (optional)",maxlength:"200"}),le=t("div",{class:"ckw-msgr-box"}),R=t("textarea",{class:"ckw-textarea ckw-msgr-input",rows:"1",placeholder:"Write your message\u2026","aria-label":"Message",maxlength:"4000"}),je=t("button",{type:"submit",class:"ckw-msgr-send","aria-label":"Send"},v(b.up));le.append(R,t("div",{class:"ckw-msgr-box-foot"},t("span",{class:"ckw-msgr-hint"},"Enter to send"),je)),le.addEventListener("click",e=>e.target===le&&R.focus()),ce.append(le);let rt=t("ol",{class:"ckw-msgs","aria-live":"polite","aria-label":"Messages"}),at=()=>{var e;return s&&!((e=r.user())!=null&&e.email)&&!(x!=null&&x.hasEmail)},He=()=>!H.value.trim()||Vt.test(H.value.trim()),nt=()=>!!R.value.trim()&&!T&&He(),C=e=>{let a=JSON.stringify(e)!==JSON.stringify(m);m=e,ue=-1,D(),a&&Ee(h,"ckw-msgr-enter"),e==="messages"?(Se(),re(),R.focus()):e==="help"&&Oe.focus(),G(0);},it=(e,a=false)=>{var p;let i=t("li",{class:"ckw-msg","data-from":e.from==="visitor"?"me":"them"},t("div",{class:"ckw-bubble"},e.body));a&&i.setAttribute("aria-busy","true");for(let d of (p=e.articles)!=null?p:[]){let w=t("button",{type:"button",class:"ckw-msgr-cite"},v(b.doc,14),t("span",{},d.title));w.addEventListener("click",()=>C({article:d.id})),i.append(w);}return i.append(t("span",{class:"ckw-msg-meta"},`${e.from!=="visitor"?`${_e[e.from]} \xB7 `:""}${a?"Sending\u2026":Be(e.at)}`)),i},jt=e=>{let a=t("button",{type:"button",class:"ckw-msgr-art"},t("span",{class:"ckw-msgr-art-t"},e.title),v(b.next,14));return a.addEventListener("click",()=>C({article:e.id})),a},ot=(e,a,i,p)=>{let d=t("button",{type:"button",class:"ckw-msgr-hrow"},t("span",{class:"ckw-msgr-hrow-main"},t("b",{},e),a?t("span",{class:"ckw-msgr-hrow-sub"},a):null,i?t("span",{class:"ckw-msgr-hrow-meta"},i):null),v(b.next,16));return d.addEventListener("click",p),d},st=(e="Search for help")=>{let a=t("label",{class:"ckw-msgr-search"}),i=t("input",{class:"ckw-msgr-search-in",type:"search",placeholder:e,"aria-label":"Search for help",maxlength:"200"});i.value=N;let p;return i.addEventListener("input",()=>{N=i.value,clearTimeout(p),p=setTimeout(()=>{if(m!=="help")return C("help");Ne(true);},250);}),i.addEventListener("keydown",d=>{d.key==="Enter"&&(d.preventDefault(),m!=="help"&&C("help"));}),a.append(v(b.search,16),i),a},Re=st("Search our help center\u2026"),Oe=Re.querySelector("input"),Pe=false,Ne=async(e=false)=>{if(!k||Pe&&!e)return;Pe=true;let a=N.trim();try{let i=await _().articles(a||void 0);if(a!==N.trim())return;z=i.articles,a||(we=i.articles.length>0);}catch(i){z=z!=null?z:[];}finally{Pe=false;}D();},Ht=()=>{var d;let e=t("div",{class:"ckw-msgr-hero"},t("span",{class:"ckw-msgr-brand"},Z("sm"),t("span",{},o)),t("p",{class:"ckw-msgr-hello"},l),t("span",{class:"ckw-msgr-online"},f)),a=((d=x==null?void 0:x.messages)!=null?d:[]).at(-1),i=[e];if(a){let w=t("button",{type:"button",class:"ckw-msgr-card ckw-msgr-recent"},t("span",{class:"ckw-msgr-card-label"},"Recent message"),t("span",{class:"ckw-msgr-recent-row"},Z(),t("span",{class:"ckw-msgr-card-main"},t("span",{class:"ckw-msgr-card-sub ckw-msgr-recent-text"},a.body),t("span",{class:"ckw-msgr-card-meta"},`${a.from==="visitor"?"You":_e[a.from]} \xB7 ${Be(a.at)}`)),u.length?t("span",{class:"ckw-msgr-badge"},String(u.length)):v(b.next,14)));w.addEventListener("click",()=>C("messages")),i.push(w);}let p=t("button",{type:"button",class:"ckw-msgr-card"},t("span",{class:"ckw-msgr-card-main"},t("b",{},"Send us a message"),t("span",{class:"ckw-msgr-card-sub"},f)),t("span",{class:"ckw-msgr-go"},v(b.send)));if(p.addEventListener("click",()=>C("messages")),i.push(p),k&&we!==false){let w=t("div",{class:"ckw-msgr-card ckw-msgr-card-col"},st()),M=(z!=null?z:[]).slice(0,4);M.length?w.append(...M.map(jt)):z===null&&w.append(t("div",{class:"ckw-skel ckw-msgr-skel"})),i.push(w);}h.replaceChildren(...i);},Rt=()=>{var M,A;Oe.value!==N&&(Oe.value=N);let e=N.trim(),a=z!=null?z:[],i=new Map;for(let g of a)i.set(g.collection,[...(M=i.get(g.collection))!=null?M:[],g]);let p=!e&&F!==null?(A=i.get(F))!=null?A:[]:null,d=e?"Search results":p?F!=null?F:"":"Most read articles",w=[t("h2",{class:"ckw-msgr-help-h"},d),Re];if(z===null)w.push(t("div",{class:"ckw-skel"}));else if(a.length)e||p?w.push(t("div",{class:"ckw-msgr-hlist"},...(p!=null?p:a).map(g=>ot(g.title,g.excerpt.startsWith(g.title)?g.excerpt.slice(g.title.length).trim():g.excerpt,e?g.collection:"",()=>C({article:g.id}))))):w.push(t("div",{class:"ckw-msgr-hlist"},...[...i].map(([g,O])=>ot(g,O.map(Ft=>Ft.title).join(", "),`${O.length} ${O.length===1?"article":"articles"}`,()=>{F=g,C("help"),Ee(h,"ckw-msgr-enter");}))));else {let g=t("button",{type:"button",class:"ckw-btn ckw-btn-primary"},"Send us a message");g.addEventListener("click",()=>C("messages")),w.push(t("div",{class:"ckw-msgr-empty"},t("p",{},e?`Nothing found for \u201C${e}\u201D.`:"No help articles yet."),g));}if(h.childNodes[1]!==Re)h.replaceChildren(...w);else {for(h.firstChild.replaceWith(w[0]);h.childNodes.length>2;)h.lastChild.remove();h.append(...w.slice(2));}},W=null,Ot=e=>{if((W==null?void 0:W.id)===e)return h.replaceChildren(W.node);let a=t("article",{class:"ckw-msgr-doc"},t("div",{class:"ckw-skel"}));W={id:e,node:a},h.replaceChildren(a),_().article(e).then(i=>{let p=t("div",{class:"ckw-msgr-rate"}),d=()=>{if(Ce.has(e))return p.replaceChildren(t("span",{},"Thanks for letting us know."));let M=t("button",{type:"button",class:"ckw-btn"},"Yes"),A=t("button",{type:"button",class:"ckw-btn"},"No"),g=O=>{Ce=new Set(Ce).add(e),d(),_().rateArticle(e,O).catch(()=>{}),O||C("messages");};M.addEventListener("click",()=>g(true)),A.addEventListener("click",()=>g(false)),p.replaceChildren(t("span",{},"Did this answer your question?"),t("span",{class:"ckw-msgr-rate-b"},M,A));};d();let w=t("button",{type:"button",class:"ckw-btn ckw-msgr-ask"},v(b.chat),"Still need help? Send us a message");w.addEventListener("click",()=>C("messages")),a.replaceChildren(t("p",{class:"ckw-msgr-doc-c"},i.collection),t("h2",{class:"ckw-msgr-doc-t"},i.title),t("p",{class:"ckw-msgr-doc-c"},`Updated ${Be(i.updatedAt)}`),t("div",{class:"ckw-msgr-doc-b"},...i.blocks.map(Jt)),p,w);}).catch(i=>{W=null,a.replaceChildren(t("p",{class:"ckw-msgr-error"},i.message));});},ue=-1,ct="",Fe=-1,Pt=t("div",{class:"ckw-msgr-intro"},t("span",{class:"ckw-msgr-intro-av"},Z()),t("span",{class:"ckw-msgr-intro-t"},t("b",{},o),t("span",{class:"ckw-msgr-online"},f))),Ke=t("div",{class:"ckw-msgr-sugg"}),Nt=()=>{var p,d;let e=(p=x==null?void 0:x.messages)!=null?p:[],a=[Pt];if(!Ue)a.push(t("div",{class:"ckw-skel"}));else {let w=`${e.map(A=>A.id).join(",")}|${T?T.body:""}|${Math.floor(Date.now()/6e4)}`;if(w!==ct){ct=w;let g=[t("li",{class:"ckw-msg","data-from":"them"},t("div",{class:"ckw-bubble"},l)),...e.map(O=>it(O)),...T?[it(T,true)]:[]];Fe>=0&&g.slice(Fe).forEach(O=>O.setAttribute("data-new","")),Fe=g.length,rt.replaceChildren(...g);}a.push(rt);let M=!e.some(A=>A.from==="visitor")&&!T?(z!=null?z:[]).slice(0,3):[];M.length&&(Ke.childNodes.length!==M.length&&Ke.replaceChildren(...M.map(A=>{let g=t("button",{type:"button",class:"ckw-msgr-sugg-b"},A.title);return g.addEventListener("click",()=>C({article:A.id})),g})),a.push(Ke));}((d=x==null?void 0:x.conversation)==null?void 0:d.status)==="solved"&&!T&&a.push(t("p",{class:"ckw-fine ckw-msgr-note"},"This conversation is closed. Write to start a new one.")),(h.childNodes.length!==a.length||a.some((w,M)=>h.childNodes[M]!==w))&&h.replaceChildren(...a);let i=e.length+(T?1:0);i!==ue&&(ue=i,h.scrollTop=h.scrollHeight),be.textContent=U,U&&!be.isConnected?ce.prepend(be):U||be.remove(),at()?(He()?H.removeAttribute("aria-invalid"):H.setAttribute("aria-invalid","true"),H.isConnected||ce.insertBefore(H,le)):H.remove(),je.disabled=!nt();},D=()=>{if(!y)return;$.dataset.view=typeof m=="string"?m:"article",It(),m==="home"?Ht():m==="messages"?Nt():m==="help"?Rt():Ot(m.article);let e=[Xe,h];m==="messages"&&e.push(ce),q.isConnected&&e.push(q),($.childNodes.length!==e.length||e.some((a,i)=>$.childNodes[i]!==a))&&$.replaceChildren(...e),tt();},lt=async()=>{B==null||B.abort(),B=new AbortController;try{Ve(await _().chat(B.signal)),U="";}catch(e){if(e.name==="AbortError")return;y&&m==="messages"&&(U=e.message);}Ue=true,D(),re(),G();};function G(e){var w,M,A;clearTimeout(ge);let a=!!(x!=null&&x.messages.some(g=>g.from==="visitor"))&&((w=x==null?void 0:x.conversation)==null?void 0:w.status)!=="solved",i=(A=((M=x==null?void 0:x.messages)!=null?M:[]).filter(g=>g.from==="visitor").at(-1))==null?void 0:A.at,p=!!i&&Date.now()-new Date(i).getTime()<Yt,d=e!=null?e:Ae()?Bt:a&&p?Ut:y||a?Dt:0;(d||e===0)&&(ge=setTimeout(()=>{lt();},d));}let pt=()=>{document.visibilityState==="visible"?G(0):clearTimeout(ge);};document.addEventListener("visibilitychange",pt);let dt=async()=>{let e=R.value.trim();if(!(!e||T||!He())){ve.unlock(),T={id:"pending",from:"visitor",body:e,at:new Date().toISOString()},R.value="",U="",D();try{Ve(await _().sendChat({body:e,email:at()&&H.value.trim()?H.value.trim():void 0,url:window.location.href.slice(0,500)}));}catch(a){R.value=e,U=a.message;}T=null,D(),G();}};ce.addEventListener("submit",e=>{e.preventDefault(),dt();}),R.addEventListener("keydown",e=>{e.key==="Enter"&&!e.shiftKey&&!e.isComposing&&(e.preventDefault(),dt());}),R.addEventListener("input",()=>je.disabled=!nt()),H.addEventListener("input",()=>D());function Y(e="home",a=false){let i=y;y=true,m=e==="help"&&!k?"home":e,ue=-1,de=true,me(true),$.toggleAttribute("data-still",a),ke($),i&&Ee(h,"ckw-msgr-enter"),(z===null||m==="help"&&N)&&Ne(),D(),re(),m==="messages"&&(Se(),R.focus()),G(0);}function Q(){y&&(y=false,q.isConnected&&se(),ee($,200),re(),G(),S&&L.focus());}let gt=e=>{e.key!=="Escape"||!y||(Ie()?(se(),oe.focus()):Q());};return document.addEventListener("keydown",gt),lt(),k&&Ne(),re(),r.opened&&Y(r.opened,true),{open:e=>Y(e!=null?e:"home"),close:Q,toggle:()=>y?Q():Y(),destroy:()=>{clearTimeout(ge),clearTimeout(ne);for(let e of V.values())clearTimeout(e);B==null||B.abort(),document.removeEventListener("keydown",gt),document.removeEventListener("visibilitychange",pt),E.remove();}}};window.__mrrocketMessenger={mountMessenger:Tt};
348
426
  })();