@journeeze/sdk 0.1.0 → 0.2.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.
Files changed (53) hide show
  1. package/AGENTS.md +2 -2
  2. package/CHANGELOG.md +13 -1
  3. package/LICENSE +202 -0
  4. package/NOTICE +7 -0
  5. package/README.md +22 -20
  6. package/dist/anchor-BhsfeHwL.js +1 -0
  7. package/dist/attach-D451Wj4h.js +21 -0
  8. package/dist/chat-ByOXN5k1.js +64 -0
  9. package/dist/claims-BfpRuIu-.js +1 -0
  10. package/dist/consent-BupCs23W.js +1 -0
  11. package/dist/contract.js +1 -1
  12. package/dist/feedback-DtMDnAam.js +1 -0
  13. package/dist/help-D_T0HiNa.js +106 -0
  14. package/dist/{hook-DGWypoEO.js → hook-BRnJ-lTk.js} +1 -1
  15. package/dist/index.js +6 -8
  16. package/dist/loader-k4pePzAw.js +127 -0
  17. package/dist/mask-audit-DtKNgOlT.js +5 -0
  18. package/dist/react.js +1 -1
  19. package/dist/resolve-7jVqhJhi.js +1 -0
  20. package/dist/script.js +1 -1
  21. package/dist/{signals-amjMQyOy.js → signals-eaZX2lNd.js} +1 -1
  22. package/dist/telemetry-DMGFJcw3.js +1 -0
  23. package/dist/{transport-B64CfIcF.js → transport-DokImbgl.js} +1 -1
  24. package/dist/types/chat/capture/attach.d.ts +2 -0
  25. package/dist/types/chat/shell/converse.d.ts +2 -0
  26. package/dist/types/chat/transport.d.ts +1 -1
  27. package/dist/types/claims.d.ts +37 -0
  28. package/dist/types/help/core/client.d.ts +3 -0
  29. package/dist/types/help/core/events.d.ts +1 -1
  30. package/dist/types/help/core/routing.d.ts +2 -0
  31. package/dist/types/loader.d.ts +3 -0
  32. package/dist/types/preview/mask-audit.d.ts +3 -1
  33. package/dist/types/telemetry/telemetry.d.ts +4 -0
  34. package/dist/types/types.d.ts +34 -0
  35. package/dist/types/widget/feedback.d.ts +7 -1
  36. package/dist/types/widget/upload.d.ts +3 -2
  37. package/dist/{upload-Fu2qvSJV.js → upload-DkAWrJhn.js} +6 -6
  38. package/dist/widget-CcAalO4B.js +118 -0
  39. package/package.json +4 -3
  40. package/LICENSE.md +0 -27
  41. package/dist/anchor-cPvFFTOS.js +0 -1
  42. package/dist/attach-DpioALxW.js +0 -21
  43. package/dist/chat-BgmB0rnW.js +0 -64
  44. package/dist/consent-DckCUvYR.js +0 -1
  45. package/dist/context-UnG6_X61.js +0 -17
  46. package/dist/feedback-CtH1a_kQ.js +0 -1
  47. package/dist/help-w0O5Qu-4.js +0 -105
  48. package/dist/index-CwG2LrhO.js +0 -20
  49. package/dist/loader-BZiIDD1D.js +0 -96
  50. package/dist/mask-audit-Du3NPoG_.js +0 -5
  51. package/dist/resolve-BfWByuTp.js +0 -1
  52. package/dist/telemetry-CyRJDaVs.js +0 -1
  53. package/dist/widget-B6mR1J3P.js +0 -118
