@mrrocket/sdk 0.14.0 → 0.15.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/README.md +9 -3
- package/dist/api-client.d.ts +62 -1
- package/dist/api-client.js +28 -1
- package/dist/api-client.js.map +1 -1
- package/dist/browser/mrrocket-flows.js +2 -2
- package/dist/browser/mrrocket-messenger.js +202 -46
- package/dist/browser/mrrocket.js +1 -1
- package/dist/core.d.ts +1 -1
- package/dist/core.js +1 -1
- package/dist/core.js.map +1 -1
- package/dist/flows-ui.js +48 -1
- package/dist/flows-ui.js.map +1 -1
- package/dist/flows.d.ts +51 -1
- package/dist/flows.js +62 -21
- package/dist/flows.js.map +1 -1
- package/dist/messenger-ui.d.ts +19 -6
- package/dist/messenger-ui.js +332 -78
- package/dist/messenger-ui.js.map +1 -1
- package/dist/messenger.d.ts +11 -3
- package/dist/messenger.js +6 -3
- package/dist/messenger.js.map +1 -1
- package/dist/react-native/index.d.cts +102 -6
- package/dist/react-native/index.d.ts +102 -6
- package/dist/react-native/index.js +447 -181
- package/dist/react-native/index.js.map +1 -1
- package/dist/styles-css.d.ts +1 -1
- package/dist/styles-css.js +200 -44
- package/dist/styles-css.js.map +1 -1
- package/package.json +5 -1
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
(function(){'use strict';var
|
|
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);
|
|
1
|
+
(function(){'use strict';var hr=Object.defineProperty;var xr=(a,n,c)=>n in a?hr(a,n,{enumerable:true,configurable:true,writable:true,value:c}):a[n]=c;var Wt=(a,n,c)=>xr(a,n+"",c);var ct=["image/png","image/jpeg","image/webp","image/gif","application/pdf"],Gt=10*1024*1024,lt=4;var Qt="https://mrrocket.dev/?utm_source=messenger&utm_medium=powered-by",Xt=a=>a==="minutes"?"We usually reply in a few minutes":a==="day"?"We usually reply within a day":"We usually reply in a few hours",Jt=a=>{let n=/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i.exec(a);if(!n)return "#ffffff";let[c,g,s]=[n[1],n[2],n[3]].map(d=>{let b=parseInt(d,16)/255;return b<=.03928?b/12.92:((b+.055)/1.055)**2.4});return .2126*c+.7152*g+.0722*s>.45?"#111214":"#ffffff"},je=class extends Error{constructor(c,g){super(c);Wt(this,"status");this.status=g;}},q=a=>Object.entries(a).filter(n=>!!n[1]).map(([n,c])=>`${encodeURIComponent(n)}=${encodeURIComponent(c)}`).join("&"),F=async(a,n,c)=>{var s;let g;try{g=await fetch(a,{...n,signal:c,headers:typeof(n==null?void 0:n.body)=="string"?{"content-type":"application/json"}:void 0});}catch(d){throw d.name==="AbortError"?d:new je("Could not reach the server. Check your connection and try again.",0)}if(!g.ok){let d="";try{d=(s=(await g.json()).error)!=null?s:"";}catch(b){}throw new je(d||(g.status===429?"Too many requests. Try again in a minute.":"Something went wrong. Please try again."),g.status)}return await g.json()},dt=a=>{let n=`${a.host}/api/sdk`,c={key:a.apiKey,distinctId:a.distinctId,user:a.user},g=(s,d,b)=>F(`${n}${s}`,{method:"POST",body:JSON.stringify({...c,...d})},b);return {list:(s,d)=>F(`${n}/feedback?${q({key:a.apiKey,distinctId:a.distinctId,board:s.board,sort:s.sort,q:s.q})}`,void 0,d),post:(s,d)=>F(`${n}/feedback/${encodeURIComponent(s)}?${q({key:a.apiKey,distinctId:a.distinctId})}`,void 0,d),roadmap:s=>F(`${n}/feedback/roadmap?${q({key:a.apiKey,distinctId:a.distinctId})}`,void 0,s),changelog:s=>F(`${n}/feedback/changelog?${q({key:a.apiKey})}`,void 0,s),submit:s=>g("/feedback",s),vote:s=>g(`/feedback/${encodeURIComponent(s)}/vote`,{}),comments:(s,d)=>F(`${n}/feedback/${encodeURIComponent(s)}/comments?${q({key:a.apiKey})}`,void 0,d),comment:(s,d)=>g(`/feedback/${encodeURIComponent(s)}/comments`,{body:d}),survey:(s,d)=>F(`${n}/surveys?${q({key:a.apiKey,distinctId:a.distinctId,url:s})}`,void 0,d),seen:s=>g(`/surveys/${encodeURIComponent(s)}/seen`,{user:void 0}),respond:(s,d)=>g(`/surveys/${encodeURIComponent(s)}/respond`,d),chat:s=>F(`${n}/messages?${q({key:a.apiKey,distinctId:a.distinctId})}`,void 0,s),sendChat:s=>g("/messages",s),uploadChatFile:(s,d)=>{let b=new FormData;return b.append("key",a.apiKey),b.append("distinctId",a.distinctId),"uri"in s?b.append("file",s):b.append("file",s,s.name||"file"),F(`${n}/messages/attachments`,{method:"POST",body:b},d)},attachmentUrl:s=>`${n}/messages/attachments/${encodeURIComponent(s)}?${q({key:a.apiKey,distinctId:a.distinctId})}`,articles:(s,d)=>F(`${n}/articles?${q({key:a.apiKey,q:s})}`,void 0,d),article:(s,d)=>F(`${n}/articles/${encodeURIComponent(s)}?${q({key:a.apiKey,distinctId:a.distinctId})}`,void 0,d),messengerLook:s=>F(`${n}/messenger?${q({key:a.apiKey})}`,void 0,s),rateArticle:(s,d)=>g(`/articles/${encodeURIComponent(s)}/rate`,{helpful:d})}};var Zt="ckw-styles",vr=`
|
|
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);--ckw-soft:0 2px 8px rgba(16,18,24,.05),0 18px 48px rgba(16,18,24,.15);
|
|
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
|
-
.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)}
|
|
5
|
-
@media (prefers-color-scheme:dark){.ckw-root[data-theme=auto]{--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)}}
|
|
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);--ckw-soft:0 0 0 1px rgba(255,255,255,.07),0 18px 50px rgba(0,0,0,.55)}
|
|
5
|
+
@media (prefers-color-scheme:dark){.ckw-root[data-theme=auto]{--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);--ckw-soft:0 0 0 1px rgba(255,255,255,.07),0 18px 50px rgba(0,0,0,.55)}}
|
|
6
6
|
.ckw-root *,.ckw-root *::before,.ckw-root *::after{box-sizing:border-box}
|
|
7
|
+
.ckw-root{--ckw-r-panel:22px;--ckw-r-bubble:18px;--ckw-r-tail:6px;--ckw-r-card:16px;--ckw-r-field:20px;--ckw-r-pill:999px;--ckw-r-fab:999px}
|
|
8
|
+
.ckw-root[data-corners=soft]{--ckw-r-panel:14px;--ckw-r-bubble:12px;--ckw-r-tail:4px;--ckw-r-card:10px;--ckw-r-field:10px;--ckw-r-pill:10px;--ckw-r-fab:18px}
|
|
9
|
+
.ckw-root[data-corners=square]{--ckw-r-panel:6px;--ckw-r-bubble:6px;--ckw-r-tail:2px;--ckw-r-card:4px;--ckw-r-field:4px;--ckw-r-pill:4px;--ckw-r-fab:8px}
|
|
10
|
+
.ckw-root[data-font=system]{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif}
|
|
7
11
|
:where(.ckw-root) :where(button,input,select,textarea){font:inherit;color:inherit;margin:0}
|
|
8
12
|
.ckw-root button{cursor:pointer}
|
|
9
13
|
.ckw-root :focus-visible{outline:2px solid var(--ckw-accent);outline-offset:2px}
|
|
@@ -204,19 +208,21 @@ font-size:14px;line-height:1.45;font-family:inherit;color:var(--ckw-fg);box-sizi
|
|
|
204
208
|
.ckw-pop .ckw-form{border:0;padding:0;margin:12px 0 0}
|
|
205
209
|
@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
210
|
/* 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
|
|
208
|
-
.ckw-msgr-fab:hover{transform:scale(1.
|
|
211
|
+
.ckw-msgr-fab{position:fixed;bottom:20px;height:52px;padding:0 20px 0 16px;gap:8px;font-size:15px;box-shadow:0 1px 2px rgba(16,18,24,.1),0 6px 20px rgba(16,18,24,.16);transition:transform .3s cubic-bezier(.32,.72,0,1),box-shadow .2s linear}
|
|
212
|
+
.ckw-msgr-fab:hover{transform:scale(1.05);box-shadow:0 1px 2px rgba(16,18,24,.1),0 10px 28px rgba(16,18,24,.2)}
|
|
209
213
|
.ckw-msgr-fab:active{transform:scale(.94);transition-duration:.1s}
|
|
210
|
-
.ckw-msgr-round{width:
|
|
214
|
+
.ckw-msgr-round{width:56px;height:56px;padding:0;justify-content:center}
|
|
215
|
+
.ckw-msgr-fab{border-radius:var(--ckw-r-fab)}
|
|
211
216
|
.ckw-msgr-fab-ic{position:relative;display:block;width:20px;height:20px;flex:none}
|
|
212
|
-
.ckw-msgr-round .ckw-msgr-fab-ic{width:
|
|
217
|
+
.ckw-msgr-round .ckw-msgr-fab-ic{width:27px;height:27px}
|
|
218
|
+
.ckw-msgr-fab .ckw-cut{stroke:var(--ckw-accent)}
|
|
213
219
|
.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
220
|
.ckw-msgr-fab-i .ckw-icon{width:auto;height:auto}
|
|
215
221
|
.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
222
|
.ckw-msgr-fab[data-open] .ckw-msgr-fab-i[data-i=chat]{transform:rotate(90deg) scale(.4)}
|
|
217
223
|
.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:
|
|
224
|
+
.ckw-msgr-fab-i[data-i=x] .ckw-icon{stroke-width:2.2}
|
|
225
|
+
.ckw-msgr-count{position:absolute;top:-2px;right:-2px;min-width:18px;height:18px;padding:0 5px;border-radius:9px;background:#ef4444;color:#fff;font-size:10.5px;font-weight:700;line-height:18px;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
226
|
@keyframes ckw-badge{from{transform:scale(0)}}
|
|
221
227
|
.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}
|
|
222
228
|
.ckw-msgr-av-sm{width:26px;height:26px;font-size:12px}
|
|
@@ -229,23 +235,24 @@ font-size:14px;line-height:1.45;font-family:inherit;color:var(--ckw-fg);box-sizi
|
|
|
229
235
|
.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
236
|
@keyframes ckw-rise{from{opacity:0;transform:translateY(10px) scale(.94)}}
|
|
231
237
|
@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:
|
|
238
|
+
.ckw-msgr-preview-card{display:flex;align-items:flex-start;gap:12px;width:100%;text-align:left;padding:14px 40px 14px 16px;border:0;border-radius:calc(var(--ckw-r-card) + 2px);background:var(--ckw-bg);box-shadow:var(--ckw-soft);transition:transform .2s cubic-bezier(.32,.72,0,1)}
|
|
233
239
|
.ckw-msgr-preview-card:hover{transform:translateY(-2px)}
|
|
234
240
|
.ckw-msgr-preview-main{display:flex;flex-direction:column;gap:2px;min-width:0}
|
|
235
241
|
.ckw-msgr-preview-who{font-size:12px;font-weight:600;color:var(--ckw-fg3)}
|
|
236
242
|
.ckw-msgr-preview-text{display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;white-space:pre-wrap;overflow-wrap:anywhere}
|
|
237
|
-
.ckw-msgr-preview-x{position:absolute;top
|
|
238
|
-
.ckw-msgr-
|
|
243
|
+
.ckw-msgr-preview-x{position:absolute;top:8px;right:8px;width:26px;height:26px;border-radius:50%;border:0;background:transparent;color:var(--ckw-fg3);display:flex;align-items:center;justify-content:center;padding:0;transition:background-color .12s linear,color .12s linear}
|
|
244
|
+
.ckw-msgr-preview-x:hover{background:var(--ckw-bg2);color:var(--ckw-fg)}
|
|
245
|
+
.ckw-msgr-teaser{width:340px;padding:16px;border-radius:calc(var(--ckw-r-card) + 4px);background:var(--ckw-bg);box-shadow:var(--ckw-soft);display:flex;flex-direction:column;gap:14px}
|
|
239
246
|
.ckw-msgr-teaser-top{display:flex;align-items:center;gap:12px}
|
|
240
247
|
.ckw-msgr-teaser-t{display:flex;flex-direction:column;gap:3px;flex:1;min-width:0}
|
|
241
248
|
.ckw-msgr-teaser-t b{font-size:15px;font-weight:700;letter-spacing:-.01em;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
242
249
|
.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:
|
|
250
|
+
.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:var(--ckw-r-pill);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
251
|
.ckw-msgr-teaser-b[data-main]{flex:1.4;background:var(--ckw-accent);color:var(--ckw-accent-ink)}
|
|
245
252
|
.ckw-msgr-teaser-b:hover{filter:brightness(1.06)}
|
|
246
253
|
.ckw-msgr-teaser-b:active{transform:scale(.96)}
|
|
247
254
|
/* The panel */
|
|
248
|
-
.ckw-msgr{bottom:92px;width:400px;height:min(680px,calc(100vh - 112px));max-height:none;border:0;border-radius:
|
|
255
|
+
.ckw-msgr{bottom:92px;width:400px;height:min(680px,calc(100vh - 112px));max-height:none;border:0;border-radius:var(--ckw-r-panel);box-shadow:var(--ckw-soft);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)}
|
|
249
256
|
.ckw-msgr[data-pos=bottom-left]{transform-origin:bottom left}
|
|
250
257
|
.ckw-msgr[data-wide]{width:680px;height:calc(100vh - 112px);max-height:860px}
|
|
251
258
|
.ckw-msgr[data-still]{animation:none}
|
|
@@ -260,14 +267,7 @@ font-size:14px;line-height:1.45;font-family:inherit;color:var(--ckw-fg);box-sizi
|
|
|
260
267
|
.ckw-msgr-ib:active{transform:scale(.9)}
|
|
261
268
|
.ckw-msgr-ib[aria-current=page]{color:var(--ckw-fg)}
|
|
262
269
|
.ckw-msgr-x{display:none}
|
|
263
|
-
.ckw-msgr-
|
|
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)}
|
|
270
|
+
.ckw-msgr-count-tab{top:-1px;right:-3px;min-width:0;width:8px;height:8px;padding:0;font-size:0;line-height:0;box-shadow:0 0 0 2px var(--ckw-bg)}
|
|
271
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
272
|
.ckw-msgr-menu[data-out]{animation:ckw-menu-out .12s cubic-bezier(.4,0,1,1) forwards}
|
|
273
273
|
@keyframes ckw-menu-in{from{opacity:0;transform:translateY(-4px) scale(.94)}}
|
|
@@ -283,12 +283,14 @@ font-size:14px;line-height:1.45;font-family:inherit;color:var(--ckw-fg);box-sizi
|
|
|
283
283
|
.ckw-msgr-enter>:nth-child(n+4){animation-delay:.09s}
|
|
284
284
|
@keyframes ckw-view{from{opacity:0;transform:translateY(8px)}}
|
|
285
285
|
/* Home */
|
|
286
|
-
.ckw-msgr-hero{display:flex;flex-direction:column;gap:
|
|
286
|
+
.ckw-msgr-hero{display:flex;flex-direction:column;gap:6px;padding:10px 4px 8px}
|
|
287
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}
|
|
288
288
|
.ckw-msgr-brand span:last-child{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
289
|
-
.ckw-msgr-hello{margin:
|
|
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:
|
|
291
|
-
button.ckw-msgr-card:hover{
|
|
289
|
+
.ckw-msgr-hello{margin:14px 0 0;font-size:28px;font-weight:650;letter-spacing:-.03em;line-height:1.12;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:var(--ckw-r-card);background:var(--ckw-bg2);transition:background-color .15s linear,box-shadow .15s linear,transform .25s cubic-bezier(.32,.72,0,1)}
|
|
291
|
+
button.ckw-msgr-card:hover{background:var(--ckw-bg3)}
|
|
292
|
+
.ckw-msgr-card-col .ckw-msgr-search{background:var(--ckw-bg)}
|
|
293
|
+
.ckw-msgr-card .ckw-msgr-art:hover{background:var(--ckw-bg3)}
|
|
292
294
|
button.ckw-msgr-card:active{transform:scale(.985)}
|
|
293
295
|
.ckw-msgr-card-col{flex-direction:column;align-items:stretch;gap:2px;padding:8px}
|
|
294
296
|
.ckw-msgr-card-main{display:flex;flex-direction:column;gap:2px;min-width:0;flex:1}
|
|
@@ -305,7 +307,7 @@ button.ckw-msgr-card:hover .ckw-msgr-go{transform:translateX(2px)}
|
|
|
305
307
|
.ckw-msgr-card .ckw-msgr-go .ckw-icon{color:var(--ckw-accent)}
|
|
306
308
|
.ckw-msgr-badge{width:8px;height:8px;flex:none;border-radius:50%;background:var(--ckw-danger);font-size:0}
|
|
307
309
|
/* Search */
|
|
308
|
-
.ckw-msgr-search{display:flex;align-items:center;gap:10px;height:46px;padding:0 14px;border:1px solid transparent;border-radius:
|
|
310
|
+
.ckw-msgr-search{display:flex;align-items:center;gap:10px;height:46px;padding:0 14px;border:1px solid transparent;border-radius:var(--ckw-r-field);background:var(--ckw-bg2);color:var(--ckw-fg3);cursor:text;transition:border-color .15s linear,box-shadow .15s linear,background-color .15s linear}
|
|
309
311
|
.ckw-msgr-card-col .ckw-msgr-search{margin-bottom:4px;height:42px}
|
|
310
312
|
.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
313
|
.ckw-msgr-search-in{flex:1;min-width:0;border:0;background:transparent;outline:none;font-size:14.5px;color:var(--ckw-fg)}
|
|
@@ -350,52 +352,206 @@ button.ckw-msgr-card:hover .ckw-msgr-go{transform:translateX(2px)}
|
|
|
350
352
|
.ckw-msgr-rate-b{display:flex;gap:6px}
|
|
351
353
|
.ckw-msgr-ask{margin-top:6px;width:100%;height:40px;border-radius:12px}
|
|
352
354
|
/* 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}
|
|
357
355
|
.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}
|
|
358
356
|
.ckw-msgr-cite .ckw-icon{color:var(--ckw-accent)}
|
|
359
357
|
.ckw-msgr-cite span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
360
|
-
.ckw-msgs{list-style:none;margin:
|
|
358
|
+
.ckw-msgs{list-style:none;margin:8px 0 0;padding:0;display:flex;flex-direction:column;gap:12px}
|
|
361
359
|
.ckw-msg{display:flex;flex-direction:column;align-items:flex-start;gap:4px;max-width:82%;transform-origin:bottom left}
|
|
362
360
|
.ckw-msg[data-from=me]{align-self:flex-end;align-items:flex-end;transform-origin:bottom right}
|
|
363
361
|
.ckw-msg[data-new]{animation:ckw-bub .4s cubic-bezier(.32,.72,0,1)}
|
|
364
362
|
@keyframes ckw-bub{from{opacity:0;transform:translateY(10px) scale(.92)}}
|
|
365
|
-
.ckw-bubble{padding:10px 14px;border-radius:
|
|
366
|
-
.ckw-msg[data-from=me] .ckw-bubble{background:var(--ckw-accent);color:var(--ckw-accent-ink);border-radius:
|
|
363
|
+
.ckw-bubble{padding:10px 14px;border-radius:var(--ckw-r-bubble) var(--ckw-r-bubble) var(--ckw-r-bubble) var(--ckw-r-tail);background:var(--ckw-bg3);white-space:pre-wrap;overflow-wrap:anywhere;font-size:14px;line-height:1.45;text-wrap:pretty}
|
|
364
|
+
.ckw-msg[data-from=me] .ckw-bubble{background:var(--ckw-accent);color:var(--ckw-accent-ink);border-radius:var(--ckw-r-bubble) var(--ckw-r-bubble) var(--ckw-r-tail) var(--ckw-r-bubble)}
|
|
367
365
|
.ckw-msg[aria-busy=true] .ckw-bubble{opacity:.7}
|
|
368
366
|
.ckw-msg-meta{font-size:11px;color:var(--ckw-fg3);font-variant-numeric:tabular-nums;padding:0 6px}
|
|
369
367
|
.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:
|
|
371
|
-
.ckw-msgr-sugg-b:hover{
|
|
368
|
+
.ckw-msgr-sugg-b{max-width:100%;padding:9px 14px;border:0;border-radius:var(--ckw-r-card);background:var(--ckw-bg2);font-size:13.5px;text-align:left;color:var(--ckw-fg);transition:background-color .12s linear,color .12s linear,transform .2s cubic-bezier(.32,.72,0,1)}
|
|
369
|
+
.ckw-msgr-sugg-b:hover{background:var(--ckw-bg3);color:var(--ckw-accent)}
|
|
372
370
|
.ckw-msgr-sugg-b:active{transform:scale(.96)}
|
|
373
371
|
.ckw-msgr-enter .ckw-msgr-sugg-b{animation:ckw-view .34s cubic-bezier(.32,.72,0,1) backwards}
|
|
374
372
|
.ckw-msgr-enter .ckw-msgr-sugg-b:nth-child(2){animation-delay:.12s}
|
|
375
373
|
.ckw-msgr-enter .ckw-msgr-sugg-b:nth-child(3){animation-delay:.18s}
|
|
376
374
|
.ckw-msgr-note{margin:4px 0 0;text-align:center}
|
|
377
375
|
.ckw-msgr-compose{display:flex;flex-direction:column;gap:8px;padding:4px 14px 14px;background:var(--ckw-bg);flex:none}
|
|
378
|
-
.ckw-msgr-compose .ckw-input{border:0;border-radius:
|
|
379
|
-
.ckw-msgr-
|
|
380
|
-
.ckw-msgr-box:
|
|
381
|
-
.ckw-msgr-
|
|
376
|
+
.ckw-msgr-compose .ckw-input{border:0;border-radius:var(--ckw-r-field);background:var(--ckw-bg2);min-height:40px;padding:8px 16px}
|
|
377
|
+
.ckw-root .ckw-msgr-compose .ckw-input:focus-visible{outline:none;background:var(--ckw-bg3)}
|
|
378
|
+
.ckw-msgr-box{display:flex;flex-direction:column;align-items:stretch;gap:4px;padding:12px 8px 8px 16px;border:0;border-radius:calc(var(--ckw-r-card) + 4px);background:var(--ckw-bg2);box-shadow:0 0 0 1px color-mix(in srgb,var(--ckw-line) 70%,transparent);cursor:text;transition:background-color .15s linear,box-shadow .15s linear}
|
|
379
|
+
.ckw-msgr-box:focus-within{background:var(--ckw-bg);box-shadow:0 0 0 1px var(--ckw-line),0 6px 18px rgba(16,18,24,.07)}
|
|
380
|
+
.ckw-msgr-tools{display:flex;align-items:center;gap:2px;margin-left:-8px}
|
|
381
|
+
.ckw-msgr-sp{flex:1}
|
|
382
|
+
.ckw-msgr-input{flex:1;min-width:0;min-height:24px;max-height:140px;padding:2px 8px 2px 0;border:0;border-radius:0;background:transparent;resize:none;field-sizing:content;font-size:14.5px}
|
|
382
383
|
.ckw-root .ckw-msgr-input:focus-visible{outline:none}
|
|
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
384
|
.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
385
|
.ckw-msgr-send:not(:disabled):hover{transform:scale(1.08)}
|
|
388
386
|
.ckw-msgr-send:not(:disabled):active{transform:scale(.9)}
|
|
389
387
|
.ckw-msgr-send:disabled{background:var(--ckw-bg3);color:var(--ckw-fg3);cursor:default}
|
|
388
|
+
/* Files: the paperclip in the field, picked files above it, sent ones in the bubbles, dropping onto the panel */
|
|
389
|
+
.ckw-msgr-compose{position:relative}
|
|
390
|
+
.ckw-msgr-clip{width:32px;height:32px;padding:0;flex:none;display:flex;align-items:center;justify-content:center;border:0;border-radius:calc(var(--ckw-r-field) - 4px);background:transparent;color:var(--ckw-fg3);transition:color .12s linear,background-color .12s linear,transform .2s cubic-bezier(.32,.72,0,1)}
|
|
391
|
+
.ckw-msgr-clip:hover,.ckw-msgr-clip[aria-expanded=true]{color:var(--ckw-fg);background:color-mix(in srgb,var(--ckw-fg) 7%,transparent)}
|
|
392
|
+
.ckw-msgr-clip:active{transform:scale(.9)}
|
|
393
|
+
|
|
394
|
+
.ckw-msgr-amenu{top:auto;bottom:calc(100% - 4px);right:14px;transform-origin:bottom right}
|
|
395
|
+
.ckw-msgr-files{display:flex;flex-wrap:wrap;gap:10px;padding:6px 2px 0}
|
|
396
|
+
.ckw-msgr-file{position:relative;width:56px;height:56px;border-radius:calc(var(--ckw-r-card) - 4px);background:var(--ckw-bg2);box-shadow:0 0 0 1px var(--ckw-line)}
|
|
397
|
+
.ckw-msgr-file img{display:block;width:100%;height:100%;object-fit:cover;border-radius:inherit}
|
|
398
|
+
.ckw-msgr-file[aria-busy=true] img,.ckw-msgr-file[aria-busy=true] .ckw-msgr-file-doc{opacity:.45}
|
|
399
|
+
.ckw-msgr-file[aria-busy=true]::after{content:"";position:absolute;left:50%;top:50%;width:18px;height:18px;margin:-9px 0 0 -9px;border:2px solid var(--ckw-fg2);border-right-color:transparent;border-radius:50%;animation:ckw-spin .8s linear infinite}
|
|
400
|
+
@keyframes ckw-spin{to{transform:rotate(360deg)}}
|
|
401
|
+
.ckw-msgr-file-doc{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;width:100%;height:100%;padding:4px;color:var(--ckw-fg2);font-size:10px;line-height:1.2}
|
|
402
|
+
.ckw-msgr-file-doc span{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
403
|
+
.ckw-msgr-file-x{position:absolute;top:-7px;right:-7px;width:20px;height:20px;padding:0;display:flex;align-items:center;justify-content:center;border:2px solid var(--ckw-bg);border-radius:50%;background:var(--ckw-fg);color:var(--ckw-bg)}
|
|
404
|
+
.ckw-msgr-file-x .ckw-icon{width:10px;height:10px}
|
|
405
|
+
.ckw-msg-files{display:flex;flex-wrap:wrap;gap:6px;max-width:100%}
|
|
406
|
+
.ckw-msg[data-from=me] .ckw-msg-files{justify-content:flex-end}
|
|
407
|
+
.ckw-msg-img{display:block;overflow:hidden;border-radius:var(--ckw-r-bubble);background:var(--ckw-bg3);box-shadow:0 0 0 1px var(--ckw-line)}
|
|
408
|
+
.ckw-msg-img img{display:block;max-width:220px;max-height:200px;min-width:48px;min-height:48px;object-fit:cover}
|
|
409
|
+
.ckw-msg-files a.ckw-msgr-cite{color:var(--ckw-fg);text-decoration:none}
|
|
410
|
+
.ckw-msgr[data-drop]::after{content:"Drop to attach";position:absolute;inset:8px;z-index:5;display:flex;align-items:center;justify-content:center;border:2px dashed var(--ckw-accent);border-radius:calc(var(--ckw-r-panel) - 6px);background:color-mix(in srgb,var(--ckw-bg) 90%,transparent);color:var(--ckw-fg);font-size:15px;font-weight:600;pointer-events:none}
|
|
411
|
+
/* Powered by */
|
|
412
|
+
.ckw-msgr-powered{flex:none;display:block;padding:2px 0 10px;text-align:center;font-size:11.5px;color:var(--ckw-fg3);text-decoration:none;background:var(--ckw-bg)}
|
|
413
|
+
.ckw-msgr-powered b{font-weight:650;color:var(--ckw-fg2)}
|
|
414
|
+
.ckw-msgr-powered:hover b{color:var(--ckw-fg)}
|
|
415
|
+
.ckw-msgr-compose:has(+.ckw-msgr-powered){padding-bottom:8px}
|
|
390
416
|
.ckw-msgr-error{margin:0;font-size:12px;color:var(--ckw-danger)}
|
|
391
417
|
.ckw-msgr .ckw-input[aria-invalid=true]{box-shadow:0 0 0 1px var(--ckw-danger)}
|
|
418
|
+
/* Bar middle, tab bar, Home's glow and "Ask a question" (Featurebase-like) */
|
|
419
|
+
.ckw-msgr-mid{display:flex;align-items:center;justify-content:center;gap:10px;min-width:0;max-width:62%;flex:none}
|
|
420
|
+
.ckw-msgr-mid b{font-size:15px;font-weight:650;letter-spacing:-.01em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
|
|
421
|
+
.ckw-msgr-mid-t{display:flex;flex-direction:column;gap:1px;min-width:0;line-height:1.25}
|
|
422
|
+
.ckw-msgr-mid-t .ckw-msgr-online{font-size:11.5px;white-space:nowrap}
|
|
423
|
+
.ckw-msgr-mid-t .ckw-msgr-online::before{width:6px;height:6px;box-shadow:none}
|
|
424
|
+
.ckw-msgr-tabs{flex:none;display:flex;padding:6px 10px 4px;background:var(--ckw-bg);box-shadow:0 -1px 0 color-mix(in srgb,var(--ckw-line) 60%,transparent)}
|
|
425
|
+
.ckw-msgr-tab{flex:1;display:flex;flex-direction:column;align-items:center;gap:3px;padding:6px 0 4px;border:0;border-radius:12px;background:none;color:var(--ckw-fg3);font-size:12px;font-weight:550;transition:color .15s linear}
|
|
426
|
+
.ckw-msgr-tab:hover{color:var(--ckw-fg2)}
|
|
427
|
+
.ckw-msgr-tab[aria-current=page]{color:var(--ckw-fg)}
|
|
428
|
+
.ckw-msgr-tab-ic{position:relative;display:block;width:22px;height:22px;transition:transform .25s cubic-bezier(.34,1.56,.64,1)}
|
|
429
|
+
.ckw-msgr-tab:active .ckw-msgr-tab-ic{transform:scale(.88)}
|
|
430
|
+
.ckw-msgr-tab-ic>.ckw-icon{position:absolute;inset:0;transition:opacity .15s linear,transform .3s cubic-bezier(.34,1.56,.64,1)}
|
|
431
|
+
.ckw-msgr-tab-ic>.ckw-icon+.ckw-icon{opacity:0;transform:scale(.75)}
|
|
432
|
+
.ckw-msgr-tab[aria-current=page] .ckw-msgr-tab-ic>.ckw-icon:first-child{opacity:0}
|
|
433
|
+
.ckw-msgr-tab[aria-current=page] .ckw-msgr-tab-ic>.ckw-icon+.ckw-icon{opacity:1;transform:none}
|
|
434
|
+
.ckw-cut{stroke:var(--ckw-bg)}
|
|
435
|
+
.ckw-root:not([data-header=color]) .ckw-msgr[data-view=home] :is(.ckw-msgr-bar,.ckw-msgr-body){background:transparent}
|
|
436
|
+
.ckw-msgr-askq{display:flex;align-items:center;gap:8px;height:52px;margin:6px 0 4px;padding:0 7px 0 18px;border-radius:var(--ckw-r-field);background:var(--ckw-bg2);box-shadow:0 0 0 1px color-mix(in srgb,var(--ckw-line) 70%,transparent);transition:background-color .15s linear,box-shadow .15s linear}
|
|
437
|
+
.ckw-msgr-askq:focus-within{background:var(--ckw-bg);box-shadow:0 0 0 1px var(--ckw-line),0 6px 18px rgba(16,18,24,.07)}
|
|
438
|
+
.ckw-msgr-askq-in{flex:1;min-width:0;border:0;background:transparent;outline:none;font-size:15px;color:var(--ckw-fg)}
|
|
439
|
+
.ckw-msgr-askq-in::placeholder{color:var(--ckw-fg3)}
|
|
440
|
+
.ckw-root .ckw-msgr-askq-in:focus-visible{outline:none}
|
|
441
|
+
.ckw-msgr-askq .ckw-msgr-send{width:38px;height:38px}
|
|
442
|
+
.ckw-root[data-header=color] .ckw-msgr-askq{background:var(--ckw-card);box-shadow:var(--ckw-raise)}
|
|
443
|
+
/* Home in the accent color (look: header "color"): the bar and the top in the accent, raised cards over its edge */
|
|
444
|
+
.ckw-root[data-header=color] .ckw-msgr[data-view=home] .ckw-msgr-bar{background:var(--ckw-accent);color:var(--ckw-accent-ink)}
|
|
445
|
+
.ckw-root[data-header=color] .ckw-msgr[data-view=home] .ckw-msgr-ib{color:color-mix(in srgb,var(--ckw-accent-ink) 80%,transparent)}
|
|
446
|
+
.ckw-root[data-header=color] .ckw-msgr[data-view=home] .ckw-msgr-ib:hover,.ckw-root[data-header=color] .ckw-msgr[data-view=home] .ckw-msgr-ib[aria-expanded=true]{background:color-mix(in srgb,var(--ckw-accent-ink) 14%,transparent);color:var(--ckw-accent-ink)}
|
|
447
|
+
.ckw-root[data-header=color] .ckw-msgr[data-view=home] .ckw-msgr-body,.ckw-root[data-header=color] .ckw-msgr[data-view=home] .ckw-msgr-powered{background:var(--ckw-bg2)}
|
|
448
|
+
.ckw-root[data-header=color] .ckw-msgr[data-view=home] .ckw-msgr-body{scrollbar-width:none}
|
|
449
|
+
.ckw-root[data-header=color] .ckw-msgr-hero{margin:-4px -16px 0;padding:14px 20px 64px;background:var(--ckw-accent);color:var(--ckw-accent-ink)}
|
|
450
|
+
.ckw-root[data-header=color] .ckw-msgr-hero .ckw-msgr-brand,.ckw-root[data-header=color] .ckw-msgr-hero .ckw-msgr-online{color:color-mix(in srgb,var(--ckw-accent-ink) 82%,transparent)}
|
|
451
|
+
.ckw-root[data-header=color] .ckw-msgr-hero .ckw-msgr-av{background:var(--ckw-accent-ink);color:var(--ckw-accent)}
|
|
452
|
+
.ckw-root[data-header=color] .ckw-msgr-hero+*{margin-top:-58px}
|
|
453
|
+
.ckw-root[data-header=color] .ckw-msgr-card{background:var(--ckw-card);box-shadow:var(--ckw-raise)}
|
|
454
|
+
.ckw-root[data-header=color] button.ckw-msgr-card:hover{background:var(--ckw-card);transform:translateY(-1px)}
|
|
455
|
+
.ckw-root[data-header=color] .ckw-msgr-card-col .ckw-msgr-search{background:var(--ckw-bg2)}
|
|
456
|
+
.ckw-root[data-header=color] .ckw-msgr-card .ckw-msgr-art:hover{background:var(--ckw-bg2)}
|
|
457
|
+
/* Where it sits: a corner, the middle of the top or bottom edge, or the middle of a side; panel and cards open from the launcher */
|
|
458
|
+
.ckw-msgr-fab[data-pos$=left],.ckw-msgr[data-pos$=left],.ckw-msgr-preview[data-pos$=left],.ckw-msgr-teaser[data-pos$=left]{left:20px;right:auto}
|
|
459
|
+
.ckw-msgr-fab[data-pos$=right],.ckw-msgr[data-pos$=right],.ckw-msgr-preview[data-pos$=right],.ckw-msgr-teaser[data-pos$=right]{right:20px;left:auto}
|
|
460
|
+
.ckw-msgr-fab[data-pos$=center],.ckw-msgr[data-pos$=center],.ckw-msgr-preview[data-pos$=center],.ckw-msgr-teaser[data-pos$=center]{left:50%;right:auto;translate:-50% 0}
|
|
461
|
+
.ckw-msgr-fab[data-pos^=top]{top:20px;bottom:auto}
|
|
462
|
+
.ckw-msgr[data-pos^=top],.ckw-msgr-preview[data-pos^=top],.ckw-msgr-teaser[data-pos^=top]{top:92px;bottom:auto}
|
|
463
|
+
.ckw-msgr-fab[data-pos^=middle],.ckw-msgr[data-pos^=middle],.ckw-msgr-preview[data-pos^=middle],.ckw-msgr-teaser[data-pos^=middle]{top:50%;bottom:auto;translate:0 -50%}
|
|
464
|
+
.ckw-msgr[data-pos=middle-left],.ckw-msgr-preview[data-pos=middle-left],.ckw-msgr-teaser[data-pos=middle-left]{left:92px}
|
|
465
|
+
.ckw-msgr[data-pos=middle-right],.ckw-msgr-preview[data-pos=middle-right],.ckw-msgr-teaser[data-pos=middle-right]{right:92px}
|
|
466
|
+
.ckw-msgr[data-pos^=middle]{height:min(680px,calc(100vh - 40px))}
|
|
467
|
+
.ckw-msgr[data-pos=top-right],.ckw-msgr-preview[data-pos=top-right],.ckw-msgr-teaser[data-pos=top-right]{transform-origin:top right}
|
|
468
|
+
.ckw-msgr[data-pos=top-left],.ckw-msgr-preview[data-pos=top-left],.ckw-msgr-teaser[data-pos=top-left]{transform-origin:top left}
|
|
469
|
+
.ckw-msgr[data-pos=top-center],.ckw-msgr-preview[data-pos=top-center],.ckw-msgr-teaser[data-pos=top-center]{transform-origin:top center}
|
|
470
|
+
.ckw-msgr[data-pos=bottom-center],.ckw-msgr-preview[data-pos=bottom-center],.ckw-msgr-teaser[data-pos=bottom-center]{transform-origin:bottom center}
|
|
471
|
+
.ckw-msgr[data-pos=middle-left],.ckw-msgr-preview[data-pos=middle-left],.ckw-msgr-teaser[data-pos=middle-left]{transform-origin:center left}
|
|
472
|
+
.ckw-msgr[data-pos=middle-right],.ckw-msgr-preview[data-pos=middle-right],.ckw-msgr-teaser[data-pos=middle-right]{transform-origin:center right}
|
|
473
|
+
@media (max-width:520px){.ckw-root:not([data-contained]) .ckw-msgr{top:0;translate:none}.ckw-msgr-fab[data-pos$=left]{left:14px}.ckw-msgr-fab[data-pos$=right]{right:14px}.ckw-msgr-fab[data-pos^=top]{top:14px}.ckw-msgr-preview[data-pos^=top],.ckw-msgr-teaser[data-pos^=top]{top:84px}.ckw-msgr-preview[data-pos^=middle],.ckw-msgr-teaser[data-pos^=middle]{top:auto;bottom:20px;left:16px;right:16px;width:auto;translate:none}}
|
|
392
474
|
/* Inside MRRocket's preview: placed in its frame, not the page */
|
|
393
475
|
.ckw-root[data-contained]{position:absolute;inset:0;pointer-events:none;overflow:hidden}
|
|
394
476
|
.ckw-root[data-contained]>*{position:absolute;pointer-events:auto}
|
|
395
477
|
.ckw-root[data-contained] .ckw-msgr{height:min(680px,calc(100% - 112px));max-width:calc(100% - 40px)}
|
|
396
478
|
.ckw-root[data-contained] .ckw-msgr[data-wide]{height:calc(100% - 112px)}
|
|
479
|
+
.ckw-root[data-contained] .ckw-msgr[data-pos^=middle]{height:min(680px,calc(100% - 40px));max-width:calc(100% - 112px)}
|
|
480
|
+
.ckw-root[data-contained] .ckw-msgr-preview[data-pos^=middle],.ckw-root[data-contained] .ckw-msgr-teaser[data-pos^=middle]{max-width:calc(100% - 112px)}
|
|
397
481
|
@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-
|
|
482
|
+
@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-tab-ic,.ckw-msgr-tab-ic>.ckw-icon,.ckw-msgr{transition:none}}
|
|
483
|
+
/* The messenger in HeroUI v3's look (heroui.com, its free components): a soft gray ground, white surfaces with a hairline
|
|
484
|
+
shadow, white fields, pill buttons and a pill tab switch, a 2px ring in the accent on focus. Its tokens (--hu-*) map onto
|
|
485
|
+
the widget's own, inside the messenger only, so the other widgets keep theirs. */
|
|
486
|
+
.ckw-root{--hu-bg:#fff;--hu-surface:#f4f4f5;--hu-default:#ececee;--hu-default-hover:#e4e4e7;--hu-segment:#fff;--hu-muted:#71717a;--hu-fg:#18181b;--hu-border:#e4e4e7;--hu-shadow:0 0 0 0 transparent;--hu-lift:0 1px 2px rgba(0,0,0,.08),0 0 1px rgba(0,0,0,.1);--hu-overlay:0 0 0 1px rgba(0,0,0,.05),0 2px 8px rgba(0,0,0,.05),0 18px 40px rgba(0,0,0,.1)}
|
|
487
|
+
.ckw-root[data-theme=dark]{--hu-bg:#111113;--hu-surface:#1c1c1f;--hu-default:#26262a;--hu-default-hover:#2e2e33;--hu-segment:#3a3a40;--hu-muted:#a1a1aa;--hu-fg:#fafafa;--hu-border:#27272a;--hu-shadow:0 0 0 0 transparent;--hu-lift:0 0 0 1px rgba(255,255,255,.06);--hu-overlay:0 0 0 1px rgba(255,255,255,.08),0 18px 40px rgba(0,0,0,.55)}
|
|
488
|
+
@media (prefers-color-scheme:dark){.ckw-root[data-theme=auto]{--hu-bg:#111113;--hu-surface:#1c1c1f;--hu-default:#26262a;--hu-default-hover:#2e2e33;--hu-segment:#3a3a40;--hu-muted:#a1a1aa;--hu-fg:#fafafa;--hu-border:#27272a;--hu-shadow:0 0 0 0 transparent;--hu-lift:0 0 0 1px rgba(255,255,255,.06);--hu-overlay:0 0 0 1px rgba(255,255,255,.08),0 18px 40px rgba(0,0,0,.55)}}
|
|
489
|
+
.ckw-msgr,.ckw-msgr-preview,.ckw-msgr-teaser{--ckw-bg:var(--hu-bg);--ckw-bg2:var(--hu-surface);--ckw-bg3:var(--hu-default);--ckw-card:var(--hu-surface);--ckw-fg:var(--hu-fg);--ckw-fg2:var(--hu-muted);--ckw-fg3:var(--hu-muted);--ckw-line:var(--hu-border);--ckw-soft:var(--hu-overlay);--ckw-raise:var(--hu-shadow)}
|
|
490
|
+
.ckw-root .ckw-msgr-preview-card,.ckw-root .ckw-msgr-teaser{background:var(--hu-surface)}
|
|
491
|
+
.ckw-root .ckw-msgr-card,.ckw-root .ckw-msgr-sugg-b,.ckw-root .ckw-msgr-rate,.ckw-root .ckw-msgr-cite{background:var(--hu-surface);box-shadow:var(--hu-shadow);border:0}
|
|
492
|
+
.ckw-root button.ckw-msgr-card:hover{background:var(--hu-default)}
|
|
493
|
+
.ckw-root .ckw-msgr-card-col{padding:6px}
|
|
494
|
+
.ckw-root .ckw-msgr-card .ckw-msgr-art:hover,.ckw-root .ckw-msgr-hrow:hover{background:var(--hu-default)}
|
|
495
|
+
.ckw-root .ckw-msgr-hrow+.ckw-msgr-hrow{box-shadow:0 -1px 0 var(--hu-border)}
|
|
496
|
+
.ckw-root .ckw-msgr-search,.ckw-root .ckw-msgr-askq,.ckw-root .ckw-msgr-box,.ckw-root .ckw-msgr-compose .ckw-input{background:var(--hu-surface);border:0;box-shadow:var(--hu-shadow)}
|
|
497
|
+
.ckw-root .ckw-msgr-search:focus-within,.ckw-root .ckw-msgr-askq:focus-within,.ckw-root .ckw-msgr-box:focus-within,.ckw-root .ckw-msgr-compose .ckw-input:focus-visible{background:var(--hu-surface);box-shadow:0 0 0 1.5px color-mix(in srgb,var(--ckw-accent) 55%,transparent),0 0 0 5px color-mix(in srgb,var(--ckw-accent) 12%,transparent);color:var(--ckw-fg3)}
|
|
498
|
+
.ckw-root .ckw-msgr-askq{height:48px;border-radius:24px}
|
|
499
|
+
.ckw-root .ckw-msgr-box{border-radius:20px}
|
|
500
|
+
.ckw-root .ckw-msgr-send{border-radius:999px}
|
|
501
|
+
.ckw-root .ckw-msgr-send:disabled{background:var(--hu-default);color:var(--hu-muted)}
|
|
502
|
+
.ckw-root .ckw-msgr-send:not(:disabled):hover{transform:none;filter:brightness(1.08)}
|
|
503
|
+
.ckw-root .ckw-msgr-send:not(:disabled):active{transform:scale(.97)}
|
|
504
|
+
.ckw-root .ckw-bubble{background:var(--hu-surface);box-shadow:var(--hu-shadow)}
|
|
505
|
+
.ckw-root .ckw-msg[data-from=me] .ckw-bubble{box-shadow:none}
|
|
506
|
+
.ckw-root .ckw-msgr-av{background:color-mix(in srgb,var(--ckw-accent) 16%,var(--hu-surface));color:var(--ckw-accent);font-weight:600}
|
|
507
|
+
.ckw-root .ckw-msgr-ib:hover,.ckw-root .ckw-msgr-ib[aria-expanded=true]{background:var(--hu-default)}
|
|
508
|
+
.ckw-root .ckw-msgr-menu{background:var(--hu-surface);box-shadow:var(--hu-overlay);border-radius:16px}
|
|
509
|
+
.ckw-root .ckw-msgr-menu-i{border-radius:10px}
|
|
510
|
+
.ckw-root .ckw-msgr-menu-i:hover,.ckw-root .ckw-msgr-menu-i:focus-visible{background:var(--hu-default)}
|
|
511
|
+
.ckw-root .ckw-msgr .ckw-btn,.ckw-root .ckw-msgr-teaser-b{height:36px;padding:0 16px;border:0;border-radius:999px;background:var(--hu-default);color:var(--hu-fg);font-size:14px;font-weight:500;box-shadow:none;transition:transform .25s cubic-bezier(.32,.72,0,1),background-color .1s linear}
|
|
512
|
+
.ckw-root .ckw-msgr .ckw-btn:hover,.ckw-root .ckw-msgr-teaser-b:hover{background:var(--hu-default-hover);filter:none}
|
|
513
|
+
.ckw-root .ckw-msgr .ckw-btn:active,.ckw-root .ckw-msgr-teaser-b:active{transform:scale(.97)}
|
|
514
|
+
.ckw-root .ckw-msgr .ckw-btn-primary,.ckw-root .ckw-msgr-teaser-b[data-main]{background:var(--ckw-accent);color:var(--ckw-accent-ink)}
|
|
515
|
+
.ckw-root .ckw-msgr .ckw-btn-primary:hover,.ckw-root .ckw-msgr-teaser-b[data-main]:hover{background:var(--ckw-accent);filter:brightness(1.08)}
|
|
516
|
+
.ckw-root .ckw-msgr-sugg-b{border-radius:999px}
|
|
517
|
+
.ckw-root .ckw-msgr-ask{height:40px;border-radius:999px}
|
|
518
|
+
/* Home like Featurebase: the product's icon top left, "Hi, Lukas \u{1F44B}" over the greeting in gray, a silk of the accent
|
|
519
|
+
with drifting dots behind the top right (.ckw-msgr-sky, also drawn by MRRocket's phone preview) */
|
|
520
|
+
.ckw-msgr-logo{display:flex;align-items:center;justify-content:center;width:32px;height:32px;flex:none;margin-left:6px}
|
|
521
|
+
.ckw-msgr-logo img{width:28px;height:28px;border-radius:8px;object-fit:contain}
|
|
522
|
+
.ckw-root .ckw-msgr[data-view=home] .ckw-msgr-bar{padding-top:16px}
|
|
523
|
+
.ckw-root .ckw-msgr[data-view=home] .ckw-msgr-body{position:relative;z-index:1;gap:10px;padding-top:0}
|
|
524
|
+
.ckw-root .ckw-msgr-hero.ckw-msgr-hello{display:flex;flex-direction:column;gap:1px;margin:22px 0 10px;padding:0 4px;font-size:25px;font-weight:600;letter-spacing:-.028em;line-height:1.2;color:var(--hu-fg)}
|
|
525
|
+
.ckw-msgr-hello-sub{color:var(--hu-muted);font-weight:500}
|
|
526
|
+
.ckw-msgr-wave{display:inline-block;transform-origin:70% 75%;animation:ckw-wave 2.4s ease-in-out .6s 1 both}
|
|
527
|
+
@keyframes ckw-wave{0%,60%,100%{transform:none}10%,30%{transform:rotate(14deg)}20%{transform:rotate(-8deg)}40%{transform:rotate(-4deg)}50%{transform:rotate(10deg)}}
|
|
528
|
+
.ckw-root .ckw-msgr[data-view=home] .ckw-msgr-askq{margin:0 0 6px}
|
|
529
|
+
.ckw-msgr-sky{position:absolute;z-index:0;top:0;left:0;right:0;height:250px;pointer-events:none;overflow:hidden;border-radius:inherit;-webkit-mask-image:linear-gradient(to bottom,#000 25%,transparent 92%);mask-image:linear-gradient(to bottom,#000 25%,transparent 92%)}
|
|
530
|
+
.ckw-msgr-sky::before{content:"";position:absolute;top:-45%;right:-25%;width:115%;height:135%;background:radial-gradient(36% 40% at 62% 46%,color-mix(in srgb,var(--ckw-accent) 92%,#fff) 0%,transparent 70%),radial-gradient(32% 36% at 86% 24%,color-mix(in srgb,var(--ckw-glow2,var(--ckw-accent)) 70%,#fff) 0%,transparent 72%),radial-gradient(46% 30% at 36% 64%,color-mix(in srgb,var(--ckw-glow3,var(--ckw-glow2,var(--ckw-accent))) 50%,#fff) 0%,transparent 70%);filter:blur(20px);opacity:.75;animation:ckw-silk 16s cubic-bezier(.45,0,.55,1) infinite alternate}
|
|
531
|
+
@keyframes ckw-silk{to{transform:translate(-7%,5%) rotate(8deg) scale(1.08)}}
|
|
532
|
+
.ckw-msgr-sky::after{content:"";position:absolute;inset:0;background-image:radial-gradient(circle,color-mix(in srgb,var(--ckw-accent) 85%,#fff) .9px,transparent 1.4px);background-size:5px 5px;-webkit-mask-image:linear-gradient(110deg,transparent 0%,#000 18%,transparent 34%,#000 52%,transparent 70%),radial-gradient(70% 85% at 88% 12%,#000 15%,transparent 75%);-webkit-mask-size:220% 100%,100% 100%;-webkit-mask-repeat:repeat-x,no-repeat;-webkit-mask-composite:source-in;mask-image:linear-gradient(110deg,transparent 0%,#000 18%,transparent 34%,#000 52%,transparent 70%),radial-gradient(70% 85% at 88% 12%,#000 15%,transparent 75%);mask-size:220% 100%,100% 100%;mask-repeat:repeat-x,no-repeat;mask-composite:intersect;opacity:.6;animation:ckw-dots 11s linear infinite}
|
|
533
|
+
@keyframes ckw-dots{from{-webkit-mask-position:0 0,0 0;mask-position:0 0,0 0}to{-webkit-mask-position:-220% 0,0 0;mask-position:-220% 0,0 0}}
|
|
534
|
+
.ckw-root[data-theme=dark] .ckw-msgr-sky::before{opacity:.4}
|
|
535
|
+
.ckw-root[data-theme=dark] .ckw-msgr-sky::after{opacity:.4}
|
|
536
|
+
@media (prefers-color-scheme:dark){.ckw-root[data-theme=auto] .ckw-msgr-sky::before{opacity:.4}.ckw-root[data-theme=auto] .ckw-msgr-sky::after{opacity:.4}}
|
|
537
|
+
.ckw-root[data-header=color] .ckw-msgr-sky{display:none}
|
|
538
|
+
@media (prefers-reduced-motion:reduce){.ckw-msgr-sky::before,.ckw-msgr-sky::after,.ckw-msgr-wave{animation:none}}
|
|
539
|
+
/* Home's latest message: one quiet row, the small mark, the words, who and when */
|
|
540
|
+
.ckw-root .ckw-msgr-recent{padding:10px 12px;gap:0}
|
|
541
|
+
.ckw-root .ckw-msgr-recent .ckw-msgr-recent-row{gap:10px}
|
|
542
|
+
.ckw-root .ckw-msgr-recent .ckw-msgr-card-main{gap:1px}
|
|
543
|
+
.ckw-root .ckw-msgr-recent-text{font-size:13.5px;font-weight:500}
|
|
544
|
+
.ckw-root .ckw-msgr-recent .ckw-msgr-card-meta{font-size:11.5px}
|
|
545
|
+
/* The tab switch: HeroUI's Tabs, a gray pill with the current tab on a raised white one */
|
|
546
|
+
.ckw-root .ckw-msgr-tabs{position:relative;z-index:1;margin:2px 12px 8px;padding:4px;gap:0;border-radius:999px;background:var(--hu-surface);box-shadow:none}
|
|
547
|
+
.ckw-root .ckw-msgr-tab{flex-direction:row;justify-content:center;gap:7px;height:36px;padding:0 10px;border-radius:999px;color:var(--hu-muted);font-size:13.5px;font-weight:500;transition:color .15s ease,background-color .15s ease,box-shadow .15s ease,opacity .15s ease}
|
|
548
|
+
.ckw-root .ckw-msgr-tab:not([aria-current=page]):hover{color:var(--hu-muted);opacity:.7}
|
|
549
|
+
.ckw-root .ckw-msgr-tab[aria-current=page]{background:var(--hu-segment);color:var(--hu-fg);box-shadow:var(--hu-lift)}
|
|
550
|
+
.ckw-root .ckw-msgr-tab-ic{width:18px;height:18px}
|
|
551
|
+
.ckw-root .ckw-msgr-tab .ckw-cut{stroke:var(--hu-segment)}
|
|
552
|
+
.ckw-root .ckw-msgr-count-tab{box-shadow:0 0 0 2px var(--hu-default)}
|
|
553
|
+
.ckw-root .ckw-msgr-tab[aria-current=page] .ckw-msgr-count-tab{box-shadow:0 0 0 2px var(--hu-segment)}
|
|
554
|
+
.ckw-root .ckw-msgr-powered{background:var(--hu-bg);padding-top:0}
|
|
399
555
|
/* Survey */
|
|
400
556
|
.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}
|
|
401
557
|
@keyframes ckw-in{from{opacity:0;transform:translateY(8px)}}
|
|
@@ -422,5 +578,5 @@ button.ckw-msgr-card:hover .ckw-msgr-go{transform:translateX(2px)}
|
|
|
422
578
|
.ckw-sv-foot{display:flex;justify-content:space-between;align-items:center;gap:8px;margin-top:12px}
|
|
423
579
|
.ckw-thanks{text-align:center;padding:14px 0;display:flex;flex-direction:column;align-items:center;gap:8px}
|
|
424
580
|
.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}
|
|
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};
|
|
581
|
+
`,er=()=>{if(typeof document=="undefined"||document.getElementById(Zt))return;let a=document.createElement("style");a.id=Zt,a.textContent=vr,document.head.appendChild(a);};var yr=4e3,zr=8e3,Mr=3e4,Cr=10*6e4,Er=/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/,or="ckw_msgr_seen",pt={visitor:"You",team:"Team",ai:"AI agent",auto:"Team"},Ar=()=>{var a;try{return (a=window.localStorage.getItem(or))!=null?a:""}catch(n){return ""}},Sr=a=>{try{window.localStorage.setItem(or,a);}catch(n){}},gt=a=>{let n=new Date(a).getTime();if(Number.isNaN(n))return "";let c=Math.max(0,Date.now()-n)/1e3;return c<60?"just now":c<3600?`${Math.floor(c/60)}m ago`:c<86400?`${Math.floor(c/3600)}h ago`:c<86400*30?`${Math.floor(c/86400)}d ago`:new Date(a).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"})},t=(a,n={},...c)=>{let g=document.createElement(a);for(let[s,d]of Object.entries(n))g.setAttribute(s,d);for(let s of c)s!==null&&s!==false&&s!==void 0&&g.append(s);return g},he="http://www.w3.org/2000/svg",z=(a,n=16)=>{let c=document.createElementNS(he,"svg");for(let[s,d]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"}))c.setAttribute(s,d);let g=document.createElementNS(he,"path");return g.setAttribute("d",a),c.appendChild(g),c},u={cross:"M18 6 6 18M6 6l12 12",chat:"M7.9 20A9 9 0 1 0 4 16.1L2 22z",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",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",down:"m6 9 6 6 6-6",help:"M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20zM9.1 9a3 3 0 0 1 5.8 1c0 2-3 3-3 3M12 17h.01",clip:"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48",image:"M19 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2zM9 11a2 2 0 1 0 0-4 2 2 0 0 0 0 4zM21 15l-3.09-3.09a2 2 0 0 0-2.82 0L6 21",screen:"M20 3H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2zM8 21h8M12 17v4"},wt=a=>{var n,c;return a.body||(((n=a.attachments)==null?void 0:n.length)===1?`Sent ${a.attachments[0].name}`:(c=a.attachments)!=null&&c.length?`Sent ${a.attachments.length} files`:"")},Tr=()=>{var a;return typeof navigator!="undefined"&&typeof((a=navigator.mediaDevices)==null?void 0:a.getDisplayMedia)=="function"},tr="M7.9 20A9 9 0 1 0 4 16.1L2 22z",Lr=(a,n)=>{let c=document.createElementNS(he,"svg");for(let[s,d]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"}))c.setAttribute(s,d);let g=document.createElementNS(he,"path");return g.setAttribute("d",a),c.appendChild(g),c},rr=(a,n,c,g=2)=>{let s=Lr(a,c),d=document.createElementNS(he,"path");for(let[b,H]of Object.entries({d:n,class:"ckw-cut",fill:"none","stroke-width":String(g),"stroke-linecap":"round","stroke-linejoin":"round"}))d.setAttribute(b,H);return s.appendChild(d),s},ar="M8 12h.01M12 12h.01M16 12h.01",$r="M3 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",Ir="M9.5 15.5c1.4 1 3.6 1 5 0",jr="M12 22a10 10 0 1 0 0-20 10 10 0 0 0 0 20z",Hr="M9.4 9.2a2.7 2.7 0 0 1 5.2 1c0 1.8-2.6 2.5-2.6 2.5M12 16.8h.01",ue=(()=>{let a=null,n=()=>{var g;let c=(g=window.AudioContext)!=null?g:window.webkitAudioContext;return c?(a!=null||(a=new c),a):null};return {unlock:()=>{try{let c=n();(c==null?void 0:c.state)==="suspended"&&c.resume();}catch(c){}},play:()=>{try{let c=n();if(!c||c.state!=="running")return;let g=c.currentTime;[880,1318.5].forEach((s,d)=>{let b=c.createOscillator(),H=c.createGain(),$=g+d*.11;b.type="sine",b.frequency.value=s,H.gain.setValueAtTime(1e-4,$),H.gain.exponentialRampToValueAtTime(.12,$+.012),H.gain.exponentialRampToValueAtTime(1e-4,$+.32),b.connect(H),H.connect(c.destination),b.start($),b.stop($+.34);});}catch(c){}}}})(),He=a=>a.map(n=>{let c=n.href?t("a",{href:n.href,target:"_blank",rel:"noopener noreferrer"},n.text):t("span",{},n.text);return n.code&&(c=t("code",{},c)),n.italic&&(c=t("em",{},c)),n.bold&&(c=t("strong",{},c)),c}),Pr=a=>{switch(a.type){case "h2":case "h3":return t(a.type,{},...He(a.spans));case "quote":return t("blockquote",{},...He(a.spans));case "ul":case "ol":return t(a.type,{},...a.items.map(n=>t("li",{},...He(n))));case "code":return t("pre",{},t("code",{},a.text));case "hr":return t("hr");default:return t("p",{},...He(a.spans))}},Rr=2500,nr=a=>{var $;let n=null,c=false,g=[],s=f=>n?f(n):g.push(f),d=new AbortController,b=f=>{var xe,_,I;if(n||c)return;let ie=Object.fromEntries(Object.entries(a).filter(([,v])=>v!==void 0));n=Or({...f!=null?f:{},...ie,accent:(xe=a.accent)!=null?xe:f==null?void 0:f.accent,theme:(_=a.theme)!=null?_:f==null?void 0:f.theme,branding:(I=f==null?void 0:f.branding)!=null?I:true});for(let v of g.splice(0))v(n);},H=setTimeout(()=>b(null),Rr);return (($=a.client)!=null?$:dt({host:a.host,apiKey:a.apiKey,distinctId:a.distinctId(),user:a.user()})).messengerLook(d.signal).then(f=>b(f)).catch(()=>b(null)).finally(()=>clearTimeout(H)),{open:f=>s(ie=>ie.open(f)),close:()=>n==null?void 0:n.close(),toggle:()=>s(f=>f.toggle()),destroy:()=>{c=true,d.abort(),clearTimeout(H),n==null||n.destroy();}}},Fr=["top-left","top-center","top-right","middle-left","middle-right","bottom-left","bottom-center","bottom-right"],Or=a=>{var Ft,Ot,qt,_t,Ut,Bt,Dt,Nt,Kt,Vt,Yt;er();let n=(Ft=Fr.find(e=>e===a.position))!=null?Ft:"bottom-right",c=a.title||"Support",g=a.greeting||"Hi! How can we help?",s=(Ot=a.askEmail)!=null?Ot:true,d=(qt=a.label)!=null?qt:"",b=Xt(a.replyTime),H=((_t=c.trim()[0])!=null?_t:"?").toUpperCase(),$=(Ut=a.launcher)!=null?Ut:true,f=(Bt=a.help)!=null?Bt:true,ie=(Dt=a.sound)!=null?Dt:true,xe=(Nt=a.preview)!=null?Nt:true,_=()=>{var e;return (e=a.client)!=null?e:dt({host:a.host,apiKey:a.apiKey,distinctId:a.distinctId(),user:a.user()})},I=t("div",{class:"ckw-root","data-theme":(Kt=a.theme)!=null?Kt:"auto","data-corners":a.corners==="soft"||a.corners==="square"?a.corners:"round","data-font":a.font==="system"?"system":"site","data-header":a.header==="color"?"color":"plain"});a.container&&I.setAttribute("data-contained",""),a.accent&&(I.style.setProperty("--ckw-accent",a.accent),I.style.setProperty("--ckw-accent-ink",Jt(a.accent))),(Vt=a.glow)==null||Vt.slice(0,2).forEach((e,r)=>/^#[0-9a-f]{6}$/i.test(e)&&I.style.setProperty(`--ckw-glow${r+2}`,e)),((Yt=a.container)!=null?Yt:document.body).appendChild(I);let v=false,m="home",x=null,kt=false,T="",P=null,Pe=null,E=[],ve=false,ye,V=null,S=null,D="",Re=new Set,ze=null,N=null,se=false,mt=e=>{var r;return ((r=e==null?void 0:e.messages)!=null?r:[]).filter(o=>o.from!=="visitor")},ft=e=>{var r,o;return (o=(r=mt(e).at(-1))==null?void 0:r.id)!=null?o:""},Fe=()=>v&&m==="messages"&&document.visibilityState!=="hidden",bt=e=>{let r=mt(e);if(Pe===null){let o=Ar(),l=r.findIndex(i=>i.id===o);E=e.messages.some(i=>i.from==="visitor")?r.slice(l+1).filter(i=>i.from!=="auto"):[];}else {let o=r.findIndex(i=>i.id===Pe),l=r.slice(o+1).filter(i=>i.from!=="auto");l.length&&(ie&&ue.play(),Fe()||(E=[...E,...l],ve=false));}Pe=ft(e),x=e,Fe()&&Oe();},Oe=()=>{E=[];let e=ft(x);e&&Sr(e);},ce=e=>t("span",{class:`ckw-msgr-av${e?" ckw-msgr-av-sm":""}`,"aria-hidden":"true"},H),Me=t("span",{class:"ckw-msgr-logo","aria-hidden":"true"});if(a.logo){let e=t("img",{src:a.logo,alt:""});e.addEventListener("error",()=>Me.replaceChildren(ce("sm"))),Me.append(e);}else Me.append(ce("sm"));let ir=t("div",{class:"ckw-msgr-sky","aria-hidden":"true"}),G=new Map,le=(e,r=I)=>{clearTimeout(G.get(e)),G.delete(e),e.removeAttribute("data-out"),e.isConnected||r.appendChild(e);},Q=(e,r=180)=>{!e.isConnected||G.has(e)||(e.setAttribute("data-out",""),G.set(e,setTimeout(()=>{G.delete(e),e.removeAttribute("data-out"),e.remove();},r)));},qe=(e,r)=>{e.classList.remove(r),e.offsetWidth,e.classList.add(r);},O=t("button",{type:"button",class:`ckw-fab ckw-msgr-fab${d?"":" ckw-msgr-round"}`,"data-pos":n,"aria-haspopup":"dialog"}),sr=t("span",{class:"ckw-msgr-fab-ic","aria-hidden":"true"},t("span",{class:"ckw-msgr-fab-i","data-i":"chat"},rr(tr,ar,d?20:27,2.6)),t("span",{class:"ckw-msgr-fab-i","data-i":"x"},z(u.down,d?18:24))),de=t("span",{class:"ckw-msgr-count","aria-hidden":"true"});O.append(sr),d&&O.append(t("span",{},d));let _e=t("div",{class:"ckw-msgr-preview","data-pos":n,role:"status"}),pe=()=>{if(O.toggleAttribute("data-open",v),E.length&&!v){let e=String(Math.min(E.length,9));de.textContent!==e&&(de.textContent=e),de.isConnected||O.append(de);}else de.remove();O.setAttribute("aria-expanded",String(v)),O.setAttribute("aria-label",v?"Close chat":E.length?`Open chat, ${E.length} new ${E.length===1?"reply":"replies"}`:"Open chat"),ht();},ut=()=>xe&&!v&&!ve&&!!E.length&&$,ht=()=>{let e=E.at(-1);if(!ut()||!e)return Q(_e);Ce(true);let r=t("button",{type:"button",class:"ckw-msgr-preview-x","aria-label":"Dismiss"},z(u.cross,14));r.addEventListener("click",l=>{l.stopPropagation(),ve=true,ht();});let o=t("button",{type:"button",class:"ckw-msgr-preview-card"},t("span",{class:"ckw-msgr-preview-main"},t("span",{class:"ckw-msgr-preview-who"},`${pt[e.from]}${E.length>1?` \xB7 ${E.length} new`:""}`),t("span",{class:"ckw-msgr-preview-text"},wt(e))));o.addEventListener("click",()=>W("messages")),_e.replaceChildren(o,r),le(_e);},ge=t("div",{class:"ckw-msgr-teaser","data-pos":n}),we,cr=()=>{if(clearTimeout(we),v||ut()||!$)return;let e=t("button",{type:"button",class:"ckw-msgr-teaser-b","data-main":""},z(u.chat),t("span",{},"Chat"));e.addEventListener("click",()=>W("messages"));let r=[e];if(f&&ze){let o=t("button",{type:"button",class:"ckw-msgr-teaser-b"},z(u.search),t("span",{},"Search"));o.addEventListener("click",()=>W("help")),r.push(o);}ge.replaceChildren(t("div",{class:"ckw-msgr-teaser-top"},t("span",{class:"ckw-msgr-teaser-t"},t("b",{},g),t("span",{class:"ckw-msgr-online"},b)),ce()),t("div",{class:"ckw-msgr-teaser-row"},...r)),le(ge);};function Ce(e=false){if(clearTimeout(we),e)return Q(ge,140);we=setTimeout(()=>Q(ge,140),260);}let xt=e=>e.pointerType==="mouse";for(let e of [O,ge])e.addEventListener("pointerenter",r=>xt(r)&&(e===O?cr():clearTimeout(we))),e.addEventListener("pointerleave",r=>xt(r)&&Ce());O.addEventListener("click",()=>{ue.unlock(),Ce(true),v?ne():W(E.length?"messages":"home");}),$&&I.appendChild(O);let M=t("div",{class:"ckw-pop ckw-msgr","data-pos":n,role:"dialog","aria-label":c}),Ue=t("div",{class:"ckw-msgr-bar"}),h=t("div",{class:"ckw-pop-body ckw-msgr-body"});M.addEventListener("click",()=>ue.unlock());let X=t("span",{class:"ckw-msgr-lead"}),Ee=t("span",{class:"ckw-msgr-mid"}),Be=t("nav",{class:"ckw-msgr-tabs","aria-label":"Messenger"}),De=(e,r,o,l,i)=>{let w=t("button",{type:"button",class:"ckw-msgr-tab"},t("span",{class:"ckw-msgr-tab-ic"},z(o,22),rr(l,i,22)),t("span",{},r));return w.addEventListener("click",()=>{N=null,A(e);}),w},Ne=De("home","Home",u.home,$r,Ir),Ae=De("messages","Messages",u.chat,tr,ar),vt=De("help","Help",u.help,jr,Hr),Se=t("span",{class:"ckw-msgr-count ckw-msgr-count-tab","aria-hidden":"true"}),ke=t("button",{type:"button",class:"ckw-msgr-ib","aria-label":"More","aria-haspopup":"menu","aria-expanded":"false"},z(u.dots,18)),yt=t("button",{type:"button",class:"ckw-msgr-ib ckw-msgr-x","aria-label":"Close messenger"},z(u.cross));yt.addEventListener("click",()=>ne()),Ue.append(X,Ee,t("span",{class:"ckw-msgr-trail"},ke,yt));let K=t("div",{class:"ckw-msgr-menu",role:"menu"}),Ke=()=>K.isConnected&&!K.hasAttribute("data-out"),me=()=>{ke.setAttribute("aria-expanded","false"),Q(K,120);},zt=(e,r,o)=>{let l=t("button",{type:"button",class:"ckw-msgr-menu-i",role:"menuitem"},z(e,15),t("span",{},r));return l.addEventListener("click",i=>{i.stopPropagation(),me(),o();}),l};ke.addEventListener("click",e=>{var r;if(e.stopPropagation(),Ke())return me();K.replaceChildren(t("span",{class:"ckw-msgr-menu-h"},"Quick actions"),zt(u.minus,"Minimize chat",()=>ne()),zt(se?u.collapse:u.expand,se?"Collapse view":"Expand view",()=>{se=!se,M.toggleAttribute("data-wide",se);})),ke.setAttribute("aria-expanded","true"),le(K,M),(r=K.querySelector("button"))==null||r.focus();}),M.addEventListener("click",()=>Ke()&&me());let lr=()=>{let e=(o,l)=>{let i=t("button",{type:"button",class:"ckw-msgr-ib","aria-label":l},z(u.back,18));return i.addEventListener("click",o),i};typeof m!="string"?X.replaceChildren(e(()=>A("help"),"Back to help")):m==="help"&&N&&!D.trim()?X.replaceChildren(e(()=>{N=null,A("help");},"All collections")):m==="messages"?X.replaceChildren(e(()=>A("home"),"Back to home")):m==="home"?X.replaceChildren(Me):X.replaceChildren(),m==="messages"?Ee.replaceChildren(ce("sm"),t("span",{class:"ckw-msgr-mid-t"},t("b",{},c),t("span",{class:"ckw-msgr-online"},b))):m==="help"?Ee.replaceChildren(t("b",{},"Help")):Ee.replaceChildren();let r=f&&ze!==false?[Ne,Ae,vt]:[Ne,Ae];Be.childNodes.length!==r.length&&Be.replaceChildren(...r),Ne.setAttribute("aria-current",m==="home"?"page":"false"),Ae.setAttribute("aria-current",m==="messages"?"page":"false"),vt.setAttribute("aria-current",m!=="home"&&m!=="messages"?"page":"false"),E.length&&m!=="messages"?(Se.textContent=String(Math.min(E.length,9)),Se.isConnected||Ae.firstChild.appendChild(Se)):Se.remove();},Y=t("form",{class:"ckw-msgr-compose"}),Te=t("p",{class:"ckw-msgr-error",role:"alert"}),U=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"}),J=t("div",{class:"ckw-msgr-box"}),L=t("textarea",{class:"ckw-textarea ckw-msgr-input",rows:"1",placeholder:"Write your message\u2026","aria-label":"Message",maxlength:"4000"}),Ve=t("button",{type:"submit",class:"ckw-msgr-send","aria-label":"Send"},z(u.up)),Ye=Tr(),fe=t("button",{type:"button",class:"ckw-msgr-clip","aria-label":Ye?"Attach a file or a screenshot":"Attach a file",...Ye?{"aria-haspopup":"menu","aria-expanded":"false"}:{}},z(u.clip,18));J.append(L,t("div",{class:"ckw-msgr-tools"},fe,t("span",{class:"ckw-msgr-sp"}),Ve)),J.addEventListener("click",e=>e.target===J&&L.focus()),Y.append(J);let Z=t("input",{type:"file",accept:ct.join(","),multiple:"",hidden:"",tabindex:"-1","aria-hidden":"true"});Y.append(Z);let ee=t("div",{class:"ckw-msgr-files",role:"list","aria-label":"Files to send"}),R=[],be=new Map,We=e=>{var r;return (r=be.get(e))!=null?r:_().attachmentUrl(e)},Mt=e=>{e.ctrl.abort(),[...be.values()].includes(e.local)||URL.revokeObjectURL(e.local);},Ct=e=>{R=R.filter(r=>r!==e),Mt(e);},Le=e=>{T="";for(let r of e){let o=r.name||"screenshot.png";if(R.length>=lt){T=`Up to ${lt} files per message.`;break}if(!ct.includes(r.type)){T="Only pictures (PNG, JPEG, WebP, GIF) and PDFs can be sent.";continue}if(r.size>Gt){T=`${o} is larger than 10 MB.`;continue}let l={key:`local-${Date.now().toString(36)}${Math.random().toString(36).slice(2,7)}`,name:o,type:r.type,size:r.size,local:URL.createObjectURL(r),up:Promise.resolve(),ctrl:new AbortController};l.up=_().uploadChatFile(r,l.ctrl.signal).then(i=>{l.id=i.id,j();},i=>{i.name!=="AbortError"&&(Ct(l),T=`${l.name}: ${i.message}`,j());}),R.push(l);}v&&m!=="messages"?A("messages"):j(),L.focus();},Et="",dr=()=>{let e=R.map(r=>`${r.key}:${r.id?1:0}`).join(",");e!==Et&&(Et=e,ee.replaceChildren(...R.map(r=>{let o=t("button",{type:"button",class:"ckw-msgr-file-x","aria-label":`Remove ${r.name}`},z(u.cross,12));o.addEventListener("click",()=>{Ct(r),j(),L.focus();});let l=r.type.startsWith("image/")?t("img",{src:r.local,alt:""}):t("span",{class:"ckw-msgr-file-doc"},z(u.doc,18),t("span",{},r.name));return t("div",{class:"ckw-msgr-file",role:"listitem",title:r.name,"aria-label":r.id?r.name:`${r.name}, uploading`,...r.id?{}:{"aria-busy":"true"}},l,o)}))),R.length?ee.isConnected||Y.insertBefore(ee,J):ee.remove();},pr=async()=>{var l;let e;try{e=await navigator.mediaDevices.getDisplayMedia({video:{displaySurface:"browser"},audio:!1,preferCurrentTab:!0,selfBrowserSurface:"include"});}catch(i){i.name!=="NotAllowedError"&&i.name!=="AbortError"&&(T="The screenshot did not work here. Attach a picture instead.",j());return}I.style.visibility="hidden";let r=null;try{let i=document.createElement("video");i.muted=!0,i.playsInline=!0,i.srcObject=e,await i.play(),await new Promise(p=>setTimeout(p,300));let w=i;await new Promise(p=>w.requestVideoFrameCallback?w.requestVideoFrameCallback(()=>p()):requestAnimationFrame(()=>p()));let k=document.createElement("canvas");k.width=i.videoWidth,k.height=i.videoHeight,(l=k.getContext("2d"))==null||l.drawImage(i,0,0);let y=(p,C)=>new Promise(B=>k.toBlob(B,p,C));r=await y("image/png"),r&&r.size>4.5*1024*1024&&(r=await y("image/jpeg",.9));}catch(i){r=null;}finally{for(let i of e.getTracks())i.stop();I.style.visibility="";}if(!r||!r.size)return T="The screenshot did not work here. Attach a picture instead.",j();let o=new Date().toISOString().slice(0,16).replace(/[:T]/g,"-");Le([Object.assign(r,{name:`screenshot-${o}.${r.type==="image/png"?"png":"jpg"}`})]);},te=t("div",{class:"ckw-msgr-menu ckw-msgr-amenu",role:"menu"}),Ge=()=>te.isConnected&&!te.hasAttribute("data-out"),$e=()=>{fe.setAttribute("aria-expanded","false"),Q(te,120);},At=(e,r,o)=>{let l=t("button",{type:"button",class:"ckw-msgr-menu-i",role:"menuitem"},z(e,15),t("span",{},r));return l.addEventListener("click",i=>{i.stopPropagation(),$e(),o();}),l};fe.addEventListener("click",e=>{var r;if(e.stopPropagation(),ue.unlock(),!Ye)return Z.click();if(Ge())return $e();te.replaceChildren(At(u.image,"Photo or file",()=>Z.click()),At(u.screen,"Screenshot of this page",()=>{pr();})),fe.setAttribute("aria-expanded","true"),le(te,Y),(r=te.querySelector("button"))==null||r.focus();}),Z.addEventListener("change",()=>{var e;Le([...(e=Z.files)!=null?e:[]]),Z.value="";});let gr=t("a",{class:"ckw-msgr-powered",href:Qt,target:"_blank",rel:"noopener"},"Powered by ",t("b",{},"MRRocket")),St=t("ol",{class:"ckw-msgs","aria-live":"polite","aria-label":"Messages"}),Tt=()=>{var e;return s&&!((e=a.user())!=null&&e.email)&&!(x!=null&&x.hasEmail)},Qe=()=>!U.value.trim()||Er.test(U.value.trim()),Xe=()=>(!!L.value.trim()||R.length>0)&&!P&&Qe(),A=e=>{let r=JSON.stringify(e)!==JSON.stringify(m);m=e,Ie=-1,j(),r&&qe(h,"ckw-msgr-enter"),e==="messages"?(Oe(),pe(),L.focus()):e==="help"&&Ze.focus(),oe(0);},wr=(e,r)=>{let o=t("img",{src:e,alt:r,loading:"lazy"});return o.addEventListener("load",()=>{h.scrollHeight-h.scrollTop-h.clientHeight<o.clientHeight+120&&(h.scrollTop=h.scrollHeight);}),o},Lt=(e,r=false)=>{var l,i,w;let o=t("li",{class:"ckw-msg","data-from":e.from==="visitor"?"me":"them"},e.body||!((l=e.attachments)!=null&&l.length)?t("div",{class:"ckw-bubble"},e.body):null);r&&o.setAttribute("aria-busy","true"),(i=e.attachments)!=null&&i.length&&o.append(t("div",{class:"ckw-msg-files"},...e.attachments.map(k=>k.type.startsWith("image/")?t("a",{class:"ckw-msg-img",href:We(k.id),target:"_blank",rel:"noopener",title:k.name},wr(We(k.id),k.name)):t("a",{class:"ckw-msgr-cite",href:We(k.id),target:"_blank",rel:"noopener"},z(u.doc,14),t("span",{},k.name)))));for(let k of (w=e.articles)!=null?w:[]){let y=t("button",{type:"button",class:"ckw-msgr-cite"},z(u.doc,14),t("span",{},k.title));y.addEventListener("click",()=>A({article:k.id})),o.append(y);}return o.append(t("span",{class:"ckw-msg-meta"},`${e.from!=="visitor"?`${pt[e.from]} \xB7 `:""}${r?"Sending\u2026":gt(e.at)}`)),o},kr=e=>{let r=t("button",{type:"button",class:"ckw-msgr-art"},t("span",{class:"ckw-msgr-art-t"},e.title),z(u.next,14));return r.addEventListener("click",()=>A({article:e.id})),r},$t=(e,r,o,l)=>{let i=t("button",{type:"button",class:"ckw-msgr-hrow"},t("span",{class:"ckw-msgr-hrow-main"},t("b",{},e),r?t("span",{class:"ckw-msgr-hrow-sub"},r):null,o?t("span",{class:"ckw-msgr-hrow-meta"},o):null),z(u.next,16));return i.addEventListener("click",l),i},Je=((e="Search for help")=>{let r=t("label",{class:"ckw-msgr-search"}),o=t("input",{class:"ckw-msgr-search-in",type:"search",placeholder:e,"aria-label":"Search for help",maxlength:"200"});o.value=D;let l;return o.addEventListener("input",()=>{D=o.value,clearTimeout(l),l=setTimeout(()=>{if(m!=="help")return A("help");tt(true);},250);}),o.addEventListener("keydown",i=>{i.key==="Enter"&&(i.preventDefault(),m!=="help"&&A("help"));}),r.append(z(u.search,16),o),r})("Search our help center\u2026"),Ze=Je.querySelector("input"),et=false,tt=async(e=false)=>{if(!f||et&&!e)return;et=true;let r=D.trim();try{let o=await _().articles(r||void 0);if(r!==D.trim())return;S=o.articles,r||(ze=o.articles.length>0);}catch(o){S=S!=null?S:[];}finally{et=false;}j();},rt=t("form",{class:"ckw-msgr-askq"}),re=t("input",{class:"ckw-msgr-askq-in",placeholder:"Ask a question","aria-label":"Ask a question",maxlength:"4000",autocomplete:"off"}),at=t("button",{type:"submit",class:"ckw-msgr-send","aria-label":"Send",disabled:""},z(u.up));rt.append(re,at),re.addEventListener("input",()=>at.disabled=!re.value.trim()),rt.addEventListener("submit",e=>{if(e.preventDefault(),!re.value.trim())return A("messages");L.value=re.value,re.value="",at.disabled=true,A("messages"),Xe()&&it();});let mr=()=>{var w,k,y;let e=(k=(w=a.user())==null?void 0:w.name)==null?void 0:k.trim().split(/\s+/)[0],r=g.replace(/^(hi|hello|hey|hallo)( there)?\s*[!,.]*\s*/i,"").trim()||"How can we help you today?",o=t("h2",{class:"ckw-msgr-hero ckw-msgr-hello"},t("span",{},e?`Hi, ${e} `:"Hi there ",t("span",{class:"ckw-msgr-wave","aria-hidden":"true"},"\u{1F44B}")),t("span",{class:"ckw-msgr-hello-sub"},r)),l=((y=x==null?void 0:x.messages)!=null?y:[]).at(-1),i=[o,rt];if(l){let p=t("button",{type:"button",class:"ckw-msgr-card ckw-msgr-recent","aria-label":`Recent message: ${wt(l)}`},t("span",{class:"ckw-msgr-recent-row"},ce("sm"),t("span",{class:"ckw-msgr-card-main"},t("span",{class:"ckw-msgr-card-sub ckw-msgr-recent-text"},wt(l)),t("span",{class:"ckw-msgr-card-meta"},`${l.from==="visitor"?"You":pt[l.from]} \xB7 ${gt(l.at)}`)),E.length?t("span",{class:"ckw-msgr-badge"},String(E.length)):z(u.next,14)));p.addEventListener("click",()=>A("messages")),i.push(p);}if(f&&ze!==false){let p=t("div",{class:"ckw-msgr-card ckw-msgr-card-col"}),C=(S!=null?S:[]).slice(0,3);C.length?p.append(...C.map(kr)):S===null&&p.append(t("div",{class:"ckw-skel ckw-msgr-skel"})),i.push(p);}h.replaceChildren(...i);},fr=()=>{var k,y;Ze.value!==D&&(Ze.value=D);let e=D.trim(),r=S!=null?S:[],o=new Map;for(let p of r)o.set(p.collection,[...(k=o.get(p.collection))!=null?k:[],p]);let l=!e&&N!==null?(y=o.get(N))!=null?y:[]:null,i=e?"Search results":l?N!=null?N:"":"Most read articles",w=[t("h2",{class:"ckw-msgr-help-h"},i),Je];if(S===null)w.push(t("div",{class:"ckw-skel"}));else if(r.length)e||l?w.push(t("div",{class:"ckw-msgr-hlist"},...(l!=null?l:r).map(p=>$t(p.title,p.excerpt.startsWith(p.title)?p.excerpt.slice(p.title.length).trim():p.excerpt,e?p.collection:"",()=>A({article:p.id}))))):w.push(t("div",{class:"ckw-msgr-hlist"},...[...o].map(([p,C])=>$t(p,C.map(B=>B.title).join(", "),`${C.length} ${C.length===1?"article":"articles"}`,()=>{N=p,A("help"),qe(h,"ckw-msgr-enter");}))));else {let p=t("button",{type:"button",class:"ckw-btn ckw-btn-primary"},"Send us a message");p.addEventListener("click",()=>A("messages")),w.push(t("div",{class:"ckw-msgr-empty"},t("p",{},e?`Nothing found for \u201C${e}\u201D.`:"No help articles yet."),p));}if(h.childNodes[1]!==Je)h.replaceChildren(...w);else {for(h.firstChild.replaceWith(w[0]);h.childNodes.length>2;)h.lastChild.remove();h.append(...w.slice(2));}},ae=null,br=e=>{if((ae==null?void 0:ae.id)===e)return h.replaceChildren(ae.node);let r=t("article",{class:"ckw-msgr-doc"},t("div",{class:"ckw-skel"}));ae={id:e,node:r},h.replaceChildren(r),_().article(e).then(o=>{let l=t("div",{class:"ckw-msgr-rate"}),i=()=>{if(Re.has(e))return l.replaceChildren(t("span",{},"Thanks for letting us know."));let k=t("button",{type:"button",class:"ckw-btn"},"Yes"),y=t("button",{type:"button",class:"ckw-btn"},"No"),p=C=>{Re=new Set(Re).add(e),i(),_().rateArticle(e,C).catch(()=>{}),C||A("messages");};k.addEventListener("click",()=>p(true)),y.addEventListener("click",()=>p(false)),l.replaceChildren(t("span",{},"Did this answer your question?"),t("span",{class:"ckw-msgr-rate-b"},k,y));};i();let w=t("button",{type:"button",class:"ckw-btn ckw-msgr-ask"},z(u.chat),"Still need help? Send us a message");w.addEventListener("click",()=>A("messages")),r.replaceChildren(t("p",{class:"ckw-msgr-doc-c"},o.collection),t("h2",{class:"ckw-msgr-doc-t"},o.title),t("p",{class:"ckw-msgr-doc-c"},`Updated ${gt(o.updatedAt)}`),t("div",{class:"ckw-msgr-doc-b"},...o.blocks.map(Pr)),l,w);}).catch(o=>{ae=null,r.replaceChildren(t("p",{class:"ckw-msgr-error"},o.message));});},Ie=-1,It="",ot=-1,nt=t("div",{class:"ckw-msgr-sugg"}),ur=()=>{var l,i,w,k;let e=(l=x==null?void 0:x.messages)!=null?l:[],r=[];if(!kt)r.push(t("div",{class:"ckw-skel"}));else {let y=`${e.map(C=>C.id).join(",")}|${P?`${P.body}+${(w=(i=P.attachments)==null?void 0:i.length)!=null?w:0}`:""}|${Math.floor(Date.now()/6e4)}`;if(y!==It){It=y;let B=[t("li",{class:"ckw-msg","data-from":"them"},t("div",{class:"ckw-bubble"},g)),...e.map(st=>Lt(st)),...P?[Lt(P,true)]:[]];ot>=0&&B.slice(ot).forEach(st=>st.setAttribute("data-new","")),ot=B.length,St.replaceChildren(...B);}r.push(St);let p=!e.some(C=>C.from==="visitor")&&!P?(S!=null?S:[]).slice(0,3):[];p.length&&(nt.childNodes.length!==p.length&&nt.replaceChildren(...p.map(C=>{let B=t("button",{type:"button",class:"ckw-msgr-sugg-b"},C.title);return B.addEventListener("click",()=>A({article:C.id})),B})),r.push(nt));}((k=x==null?void 0:x.conversation)==null?void 0:k.status)==="solved"&&!P&&r.push(t("p",{class:"ckw-fine ckw-msgr-note"},"This conversation is closed. Write to start a new one.")),(h.childNodes.length!==r.length||r.some((y,p)=>h.childNodes[p]!==y))&&h.replaceChildren(...r);let o=e.length+(P?1:0);o!==Ie&&(Ie=o,h.scrollTop=h.scrollHeight),Te.textContent=T,T&&!Te.isConnected?Y.prepend(Te):T||Te.remove(),Tt()?(Qe()?U.removeAttribute("aria-invalid"):U.setAttribute("aria-invalid","true"),U.isConnected||Y.insertBefore(U,ee.isConnected?ee:J)):U.remove(),dr(),Ve.disabled=!Xe();},j=()=>{if(!v)return;M.dataset.view=typeof m=="string"?m:"article",lr(),m==="home"?mr():m==="messages"?ur():m==="help"?fr():br(m.article);let e=m==="home"?[ir,Ue,h]:[Ue,h];e.push(m==="messages"?Y:Be),a.branding!==false&&e.push(gr),K.isConnected&&e.push(K),(M.childNodes.length!==e.length||e.some((r,o)=>M.childNodes[o]!==r))&&M.replaceChildren(...e);},jt=async()=>{V==null||V.abort(),V=new AbortController;try{bt(await _().chat(V.signal)),T="";}catch(e){if(e.name==="AbortError")return;v&&m==="messages"&&(T=e.message);}kt=true,j(),pe(),oe();};function oe(e){var w,k,y;clearTimeout(ye);let r=!!(x!=null&&x.messages.some(p=>p.from==="visitor"))&&((w=x==null?void 0:x.conversation)==null?void 0:w.status)!=="solved",o=(y=((k=x==null?void 0:x.messages)!=null?k:[]).filter(p=>p.from==="visitor").at(-1))==null?void 0:y.at,l=!!o&&Date.now()-new Date(o).getTime()<Cr,i=e!=null?e:Fe()?yr:r&&l?zr:v||r?Mr:0;(i||e===0)&&(ye=setTimeout(()=>{jt();},i));}let Ht=()=>{document.visibilityState==="visible"?oe(0):clearTimeout(ye);};document.addEventListener("visibilitychange",Ht);let it=async()=>{let e=L.value.trim(),r=R;if(!e&&!r.length||P||!Qe())return;ue.unlock();for(let i of r)be.set(i.key,i.local);P={id:"pending",from:"visitor",body:e,at:new Date().toISOString(),...r.length?{attachments:r.map(i=>({id:i.key,name:i.name,type:i.type,size:i.size}))}:{}},L.value="",R=[],T="",j(),await Promise.all(r.map(i=>i.up));let o=r.filter(i=>i.id).map(i=>i.id),l=false;try{if(!e&&!o.length)throw new Error(T||"The file could not be sent.");bt(await _().sendChat({body:e,email:Tt()&&U.value.trim()?U.value.trim():void 0,url:window.location.href.slice(0,500),...o.length?{attachments:o}:{},context:{viewport:`${window.innerWidth}\xD7${window.innerHeight}`}})),l=!0;}catch(i){L.value=e,R=r.filter(w=>w.id),T=i.message;}P=null;for(let i of r)be.delete(i.key);if(j(),l)for(let i of r)URL.revokeObjectURL(i.local);oe();};Y.addEventListener("submit",e=>{e.preventDefault(),it();}),L.addEventListener("keydown",e=>{e.key==="Enter"&&!e.shiftKey&&!e.isComposing&&(e.preventDefault(),it());}),L.addEventListener("input",()=>Ve.disabled=!Xe()),L.addEventListener("paste",e=>{var o,l;let r=[...(l=(o=e.clipboardData)==null?void 0:o.files)!=null?l:[]];r.length&&(e.preventDefault(),Le(r));});let Pt=e=>!!e.dataTransfer&&[...e.dataTransfer.types].includes("Files");M.addEventListener("dragover",e=>{Pt(e)&&(e.preventDefault(),M.setAttribute("data-drop",""));}),M.addEventListener("dragleave",e=>{(!e.relatedTarget||!M.contains(e.relatedTarget))&&M.removeAttribute("data-drop");}),M.addEventListener("drop",e=>{var r,o;Pt(e)&&(e.preventDefault(),M.removeAttribute("data-drop"),Le([...(o=(r=e.dataTransfer)==null?void 0:r.files)!=null?o:[]]));}),U.addEventListener("input",()=>j());function W(e="home",r=false){let o=v;v=true,m=e==="help"&&!f?"home":e,Ie=-1,ve=true,Ce(true),M.toggleAttribute("data-still",r),le(M),o&&qe(h,"ckw-msgr-enter"),(S===null||m==="help"&&D)&&tt(),j(),pe(),m==="messages"&&(Oe(),L.focus()),oe(0);}function ne(){v&&(v=false,K.isConnected&&me(),Q(M,200),pe(),oe(),$&&O.focus());}M.addEventListener("click",()=>Ge()&&$e());let Rt=e=>{e.key!=="Escape"||!v||(Ge()?($e(),fe.focus()):Ke()?(me(),ke.focus()):ne());};return document.addEventListener("keydown",Rt),jt(),f&&tt(),pe(),a.opened&&W(a.opened,true),{open:e=>W(e!=null?e:"home"),close:ne,toggle:()=>v?ne():W(),destroy:()=>{clearTimeout(ye),clearTimeout(we);for(let e of G.values())clearTimeout(e);V==null||V.abort();for(let e of R)Mt(e);for(let e of be.values())URL.revokeObjectURL(e);document.removeEventListener("keydown",Rt),document.removeEventListener("visibilitychange",Ht),I.remove();}}};window.__mrrocketMessenger={mountMessenger:nr};
|
|
426
582
|
})();
|