@@ -1,64 +0,0 @@
1
- var X=Object.defineProperty;var Y=(i,e,t)=>e in i?X(i,e,{enumerable:true,configurable:true,writable:true,value:t}):i[e]=t;var c=(i,e,t)=>Y(i,typeof e!="symbol"?e+"":e,t);import{c as P,C as Q,j as Z,d as ee,i as te,f as U,h as ne,s as ie,e as re}from"./consent-DckCUvYR.js";const ae="journeeze.turn/v1";class se extends Error{constructor(t,n){super(t);c(this,"kind");c(this,"status");this.kind=t,this.status=n}}function M(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();const i=crypto.getRandomValues(new Uint8Array(16));i[6]=i[6]&15|64,i[8]=i[8]&63|128;const e=[...i].map(t=>t.toString(16).padStart(2,"0")).join("");return`${e.slice(0,8)}-${e.slice(8,12)}-${e.slice(12,16)}-${e.slice(16,20)}-${e.slice(20)}`}function oe(i){const e=i instanceof Q?i.status:0,t=e===429?"busy":e===400?"invalid":"unavailable";return new se(t,e)}function de(i,e=(...t)=>fetch(...t)){return{turn:t=>P(i,"Converse",t,e).then(n=>({...n,messages:n.messages??[],actions:n.actions??[],requiresConsent:!!n.requiresConsent}),n=>{throw oe(n)})}}function le(i,e,t){const n=de(i,t);return{turn:r=>n.turn({...r,...e.reviewerToken&&{reviewerToken:e.reviewerToken},...r.consentGiven&&e.userId&&{userId:e.userId,...Z(e)}})}}const ce="Help";function pe(i){return(e,t)=>(i?.["widget.ui."+e]??"").replace(/\{(\w+)\}/g,(n,r)=>String(t?.[r]??""))}function he(i,e){const t=e.toLowerCase().split(/\s+/).filter(Boolean);return i.filter(n=>t.every(r=>n.title.toLowerCase().includes(r)))}function ue(i){return typeof i.steps=="number"&&i.steps>0?i.steps:void 0}function fe(i){return/Edg\//.test(i)?"Edge":/Firefox\//.test(i)?"Firefox":/Chrome\/|CriOS\//.test(i)?"Chrome":/Safari\//.test(i)?"Safari":"Other"}function be(i,e,t){const n=[],r=(l,b,o=true)=>{b&&!e.has(l)&&n.push({key:l,label:b,removable:o})};return r("page",i.pagePath&&t("context.page",{value:i.pagePath})),r("job",i.job,false),r("step",i.step!==void 0&&t("context.step",{step:i.step}),false),r("persona",i.persona&&t("context.persona",{value:i.persona})),r("browser",i.browser),r("device",i.device&&(i.viewport?`${i.device} · ${i.viewport.w}×${i.viewport.h}`:i.device)),r("build",i.build&&t("context.build",{value:i.build})),n}const me=["page","persona","browser","device","viewport","build"];function ve(i,e){const t=new Set(e);t.has("device")&&t.add("viewport");const n={pagePath:t.has("page")?"":i.pagePath};i.persona&&!t.has("persona")&&(n.persona=i.persona),i.browser&&!t.has("browser")&&(n.browser=i.browser),i.device&&!t.has("device")&&(n.device=i.device),i.viewport&&!t.has("viewport")&&(n.viewport=i.viewport),i.build&&!t.has("build")&&(n.build=i.build);const r=me.filter(l=>t.has(l));return r.length>0&&(n.removed=r),n}const ge=5,xe="clarify_tap_only";class L{constructor(e){c(this,"deps");c(this,"conversationId",M());c(this,"entries",[]);c(this,"state","choose_job");c(this,"actions",[]);c(this,"requiresConsent",false);c(this,"pending",false);c(this,"error");c(this,"tapOnly",false);c(this,"consentAsked",false);c(this,"filed");c(this,"attachments",[]);c(this,"anchor");c(this,"removed",new Set);c(this,"team",{});c(this,"job");c(this,"step",0);c(this,"last");c(this,"ended",false);c(this,"opening",{chips:[]});c(this,"overMask",new Map);c(this,"listeners",new Set);c(this,"consent");c(this,"t");this.deps=e,this.consent=e.hasConsent(),this.t=e.t}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}emit(){for(const e of this.listeners)e()}start(e){this.opening={chips:e},this.entries=[{kind:"assistant",copyId:"ask_job",text:this.t("greeting")}],this.actions=[...e,{type:"other_need",label:this.t("other_need")}],this.emit()}close(){if(this.ended||(this.ended=true,!this.last))return;const e=this.conversationId,t={kind:"action",action:"cancel"};this.send({turnId:M(),input:t}).then(n=>{e===this.conversationId&&(this.apply(t,n),this.emit())},()=>{})}reopen(){if(!this.ended)return;for(const t of this.attachments)t.release?.();const{chips:e}=this.opening;Object.assign(this,new L(this.deps),{listeners:this.listeners,overMask:this.overMask}),this.start(e)}offers(e){return this.actions.some(t=>t.type===e)}label(e){return this.actions.find(t=>t.type===e)?.label??""}chips(){return this.actions.filter(e=>e.type==="chip")}plusItems(){for(const e of this.actions)if(e.type==="plus_menu")return e.menu??e.items.map(t=>({id:t,label:""}));return[]}needsConsent(){return!this.consent&&(this.requiresConsent||this.offers("consent"))}allow(){this.deps.giveConsent(),this.consent=true,this.consentAsked=false,this.emit()}contextChips(){return be(this.facts(),this.removed,this.t)}removeContext(e){this.removed.add(e),this.emit()}setTeam(e){this.team={...this.team,...e}}teamOnWire(){const e={};return this.team.verdict&&(e.verdict=this.team.verdict),this.team.severity&&(e.severity=this.team.severity),e}addAttachment(e){const t=this.attachments.filter(n=>n.id!==e.id);return t.length>=ge?false:(this.attachments=[...t,e],this.emit(),true)}removeAttachment(e){this.attachments.find(t=>t.id===e)?.release?.(),this.attachments=this.attachments.filter(t=>t.id!==e),this.emit()}setAnchor(e){this.anchor=e,this.emit()}note(e){this.entries=[...this.entries,{kind:"note",text:e}],this.emit()}async uploadPending(){if(!this.consent)return;const e=this.attachments.filter(r=>!r.screenshotId&&r.upload),t=await Promise.all(e.map(r=>r.upload().catch(()=>{})));let n=false;e.forEach((r,l)=>{const b=t[l];b?this.attachments=this.attachments.map(o=>o===r?{...r,screenshotId:b}:o):(n=true,r.release?.(),this.attachments=this.attachments.filter(o=>o!==r))}),n&&(this.entries=[...this.entries,{kind:"note",text:this.t("note.upload_failed")}])}draft(){if(!this.consent)return;const e=this.attachments.flatMap(n=>n.screenshotId?[{screenshotId:n.screenshotId,...n.shapes?.length?{shapes:n.shapes}:{}}]:[]),t={};return e.length>0&&(t.attachments=e),this.anchor&&(t.anchor=this.anchor.tflowId),t.attachments||t.anchor?t:void 0}pickJob(e){this.job={id:e.jobId,title:e.title,of:ue(e)},this.run({kind:"action",action:"pick_job",jobId:e.jobId},e.title)}other(){this.run({kind:"action",action:"other_need"},this.label("other_need"))}next(){this.job&&this.run({kind:"action",action:"guide_next",jobId:this.job.id,step:this.step})}back(){this.state==="guide_step"&&this.job?this.run({kind:"action",action:"guide_back",jobId:this.job.id,step:this.step}):this.run({kind:"action",action:"guide_back"})}didntWork(){this.run({kind:"action",action:"didnt_work"},this.label("didnt_work"))}talk(){this.run({kind:"action",action:"talk_to_assistant"},this.label("talk_to_assistant"))}reportProblem(){this.run({kind:"action",action:"report_problem"},this.t("report_problem"))}sendText(e){const t=e.trim().slice(0,2e3);return!t||this.tapOnly||this.pending?false:this.needsConsent()?this.askConsent():(this.run({kind:"text",text:t},t),true)}sendReport(){return this.needsConsent()?this.askConsent():(this.run({kind:"action",action:"send"},this.label("send")),true)}retry(){this.last&&!this.pending&&this.exec(this.last)}askConsent(){return this.consentAsked=true,this.emit(),false}facts(){const e=this.deps.facts();return this.job?{...e,job:this.job.title,...this.step>0?{step:this.step}:{}}:e}run(e,t){this.pending||(t&&(this.entries=[...this.entries,{kind:"user",text:t}]),this.exec(this.last={turnId:M(),input:e}))}exec(e){this.pending=true,this.error=void 0,this.emit();const t=this.conversationId;this.uploadPending().then(()=>this.send(e)).then(n=>{t===this.conversationId&&this.apply(e.input,n)},n=>{t===this.conversationId&&(this.error=n.kind??"unavailable",this.error==="unavailable"&&(this.tapOnly=true))}).finally(()=>{this.pending=false,this.emit()})}send(e){const t=this.draft(),n=this.consent?[...this.overMask].map(([r,l])=>({rule:r,count:l})):[];return this.deps.transport.turn({siteKey:this.deps.siteKey,conversationId:this.conversationId,turnId:e.turnId,consentGiven:this.consent,context:ve(this.facts(),this.removed),schema:ae,payload:{input:e.input,...t?{draft:t}:{},...this.deps.reviewer&&(this.team.verdict||this.team.severity)?{team:this.teamOnWire()}:{}},...n.length?{overMasked:n}:{}}).then(r=>(n.length&&this.overMask.clear(),r))}apply(e,t){const n=this.state,r=e.kind==="action"?e.action:void 0;t.state==="guide_step"&&(r==="pick_job"?this.step=1:r==="guide_next"?this.step+=1:r==="guide_back"&&(this.step=Math.max(1,this.step-1)));const l=this.entries.map(o=>o.kind==="card"&&o.live?{...o,live:false}:o);let b;for(const o of t.messages)l.push({kind:"assistant",copyId:o.copyId,text:o.text}),o.card&&(o.card.step&&(this.step=o.card.step),this.job&&o.card.of&&(this.job.of=o.card.of),b={kind:"card",job:this.job?.title??"",step:this.step,of:o.card.of??this.job?.of,title:o.card.title,instruction:o.card.instruction,live:true});if(t.state==="guide_step"&&this.job&&l.push(b??{kind:"card",job:this.job.title,step:this.step,of:this.job.of,live:true}),t.state==="unmet_need"&&n!=="unmet_need"&&l.push({kind:"note",text:this.t("note.unmet")}),this.entries=l,this.tapOnly=t.messages.some(o=>o.copyId===xe),this.actions=t.actions,this.requiresConsent=t.requiresConsent,this.state=t.state,this.filed=t.filed?t.filed.kind??"problem":void 0,t.filed){for(const o of this.attachments)o.release?.();this.attachments=[],this.anchor=void 0,this.removed.clear(),this.team={}}["guide_step","didnt_work","gather","confirm_send"].includes(t.state)||(this.job=void 0,this.step=0)}}const ke=`
2
- :host{all:initial;--c:#F7F7F5;--s:#FFF;--r:#F0F0EC;--i:#1D2024;--m:#5D636B;--f:#6C727B;--l:rgb(29 32 36/12%);--a:#3D63C9;--ai:#FFF;--as:rgb(61 99 201/10%);--sh:0 1px 3px rgb(0 0 0/12%),0 4px 12px rgb(0 0 0/8%);
3
- font:400 13px/1.45 Inter,system-ui,-apple-system,"Segoe UI",sans-serif;color:var(--i);-webkit-font-smoothing:antialiased}
4
- @media (prefers-color-scheme:dark){:host{--c:#111316;--s:#181B1F;--r:#20242A;--i:#E8EAED;--m:#A3A9B2;--f:#8A919B;--l:rgb(232 234 237/12%);--a:#7F9CF0;--ai:#111316;--as:rgb(127 156 240/14%)}}
5
- *,*::before,*::after{box-sizing:border-box}
6
- button,input,select{font:inherit;color:inherit}
7
- button{cursor:pointer}
8
- button:disabled,input:disabled{cursor:not-allowed;opacity:.55}
9
- :focus-visible{outline:2px solid var(--a);outline-offset:2px}
10
- [hidden]{display:none!important}
11
- .sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
12
- .launcher{position:fixed;right:24px;bottom:24px;z-index:2147483646;width:56px;height:56px;border-radius:999px;border:0;background:var(--a);color:var(--ai);font-size:24px;font-weight:600;box-shadow:var(--sh)}
13
- .panel{position:fixed;right:24px;bottom:92px;z-index:2147483646;width:min(360px,calc(100vw - 48px));height:min(600px,calc(100vh - 116px));display:flex;flex-direction:column;background:var(--s);border:1px solid var(--l);border-radius:10px;box-shadow:var(--sh);overflow:hidden}
14
- .head{display:flex;justify-content:space-between;align-items:center;gap:8px;padding:8px 8px 8px 16px;border-bottom:1px solid var(--l);background:var(--c)}
15
- .head h2{margin:0;font-size:13px;font-weight:600}
16
- .head p{margin:0;font-size:12px;color:var(--f)}
17
- .x{width:44px;height:44px;border:0;border-radius:6px;background:transparent;color:var(--m);font-size:20px}
18
- .log{flex:1;overflow-y:auto;padding:16px;display:flex;flex-direction:column;gap:12px}
19
- .msg{max-width:85%;padding:8px 12px;border:1px solid var(--l);border-radius:12px;white-space:pre-wrap;overflow-wrap:anywhere}
20
- .as{align-self:flex-start;background:var(--s);border-bottom-left-radius:2px}
21
- .us{align-self:flex-end;background:var(--as);border-bottom-right-radius:2px}
22
- .note{align-self:flex-start;margin:0;font-size:12px;color:var(--m)}
23
- .card{align-self:flex-start;width:90%;padding:12px;border:1px solid var(--l);border-radius:10px;background:var(--c)}
24
- .card h3{margin:0 0 4px;font-size:12px;font-weight:600;color:var(--a)}
25
- .card p{margin:0 0 8px;color:var(--m)}
26
- .row{display:flex;gap:8px;flex-wrap:wrap}
27
- .btn{min-height:44px;padding:0 16px;border:1px solid var(--l);border-radius:6px;background:var(--s)}
28
- .pri{background:var(--a);border-color:var(--a);color:var(--ai);font-weight:600}
29
- .link{min-height:44px;padding:0 4px;border:0;background:none;color:var(--a);text-decoration:underline}
30
- .foot{border-top:1px solid var(--l);padding:12px;display:flex;flex-direction:column;gap:8px;background:var(--s)}
31
- .dyn{display:flex;flex-direction:column;gap:8px}.dyn:empty{display:none}
32
- .chips{display:flex;flex-wrap:wrap;gap:6px}
33
- .chip{min-height:44px;padding:0 12px;border:1px solid var(--l);border-radius:999px;background:var(--s);color:var(--m)}
34
- .chip.job{border-color:var(--a);color:var(--a)}
35
- .err{margin:0;padding:8px;border-radius:6px;background:var(--r);color:var(--i)}
36
- .consent{margin:0;font-size:12px;color:var(--m)}
37
- .consent.ask{color:var(--i);font-weight:600}
38
- details{font-size:12px;color:var(--m)}
39
- summary{cursor:pointer;min-height:24px}
40
- .ctx{display:flex;flex-wrap:wrap;gap:6px;margin-top:6px;padding:0;list-style:none}
41
- .ctx li{display:flex;align-items:center;gap:2px;padding-left:8px;border:1px solid var(--l);border-radius:6px;background:var(--r);color:var(--i)}
42
- .ctx li.fixed{padding-right:8px;min-height:32px}
43
- .ctx button,.att button{width:32px;height:32px;border:0;background:none;color:var(--m)}
44
- .team{display:flex;gap:8px;margin-top:6px}
45
- .team label{display:flex;flex-direction:column;gap:2px;color:var(--i)}
46
- .team select{min-height:32px;border:1px solid var(--l);border-radius:6px;background:var(--s)}
47
- .atts{display:flex;flex-wrap:wrap;gap:8px;margin:0;padding:0;list-style:none}
48
- .att{position:relative;width:64px;height:48px;border:1px solid var(--l);border-radius:6px;overflow:hidden;background:var(--r)}
49
- .att img{width:100%;height:100%;object-fit:cover}
50
- .pt{display:flex;align-items:center;gap:2px;padding-left:8px;border:1px solid var(--l);border-radius:6px;background:var(--r);font-size:12px;max-width:100%;overflow-wrap:anywhere}
51
- .pt button{width:32px;height:32px;border:0;background:none;color:var(--m)}
52
- .att button{position:absolute;top:0;right:0;background:var(--i);color:var(--s);border-radius:0 0 0 6px}
53
- .comp{position:relative;display:flex;gap:6px;align-items:center}
54
- .comp input{flex:1;min-width:0;min-height:44px;padding:0 12px;border:1px solid var(--l);border-radius:6px;background:var(--c)}
55
- .ico{width:44px;height:44px;flex:none;border:1px solid var(--l);border-radius:6px;background:var(--s);font-size:18px}
56
- .send{background:var(--a);border-color:var(--a);color:var(--ai)}
57
- .menu{position:absolute;left:0;right:0;bottom:52px;z-index:1;padding:4px;margin:0;list-style:none;background:var(--s);border:1px solid var(--l);border-radius:10px;box-shadow:var(--sh)}
58
- .menu button{display:block;width:100%;min-height:44px;padding:4px 12px;border:0;border-radius:6px;background:none;text-align:left}
59
- .menu button:hover,.menu button:focus-visible{background:var(--c)}
60
- .menu small{display:block;color:var(--f)}
61
- .dots{align-self:flex-start;color:var(--f)}
62
- @media (max-width:640px){.panel{inset:0;width:auto;height:auto;border-radius:0;border:0}.launcher[aria-expanded=true]{display:none}}
63
- @media (prefers-reduced-motion:reduce){*{transition-duration:1ms!important}}
64
- `,we=["unreviewed","polished","needs_polish","broken"],ye=["low","medium","high","critical"],_e=["didnt_work","gather","confirm_send","unmet_need"];function s(i,e={},...t){const n=document.createElement(i);for(const[r,l]of Object.entries(e))n.setAttribute(r,l);for(const r of t)r&&n.append(r);return n}function g(i,e,t,n={}){const r=s("button",{type:"button",class:e,...n},i);return r.addEventListener("click",t),r}function Ce(i,e,t){const n=e.t,r=s("button",{type:"button",class:"launcher","aria-label":n("launcher")||ce,"aria-expanded":"false","aria-controls":"jz-chat"},"?"),l=s("div",{class:"log",role:"log","aria-live":"polite","aria-label":n("conversation")}),b=s("div",{class:"dyn"});s("div");const o=s("input",{id:"jz-in",type:"text",autocomplete:"off",maxlength:"2000","aria-describedby":"jz-hint"}),T=s("span",{id:"jz-hint",class:"sr"}),k=s("button",{type:"button",class:"ico","aria-label":n("add_to_message"),"aria-haspopup":"menu","aria-expanded":"false","aria-controls":"jz-menu"},"+"),m=s("ul",{id:"jz-menu",class:"menu",role:"menu","aria-label":n("add_to_message")}),z=s("button",{type:"submit",class:"ico send","aria-label":n("send")},"➤"),O=s("form",{class:"comp"},m,k,s("label",{for:"jz-in",class:"sr"},n("message")),o,T,z),u=s("section",{id:"jz-chat",class:"panel",role:"dialog","aria-modal":"false","aria-labelledby":"jz-title"},s("header",{class:"head"},s("div",{},s("h2",{id:"jz-title"},n("title")),s("p",{},n("subtitle"))),g("✕","x",()=>S(),{"aria-label":n("close")})),l,s("div",{class:"foot"},b,O));u.hidden=true,m.hidden=true,i.append(r,u);let w=[],j=[];const I={ctx:false,team:false};r.addEventListener("click",()=>u.hidden?E():S()),o.addEventListener("input",()=>q()),O.addEventListener("submit",a=>{a.preventDefault(),e.sendText(o.value)&&(o.value="")}),k.addEventListener("click",()=>m.hidden?$():y(true)),m.addEventListener("keydown",a=>{const d=[...m.querySelectorAll("button")],f=d.indexOf(i.activeElement);a.key==="ArrowDown"||a.key==="ArrowUp"?(a.preventDefault(),d[(f+(a.key==="ArrowDown"?1:d.length-1))%d.length]?.focus()):a.key==="Tab"&&y(false)}),u.addEventListener("keydown",a=>{a.key==="Escape"&&(a.stopPropagation(),m.hidden?S():y(true))});function $(){m.replaceChildren(...e.plusItems().map(a=>{const d=s("button",{type:"button",role:"menuitem"},a.label,a.hint&&s("small",{},a.hint));return d.addEventListener("click",()=>{y(true),t.onPlusItem(a.id)}),s("li",{role:"none"},d)})),m.hidden=false,k.setAttribute("aria-expanded","true"),m.querySelector("button")?.focus()}function y(a){m.hidden=true,k.setAttribute("aria-expanded","false"),a&&k.focus()}function E(){e.reopen(),u.hidden=false,r.setAttribute("aria-expanded","true"),F(),(o.disabled?b.querySelector("button"):o)?.focus()}function S(){y(false),e.close(),u.hidden=true,r.setAttribute("aria-expanded","false"),r.focus()}function N(a){if(a.kind==="assistant")return s("div",{class:"msg as"},s("span",{class:"sr"},`${n("speaker.assistant")} `),a.text);if(a.kind==="user")return s("div",{class:"msg us"},s("span",{class:"sr"},`${n("speaker.you")} `),a.text);if(a.kind==="note")return s("p",{class:"note"},a.text);const d=`${a.job} · ${n(a.of?"card.step_of":"card.step",{step:a.step,of:a.of??""})}`,f=s("div",{class:"card",role:"group","aria-label":d},s("h3",{},d),a.title&&s("p",{},s("strong",{},a.title)),a.instruction&&s("p",{},a.instruction));if(a.live){const p=e.pending,C=g(e.label("guide_back"),"btn",()=>e.back(),{"data-back":""});C.disabled=p||a.step<=1;const _=g(e.label("guide_next"),"btn pri",()=>e.next());_.disabled=p;const x=g(e.label("didnt_work"),"link",()=>e.didntWork());x.disabled=p,f.append(s("div",{class:"row"},C,_),x)}return f}function V(){const a=e.entries;(a.length<j.length||a[0]!==j[0])&&(l.replaceChildren(),w=[],j=[]),a.forEach((d,f)=>{if(j[f]===d)return;const p=N(d);w[f]?d.kind==="card"?w[f].querySelectorAll(".row, .link").forEach(C=>C.remove()):w[f].replaceWith(p):(w[f]=p,l.append(p))}),a.forEach((d,f)=>{d.kind==="card"&&d.live&&w[f].querySelectorAll("button").forEach(p=>p.disabled=e.pending||p.hasAttribute("data-back")&&d.step<=1)}),j=[...a],l.querySelector(".dots")?.remove(),l.setAttribute("aria-busy",String(e.pending)),e.pending&&l.append(s("p",{class:"dots","aria-hidden":"true"},"…")),l.scrollTop=l.scrollHeight}function q(){const a=i.activeElement,d=a&&b.contains(a)?a.dataset.k:void 0,f=e.pending,p=[];e.error&&p.push(s("p",{class:"err",role:"status"},n(`error.${e.error}`)," ",g(n("try_again"),"link",()=>e.retry(),{"data-k":"retry"})));const C=e.tapOnly?e.chips():he(e.chips(),o.value),_=e.offers("other_need");if(C.length>0||_){const v=s("div",{class:"chips",role:"group","aria-label":n("suggestions")});for(const h of C){const A=g(h.badge?`${h.title} · ${h.badge}`:h.title,"chip job",()=>e.pickJob(h),{"data-k":`job:${h.jobId}`});A.disabled=f,v.append(A)}if(_){const h=g(e.label("other_need"),"chip",()=>e.other(),{"data-k":"other"});h.disabled=f,v.append(h)}p.push(v)}const x=s("div",{class:"row"});if(e.offers("guide_back")&&e.state!=="guide_step"&&x.append(g(e.label("guide_back"),"btn",()=>e.back(),{"data-k":"back"})),e.offers("talk_to_assistant")&&x.append(g(e.label("talk_to_assistant"),"btn",()=>e.talk(),{"data-k":"talk"})),e.offers("send")&&x.append(g(e.label("send"),"btn pri",()=>e.sendReport(),{"data-k":"send",...e.needsConsent()?{"aria-describedby":"jz-consent"}:{}})),x.querySelectorAll("button").forEach(v=>v.disabled=f),x.childElementCount>0&&p.push(x),e.needsConsent()){const v=g(e.label("consent")||n("allow"),"link",()=>{e.allow(),o.focus()},{"data-k":"allow"});p.push(s("p",{id:"jz-consent",class:e.consentAsked?"consent ask":"consent"},`${n("consent_line")} · `,v))}if(_e.includes(e.state)||e.offers("send")){const v=s("ul",{class:"ctx"});for(const h of e.contextChips()){const A=s("li",h.removable?{}:{class:"fixed"},h.label);h.removable&&A.append(g("✕","",()=>e.removeContext(h.key),{"aria-label":n("remove",{name:h.label}),"data-k":`ctx:${h.key}`})),v.append(A)}p.push(D("ctx",n("context.title"),v)),t.reviewer&&p.push(D("team",n("team.title"),W()))}if(e.attachments.length>0||e.anchor){const v=s("ul",{class:"atts","aria-label":n("attachments")});if(e.anchor){const h=n("pointed_at",{name:e.anchor.tflowId});v.append(s("li",{class:"pt"},h,g("✕","",()=>e.setAnchor(void 0),{"aria-label":n("remove",{name:h}),"data-k":"anchor"})))}e.attachments.forEach((h,A)=>{const R=h.label??n("attachment.screenshot",{n:A+1});v.append(s("li",{class:"att"},s("img",{src:h.thumbnail,alt:R}),g("✕","",()=>e.removeAttachment(h.id),{"aria-label":n("remove",{name:R}),"data-k":`att:${h.id}`})))}),p.push(v)}const J=e.state==="closed";o.disabled=e.tapOnly||J,o.placeholder=n(e.tapOnly?"input.tap_only":"input.placeholder"),T.textContent=e.tapOnly?n("input.paused"):"",z.disabled=o.disabled||f,k.hidden=e.plusItems().length===0,k.hidden&&!m.hidden&&y(false),b.replaceChildren(...p.filter(v=>!!v&&typeof v!="string")),e.consentAsked?b.querySelector("[data-k=allow]")?.focus():d&&(b.querySelector(`[data-k="${d}"]`)??(o.disabled?b.querySelector("button"):o))?.focus()}function D(a,d,f){const p=s("details",{},s("summary",{},d),f);return p.open=I[a],p.addEventListener("toggle",()=>I[a]=p.open),p}function W(){const a=(d,f,p,C)=>{const _=s("select",{},s("option",{value:""},"—"),...f.map(x=>s("option",{value:x},n(`team.${d}.${x}`))));return _.value=p??"",_.addEventListener("change",()=>C(_.value)),s("label",{},n(`team.${d}`),_)};return s("div",{class:"team"},a("verdict",we,e.team.verdict,d=>e.setTeam({verdict:d||void 0})),a("severity",ye,e.team.severity,d=>e.setTeam({severity:d||void 0})))}function F(){u.hidden||(V(),q())}const G=e.subscribe(F);return{open:E,close:S,isOpen:()=>!u.hidden,suspend(){y(false);const a=!u.hidden;return u.hidden=true,r.hidden=true,()=>{r.hidden=false,a&&(u.hidden=false,F(),(k.hidden?o:k).focus())}},destroy(){G(),r.remove(),u.remove()}}}const je=["desktop","tablet","mobile"];function B(i,e){const t=window.innerWidth,n=e.device&&je.includes(e.device)?e.device:t<768?"mobile":t<1024?"tablet":"desktop",r=i.signals?.appVersion;return{pagePath:i.pagePath==="none"?"":ie(location.href).slice(0,512),persona:e.persona,browser:fe(navigator.userAgent),device:n,viewport:{w:Math.min(t,2e4),h:Math.min(window.innerHeight,2e4)},build:r&&r.length<=64?r:void 0}}function Ie(i,e){const t={siteKey:e.siteKey,...e.reviewerToken?{reviewerToken:e.reviewerToken}:{}};return P(i,"GetHelpIndex",t).then(n=>n.jobs??[])}function H(i,e){return i.flatMap(t=>{if(!t.jobId||!t.title)return[];const n=t.stepCount;return[{type:"chip",jobId:t.jobId,title:t.title,label:t.title,badge:n?n===1?e("chip.one_step"):e("chip.steps",{n}):e("chip.no_guide"),...n?{steps:n}:{}}]})}function K(i,e,t={}){const n=ee(i),r=document.createElement("div");r.setAttribute("data-journeeze-chat","");const l=r.attachShadow({mode:"closed"}),b=document.createElement("style");b.textContent=ke,i.nonce&&(b.nonce=i.nonce),l.append(b),document.body.append(r);let o;const T=()=>o??(o=P(n,"GetWidgetConfig",{siteKey:i.siteKey}).catch(u=>{throw o=void 0,u})),k=(t.loadJobs??(()=>Ie(n,i)))().catch(()=>[]);let m,z=false;const O=T().then(u=>u.copy,()=>{}).then(async u=>{if(z)return;const w=pe(u),j=()=>i.reviewerToken||i.userId?void 0:null,I=new L({siteKey:i.siteKey,reviewer:!!i.reviewerToken,transport:t.transport??le(n,i),t:w,facts:()=>B(i,e()),hasConsent:()=>ne(U(i),j()),giveConsent:()=>te(U(i),j())}),$=E=>import("./attach-DpioALxW.js").then(S=>S.plusItem(E,{session:I,root:l,options:i,endpoint:n,config:T,suspend:()=>y.suspend()}),()=>I.note(w("note.capture_unavailable"))),y=Ce(l,I,{reviewer:!!i.reviewerToken,onPlusItem:t.onPlusItem??(E=>{$(E)})});m={session:I,view:y},I.start(H(await k,w))});return{unmount(){z=true,m?.view.destroy(),r.remove()},report(){O.then(()=>{m?.view.open(),m?.session.reportProblem()})},addAttachment:u=>!!m?.session.addAttachment(u),removeAttachment:u=>m?.session.removeAttachment(u)}}const Ae=(i,e)=>K(i,()=>re(e())),Te=Object.freeze(Object.defineProperty({__proto__:null,jobChips:H,mount:Ae,mountChat:K,pageFacts:B},Symbol.toStringTag,{value:"Module"}));export{ge as M,Te as c,M as u};
@@ -1 +0,0 @@
1
- var v=Object.defineProperty;var w=(e,t,n)=>t in e?v(e,t,{enumerable:true,configurable:true,writable:true,value:n}):e[t]=n;var u=(e,t,n)=>w(e,typeof t!="symbol"?t+"":t,n);import{CONTEXT_FIELDS as S,CONTEXT_VALUE_MAX_LEN as T,CONTEXT_ID_PATTERN as E,API_PATH_PATTERN as N}from"./contract.js";import{p as _}from"./context-UnG6_X61.js";import{w as c}from"./loader-BZiIDD1D.js";class m extends Error{constructor(n,r,o=0,i){super(r);u(this,"code");u(this,"status");u(this,"retryAfterMs");this.code=n,this.status=o,this.retryAfterMs=i}}const I="https://app.journeeze.dev",b=15e3;function C(e,t=b){return typeof AbortSignal<"u"&&typeof AbortSignal.timeout=="function"?{...e,signal:AbortSignal.timeout(t)}:e}function $(e,t=location.href){try{return new URL(e,t).origin!==new URL(t).origin}catch{return true}}const k="text/plain;charset=UTF-8";function A(e,t){return`${e.replace(/\/+$/,"")}/journeeze.collector.v1.CollectorService/${t}`}function O(e,t){const n=$(e)?{"content-type":k}:{"content-type":"application/json","connect-protocol-version":"1"};return t?{...n,"if-none-match":t}:n}function y(e,t,n,r,o){const i=C({method:"POST",headers:O(e,o.etag),body:JSON.stringify(n),credentials:"omit",cache:"no-store",referrerPolicy:"no-referrer",...o.keepalive?{keepalive:true}:{}});return r(A(e,t),i)}const x=6e4;function j(e,t=Date.now()){if(!e)return;const n=Number(e.trim()),r=Number.isFinite(n)&&/^\d+$/.test(e.trim())?n*1e3:Date.parse(e)-t;return Number.isFinite(r)?Math.min(Math.max(r,0),x):void 0}async function g(e){const t=await e.json().catch(()=>{});if(!e.ok){const n=typeof t?.code=="string"?t.code:M(e.status);throw new m(n,String(t?.message??e.statusText),e.status,j(e.headers.get("retry-after")))}if(t===void 0||typeof t!="object"||t===null)throw new m("unavailable","the collector did not answer with Connect JSON",e.status);return t}async function F(e,t,n,r=fetch,o={}){return g(await y(e,t,n,r,o.keepalive?{keepalive:true}:{}))}async function H(e,t,n,r,o=fetch){const i=await y(e,t,n,o,r?{etag:r}:{});if(i.status===304)return{notModified:true};const s=await g(i),a=i.headers.get("etag");return a?{notModified:false,value:s,etag:a}:{notModified:false,value:s}}function X(e,t){return t?`${e.replace(/\/+$/,"")}${t.startsWith("/")?"":"/"}${t}`:void 0}function M(e){return e===401?"unauthenticated":e===403?"permission_denied":e===409?"already_exists":e===412?"failed_precondition":e===429?"resource_exhausted":e===404||e===408||e>=500?"unavailable":e>=400?"invalid_argument":"unknown"}function z(e,t=location.href){const{endpoint:n,apiHost:r,apiPath:o}=e;if(n!==void 0)return c("endpoint is deprecated; use apiHost"),new URL(n,t).href.replace(/\/+$/,"");let i=I;if(r!==void 0){const s=r.replace(/\/$/,"");let a=false;try{const f=new URL(s);a=f.origin===s&&(f.protocol==="https:"||/^(localhost|127\.0\.0\.1)$/.test(f.hostname))}catch{}a?i=s:c("invalid apiHost ignored")}return o===void 0?i:N.test(o)?i+o:(c("invalid apiPath ignored"),i)}function J(e){const t={};for(const n of S){if(!(n in e))continue;const r=e[n]||void 0;if(r!==void 0&&(typeof r!="string"||r.length>T||/[\0-\x1f\x7f]/.test(r))){c(`context.${n} dropped (1..=128 printable characters)`),t[n]=void 0;continue}r!==void 0&&!E.test(r)&&c(`context.${n} should be an id`),t[n]=r}return t}const P=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$|[0-9a-f]{16}|@|^[\w-]{24,}$/i;function Y(e){return _(e).split("/").map(t=>{let n=t;try{n=decodeURIComponent(t)}catch{}return P.test(n)?":id":t}).join("/")}function q(e){const t=e.signature===void 0?e.userIdSig:e.signature?e.signature.sig:void 0,n=e.signature===void 0?e.userIdExp:e.signature?e.signature.exp:void 0;return typeof t!="string"||!/^[A-Za-z0-9_-]{43}$/.test(t)?{}:typeof n!="number"||!Number.isInteger(n)||n*1e3<=Date.now()?{}:{userIdSig:t,userIdExp:n}}const d=1,V="Feedback mode captures the element you point at, a screenshot of this page with form fields hidden, your comment, and your persona and journey step. It never records keystrokes, form contents or query strings. Your feedback is visible to the project's review team.",B="Feedback mode captures the element you point at, your comment, and your persona and journey step. No screenshot is sent. It never records keystrokes, form contents or query strings. Your feedback is visible to the project's review team.",l=e=>`jz:consent:v${d}:${e}`,p=new Set,G=e=>e.userId?`${e.siteKey}:u:${e.userId}`:e.siteKey;function K(e,t=h()){p.delete(e);try{t?.removeItem(l(e))}catch{}}function h(){try{return window.localStorage}catch{return}}function W(e,t=h()){if(p.has(e))return true;try{const n=t?.getItem(l(e));return n?JSON.parse(n).v===d:false}catch{return false}}function Z(e,t=h()){p.add(e);try{t?.setItem(l(e),JSON.stringify({v:d,at:new Date().toISOString()}))}catch{}}export{m as C,V as D,x as R,k as T,h as a,K as b,F as c,z as d,J as e,G as f,B as g,W as h,Z as i,q as j,H as k,X as l,A as r,Y as s,C as w};
@@ -1,17 +0,0 @@
1
- const o = /^[a-z0-9._:-]{1,96}$/;
2
- function e(t) {
3
- const a = t?.closest("[data-tflow-id]")?.getAttribute("data-tflow-id") ?? void 0;
4
- return a !== void 0 && o.test(a) ? a : void 0;
5
- }
6
- function n(t) {
7
- try {
8
- return new URL(t).pathname;
9
- } catch {
10
- return "/";
11
- }
12
- }
13
- export {
14
- o as T,
15
- n as p,
16
- e as t
17
- };
@@ -1 +0,0 @@
1
- var E=Object.defineProperty;var I=(s,e,t)=>e in s?E(s,e,{enumerable:true,configurable:true,writable:true,value:t}):s[e]=t;var d=(s,e,t)=>I(s,typeof e!="symbol"?e+"":e,t);import{C as w,a as v,c as f,b as _,d as q}from"./consent-DckCUvYR.js";const x=new Set(["invalid_argument","failed_precondition","permission_denied","unauthenticated","not_found","already_exists","unimplemented"]),g=50,A=1e3,O=6e4,y=1440*60*1e3;function T(s){return Math.min(O,A*2**Math.max(0,s))}function L(s){return s instanceof w&&x.has(s.code)}class M{constructor(e){d(this,"deps");d(this,"items",[]);d(this,"inFlight");d(this,"attempt",0);d(this,"flushing");d(this,"timer");d(this,"disposed",false);d(this,"schedule");d(this,"cancel");d(this,"now");this.deps=e,this.schedule=e.schedule??((t,i)=>setTimeout(t,i)),this.cancel=e.cancel??(t=>clearTimeout(t)),this.now=e.now??Date.now,this.claim()}get size(){return this.items.length}enqueue(e){return new Promise(t=>{const i={request:e,settle:t};this.add(i),this.flush().then(()=>{this.items.includes(i)&&u(i,"queued")})})}stash(e){this.add({request:e})}flush(){return this.disposed?Promise.resolve():(this.timer!==void 0&&(this.cancel(this.timer),this.timer=void 0),this.flushing?this.flushing.then(()=>this.timer===void 0?this.flush():void 0):(this.flushing=this.drain().finally(()=>{this.flushing=void 0}),this.flushing))}persist(){const e=this.items.filter(t=>t!==this.inFlight);if(!(e.length===0||!this.deps.storage))try{const t=this.read(),i=this.now(),n=this.deps.user?.(),c=[...t,...e.map(r=>({owner:this.deps.owner,request:r.request,at:r.at??i,...n?{user:n}:{}}))].slice(-g);this.deps.storage?.setItem(this.deps.storageKey,JSON.stringify(c));for(const r of e)u(r,"queued");this.items=this.items.filter(r=>r===this.inFlight)}catch{}}claim(){try{const e=this.read(),t=e.filter(n=>n.owner===this.deps.owner);if(t.length===0)return;const i=e.filter(n=>n.owner!==this.deps.owner);i.length===0?this.deps.storage?.removeItem(this.deps.storageKey):this.deps.storage?.setItem(this.deps.storageKey,JSON.stringify(i));for(const n of t)this.fresh(n)&&this.add({request:n.request,at:n.at})}catch{}}dispose(){this.persist(),this.disposed=true,this.timer!==void 0&&this.cancel(this.timer),this.timer=void 0}add(e){var t;for((t=e.request).submissionId??(t.submissionId=F()),this.items.push(e);this.items.length>g;){const i=this.items[0]===this.inFlight?1:0,[n]=this.items.splice(i,1);n&&u(n,"dropped")}}async drain(){for(;!this.disposed;){const e=this.items[0];if(!e){this.attempt=0;return}this.inFlight=e;try{await this.deps.send(e.request),this.remove(e),this.attempt=0,u(e,"sent")}catch(t){if(L(t)){this.remove(e),u(e,"dropped"),this.deps.onDropped?.(t);continue}if(this.disposed){this.inFlight=void 0,this.persist();return}const i=T(this.attempt++);this.timer=this.schedule(()=>{this.timer=void 0,this.flush()},i);return}finally{this.inFlight=void 0}}}fresh(e){return e.at===void 0?true:typeof e.at=="number"&&Number.isFinite(e.at)&&this.now()-e.at<=y}remove(e){const t=this.items.indexOf(e);t>=0&&this.items.splice(t,1)}read(){const e=this.deps.storage?.getItem(this.deps.storageKey),t=e?JSON.parse(e):[];return Array.isArray(t)?t.filter(i=>typeof i=="object"&&i!==null&&typeof i.owner=="string"&&typeof i.request=="object"&&i.request!==null):[]}}function D(s){if(!s)return"";let e=2166136261;for(let t=0;t<s.length;t++)e^=s.charCodeAt(t),e=Math.imul(e,16777619)>>>0;return e.toString(16).padStart(8,"0")}function F(){return crypto.randomUUID()}function u(s,e){const t=s.settle;s.settle=void 0,t?.(e)}function P(s,e,t,i=Date.now()){try{const n=s?.getItem(e),c=n?JSON.parse(n):[],r=Array.isArray(c)?c:[],a=r.filter(o=>o?.owner===t),h=r.filter(o=>o?.owner!==t);return h.length===0?s?.removeItem(e):s?.setItem(e,JSON.stringify(h)),a.filter(o=>o.request&&(o.at===void 0||i-o.at<=y)).sort((o,l)=>(o.at??0)-(l.at??0)).map(o=>o.request)}catch{return[]}}const b=s=>D(s.reviewerToken||(s.userId?`u:${s.userId}`:void 0)),N=32*1024;async function k(s){const e=P(v(),`jz:outbox:v2:${s.siteKey}`,b(s));if(_(s.siteKey),e.length===0)return;const t=q(s);let i=N;const n=(a,h)=>f(t,"SubmitFeedback",a,fetch,{keepalive:h}),r=(await Promise.allSettled(e.map(a=>{const h=S(s,a),o=new Blob([JSON.stringify(h)]).size,l=o<=i;l&&(i-=o);const m=n(h,l);return l?m.catch(p=>p instanceof w?Promise.reject(p):n(h,false)):m}))).filter(a=>a.status==="rejected").length;r&&console.warn(`[journeeze] ${r} feedback item(s) could not be sent at logout and were discarded`)}function S(s,e){const t=s.reviewerToken?{...e,reviewerToken:s.reviewerToken}:{...e};if(s.pagePath==="none"){const{pagePath:i,...n}=t.context;t.context=n}return t}function K(s,e,t={}){const i=h=>f(e,"SubmitFeedback",S(s,h),fetch,{keepalive:true}).then(()=>{}),n=new M({send:i,storage:t.memoryOnly?void 0:v(),storageKey:`jz:outbox:v2:${s.siteKey}`,owner:b(s),user:()=>s.userId,...t.onDropped?{onDropped:t.onDropped}:{}}),c=()=>{n.flush()},r=()=>{t.beforePersist?.(),n.persist()},a=h=>{h.persisted&&(n.claim(),n.flush())};return window.addEventListener("online",c),window.addEventListener("pagehide",r),window.addEventListener("pageshow",a),{outbox:n,dispose(){window.removeEventListener("online",c),window.removeEventListener("pagehide",r),window.removeEventListener("pageshow",a),n.dispose()}}}function z(s,e){return f(s,"GetWidgetConfig",{siteKey:e})}export{K as feedbackChannel,k as logout,b as ownerOf,z as widgetConfig};
@@ -1,105 +0,0 @@
1
- var X=Object.defineProperty;var J=(n,e,t)=>e in n?X(n,e,{enumerable:true,configurable:true,writable:true,value:t}):n[e]=t;var m=(n,e,t)=>J(n,typeof e!="symbol"?e+"":e,t);import{s as Z,F as R,R as ee}from"./hook-DGWypoEO.js";import{d as W}from"./anchor-cPvFFTOS.js";import{k as te,C as ne,l as M,c as Y,s as Q,d as ie,D as se,i as re,h as oe,f as ae,e as de}from"./consent-DckCUvYR.js";import{T as ce}from"./context-UnG6_X61.js";const le=6e4;class ue{constructor(e){m(this,"opts");m(this,"indexEntry");m(this,"guides",new Map);m(this,"inflight",new Map);m(this,"now");m(this,"freshMs");this.opts=e,this.now=e.now??Date.now,this.freshMs=e.freshMs??6e4}index(){return this.read("index","GetHelpIndex",this.body({}),()=>this.indexEntry,e=>this.indexEntry=e,()=>false)}guide(e){return this.read(`guide:${e}`,"GetGuide",this.body({journeyId:e}),()=>this.guides.get(e),t=>this.guides.set(e,t),t=>{const i=t.linksExpireAt?Date.parse(t.linksExpireAt):NaN;return Number.isFinite(i)&&i-this.now()<le})}body(e){const t=this.opts.reviewerToken;return{siteKey:this.opts.siteKey,...e,...t&&{reviewerToken:t}}}read(e,t,i,s,o,g){const l=s();if(l&&this.now()-l.at<this.freshMs&&!g(l.value))return Promise.resolve(l.value);const f=this.inflight.get(e);if(f)return f;const E=l&&!g(l.value)?l.etag:void 0,T=te(this.opts.endpoint,t,i,E,this.opts.fetchImpl).then(z=>{if(z.notModified){if(!l)throw new Error("304 without a cached value");return o({...l,at:this.now()}),l.value}return o({value:z.value,etag:z.etag,at:this.now()}),z.value}).finally(()=>this.inflight.delete(e));return this.inflight.set(e,T),T}}const H=n=>n.toLowerCase().normalize("NFKD").replace(/[̀-ͯ]/g,"").split(/[^\p{L}\p{N}]+/u).filter(Boolean);function O(n,e){const t=H(e);if(t.length===0)return[...n];const i=[];return n.forEach((s,o)=>{const g=H(s.title??""),l=H(s.goal??""),f=(s.stepTitles??[]).flatMap(H);let E=0;for(const T of t){const z=a=>a.some(v=>v.startsWith(T)),q=z(g)?3:z(l)?2:z(f)?1:0;if(q===0)return;E+=q}i.push([s,E,o])}),i.sort((s,o)=>o[1]-s[1]||s[2]-o[2]).map(([s])=>s)}const pe=4e3;function L(n){return n instanceof ne&&n.code==="failed_precondition"}class he{constructor(e){m(this,"deps");m(this,"current",{view:"closed"});m(this,"listeners",new Set);m(this,"entries",[]);m(this,"generation",0);m(this,"asked",new Set);m(this,"pending");m(this,"pendingSignal");this.deps=e}get state(){return this.current}subscribe(e){return this.listeners.add(e),e(this.current),()=>this.listeners.delete(e)}probe(){return this.deps.loadIndex().then(()=>{},e=>{L(e)&&this.disable()})}open(){if(this.current.view==="disabled")return;const e=++this.generation;this.deps.clearHighlight(),this.set({view:"index",status:"loading",query:"",results:[],total:0}),this.deps.loadIndex().then(t=>{if(e!==this.generation)return;this.entries=(t.guides??[]).filter(o=>o.journeyId);const i=this.current.view==="index"?this.current.query:"",s=(t.jobs??[]).filter(o=>o.jobId&&o.title);this.set({view:"index",status:"ready",query:i,results:O(this.entries,i),total:this.entries.length,jobs:s})},t=>{if(e!==this.generation)return;if(L(t))return this.disable();const i=this.current.view==="index"?this.current.query:"";this.set({view:"index",status:"error",query:i,results:[],total:0})})}close(){this.current.view!=="disabled"&&(this.generation++,this.pending=void 0,this.pendingSignal=void 0,this.deps.clearHighlight(),this.set({view:"closed"}))}search(e){const t=this.current;if(t.view!=="index")return;const i=t.status==="ready"?O(this.entries,e):[];this.set({...t,query:e,results:i})}openGuide(e){if(this.current.view==="disabled")return;const t=++this.generation;this.pending=void 0,this.deps.clearHighlight(),this.set({view:"guide",status:"loading",journeyId:e,step:0,anchor:"none",checkin:"idle"}),this.deps.loadGuide(e).then(i=>{if(t!==this.generation)return;const s=ge(i,e,this.deps.endpoint);if(s.steps.length===0){this.set({view:"guide",status:"error",journeyId:e,step:0,anchor:"none",checkin:"idle"});return}this.showStep(s,0)},i=>{if(t===this.generation){if(L(i))return this.disable();this.set({view:"guide",status:"error",journeyId:e,step:0,anchor:"none",checkin:"idle"})}})}disable(){this.generation++,this.pending=void 0,this.deps.clearHighlight(),this.set({view:"disabled"})}back(){const e=this.current;if(e.view==="finished")return this.showStep(e.guide,e.guide.steps.length-1);if(e.view!=="guide"||!e.guide)return this.open();if(e.step===0)return this.open();this.generation++,this.pending=void 0,this.showStep(e.guide,e.step-1)}next(){const e=this.current;if(e.view!=="guide"||e.status!=="ready"||!e.guide||e.checkin!=="idle")return;const t=e.guide.steps[e.step];if(t&&!this.asked.has(G(e.guide,t))){this.set({...e,checkin:"asking",notice:void 0});return}this.advance()}answer(e){const t=this.current;if(!(t.view!=="guide"||t.checkin!=="asking"&&t.checkin!=="needs-consent")){if(!this.deps.hasConsent()){this.pending=e,this.set({...t,checkin:"needs-consent"});return}this.send(e)}}skipCheckin(){const e=this.current;e.view!=="guide"||e.checkin!=="asking"&&e.checkin!=="needs-consent"||(this.pending=void 0,this.markAsked(e),this.set({...e,checkin:"idle"}),this.advance())}giveConsent(){const e=this.pendingSignal,t=this.current;if(e&&(t.view==="index"||t.view==="guide")&&t.signal==="needs-consent"){this.pendingSignal=void 0,this.deps.giveConsent(),this.sendSignalNow(e);return}const i=this.current;if(i.view!=="guide"||i.checkin!=="needs-consent"||!this.pending)return;this.deps.giveConsent();const s=this.pending;this.pending=void 0,this.send(s)}declineConsent(){const e=this.current;if(this.pendingSignal&&(e.view==="index"||e.view==="guide")&&e.signal==="needs-consent"){this.pendingSignal=void 0,this.patchSignal({signal:"idle"});return}this.skipCheckin()}canSignal(){return this.deps.signalsAllowed?.()??true}hasConsent(){return this.deps.hasConsent()}sendCallout(e){if(!this.canSignal())return;const t=this.current;if(t.view!=="guide"||t.status!=="ready"||!t.guide||B(t.signal))return;const i=t.guide.steps.find(s=>s.index===e);i&&this.signal({kind:"callout",guide:t.guide,step:i})}sendRequest(e,t){if(!this.canSignal())return;const i=e.trim();if(!i||[...i].length>pe)return;const s=this.current;s.view==="index"&&!B(s.signal)?this.signal(t?{kind:"request",text:i,jobRequest:t}:{kind:"request",text:i}):s.view==="guide"&&s.status==="ready"&&s.guide&&!B(s.signal)&&this.signal({kind:"request",text:i,guide:s.guide,step:s.guide.steps[s.step]})}signal(e){if(!this.deps.hasConsent()){this.pendingSignal=e,this.patchSignal({signal:"needs-consent",signalNotice:void 0});return}this.sendSignalNow(e)}patchSignal(e){const t=this.current;(t.view==="index"||t.view==="guide")&&this.set({...t,...e})}async sendSignalNow(e){const t=this.generation;this.patchSignal({signal:"sending",signalNotice:void 0});let i;try{i=await this.deps.sendSignal(e)}catch{i="dropped"}t===this.generation&&this.patchSignal({signal:"idle",signalNotice:i})}async send(e){const t=this.current;if(t.view!=="guide"||!t.guide)return;const i=t.guide.steps[t.step];if(!i)return;this.markAsked(t);const s=this.generation;this.set({...t,checkin:"sending"});let o;try{o=await this.deps.sendCheckin({guide:t.guide,step:i,answer:e})}catch{o="dropped"}if(s!==this.generation)return;const g=this.current;g.view==="guide"&&(this.set({...g,checkin:"idle"}),this.advance(o))}refreshHighlight(){const e=this.current;if(e.view!=="guide"||e.status!=="ready"||!e.guide)return;const t=this.anchorFor(e.guide,e.step);t!==e.anchor&&this.set({...e,anchor:t})}markAsked(e){if(e.view!=="guide"||!e.guide)return;const t=e.guide.steps[e.step];t&&this.asked.add(G(e.guide,t))}advance(e){const t=this.current;if(!(t.view!=="guide"||!t.guide)){if(t.step+1<t.guide.steps.length)return this.showStep(t.guide,t.step+1,e);this.deps.clearHighlight(),this.set({view:"finished",guide:t.guide,notice:e})}}showStep(e,t,i){const s=this.anchorFor(e,t);this.set({view:"guide",status:"ready",journeyId:e.journeyId,guide:e,step:t,anchor:s,checkin:"idle",notice:i})}anchorFor(e,t){const i=this.deps.highlight(e.steps[t]?.targets);return typeof i=="string"?i:(i.then(s=>{const o=this.current;o.view==="guide"&&o.guide===e&&o.step===t&&o.anchor!==s&&this.set({...o,anchor:s})}),"none")}set(e){this.current=e;for(const t of this.listeners)t(e)}}const G=(n,e)=>`${n.journeyId}/${e.index}`;function ge(n,e,t){const i=(n.steps??[]).map((s,o)=>({index:s.index??o,title:s.title??"",instruction:s.instruction??"",tflowId:s.tflowId||void 0,targets:ve(s),stepRef:s.stepRef||void 0,screenshotUrl:M(t,s.screenshotUrl),videoStartMs:s.videoStartMs,videoEndMs:s.videoEndMs})).sort((s,o)=>s.index-o.index);return{journeyId:n.journeyId??e,slug:n.slug??"",title:n.title??"",goal:n.goal??"",steps:i,videoUrl:M(t,n.videoUrl),captionsUrl:M(t,n.captionsUrl),version:n.contentVersion||void 0}}function B(n){return n==="needs-consent"||n==="sending"}const fe=/^(tflow|testId|role|css)$/;function ve(n){const e=(n.targets??[]).filter(t=>fe.test(t.strategy??"")&&t.value).map(t=>({by:t.strategy,value:t.value,name:t.name||void 0}));return e.length||!n.tflowId?e:[{by:"tflow",value:n.tflowId}]}const be=()=>import("./resolve-BfWByuTp.js");function xe(n,e=document){if(ce.test(n))for(const t of e.querySelectorAll(`[data-tflow-id="${n}"]`)){const i=t.getBoundingClientRect();if(i.width>0||i.height>0)return t}}function we(n=window){try{return n.matchMedia?.("(prefers-reduced-motion: reduce)").matches??false}catch{return false}}class me{constructor(e,t=window,i=be){m(this,"win");m(this,"load");m(this,"target");m(this,"box");m(this,"onMove",()=>this.place());m(this,"seq",0);this.win=t,this.load=i,this.box=t.document.createElement("div"),this.box.className="jz-help-highlight",this.box.setAttribute("aria-hidden","true"),this.box.hidden=true,e.append(this.box)}show(e){this.hide();const t=this.seq,[i]=e??[];return i?e?.length===1&&i.by==="tflow"?this.outline(xe(i.value,this.win.document)):this.load().then(s=>t===this.seq?this.outline(s.resolveTarget(e??[],this.win.document)):"none",()=>"missing"):"none"}outline(e){return e?(this.target=e,e.scrollIntoView?.({block:"center",inline:"nearest",behavior:we(this.win)?"auto":"smooth"}),this.win.addEventListener("scroll",this.onMove,{capture:true,passive:true}),this.win.addEventListener("resize",this.onMove,{passive:true}),this.box.hidden=false,this.place(),"found"):"missing"}hide(){this.seq++,this.target&&(this.target=void 0,this.box.hidden=true,this.win.removeEventListener("scroll",this.onMove,{capture:true}),this.win.removeEventListener("resize",this.onMove))}dispose(){this.hide(),this.box.remove()}place(){if(!this.target)return;if(!this.target.isConnected)return this.hide();const e=this.target.getBoundingClientRect();Object.assign(this.box.style,{left:`${e.left-4}px`,top:`${e.top-4}px`,width:`${e.width+8}px`,height:`${e.height+8}px`})}}function ye(n,e,t){let i;return{start(){i??(i=import("./telemetry-CyRJDaVs.js").then(s=>s.startTelemetry({endpoint:n,siteKey:e,subscribe:o=>t.subscribe(o)}),()=>{i=void 0}))},checkin:s=>{i?.then(o=>o?.checkin(s))},job:s=>{i?.then(o=>o?.job(s))},stop:s=>{i?.then(o=>o?.stop(s))}}}const _e=`
2
- :host { all: initial; }
3
- .launcher { position:fixed; left:24px; bottom:24px; z-index:2147483646; width:44px; height:44px; border-radius:22px;
4
- border:1px solid #1D2024; background:#1D2024; color:#FFFFFF; font:600 18px/1 system-ui,sans-serif; cursor:pointer; }
5
- .panel { position:fixed; left:24px; bottom:80px; z-index:2147483646; width:min(340px, calc(100vw - 48px));
6
- max-height:min(70vh, 560px); overflow:auto; box-sizing:border-box; padding:16px; border:1px solid rgb(29 32 36/12%);
7
- border-radius:10px; background:#FFFFFF; color:#1D2024; font:14px/1.45 system-ui,sans-serif; box-shadow:0 8px 24px rgb(0 0 0/12%); }
8
- .panel h2 { font-size:15px; margin:0 0 8px; }
9
- .panel p { margin:0 0 8px; }
10
- .panel ul { list-style:none; padding:0; margin:8px 0 0; }
11
- .panel li button { display:block; width:100%; text-align:left; padding:8px; margin:0 0 4px; border:1px solid rgb(29 32 36/12%);
12
- border-radius:6px; background:#FFFFFF; color:inherit; font:inherit; cursor:pointer; }
13
- .panel input { width:100%; box-sizing:border-box; padding:8px; border:1px solid rgb(29 32 36/24%); border-radius:6px; font:inherit; }
14
- .panel .row { display:flex; gap:8px; flex-wrap:wrap; margin-top:12px; }
15
- .panel .row button { padding:6px 12px; border:1px solid #1D2024; border-radius:6px; background:#FFFFFF; color:#1D2024; font:inherit; cursor:pointer; }
16
- .panel .muted { color:#5D636B; font-size:13px; }
17
- .panel img { max-width:100%; border:1px solid rgb(29 32 36/12%); border-radius:6px; }
18
- :focus-visible { outline:2px solid #3D63C9; outline-offset:2px; }
19
- .jz-help-highlight { position:fixed; z-index:2147483645; pointer-events:none; box-sizing:border-box;
20
- border:2px solid #3D63C9; border-radius:6px; box-shadow:0 0 0 4px rgb(61 99 201/20%); }
21
- `;function p(n,e={},...t){const i=document.createElement(n);for(const[s,o]of Object.entries(e))i.setAttribute(s,o);for(const s of t)s&&i.append(s);return i}const _={sent:"Thanks. Your answer was sent.",queued:"Saved. It will send when you're back online.",dropped:"Your answer couldn't be sent."},ke=(n,e,t)=>{const i=p("button",{type:"button",class:"launcher","aria-label":"Help","aria-expanded":"false","aria-controls":"jz-help-panel"},"?"),s=p("div",{id:"jz-help-panel",class:"panel",role:"dialog","aria-modal":"false","aria-label":"Help"});s.hidden=true,n.append(i,s);let o="",g=false,l;i.addEventListener("click",()=>e.state.view==="closed"?e.open():e.close()),s.addEventListener("keydown",a=>{a.key==="Escape"&&(a.stopPropagation(),e.close())});const f=(a,v,h={})=>{const C=p("button",{type:"button",...h},a);return C.addEventListener("click",v),C};function E(a){const v=n.activeElement,h=v!==null&&s.contains(v),C=h?v.id:"";i.hidden=a.view==="disabled";const x=a.view!=="closed"&&a.view!=="disabled";if(i.setAttribute("aria-expanded",String(x)),s.hidden=!x,a.view==="index"&&l&&s.contains(l.input)){z(a),h&&v&&!v.isConnected&&(C&&n.getElementById(C)||l.input).focus(),g=x;return}if(l=void 0,s.replaceChildren(...(x?T(a):[]).filter(w=>!!w)),x&&(!g||h)){const y=(C?n.getElementById(C):null)??s.querySelector("input, [role=group] button, button");y?.focus(),y instanceof HTMLInputElement&&y.setSelectionRange(y.value.length,y.value.length)}!x&&g&&i.focus(),g=x}function T(a){if(a.view==="index"){const w=p("input",{id:"jz-help-search",type:"search","aria-label":"Search help",placeholder:"How do I…",autocomplete:"off"});return w.value=a.query,w.addEventListener("input",()=>e.search(w.value)),l={input:w,status:p("p",{class:"muted",role:"status"}),retry:p("div",{class:"row"},f("Try again",()=>e.open())),list:p("ul",{"aria-label":"Guides"})},z(a),[p("h2",{},"How do I…"),w,l.status,l.retry,l.list,p("div",{class:"row"},f("Close",()=>e.close()))]}if(a.view==="finished")return[p("h2",{},`You finished “${a.guide.title}”`),a.notice&&p("p",{class:"muted",role:"status"},_[a.notice]??""),p("div",{class:"row"},f("More guides",()=>e.open(),{id:"jz-help-more"}),f("Back",()=>e.back()),f("Close",()=>e.close()))];if(a.view!=="guide")return[];if(a.status!=="ready"||!a.guide)return[p("p",{role:"status"},a.status==="loading"?"Loading guide…":"This guide isn't available right now."),p("div",{class:"row"},f("Back",()=>e.open()),f("Close",()=>e.close()))];const v=a.guide,h=v.steps[a.step];if(!h)return[];const C=a.step+1===v.steps.length,x=[p("h2",{},v.title),p("p",{class:"muted"},`Step ${a.step+1} of ${v.steps.length}`),p("p",{},p("strong",{},h.title)),h.instruction&&p("p",{},h.instruction),a.anchor==="missing"&&p("p",{class:"muted"},"The part of the page this step uses isn't shown here. Follow the steps in the text."),h.screenshotUrl&&p("img",{referrerpolicy:"no-referrer",src:h.screenshotUrl,alt:`Screenshot for: ${h.title}`,loading:"lazy"}),a.notice&&p("p",{class:"muted",role:"status"},_[a.notice]??"")];if(a.checkin==="asking")x.push(p("div",{role:"group","aria-label":"Step check-in"},p("p",{},"Did this step make sense?"),p("div",{class:"row"},f("Understood",()=>e.answer("understood"),{id:"jz-help-yes"}),f("Confused",()=>e.answer("confused")),f("Skip",()=>e.skipCheckin()))));else if(a.checkin==="needs-consent"){const w=p("p",{},o||"Loading…");o||t.consentText().then(y=>{o=y,w.textContent=y}),x.push(p("div",{role:"group","aria-label":"Consent"},w,p("div",{class:"row"},f("Allow and send",()=>e.giveConsent(),{id:"jz-help-allow"}),f("Not now",()=>e.declineConsent()))))}else a.checkin==="sending"?x.push(p("p",{role:"status"},"Sending…")):x.push(p("div",{class:"row"},f("Back",()=>e.back()),f(C?"Finish":"Next",()=>e.next(),{id:"jz-help-next"}),f("Close",()=>e.close())));return x}function z(a){if(!l)return;const{input:v,status:h,retry:C,list:x}=l;v.value!==a.query&&n.activeElement!==v&&(v.value=a.query),h.textContent=a.status==="loading"?"Loading guides…":a.status==="error"?"Help isn't available right now.":a.results.length===0?a.query?`No guide matches “${a.query}”.`:"No guides yet.":"",h.hidden=h.textContent==="",C.hidden=a.status!=="error",x.replaceChildren(...a.results.map((w,y)=>p("li",{},f(w.title||"Untitled guide",()=>e.openGuide(w.journeyId??""),{id:`jz-help-g${y}`}),w.goal?p("p",{class:"muted"},w.goal):void 0)))}const q=e.subscribe(E);return{destroy(){q(),i.remove(),s.remove()}}},K="http://www.w3.org/2000/svg",je="M6.1 6.2a2 2 0 1 1 2.7 1.9c-.7.3-1 .6-1 1.3v.5H6.4v-.6c0-1.1.4-1.6 1.2-2 .5-.2.8-.5.8-1a1 1 0 0 0-2 0v.1H6.1zM7.2 11.4h1.6V13H7.2z";function ze(n){const e=document.createElementNS(K,"svg");e.setAttribute("viewBox","0 0 16 16"),e.setAttribute("width","14"),e.setAttribute("height","14"),e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false");const t=document.createElementNS(K,"path");return t.setAttribute("d",n),t.setAttribute("fill","currentColor"),e.append(t),e}function Ce(n,e){const t=document.createElement("button");return t.type="button",t.id="jz-help-callout",t.className="callout-btn",t.append(ze(je),document.createTextNode("This is confusing")),t.addEventListener("click",()=>n.sendCallout(e)),t}function Se(n,e){const t=document.createElement("form");t.setAttribute("aria-label","Ask for something you could not find");const i=document.createElement("p");i.textContent="Couldn't find it? Tell us what you were trying to do.";const s=document.createElement("textarea");s.id="jz-help-request",s.setAttribute("aria-label","What were you trying to do?"),s.maxLength=4e3,s.rows=3,s.value=`I couldn't find how to ${e}`;const o=document.createElement("button");return o.type="submit",o.id="jz-help-request-send",o.textContent="Send request",t.append(i,s,o),t.addEventListener("submit",g=>{g.preventDefault(),n.sendRequest(s.value)}),t}function d(n,e={},...t){const i=document.createElement(n);for(const[s,o]of Object.entries(e))i.setAttribute(s,o);for(const s of t)s&&i.append(s);return i}function D(n,e){const t=d(n,{...e,crossorigin:"anonymous"});return Object.assign(t,{referrerPolicy:"no-referrer"}),t.setAttribute("referrerpolicy","no-referrer"),t}const P="http://www.w3.org/2000/svg";function Ee(n){const e=document.createElementNS(P,"svg");e.setAttribute("viewBox","0 0 16 16"),e.setAttribute("width","14"),e.setAttribute("height","14"),e.setAttribute("aria-hidden","true"),e.setAttribute("focusable","false");const t=document.createElementNS(P,"path");return t.setAttribute("d",n),t.setAttribute("fill","currentColor"),e.append(t),e}const Ie="M6.2 11.4 3 8.2l1.1-1.1 2.1 2.1 4.6-4.6 1.1 1.1z",Fe="M6.1 6.2a2 2 0 1 1 2.7 1.9c-.7.3-1 .6-1 1.3v.5H6.4v-.6c0-1.1.4-1.6 1.2-2 .5-.2.8-.5.8-1a1 1 0 0 0-2 0v.1H6.1zM7.2 11.4h1.6V13H7.2z",U={sent:"Thanks. Your answer was sent.",queued:"Saved. It will send when you're back online.",dropped:"Your answer couldn't be sent."},V={sent:"Thanks. We'll take a look.",queued:"Saved. It will send when you're back online.",dropped:"Your request couldn't be sent."},Te=(n,e,t)=>{const i=d("button",{type:"button",class:"launcher","aria-label":"Help","aria-expanded":"false","aria-controls":"jz-help-panel"},"?"),s=d("div",{id:"jz-help-panel",class:"panel",role:"dialog","aria-modal":"false","aria-label":"Help"});s.hidden=true,n.append(i,s);let o="",g=false,l,f,E,T,z=false;const q=r=>!z&&r.view==="index"&&r.status==="ready"&&!!r.jobs?.length;i.addEventListener("click",()=>e.state.view==="closed"?e.open():e.close()),s.addEventListener("keydown",r=>{r.key==="Escape"&&(r.stopPropagation(),e.close())});const a=(r,c,b={})=>{const k=d("button",{type:"button",...b},r);return k.addEventListener("click",c),k},v=()=>{const r=d("p",{},o||"Loading…");return o||t.consentText().then(c=>{o=c,r.textContent=c}),d("div",{class:"checkin",role:"group","aria-label":"Consent"},r,d("div",{class:"row"},a("Allow and send",()=>e.giveConsent(),{id:"jz-help-allow",class:"primary"}),a("Not now",()=>e.declineConsent())))},h=()=>d("div",{class:"panel-head"},d("h2",{},"Help"),a("×",()=>e.close(),{class:"icon-btn","aria-label":"Close help"})),C=(r,c,b)=>{const k=d("button",{type:"button",id:`jz-help-${c}`,class:`checkin-btn ${c}`});return k.append(Ee(c==="understood"?Ie:Fe),d("span",{},r)),k.addEventListener("click",b),k};function x(r){const c=n.activeElement,b=c!==null&&s.contains(c),k=b?c.id:"";i.hidden=r.view==="disabled";const j=r.view!=="closed"&&r.view!=="disabled";if(i.setAttribute("aria-expanded",String(j)),s.hidden=!j,r.view==="index"&&!q(r)&&l&&s.contains(l.input)){y(r),b&&c&&!c.isConnected&&(k&&n.getElementById(k)||l.input).focus(),g=j;return}if(l=void 0,s.replaceChildren(...(j?w(r):[]).filter(F=>!!F)),j&&(!g||b)){const u=(k?n.getElementById(k):null)??s.querySelector("[data-autofocus]")??s.querySelector("input, [role=group] button, button");u?.focus(),u instanceof HTMLInputElement&&u.setSelectionRange(u.value.length,u.value.length)}!j&&g&&i.focus(),g=j}function w(r){if(E?.owns(r))return E.content(r);if(q(r))return T??(T=import("./jobs-CAXbM5-g.js").then(A=>{E=A.jobsUi({controller:e,options:t,el:d,button:a,consentGroup:v,rerender:()=>x(e.state),checkinNotice:U})},()=>{z=true}).then(()=>x(e.state))),[h(),d("p",{class:"muted",role:"status"},"Loading…")];if(r.view==="index"){const A=d("input",{id:"jz-help-search",type:"search","aria-label":"Search help",placeholder:"How do I…",autocomplete:"off"});return A.value=r.query,A.addEventListener("input",()=>e.search(A.value)),l={input:A,status:d("p",{class:"muted",role:"status"}),retry:d("div",{class:"row"},a("Try again",()=>e.open())),request:d("div",{class:"request"}),signal:d("div",{class:"signal"}),list:d("ul",{"aria-label":"Guides"})},y(r),[h(),A,l.status,l.retry,l.request,l.signal,l.list]}if(r.view==="finished")return[h(),d("h2",{},`You finished “${r.guide.title}”`),r.notice&&d("p",{class:"muted",role:"status"},U[r.notice]??""),d("div",{class:"row"},a("More guides",()=>e.open(),{id:"jz-help-more"}),a("Back",()=>e.back()),a("Close",()=>e.close()))];if(r.view!=="guide")return[];if(r.status!=="ready"||!r.guide)return[h(),d("p",{role:"status"},r.status==="loading"?"Loading guide…":"This guide isn't available right now."),d("div",{class:"row"},a("Back",()=>e.open()),a("Close",()=>e.close()))];const c=r.guide,b=c.steps[r.step];if(!b)return[];const k=r.step+1===c.steps.length,j=c.steps.length,F=d("div",{class:"progress","aria-hidden":"true"},d("div",{class:"progress-fill"})),u=F.firstElementChild;u.style.width=`${Math.round((r.step+1)/j*100)}%`;const I=[d("h2",{},c.title),d("p",{class:"muted"},`Step ${r.step+1} of ${j}`),F,d("p",{class:"step-title"},b.title),b.instruction&&d("p",{},b.instruction),r.anchor==="missing"&&d("p",{class:"muted"},"The part of the page this step uses isn't shown here. Follow the steps in the text."),b.screenshotUrl&&D("img",{src:b.screenshotUrl,alt:`Screenshot for: ${b.title}`,loading:"lazy"})];if(c.videoUrl){const A=D("video",{controls:"",preload:"none",src:c.videoUrl});c.captionsUrl&&A.append(D("track",{kind:"captions",src:c.captionsUrl,default:""})),I.push(A)}const S=[h(),d("div",{class:"card"},...I),r.notice&&d("p",{class:"muted",role:"status"},U[r.notice]??"")];return r.checkin==="asking"?S.push(d("div",{class:"checkin",role:"group","aria-label":"Step check-in"},d("p",{},"Did this step make sense?"),d("div",{class:"row"},C("Understood","understood",()=>e.answer("understood")),C("Confused","confused",()=>e.answer("confused")),a("Skip",()=>e.skipCheckin())))):r.checkin==="needs-consent"?S.push(v()):r.checkin==="sending"?S.push(d("p",{role:"status"},"Sending…")):(r.signal==="needs-consent"?S.push(v()):r.signal==="sending"?S.push(d("p",{role:"status"},"Sending…")):r.signalNotice&&S.push(d("p",{class:"muted",role:"status"},V[r.signalNotice]??"")),e.canSignal()&&S.push(Ce(e,b.index)),S.push(d("div",{class:"row"},a("Back",()=>e.back()),a(k?"Finish":"Next",()=>e.next(),{id:"jz-help-next"}),a("Close",()=>e.close())))),S}function y(r){if(!l)return;const{input:c,status:b,retry:k,request:j,signal:F,list:u}=l;if(c.value!==r.query&&n.activeElement!==c&&(c.value=r.query),b.textContent=r.status==="loading"?"Loading guides…":r.status==="error"?"Help isn't available right now.":r.results.length===0?r.query?`No guide matches “${r.query}”.`:"No guides yet.":"",b.hidden=b.textContent==="",k.hidden=r.status!=="error",r.status==="ready"&&r.query.trim()!==""&&r.results.length===0&&e.canSignal()){const S=r.query.trim();(f!==S||!j.firstElementChild)&&(f=S,j.replaceChildren(Se(e,S)))}else j.firstElementChild&&(f=void 0,j.replaceChildren());r.signal==="needs-consent"?F.replaceChildren(v()):r.signal==="sending"?F.replaceChildren(d("p",{role:"status"},"Sending…")):r.signalNotice?F.replaceChildren(d("p",{class:"muted",role:"status"},V[r.signalNotice]??"")):F.firstElementChild&&F.replaceChildren(),u.replaceChildren(...r.results.map((S,A)=>d("li",{},a(S.title||"Untitled guide",()=>e.openGuide(S.journeyId??""),{id:`jz-help-g${A}`}),S.goal?d("p",{class:"muted"},S.goal):void 0)))}const N=e.subscribe(x);return{destroy(){N(),E?.destroy(),i.remove(),s.remove()}}},Ae=500,qe=6e3;async function Ne(n,e){const t=e.trim();if(!t||[...t].length>Ae||!n.canSignal()||!n.hasConsent())return;const i={siteKey:n.siteKey,consentGiven:true,text:t};n.reviewerToken&&(i.reviewerToken=n.reviewerToken);let s;try{const o=await Promise.race([Y(n.endpoint,"RouteIntent",i,n.fetchImpl),new Promise(g=>s=setTimeout(g,qe))]);return o?.jobId?{jobId:o.jobId,journeyId:o.journeyId||void 0}:void 0}catch{return}finally{clearTimeout(s)}}const He=`
22
- :host {
23
- all: initial;
24
- --jz-canvas:#F7F7F5; --jz-surface:#FFFFFF; --jz-raised:#F0F0EC; --jz-ink:#1D2024; --jz-muted:#5D636B;
25
- --jz-faint:#6C727B; --jz-rule:rgb(29 32 36 / 12%); --jz-accent:#3D63C9; --jz-accent-ink:#FFFFFF;
26
- --jz-accent-soft:rgb(61 99 201 / 10%); --jz-polished:#2F7D4F; --jz-confused:#6E4FC2;
27
- --jz-shadow:0 1px 3px rgb(0 0 0 / 12%);
28
- font: 400 13px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
29
- color: var(--jz-ink); -webkit-font-smoothing: antialiased;
30
- }
31
- @media (prefers-color-scheme: dark) {
32
- :host {
33
- --jz-canvas:#111316; --jz-surface:#181B1F; --jz-raised:#20242A; --jz-ink:#E8EAED; --jz-muted:#A3A9B2;
34
- --jz-faint:#8A919B; --jz-rule:rgb(232 234 237 / 12%); --jz-accent:#7F9CF0; --jz-accent-ink:#111316;
35
- --jz-accent-soft:rgb(127 156 240 / 14%); --jz-polished:#5DBB84; --jz-confused:#A48BEA;
36
- }
37
- }
38
- *, *::before, *::after { box-sizing: border-box; }
39
- button { font: inherit; color: inherit; cursor: pointer; }
40
- :focus-visible { outline: 2px solid var(--jz-accent); outline-offset: 2px; }
41
- button:disabled { opacity: .45; cursor: not-allowed; }
42
- [hidden] { display: none !important; }
43
-
44
- .launcher { position:fixed; left:24px; bottom:24px; z-index:2147483646; width:44px; height:44px; min-width:44px; min-height:44px;
45
- display:flex; align-items:center; justify-content:center; padding:0; border:1px solid var(--jz-accent); border-radius:999px;
46
- background:var(--jz-accent); color:var(--jz-accent-ink); font-size:18px; font-weight:600; box-shadow:var(--jz-shadow);
47
- transition: background 180ms ease-out, transform 180ms ease-out; }
48
- .launcher:hover, .launcher[aria-expanded="true"] { background:var(--jz-ink); border-color:var(--jz-ink); }
49
-
50
- .panel { position:fixed; left:24px; bottom:80px; z-index:2147483646; width:min(360px, calc(100vw - 48px));
51
- max-height:min(75vh, 580px); overflow:auto; padding:16px; border:1px solid var(--jz-rule); border-radius:10px;
52
- background:var(--jz-surface); color:var(--jz-ink); box-shadow:var(--jz-shadow);
53
- transition: opacity 180ms ease-out, transform 180ms ease-out; }
54
- .panel-head { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:12px; }
55
- .panel-head h2 { margin:0; font-size:14px; font-weight:600; }
56
- .icon-btn { width:44px; height:44px; min-width:44px; display:flex; align-items:center; justify-content:center; padding:0;
57
- border:0; border-radius:6px; background:transparent; color:var(--jz-faint); transition: color 180ms ease-out, background 180ms ease-out; }
58
- .icon-btn:hover { color:var(--jz-ink); background:var(--jz-raised); }
59
-
60
- .panel input { width:100%; min-height:44px; padding:8px 12px; border:1px solid var(--jz-rule); border-radius:6px;
61
- background:var(--jz-canvas); color:var(--jz-ink); font:inherit; }
62
- .panel input::placeholder { color:var(--jz-faint); }
63
- .panel ul { list-style:none; padding:0; margin:12px 0 0; }
64
- .panel li { margin:0 0 8px; }
65
- .panel li button { display:block; width:100%; min-height:44px; text-align:left; padding:8px 12px; border:1px solid var(--jz-rule);
66
- border-radius:6px; background:var(--jz-surface); color:inherit; font:inherit; transition: background 180ms ease-out, border-color 180ms ease-out; }
67
- .panel li button:hover { background:var(--jz-raised); border-color:var(--jz-accent); }
68
- .muted { color:var(--jz-muted); font-size:12px; margin:4px 0 0; }
69
- .row { display:flex; gap:8px; flex-wrap:wrap; margin-top:12px; }
70
- .row button { min-height:44px; padding:0 16px; border:1px solid var(--jz-rule); border-radius:6px; background:var(--jz-surface);
71
- color:var(--jz-muted); transition: background 180ms ease-out, color 180ms ease-out; }
72
- .row button:hover { color:var(--jz-ink); background:var(--jz-raised); }
73
- .row .primary { border-color:var(--jz-accent); background:var(--jz-accent); color:var(--jz-accent-ink); }
74
-
75
- .card { border:1px solid var(--jz-rule); border-radius:10px; padding:16px; }
76
- .card h2 { margin:0 0 8px; font-size:14px; font-weight:600; }
77
- .progress { height:4px; margin:8px 0 12px; border-radius:999px; background:var(--jz-raised); overflow:hidden; }
78
- .progress-fill { height:100%; border-radius:999px; background:var(--jz-accent); transition: width 180ms ease-out; }
79
- .step-title { margin:0 0 8px; font-weight:600; }
80
- .panel img, .panel video { max-width:100%; margin-top:12px; border:1px solid var(--jz-rule); border-radius:6px; }
81
-
82
- .checkin { margin-top:12px; padding-top:12px; border-top:1px solid var(--jz-rule); }
83
- .checkin p { margin:0 0 8px; }
84
- .callout-btn { display:inline-flex; align-items:center; gap:6px; margin-top:12px; min-height:44px; padding:0 16px;
85
- border:1px solid var(--jz-confused); border-radius:6px; background:var(--jz-surface); color:var(--jz-confused);
86
- transition: background 180ms ease-out, color 180ms ease-out; }
87
- .callout-btn:hover { background:var(--jz-raised); }
88
- .callout-btn svg { flex:none; }
89
- .request { margin-top:12px; }
90
- .request p { margin:0 0 8px; color:var(--jz-muted); font-size:12px; }
91
- .request textarea { display:block; width:100%; padding:8px 12px; border:1px solid var(--jz-rule); border-radius:6px;
92
- background:var(--jz-canvas); color:var(--jz-ink); font:inherit; resize:vertical; }
93
- .request button { margin-top:8px; min-height:44px; padding:0 16px; border:1px solid var(--jz-accent);
94
- border-radius:6px; background:var(--jz-accent); color:var(--jz-accent-ink); }
95
- .checkin-btn { display:inline-flex; align-items:center; gap:6px; }
96
- .checkin-btn.understood { color:var(--jz-polished); border-color:var(--jz-polished); }
97
- .checkin-btn.confused { color:var(--jz-confused); border-color:var(--jz-confused); }
98
- .checkin-btn svg { flex:none; }
99
-
100
- @media (prefers-reduced-motion: reduce) {
101
- :host *, :host *::before, :host *::after { animation-duration:1ms !important; transition-duration:1ms !important; }
102
- }
103
- .jz-help-highlight { position:fixed; z-index:2147483645; pointer-events:none; box-sizing:border-box;
104
- border:2px solid var(--jz-accent); border-radius:6px; box-shadow:0 0 0 4px var(--jz-accent-soft); }
105
- `;function $(n,e,t,i,s){const o={journeyId:e.slug||e.journeyId,journeyStep:String(t.index),pagePath:Q(i),device:n.device||W(s)};return n.persona&&(o.persona=n.persona),n.businessType&&(o.businessType=n.businessType),n.state&&(o.state=n.state),t.tflowId&&(o.tflowId=t.tflowId),o}function Me(n,e,t,i){return $(n,e.guide,e.step,t,i)}function Le(n,e,t){const i={pagePath:Q(e),device:n.device||W(t)};return n.persona&&(i.persona=n.persona),n.journeyId&&(i.journeyId=n.journeyId),n.journeyStep&&(i.journeyStep=n.journeyStep),n.businessType&&(i.businessType=n.businessType),n.state&&(i.state=n.state),i}function Be(n,e,t,i,s){if(t.kind==="callout")return{siteKey:n,consentGiven:true,kind:R.callout,context:$(e,t.guide,t.step,i,s)};const o=t.guide&&t.step?$(e,t.guide,t.step,i,s):Le(e,i,s),g={siteKey:n,consentGiven:true,kind:R.request,comment:t.text,context:o};return t.jobRequest&&(g.jobRequest=t.jobRequest),g}function De(n,e,t=ke){const i=ie(n),s=new ue({endpoint:i,siteKey:n.siteKey,reviewerToken:n.reviewerToken});let o;const g=Y(i,"GetWidgetConfig",{siteKey:n.siteKey}).then(u=>o=u,()=>{}),l=()=>!n.reviewerToken&&!n.userId,f=()=>l()&&o?.helpAudience!="reviewers",E=document.createElement("div");E.setAttribute("data-journeeze-help","");const T=E.attachShadow({mode:"closed"}),z=document.createElement("style");z.textContent=He,n.nonce&&(z.nonce=n.nonce),T.append(z);const q=new me(T);document.body.append(E);let a;const v=u=>(a??(a=import("./feedback-CtH1a_kQ.js").then(I=>I.feedbackChannel(n,i,{memoryOnly:f()})))).then(I=>I.outbox.enqueue(u),()=>"dropped");let h,C=false;const x=()=>ae(n),w=()=>f()?null:void 0,y=()=>oe(x(),w()),N=Z(n,i,e),r=()=>{C&&c.state.view!=="disabled"&&y()&&(h?.start(),N.start(g))},c=new he({endpoint:i,loadIndex:()=>s.index(),loadGuide:u=>s.guide(u),highlight:u=>q.show(u),clearHighlight:()=>q.hide(),hasConsent:y,giveConsent(){re(x(),w()),r()},signalsAllowed:()=>!l()||o?.anonymousAllowed==true,sendCheckin(u){return y()?(h?.checkin(u),v({siteKey:n.siteKey,consentGiven:true,context:Me(e(),u,location.href,window.innerWidth),reaction:ee[u.answer]})):Promise.resolve("dropped")},sendSignal(u){return!c.canSignal()||!y()?Promise.resolve("dropped"):v(Be(n.siteKey,e(),u,location.href,window.innerWidth))}});n.noTelemetry||(h=ye(i,n.siteKey,c)),c.subscribe(r);let b,k=false,j;const F=u=>{const I=u.available?"on":u.reason;if(!(k||I===j)){j=I;try{n.onHelpStatus?.(u)}catch{}}};return c.subscribe(()=>{j!==void 0&&c.state.view==="disabled"&&F({available:false,reason:"disabled"})}),Promise.all([c.probe(),g]).then(()=>{if(!k){if(c.state.view==="disabled")return F({available:false,reason:"disabled"});F(o?.helpAudience=="reviewers"&&!n.reviewerToken?{available:false,reason:"audience"}:{available:true}),C=true,r(),b=t(T,c,{consentText:()=>g.then(u=>u?.consentText||se),persona:()=>e().persona,jobEvent(u){C&&c.state.view!=="disabled"&&y()&&h?.job(u)},routeIntent:u=>Ne({endpoint:i,siteKey:n.siteKey,reviewerToken:n.reviewerToken,hasConsent:y,canSignal:()=>c.canSignal()},u),addStyle(u){const I=document.createElement("style");I.textContent=u,n.nonce&&(I.nonce=n.nonce),T.append(I)}})}}),{unmount(u){k=true,c.close(),h?.stop(u),N.stop(u),b?.destroy(),q.dispose(),E.remove(),a?.then(I=>I.dispose())},contextChanged:()=>{c.refreshHighlight(),N.contextChanged()}}}const Ke=(n,e)=>De(n,()=>de(e()),Te);export{ue as HelpClient,he as HelpController,me as Highlighter,pe as MAX_REQUEST_CHARS,_e as PANEL_CSS,Me as checkinContext,xe as findAnchor,$ as guideStepContext,L as isHelpDisabled,Ke as mount,De as mountHelp,Le as pageContext,ke as placeholderView,O as searchGuides,Be as signalRequest,ge as toView};
@@ -1,20 +0,0 @@
1
- import "./loader-BZiIDD1D.js";
2
- import "./context-UnG6_X61.js";
3
- const n = "input, textarea, select, [data-jz-mask]";
4
- function r(t) {
5
- if (t.isContentEditable === !0) return !0;
6
- const e = t.getAttribute("contenteditable");
7
- return e !== null && e.trim().toLowerCase() !== "false";
8
- }
9
- function a(t) {
10
- return t.matches(n) || r(t);
11
- }
12
- function o(t) {
13
- for (let e = t; e; e = e.parentElement)
14
- if (a(e)) return !0;
15
- return !1;
16
- }
17
- export {
18
- a,
19
- o as i
20
- };
@@ -1,96 +0,0 @@
1
- function C(e) {
2
- const c = `jz:reviewer:${e}`;
3
- let r = null;
4
- try {
5
- const t = new URL(location.href);
6
- r = t.searchParams.get("jz_invite"), r ? (t.searchParams.delete("jz_invite"), history.replaceState(history.state, "", t.href), sessionStorage.setItem(c, r)) : r = sessionStorage.getItem(c);
7
- } catch {
8
- }
9
- return r || void 0;
10
- }
11
- function I(e) {
12
- try {
13
- sessionStorage.removeItem(`jz:reviewer:${e}`);
14
- } catch {
15
- }
16
- }
17
- const k = /^(?:[0-9a-f]{64}|[A-Za-z0-9_-]{43})$/, x = /^pk_[0-9a-f]{32}$/, S = () => import("./widget-B6mR1J3P.js"), T = () => import("./help-w0O5Qu-4.js"), z = () => import("./chat-BgmB0rnW.js").then((e) => e.c), g = /* @__PURE__ */ new Set();
18
- function p(e) {
19
- g.has(e) || (g.add(e), console.warn(`[journeeze] ${e}`));
20
- }
21
- function w(e) {
22
- if (e === void 0 || k.test(e)) return e;
23
- p("invalid userId ignored");
24
- }
25
- function b(e, c, r) {
26
- let t, l, i = 0, u = -1;
27
- const f = {
28
- on() {
29
- if (t) return Promise.resolve();
30
- if (l && u === i) return l;
31
- const s = u = i, n = e().then((a) => {
32
- s === i && !t && (t = c(a, () => f.off()), r?.(!0));
33
- }).finally(() => {
34
- l === n && (l = void 0);
35
- });
36
- return l = n, n;
37
- },
38
- off(s) {
39
- i++;
40
- const n = t;
41
- n && (t = void 0, n.unmount(s), r?.(!1));
42
- },
43
- mounted: () => t
44
- };
45
- return f;
46
- }
47
- const h = (e, c) => (...r) => {
48
- try {
49
- c(...r);
50
- } catch (t) {
51
- p(`${e} failed: ${String(t)}`);
52
- }
53
- };
54
- function E(e, c = S, r = e.chat ? z : T) {
55
- const { siteKey: t } = e, l = x.test(t);
56
- l || p("invalid siteKey");
57
- let i = w(e.userId), u = { ...e.context };
58
- const f = () => u, s = { ...e };
59
- Object.defineProperty(s, "userId", { get: () => i, enumerable: !0 }), e.respectGlobalPrivacyControl !== !1 && navigator.globalPrivacyControl && (s.noTelemetry = !0);
60
- const n = b(c, (o, d) => o.mount(s, f, d), (o) => s.onModeChange?.(o)), a = b(r, (o, d) => o.mount(s, f, d)), v = (o) => async () => {
61
- if (!l) throw new Error("[journeeze] invalid siteKey");
62
- return o.on();
63
- }, y = {
64
- enable: v(n),
65
- disable: h("disable", () => n.off()),
66
- isEnabled: () => !!n.mounted(),
67
- enableHelp: v(a),
68
- disableHelp: h("disableHelp", () => a.off()),
69
- isHelpEnabled: () => !!a.mounted(),
70
- feedback: () => v(e.chat ? a : n)().then(() => a.mounted()?.report?.()),
71
- setContext: h("setContext", (o) => {
72
- u = { ...u, ...o }, n.mounted()?.contextChanged?.(), a.mounted()?.contextChanged?.();
73
- }),
74
- getContext: f,
75
- setUser: h("setUser", (o, d) => {
76
- const m = w(o);
77
- i !== void 0 && m !== i && y.reset(), i = m, s.signature = m && d;
78
- }),
79
- reset: h("reset", () => {
80
- const o = !!a.mounted(), d = { ...s, userId: i };
81
- n.off(!0), a.off(!0), i = void 0, u = {}, delete s.reviewerToken, I(t), import("./feedback-CtH1a_kQ.js").then((m) => m.logout(d)).catch(() => {
82
- }).then(() => {
83
- o && !a.mounted() && a.on().catch(() => {
84
- });
85
- });
86
- })
87
- };
88
- return y;
89
- }
90
- export {
91
- x as S,
92
- k as U,
93
- E as c,
94
- C as t,
95
- p as w
96
- };
@@ -1,5 +0,0 @@
1
- import{s as u,c as f}from"./consent-DckCUvYR.js";import{w as d}from"./loader-BZiIDD1D.js";const i=50,m=/^[a-z0-9._:-]{1,96}$/,h=/^\[data-tflow-id="([^"\\]*)"\]$/,g=/^[\x20-\x7e]{1,200}$/,k=/[{};@\\<`]|\/\*|::/,s=new Set;function w(e,n,r){const t=h.exec(e.selector)?.[1];if(t!==void 0&&m.test(t))return{anchor:t,pagePath:n,rule:e.rule,detectedAt:r};if(!(!g.test(e.selector)||k.test(e.selector)))return{selector:e.selector,pagePath:n,rule:e.rule,detectedAt:r}}function $(e){return n=>n.hasAttribute("data-jz-mask")||e.some(r=>{try{return n.matches(r)}catch{return true}})}function y(e,n,r,t,o){const c=u(r),a=o.toISOString();return e(n,$(t)).map(l=>w(l,c,a)).filter(l=>l!==void 0)}async function T(e){const r=y(e.scan,document.body,location.href,e.maskSelectors??[],(e.now??(()=>new Date))()).filter(t=>{const o=`${t.pagePath}
2
- ${t.anchor??t.selector}
3
- ${t.rule}`;return s.has(o)?false:(s.add(o),true)});for(let t=0;t<r.length;t+=i){const o=r.slice(t,t+i);try{await f(e.endpoint,"SubmitMaskFindings",{siteKey:e.siteKey,reviewerToken:e.reviewerToken,findings:o},e.fetchImpl)}catch(c){for(const a of o)s.delete(`${a.pagePath}
4
- ${a.anchor??a.selector}
5
- ${a.rule}`);d(`mask audit not sent: ${String(c.code??c)}`)}}return r.length}function v(){s.clear()}export{y as auditPage,v as resetMaskAudit,T as runMaskAudit};
@@ -1 +0,0 @@
1
- import{T as c}from"./context-UnG6_X61.js";const p=/^[A-Za-z0-9][A-Za-z0-9._:/-]{0,127}$/,b=/^[a-z]{2,32}$/,m="input:not([type]),input[type=text],input[type=email],input[type=tel],input[type=url],input[type=password]",f={button:"button,input[type=button],input[type=submit],input[type=reset],input[type=image],summary",link:"a[href],area[href]",textbox:`textarea,${m}`,searchbox:"input[type=search]",checkbox:"input[type=checkbox]",radio:"input[type=radio]",combobox:"select:not([multiple]):not([size]),input[list]",listbox:"select[multiple],select[size],datalist",option:"option",slider:"input[type=range]",spinbutton:"input[type=number]",progressbar:"progress",heading:"h1,h2,h3,h4,h5,h6",img:"img[alt]:not([alt='']),svg[aria-label]",list:"ul,ol,menu",listitem:"li",table:"table",row:"tr",cell:"td",columnheader:"th",navigation:"nav",main:"main",form:"form",dialog:"dialog",article:"article",separator:"hr",group:"fieldset,details,optgroup"},d=new Set(["button","link","heading","option","cell","columnheader","row","listitem","tab","menuitem","checkbox","radio","switch","treeitem","tooltip"]),r=t=>(t??"").replace(/\s+/g," ").trim(),h=t=>{const o=t.getBoundingClientRect();return o.width>0||o.height>0};function g(t){const o=t.ownerDocument,e=[],n=t.getAttribute("id");if(n)for(const s of o.querySelectorAll("label"))s.getAttribute("for")===n&&e.push(s);const a=t.parentElement?.closest("label");return a&&!e.includes(a)&&e.push(a),e}function y(t,o){const e=t.ownerDocument,n=t.getAttribute("aria-labelledby");if(n){const i=r(n.split(/\s+/).map(l=>e.getElementById(l)?.textContent??"").join(" "));if(i)return i}const a=r(t.getAttribute("aria-label"));if(a)return a;const s=r(g(t).map(i=>i.textContent).join(" "));if(s)return s;const u=r(t.getAttribute("alt"));if(u)return u;if(t instanceof HTMLInputElement&&/^(button|submit|reset)$/.test(t.type)){const i=r(t.value);if(i)return i}if(d.has(o)){const i=r(t.textContent);if(i)return i}return r(t.getAttribute("title"))||r(t.getAttribute("placeholder"))}function v(t,o){const e=n=>[...o.querySelectorAll(n)];try{switch(t.by){case"tflow":return c.test(t.value)?e(`[data-tflow-id="${t.value}"]`):[];case"testId":return p.test(t.value)?e(`[data-testid="${t.value}"]`):[];case"role":{if(!b.test(t.value))return[];const n=f[t.value],a=e(n?`[role="${t.value}"],${n}`:`[role="${t.value}"]`),s=r(t.name);return a.filter(u=>{const i=u.getAttribute("role");return i&&i.split(/\s+/)[0]!==t.value?false:!s||y(u,t.value)===s})}case"css":return e(t.value)}}catch{}return[]}function A(t,o=document){for(const e of t){const n=v(e,o).filter(h);if(n.length===1)return n[0]}}export{y as accessibleName,A as resolveTarget};
@@ -1 +0,0 @@
1
- import{h as P,c as W,C as Y}from"./consent-DckCUvYR.js";import{p as J,j as T,s as q,M as Q,m as z,r as Z}from"./transport-B64CfIcF.js";function ee(n,u=globalThis.navigator){return n.respectGlobalPrivacyControl!==false&&u?.globalPrivacyControl===true}const M=50,x=32*1024,te=5e3,ne=1e3,ie=1e4,$=200,re=256*1024,c="HELP_EVENT_";function C(n,u){return n.version?{journeyId:n.journeyId,stepIndex:u,guideVersion:n.version}:{journeyId:n.journeyId,stepIndex:u}}const L=new Set([`${c}GUIDE_ABANDONED`,`${c}JOB_OUTCOME`]);function oe(n){return Math.min(Math.max(n??te,ne),ie)}function se(){return crypto.randomUUID()}function le(n){if(ee(n))return{checkin:()=>{},job:()=>{},stop:()=>{}};const u=n.fetchImpl??fetch,m=oe(n.flushMs),B=n.random??Math.random,k=n.newId??se;let t=[],o,s,l=false,y=false,_=0,g=0,r,A,N=false,j;const f=e=>{l||s||(s=setTimeout(()=>{s=void 0,D()},e))},K=()=>{for(t.length>$&&(t=t.slice(-$));t.length>0&&T(t)>re;)t=t.slice(1)},v=e=>{l||(_=_+1>>>0||1,t.push({...e,eventId:k(),seq:_}),K(),L.has(e.event)?(s&&clearTimeout(s),s=void 0,D()):f(m))},G=()=>{if(o)return o;if(t.length===0)return;const e=[];for(const i of t){if(e.length===M||e.length>0&&T([...e,i])>x)break;e.push(i)}return t=t.slice(e.length),{events:e,firstAttempt:Date.now(),retries:0}},b=e=>{const i={siteKey:n.siteKey,consentGiven:true,events:e};return g>0&&(i.droppedAtUnload=g),i},D=async()=>{if(y||l)return;if(!P(n.siteKey)){t=[],o=void 0;return}if(typeof navigator<"u"&&navigator.onLine===false)return;const e=G();if(!e)return;if(o=void 0,Date.now()-e.firstAttempt>Q){t.length>0&&f(m);return}y=true;const i=g;try{await W(n.endpoint,"RecordHelpEvents",b(e.events),u),g-=i}catch(h){const d=h instanceof Y?h:void 0,a=d?.status??0;if(d?.code==="failed_precondition")l=true,t=[];else if(z(e.retries,a)){e.retries+=1,o=e,y=false,f(Z(e.retries,d?.retryAfterMs,B));return}}finally{y=false}!l&&(t.length>0||o)&&f(t.length>=M?0:m)},H=()=>{if(l&&t.length===0&&!o||(s&&clearTimeout(s),s=void 0,!P(n.siteKey)))return;const e=[...o?.events??[],...t];if(e.length===0)return;const i=[...e.filter(a=>L.has(a.event)),...e.filter(a=>!L.has(a.event))],h=Math.min(J(),x),d=[];for(const a of i){if(d.length===M||T(b([...d,a]))>h)break;d.push(a)}d.length!==0&&q(n.endpoint,"RecordHelpEvents",b(d),u)&&(g+=e.length-d.length,t=[],o=void 0)};let w=false;const I=()=>{w||(w=true,H())},R=()=>{typeof document<"u"&&document.visibilityState==="hidden"&&I()},p=()=>{typeof document<"u"&&document.visibilityState!=="visible"||(w=false,(t.length>0||o)&&f(0))},U=()=>{(t.length>0||o)&&f(0)},S=()=>{r&&!r.done&&r.last!==void 0&&v({event:`${c}GUIDE_ABANDONED`,...C(r.guide,r.last)}),r=void 0,A=void 0},X=e=>{const i=j;if(j=e,i===void 0)return;if(e.view==="disabled"){l=true,t=[];return}i.view==="closed"&&(e.view==="index"||e.view==="guide")&&v({event:`${c}HELP_OPENED`,entry:e.view==="index"?"HELP_ENTRY_LAUNCHER":"HELP_ENTRY_API"});const h=e.view==="guide"||e.view==="finished"?e.guide:void 0,d=e.view==="guide"?e.journeyId:h?.journeyId;if(r&&d!==r.guide.journeyId&&S(),e.view==="guide"&&e.status==="ready"&&e.guide){r||(r={guide:e.guide,seen:new Set,done:false});const E=e.guide.steps[e.step],O=E&&`${e.guide.journeyId}/${e.step}`;E&&O!==A&&(A=O,r.last=E.index,v({event:`${c}${r.seen.has(E.index)?"STEP_REPEATED":"STEP_REACHED"}`,...C(e.guide,E.index)}),r.seen.add(E.index))}else e.view==="finished"&&r&&(r.done=true,S());const a=e.view==="index"&&e.status==="ready"&&e.query.trim()!==""&&e.results.length===0;a&&!N&&v({event:`${c}SEARCH_NO_RESULT`}),N=a},F=n.subscribe(X);addEventListener("pagehide",I),addEventListener("visibilitychange",R),addEventListener("visibilitychange",p),addEventListener("pageshow",p),addEventListener("online",U);const V=()=>{removeEventListener("pagehide",I),removeEventListener("visibilitychange",R),removeEventListener("visibilitychange",p),removeEventListener("pageshow",p),removeEventListener("online",U)};return{checkin(e){v({event:`${c}CHECKIN_ANSWERED`,...C(e.guide,e.step.index),answer:e.answer==="confused"?"CHECKIN_ANSWER_CONFUSED":"CHECKIN_ANSWER_UNDERSTOOD"})},job(e){const i={event:`${c}JOB_${e.event}`,jobId:e.jobId};e.jobVersion&&(i.jobVersion=e.jobVersion),e.persona&&(i.persona=e.persona),e.event==="OUTCOME"&&(i.jobAnswer=`JOB_ANSWER_${e.answer}`,e.harder!==void 0&&(i.harderThanExpected=e.harder)),v(i)},stop(e){if(F(),V(),!l){if(e){t=[],o=void 0,s&&clearTimeout(s),s=void 0,l=true;return}S(),l=true,H()}}}}export{te as FLUSH_MS,M as MAX_BATCH,x as MAX_BATCH_BYTES,ie as MAX_FLUSH_MS,$ as MAX_QUEUED,re as MAX_QUEUED_BYTES,ne as MIN_FLUSH_MS,ee as gpcRefusesTelemetry,le as startTelemetry};