@snippyly/plugin-staging 1.0.889 → 1.0.891

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/snippyly.js CHANGED
@@ -68,7 +68,7 @@ const at=1,lt=2,ct=t=>(...e)=>({_$litDirective$:t,values:e});class dt{constructo
68
68
  * @license
69
69
  * Copyright 2017 Google LLC
70
70
  * SPDX-License-Identifier: BSD-3-Clause
71
- */class ut extends dt{constructor(t){if(super(t),this.it=R,t.type!==lt)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===R||null==t)return this.ft=void 0,this.it=t;if(t===D)return t;if("string"!=typeof t)throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this.ft;this.it=t;const e=[t];return e.raw=e,this.ft={_$litType$:this.constructor.resultType,strings:e,values:[]}}}ut.directiveName="unsafeHTML",ut.resultType=1;const pt=ct(ut);class vt{}vt.Events={GUEST_MODE_SIGN_IN_DIALOG_SHOWN:"guestModeSignInDialogShown",GUEST_MODE_NAME_DIALOG_SHOWN:"guestModeNameDialogShown",GUEST_MODE_SIGN_IN_BANNER_SHOWN:"guestModeSignInBannerShown",GUEST_MODE_SIGN_IN_BUTTON_CLICKED:"guestModeSignInButtonClicked",PASSWORD_PROTECTED_MODAL_CLOSE_BUTTON_CLICKED:"passwordProtectedModalCloseButtonClicked",PASSWORD_PROTECTED_MODAL_OPEN_BUTTON_CLICKED:"passwordProtectedModalOpenButtonClicked",TOOLBAR_EXPANDED:"toolbarExpanded",TOOLBAR_COLLAPSED:"toolbarCollapsed",TOOLBAR_NOTIFICATION_CLICKED:"toolbarNotificationClicked",GUEST_MODE_SKIP_BUTTON_CLICKED:"guestModeSkipButtonClicked",GUEST_MODE_SIGN_IN_NUDGE_SHOWN:"guestModeSignInNudgeShown",GUEST_MODE_NAME_NUDGE_SHOWN:"guestModeNameNudgeShown",GUEST_MODE_SIGN_IN_CLICKED:"guestModeSignInClicked",GUEST_MODE_PRESENT:"guestModePresent",GUEST_MODE_NAME_ADDED:"guestModeNameAdded",REVIEW_PASSWORD_ADDED:"reviewPasswordAdded",REVIEW_PASSWORD_REJECTED:"reviewPasswordRejected",REVIEW_PASSWORD_ACCEPTED:"reviewPasswordAccepted",PRIVATE_MODE_ENABLED:"privateModeEnabled",PRIVATE_MODE_DISABLED:"privateModeDisabled",VISIBILITY_OPTIONS_ENABLED:"visibilityOptionsEnabled",VISIBILITY_OPTIONS_DISABLED:"visibilityOptionsDisabled",VIEW_PROJECT_CLICKED:"viewProjectClicked",REPORT_BUG_CLICKED:"reportBugClicked",REPORT_BUG_SUBMITTED:"reportBugSubmitted",OPEN_MOBILE_CLICKED:"openMobileClicked",EXIT_REVIEW_MODE_CLICKED:"exitReviewModeClicked",SIGNOUT_CLICKED:"signoutClicked",SIGNIN_CLICKED:"signinClicked",SIGN_IN_REQUIRED:"signInRequired",USER_EMAIL_NOT_WHITELISTED:"userEmailNotWhitelisted",DOMAIN_NOT_WHITELISTED:"domainNotWhitelisted",DUPLICATE_SCRIPT_INSTALLED:"duplicateScriptInstalled",TOOLBAR_DISABLED:"toolbarDisabled",INVITE_MODAL_OPENED:"inviteModalOpened",INVITE_SENT:"inviteSent",QUALITY_CHECK_RUN_TOOLBAR_CLICKED:"qualityCheckRunFromToolbarClicked"};const gt="1.0.748",ft="6.0.5",mt="6.0.12",wt=["v3ogId1G43AFHehEOewv","rNYzMJd13L27xtfipmSK","aU1MxKP0rca2UXwKi8bl"],yt="sfSidebarV2Enabled",bt="sfUseProxy",Ct=["v3ogId1G43AFHehEOewv"],xt=[],Et="review",kt="feedback",St="sembed",Mt="scommentmode",Tt="sreadonly",At="sagentcomments",_t="spath",It="sonboarding",$t="sf-onboarding-agent-status",Nt="sf-onboarding-ready",Ot="sf-onboarding-diagnostics-request",Lt="sf-onboarding-diagnostics",Dt=3e5,Rt=["failed","systemError","error"],Ft={SDK_NOT_READY:"sdk-not-ready",SDK_RETURNED_NULL:"sdk-returned-null",FETCH_THREW:"fetch-threw"},Pt="sfOnboardingSidebarDismissed",Vt="Unknown Agent",jt=[{hostSuffix:"cloudfunctions.net",pathPrefix:"/previewproxy"},{hostSuffix:"api.velt.dev",pathPrefix:"/previewproxy"}],Ut="sf-preview-navigate",zt="sfPageCommentsHidden",Bt="sreviewId",Ht="scommentId",Gt="snippyly-user",Wt="st",Zt="_sfut",Kt="_sfgut",Yt="projectVersionKey",Jt="projectVersion",qt="sversion",Qt="sprojectInstall",Xt="sflivedemo",te="sffigmademo",ee="sfTourCommentTooltip",ie="sfUserAdmin",oe="sfGuestMode",ne="sfPasswordProtected",re="sfQueryParamsComments",se="sfUsePageTitleAsLocationName",ae="sfPasswordIsValid",le="sfPrivateMode",ce="organizationPrivate",de="sfGuestModeAllowSignIn",he="sfGuestUserModelOpened",ue="sfGuestUserNameUpdated",pe="sfGuestUserBannerOpened",ve="sfCustomerMetadata",ge="sfContentWarningSidebarOpen",fe={LOADING:"loading",RUNNING:"running",FINDINGS:"findings",CLEAN:"clean",IDLE:"idle"},me={QA_AGENTS:"QA Agents",LOADING:"Running QA Agents",RUNNING:"Running",RUNNING_SINGLE:"Running 1 QA Agent",FINDING_SINGLE:"1 Agent Finding",FINDINGS:"Agent Findings",NO_ISSUES_FOUND:"No Issues Found"},we="sfNativeScreenshotPermission",ye="sfSamlConfig",be=[{hostSuffix:"drive.usesuperflow.com",pathPrefix:"/"},{hostSuffix:"superflow-file-viewer-staging.web.app",pathPrefix:"/"},{hostSuffix:"app.usesuperflow.com",pathPrefix:"/drive"},{hostSuffix:"superflow-portal-v2-staging.firebaseapp.com",pathPrefix:"/drive"},{hostSuffix:"superflow-portal-v2-staging.web.app",pathPrefix:"/drive"},{hostSuffix:"superflow-portal-v2-prod.firebaseapp.com",pathPrefix:"/drive"},{hostSuffix:"superflow-portal-v2-prod.web.app",pathPrefix:"/drive"}],Ce=["app.usesuperflow.com","superflow-portal-v2-staging.firebaseapp.com"],xe="terminal",Ee="suggestion",ke={AGENT:"agent:",AGENT_TYPE_CUSTOM:"agentType:custom"},Se={SPELL_CHECK:"spell-check",BROKEN_LINKS:"broken-links",GRAMMAR_CHECK:"grammar-check"},Me={VELT_ROOT:"velt-root",VELT_PRESENCE:"velt-presence",VELT_CURSOR:"velt-cursor",VELT_COMMENT_TOOL:"velt-comment-tool",VELT_COMMENTS:"velt-comments",SNIPPYLY_TEXT_HIGHLIGHT:"snippyly-text-highlight",VELT_COMMENTS_SIDEBAR_LEGACY:"velt-comments-sidebar",VELT_COMMENTS_SIDEBAR_V2:"velt-comments-sidebar-v2",VELT_HUDDLE:"velt-huddle",VELT_RECORDER_NOTES:"velt-recorder-notes",VELT_RECORDER_CONTROL_PANEL:"velt-recorder-control-panel",VELT_ARROWS:"velt-arrows",VELT_NOTIFICATIONS_HISTORY_PANEL:"velt-notifications-history-panel"},Te={ENABLE_URL_NAVIGATION:"enable-url-navigation",URL_NAVIGATION:"url-navigation",CURRENT_LOCATION_SUFFIX:"current-location-suffix",SIDEBAR_BUTTON_COUNT_TYPE:"sidebar-button-count-type",CUSTOM_ACTIONS:"custom-actions"},Ae="filter",_e={customBranding:{logo:{logoMark:{lightUrl:'\n\t\t\t\t<svg viewBox="0 0 49 48" fill="none" xmlns="http://www.w3.org/2000/svg">\n\t\t\t\t\t<path d="M8 8C8 3.58172 11.5817 0 16 0V0C20.4183 0 24 3.58172 24 8V16H16C11.5817 16 8 12.4183 8 8V8Z" fill="#FFCD2E"/>\n\t\t\t\t\t<path d="M0 29C0 22.3726 5.37258 17 12 17H24V29C24 35.6274 18.6274 41 12 41V41C5.37258 41 0 35.6274 0 29V29Z" fill="#A259FE"/>\n\t\t\t\t\t<path d="M25 19C25 12.3726 30.3726 7 37 7V7C43.6274 7 49 12.3726 49 19V19C49 25.6274 43.6274 31 37 31H25V19Z" fill="#FF7162"/>\n\t\t\t\t\t<path d="M25 32H33C37.4183 32 41 35.5817 41 40V40C41 44.4183 37.4183 48 33 48V48C28.5817 48 25 44.4183 25 40V32Z" fill="#0DCF82"/>\n\t\t\t\t</svg>\n\t\t\t\t',darkUrl:'\n\t\t\t\t<svg viewBox="0 0 49 48" fill="none" xmlns="http://www.w3.org/2000/svg">\n\t\t\t\t\t<path d="M8 8C8 3.58172 11.5817 0 16 0V0C20.4183 0 24 3.58172 24 8V16H16C11.5817 16 8 12.4183 8 8V8Z" fill="#FFCD2E"/>\n\t\t\t\t\t<path d="M0 29C0 22.3726 5.37258 17 12 17H24V29C24 35.6274 18.6274 41 12 41V41C5.37258 41 0 35.6274 0 29V29Z" fill="#A259FE"/>\n\t\t\t\t\t<path d="M25 19C25 12.3726 30.3726 7 37 7V7C43.6274 7 49 12.3726 49 19V19C49 25.6274 43.6274 31 37 31H25V19Z" fill="#FF7162"/>\n\t\t\t\t\t<path d="M25 32H33C37.4183 32 41 35.5817 41 40V40C41 44.4183 37.4183 48 33 48V48C28.5817 48 25 44.4183 25 40V32Z" fill="#0DCF82"/>\n\t\t\t\t</svg>\n\t\t\t\t'},wordMark:{lightUrl:'\n\t\t\t\t<svg width="257" height="65" viewBox="0 0 257 65" fill="none" xmlns="http://www.w3.org/2000/svg">\n\t\t\t\t\t<path d="M8 16C8 11.5817 11.5817 8 16 8V8C20.4183 8 24 11.5817 24 16V24H16C11.5817 24 8 20.4183 8 16V16Z" fill="#FFCD2E"/>\n\t\t\t\t\t<path d="M0 37C0 30.3726 5.37258 25 12 25H24V37C24 43.6274 18.6274 49 12 49V49C5.37258 49 0 43.6274 0 37V37Z" fill="#A259FE"/>\n\t\t\t\t\t<path d="M25 27C25 20.3726 30.3726 15 37 15V15C43.6274 15 49 20.3726 49 27V27C49 33.6274 43.6274 39 37 39H25V27Z" fill="#FF7162"/>\n\t\t\t\t\t<path d="M25 40H33C37.4183 40 41 43.5817 41 48V48C41 52.4183 37.4183 56 33 56V56C28.5817 56 25 52.4183 25 48V40Z" fill="#0DCF82"/>\n\t\t\t\t\t<path d="M73.4 46.28C71.4533 46.28 69.6933 45.9467 68.12 45.28C66.5733 44.6133 65.3467 43.6533 64.44 42.4C63.5333 41.1467 63.0667 39.6667 63.04 37.96H69.04C69.12 39.1067 69.52 40.0133 70.24 40.68C70.9867 41.3467 72 41.68 73.28 41.68C74.5867 41.68 75.6133 41.3733 76.36 40.76C77.1067 40.12 77.48 39.2933 77.48 38.28C77.48 37.4533 77.2267 36.7733 76.72 36.24C76.2133 35.7067 75.5733 35.2933 74.8 35C74.0533 34.68 73.0133 34.3333 71.68 33.96C69.8667 33.4267 68.3867 32.9067 67.24 32.4C66.12 31.8667 65.1467 31.08 64.32 30.04C63.52 28.9733 63.12 27.56 63.12 25.8C63.12 24.1467 63.5333 22.7067 64.36 21.48C65.1867 20.2533 66.3467 19.32 67.84 18.68C69.3333 18.0133 71.04 17.68 72.96 17.68C75.84 17.68 78.1733 18.3867 79.96 19.8C81.7733 21.1867 82.7733 23.1333 82.96 25.64H76.8C76.7467 24.68 76.3333 23.8933 75.56 23.28C74.8133 22.64 73.8133 22.32 72.56 22.32C71.4667 22.32 70.5867 22.6 69.92 23.16C69.28 23.72 68.96 24.5333 68.96 25.6C68.96 26.3467 69.2 26.9733 69.68 27.48C70.1867 27.96 70.8 28.36 71.52 28.68C72.2667 28.9733 73.3067 29.32 74.64 29.72C76.4533 30.2533 77.9333 30.7867 79.08 31.32C80.2267 31.8533 81.2133 32.6533 82.04 33.72C82.8667 34.7867 83.28 36.1867 83.28 37.92C83.28 39.4133 82.8933 40.8 82.12 42.08C81.3467 43.36 80.2133 44.3867 78.72 45.16C77.2267 45.9067 75.4533 46.28 73.4 46.28ZM107.855 23.84V46H102.215V43.2C101.495 44.16 100.548 44.92 99.375 45.48C98.2283 46.0133 96.975 46.28 95.615 46.28C93.8817 46.28 92.3483 45.92 91.015 45.2C89.6817 44.4533 88.6283 43.3733 87.855 41.96C87.1083 40.52 86.735 38.8133 86.735 36.84V23.84H92.335V36.04C92.335 37.8 92.775 39.16 93.655 40.12C94.535 41.0533 95.735 41.52 97.255 41.52C98.8017 41.52 100.015 41.0533 100.895 40.12C101.775 39.16 102.215 37.8 102.215 36.04V23.84H107.855ZM116.98 27.04C117.7 26.0267 118.687 25.1867 119.94 24.52C121.22 23.8267 122.674 23.48 124.3 23.48C126.194 23.48 127.9 23.9467 129.42 24.88C130.967 25.8133 132.18 27.1467 133.06 28.88C133.967 30.5867 134.42 32.5733 134.42 34.84C134.42 37.1067 133.967 39.12 133.06 40.88C132.18 42.6133 130.967 43.96 129.42 44.92C127.9 45.88 126.194 46.36 124.3 46.36C122.674 46.36 121.234 46.0267 119.98 45.36C118.754 44.6933 117.754 43.8533 116.98 42.84V56.56H111.38V23.84H116.98V27.04ZM128.7 34.84C128.7 33.5067 128.42 32.36 127.86 31.4C127.327 30.4133 126.607 29.6667 125.7 29.16C124.82 28.6533 123.86 28.4 122.82 28.4C121.807 28.4 120.847 28.6667 119.94 29.2C119.06 29.7067 118.34 30.4533 117.78 31.44C117.247 32.4267 116.98 33.5867 116.98 34.92C116.98 36.2533 117.247 37.4133 117.78 38.4C118.34 39.3867 119.06 40.1467 119.94 40.68C120.847 41.1867 121.807 41.44 122.82 41.44C123.86 41.44 124.82 41.1733 125.7 40.64C126.607 40.1067 127.327 39.3467 127.86 38.36C128.42 37.3733 128.7 36.2 128.7 34.84ZM158.29 34.44C158.29 35.24 158.236 35.96 158.13 36.6H141.93C142.063 38.2 142.623 39.4533 143.61 40.36C144.596 41.2667 145.81 41.72 147.25 41.72C149.33 41.72 150.81 40.8267 151.69 39.04H157.73C157.09 41.1733 155.863 42.9333 154.05 44.32C152.236 45.68 150.01 46.36 147.37 46.36C145.236 46.36 143.316 45.8933 141.61 44.96C139.93 44 138.61 42.6533 137.65 40.92C136.716 39.1867 136.25 37.1867 136.25 34.92C136.25 32.6267 136.716 30.6133 137.65 28.88C138.583 27.1467 139.89 25.8133 141.57 24.88C143.25 23.9467 145.183 23.48 147.37 23.48C149.476 23.48 151.356 23.9333 153.01 24.84C154.69 25.7467 155.983 27.04 156.89 28.72C157.823 30.3733 158.29 32.28 158.29 34.44ZM152.49 32.84C152.463 31.4 151.943 30.2533 150.93 29.4C149.916 28.52 148.676 28.08 147.21 28.08C145.823 28.08 144.65 28.5067 143.69 29.36C142.756 30.1867 142.183 31.3467 141.97 32.84H152.49ZM167.177 27.28C167.897 26.1067 168.831 25.1867 169.977 24.52C171.151 23.8533 172.484 23.52 173.977 23.52V29.4H172.497C170.737 29.4 169.404 29.8133 168.497 30.64C167.617 31.4667 167.177 32.9067 167.177 34.96V46H161.577V23.84H167.177V27.28ZM188.309 28.44H184.429V46H178.749V28.44H176.229V23.84H178.749V22.72C178.749 20 179.522 18 181.069 16.72C182.616 15.44 184.949 14.84 188.069 14.92V19.64C186.709 19.6133 185.762 19.84 185.229 20.32C184.696 20.8 184.429 21.6667 184.429 22.92V23.84H188.309V28.44ZM197.538 16.4V46H191.938V16.4H197.538ZM211.711 46.36C209.578 46.36 207.658 45.8933 205.951 44.96C204.244 44 202.898 42.6533 201.911 40.92C200.951 39.1867 200.471 37.1867 200.471 34.92C200.471 32.6533 200.964 30.6533 201.951 28.92C202.964 27.1867 204.338 25.8533 206.071 24.92C207.804 23.96 209.738 23.48 211.871 23.48C214.004 23.48 215.938 23.96 217.671 24.92C219.404 25.8533 220.764 27.1867 221.751 28.92C222.764 30.6533 223.271 32.6533 223.271 34.92C223.271 37.1867 222.751 39.1867 221.711 40.92C220.698 42.6533 219.311 44 217.551 44.96C215.818 45.8933 213.871 46.36 211.711 46.36ZM211.711 41.48C212.724 41.48 213.671 41.24 214.551 40.76C215.458 40.2533 216.178 39.5067 216.711 38.52C217.244 37.5333 217.511 36.3333 217.511 34.92C217.511 32.8133 216.951 31.2 215.831 30.08C214.738 28.9333 213.391 28.36 211.791 28.36C210.191 28.36 208.844 28.9333 207.751 30.08C206.684 31.2 206.151 32.8133 206.151 34.92C206.151 37.0267 206.671 38.6533 207.711 39.8C208.778 40.92 210.111 41.48 211.711 41.48ZM256.499 23.84L250.019 46H243.979L239.939 30.52L235.899 46H229.819L223.299 23.84H228.979L232.899 40.72L237.139 23.84H243.059L247.219 40.68L251.139 23.84H256.499Z" fill="#141416"/>\n\t\t\t\t</svg>\n\t\t\t\t',darkUrl:'\n\t\t\t\t<svg width="257" height="65" viewBox="0 0 257 65" fill="none" xmlns="http://www.w3.org/2000/svg">\n\t\t\t\t\t<path d="M8 16C8 11.5817 11.5817 8 16 8V8C20.4183 8 24 11.5817 24 16V24H16C11.5817 24 8 20.4183 8 16V16Z" fill="#FFCD2E"/>\n\t\t\t\t\t<path d="M0 37C0 30.3726 5.37258 25 12 25H24V37C24 43.6274 18.6274 49 12 49V49C5.37258 49 0 43.6274 0 37V37Z" fill="#A259FE"/>\n\t\t\t\t\t<path d="M25 27C25 20.3726 30.3726 15 37 15V15C43.6274 15 49 20.3726 49 27V27C49 33.6274 43.6274 39 37 39H25V27Z" fill="#FF7162"/>\n\t\t\t\t\t<path d="M25 40H33C37.4183 40 41 43.5817 41 48V48C41 52.4183 37.4183 56 33 56V56C28.5817 56 25 52.4183 25 48V40Z" fill="#0DCF82"/>\n\t\t\t\t\t<path d="M73.4 46.28C71.4533 46.28 69.6933 45.9467 68.12 45.28C66.5733 44.6133 65.3467 43.6533 64.44 42.4C63.5333 41.1467 63.0667 39.6667 63.04 37.96H69.04C69.12 39.1067 69.52 40.0133 70.24 40.68C70.9867 41.3467 72 41.68 73.28 41.68C74.5867 41.68 75.6133 41.3733 76.36 40.76C77.1067 40.12 77.48 39.2933 77.48 38.28C77.48 37.4533 77.2267 36.7733 76.72 36.24C76.2133 35.7067 75.5733 35.2933 74.8 35C74.0533 34.68 73.0133 34.3333 71.68 33.96C69.8667 33.4267 68.3867 32.9067 67.24 32.4C66.12 31.8667 65.1467 31.08 64.32 30.04C63.52 28.9733 63.12 27.56 63.12 25.8C63.12 24.1467 63.5333 22.7067 64.36 21.48C65.1867 20.2533 66.3467 19.32 67.84 18.68C69.3333 18.0133 71.04 17.68 72.96 17.68C75.84 17.68 78.1733 18.3867 79.96 19.8C81.7733 21.1867 82.7733 23.1333 82.96 25.64H76.8C76.7467 24.68 76.3333 23.8933 75.56 23.28C74.8133 22.64 73.8133 22.32 72.56 22.32C71.4667 22.32 70.5867 22.6 69.92 23.16C69.28 23.72 68.96 24.5333 68.96 25.6C68.96 26.3467 69.2 26.9733 69.68 27.48C70.1867 27.96 70.8 28.36 71.52 28.68C72.2667 28.9733 73.3067 29.32 74.64 29.72C76.4533 30.2533 77.9333 30.7867 79.08 31.32C80.2267 31.8533 81.2133 32.6533 82.04 33.72C82.8667 34.7867 83.28 36.1867 83.28 37.92C83.28 39.4133 82.8933 40.8 82.12 42.08C81.3467 43.36 80.2133 44.3867 78.72 45.16C77.2267 45.9067 75.4533 46.28 73.4 46.28ZM107.855 23.84V46H102.215V43.2C101.495 44.16 100.548 44.92 99.375 45.48C98.2283 46.0133 96.975 46.28 95.615 46.28C93.8817 46.28 92.3483 45.92 91.015 45.2C89.6817 44.4533 88.6283 43.3733 87.855 41.96C87.1083 40.52 86.735 38.8133 86.735 36.84V23.84H92.335V36.04C92.335 37.8 92.775 39.16 93.655 40.12C94.535 41.0533 95.735 41.52 97.255 41.52C98.8017 41.52 100.015 41.0533 100.895 40.12C101.775 39.16 102.215 37.8 102.215 36.04V23.84H107.855ZM116.98 27.04C117.7 26.0267 118.687 25.1867 119.94 24.52C121.22 23.8267 122.674 23.48 124.3 23.48C126.194 23.48 127.9 23.9467 129.42 24.88C130.967 25.8133 132.18 27.1467 133.06 28.88C133.967 30.5867 134.42 32.5733 134.42 34.84C134.42 37.1067 133.967 39.12 133.06 40.88C132.18 42.6133 130.967 43.96 129.42 44.92C127.9 45.88 126.194 46.36 124.3 46.36C122.674 46.36 121.234 46.0267 119.98 45.36C118.754 44.6933 117.754 43.8533 116.98 42.84V56.56H111.38V23.84H116.98V27.04ZM128.7 34.84C128.7 33.5067 128.42 32.36 127.86 31.4C127.327 30.4133 126.607 29.6667 125.7 29.16C124.82 28.6533 123.86 28.4 122.82 28.4C121.807 28.4 120.847 28.6667 119.94 29.2C119.06 29.7067 118.34 30.4533 117.78 31.44C117.247 32.4267 116.98 33.5867 116.98 34.92C116.98 36.2533 117.247 37.4133 117.78 38.4C118.34 39.3867 119.06 40.1467 119.94 40.68C120.847 41.1867 121.807 41.44 122.82 41.44C123.86 41.44 124.82 41.1733 125.7 40.64C126.607 40.1067 127.327 39.3467 127.86 38.36C128.42 37.3733 128.7 36.2 128.7 34.84ZM158.29 34.44C158.29 35.24 158.236 35.96 158.13 36.6H141.93C142.063 38.2 142.623 39.4533 143.61 40.36C144.596 41.2667 145.81 41.72 147.25 41.72C149.33 41.72 150.81 40.8267 151.69 39.04H157.73C157.09 41.1733 155.863 42.9333 154.05 44.32C152.236 45.68 150.01 46.36 147.37 46.36C145.236 46.36 143.316 45.8933 141.61 44.96C139.93 44 138.61 42.6533 137.65 40.92C136.716 39.1867 136.25 37.1867 136.25 34.92C136.25 32.6267 136.716 30.6133 137.65 28.88C138.583 27.1467 139.89 25.8133 141.57 24.88C143.25 23.9467 145.183 23.48 147.37 23.48C149.476 23.48 151.356 23.9333 153.01 24.84C154.69 25.7467 155.983 27.04 156.89 28.72C157.823 30.3733 158.29 32.28 158.29 34.44ZM152.49 32.84C152.463 31.4 151.943 30.2533 150.93 29.4C149.916 28.52 148.676 28.08 147.21 28.08C145.823 28.08 144.65 28.5067 143.69 29.36C142.756 30.1867 142.183 31.3467 141.97 32.84H152.49ZM167.177 27.28C167.897 26.1067 168.831 25.1867 169.977 24.52C171.151 23.8533 172.484 23.52 173.977 23.52V29.4H172.497C170.737 29.4 169.404 29.8133 168.497 30.64C167.617 31.4667 167.177 32.9067 167.177 34.96V46H161.577V23.84H167.177V27.28ZM188.309 28.44H184.429V46H178.749V28.44H176.229V23.84H178.749V22.72C178.749 20 179.522 18 181.069 16.72C182.616 15.44 184.949 14.84 188.069 14.92V19.64C186.709 19.6133 185.762 19.84 185.229 20.32C184.696 20.8 184.429 21.6667 184.429 22.92V23.84H188.309V28.44ZM197.538 16.4V46H191.938V16.4H197.538ZM211.711 46.36C209.578 46.36 207.658 45.8933 205.951 44.96C204.244 44 202.898 42.6533 201.911 40.92C200.951 39.1867 200.471 37.1867 200.471 34.92C200.471 32.6533 200.964 30.6533 201.951 28.92C202.964 27.1867 204.338 25.8533 206.071 24.92C207.804 23.96 209.738 23.48 211.871 23.48C214.004 23.48 215.938 23.96 217.671 24.92C219.404 25.8533 220.764 27.1867 221.751 28.92C222.764 30.6533 223.271 32.6533 223.271 34.92C223.271 37.1867 222.751 39.1867 221.711 40.92C220.698 42.6533 219.311 44 217.551 44.96C215.818 45.8933 213.871 46.36 211.711 46.36ZM211.711 41.48C212.724 41.48 213.671 41.24 214.551 40.76C215.458 40.2533 216.178 39.5067 216.711 38.52C217.244 37.5333 217.511 36.3333 217.511 34.92C217.511 32.8133 216.951 31.2 215.831 30.08C214.738 28.9333 213.391 28.36 211.791 28.36C210.191 28.36 208.844 28.9333 207.751 30.08C206.684 31.2 206.151 32.8133 206.151 34.92C206.151 37.0267 206.671 38.6533 207.711 39.8C208.778 40.92 210.111 41.48 211.711 41.48ZM256.499 23.84L250.019 46H243.979L239.939 30.52L235.899 46H229.819L223.299 23.84H228.979L232.899 40.72L237.139 23.84H243.059L247.219 40.68L251.139 23.84H256.499Z" fill="white"/>\n\t\t\t\t</svg>\n\t\t\t\t'}}}},Ie=[{name:"Peppa Pig",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Fpeppa_pig.svg?alt=media&token=a9fc83f7-b347-4868-8d52-0e888f0de73a&_gl=1*jzxghx*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMTQ5LjQyLjAuMA.."},{name:"Dazzling Dalmatian",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Fdazzling_dalmatian.svg?alt=media&token=5842b24c-7e58-4bb5-96c2-d09aa11f7f9e&_gl=1*11ayw3z*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQxOTY4LjExLjAuMA.."},{name:"Rosy Rabbit",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Frosy_rabbit.svg?alt=media&token=4e65a9e3-080d-4416-839d-e761b6b37181&_gl=1*156om5t*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMjUzLjYwLjAuMA.."},{name:"Leo the Lion",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Fleo_the_lion.svg?alt=media&token=58d1296e-fefd-42ce-80ea-ae2cc830f1a9&_gl=1*1cz8e9q*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMTAwLjIwLjAuMA.."},{name:"Ducky Down",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Fducky_down.svg?alt=media&token=d67ae889-78c5-46e3-aaa9-3eb511fe90b3&_gl=1*cxyj7o*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQxOTkwLjYwLjAuMA.."},{name:"Merry Monkey",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Fmerry_monkey.svg?alt=media&token=5bd2f69a-7211-42df-9718-5339c467b2d1&_gl=1*1labjed*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMTE3LjMuMC4w"},{name:"Ecstatic Elephant",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Fecstatic_elephant.svg?alt=media&token=fbd2ba76-6c3a-47a7-beac-0460a2178b7d&_gl=1*aku3ps*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMDA3LjQzLjAuMA.."},{name:"Baby Bear",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Fbaby_bear.svg?alt=media&token=71d0c5fb-60aa-4304-adc1-635a83650bde&_gl=1*1dxajmf*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQxMjQyLjUyLjAuMA.."},{name:"Freddy Froglet",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Ffreddy_froglet.svg?alt=media&token=e3b2e292-6480-4507-9da3-21a62a1346d4&_gl=1*s4yycs*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMDQzLjcuMC4w"},{name:"Powerful Panda",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Fpowerful_panda.svg?alt=media&token=07f9d60f-aa14-4a77-ad5b-c48ee76db3f5&_gl=1*7gfuit*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMTkzLjYwLjAuMA.."},{name:"Curious Cat",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Fcurious_cat.svg?alt=media&token=dccf6824-3b7c-4e4e-8559-40fbb8ff6186&_gl=1*1nwi0ti*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQxOTM3LjQyLjAuMA.."},{name:"Playful Penguin",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Fplayful_penguin.svg?alt=media&token=c6d1b11a-43a6-4001-ae56-e04fd5a3f965&_gl=1*1xdxvkx*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMTYzLjI4LjAuMA.."},{name:"Kind Koala",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Fkind_koala.svg?alt=media&token=974396d6-6ccd-4367-8563-b27634849cb5&_gl=1*1w1gbnn*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMDgwLjQwLjAuMA.."},{name:"Tommy Tiger",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Ftommy_tiger.svg?alt=media&token=40a95ac7-cc91-4b74-859a-4e2e5964b967&_gl=1*1n0cr0n*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMjczLjQwLjAuMA.."},{name:"Wally Walrus",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Fwally_walrus.svg?alt=media&token=31e02ef2-c986-4724-b987-dca97f84f81b&_gl=1*y5by2c*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMjkxLjIyLjAuMA.."},{name:"Ricky Rhino",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Fricky_rhino.svg?alt=media&token=5d9dafe5-f4de-4f8b-94c1-49e01c776611&_gl=1*zyp4n2*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMjMxLjIyLjAuMA.."},{name:"Oliver Otter",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Foliver_otter.svg?alt=media&token=5298b869-0903-40b2-a702-224a3e0bcd95&_gl=1*aicppz*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMTMxLjYwLjAuMA.."},{name:"Reggie Ratling",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Freggie_ratling.svg?alt=media&token=f37fd4a0-9dbd-403a-bb82-81fdfb63cf88&_gl=1*16lzeql*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMjA3LjQ2LjAuMA.."},{name:"Gentle Giraffe",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Fgentle_giraffe.svg?alt=media&token=f097ec12-e8ce-4d26-bf32-43e470eb7907&_gl=1*11ctuwz*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMDYwLjYwLjAuMA.."},{name:"Fabulous Fox",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Ffabulous_fox.svg?alt=media&token=fe1a4236-af45-427f-a035-1eda417b0682&_gl=1*xyyv1g*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMDIxLjI5LjAuMA.."}],$e="bugReport",Ne="create",Oe="Sign in to report a bug.",Le="Something went wrong. Please try again.",De={console:100,errors:25,network:25},Re={maxMessageChars:5e3,maxDigestBytes:2048,maxBundleBytes:262144,maxEntryChars:500,maxStackFrames:5,digestListSize:5};const Fe=[{pattern:/eyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]*/g,replacement:"[REDACTED_JWT]"},{pattern:/\b(sk|pk|rk)_(live|test)_[A-Za-z0-9]{8,}/g,replacement:"[REDACTED_STRIPE_KEY]"},{pattern:/\bAIza[0-9A-Za-z_-]{35}\b/g,replacement:"[REDACTED_FIREBASE_KEY]"},{pattern:/\bghp_[A-Za-z0-9]{20,}\b/g,replacement:"[REDACTED_GITHUB_TOKEN]"},{pattern:/\bxox[abprs]-[A-Za-z0-9-]{10,}\b/gi,replacement:"[REDACTED_SLACK_TOKEN]"},{pattern:/\b(?:sk|pk|api|key)[_-][A-Za-z0-9]{12,}\b/gi,replacement:"[REDACTED_API_KEY]"},{pattern:/\b[Bb]earer\s+[A-Za-z0-9._-]{16,}/g,replacement:"Bearer [REDACTED]"},{pattern:/\bAuthorization\s*:\s*(?:Bearer|Basic|Token|Digest)?\s*\S+/gi,replacement:"Authorization: [REDACTED]"},{pattern:/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g,replacement:"[REDACTED_EMAIL]"},{pattern:/\b\d{4}[ -]\d{4}[ -]\d{4}[ -]\d{1,4}\b/g,replacement:"[REDACTED_CARD_NUMBER]"},{pattern:/\b\d{13,19}\b/g,replacement:function(t){try{return function(t){try{let e=0,i=!1;for(let o=t.length-1;o>=0;o-=1){let n=Number(t[o]);i&&(n*=2,n>9&&(n-=9)),e+=n,i=!i}return e%10==0}catch{return!0}}(t)?"[REDACTED_CARD_NUMBER]":t}catch{return"[REDACTED_CARD_NUMBER]"}}},{pattern:/\b[A-Fa-f0-9]{40,}\b/g,replacement:"[REDACTED_HEX]"},{pattern:/\b[A-Za-z0-9+/]{40,}={0,2}\b/g,replacement:"[REDACTED_BASE64]"}];var Pe=Object.freeze({__proto__:null,AGENT_COMMENTS_MODE:At,AGENT_FIELD_PREFIXES:ke,ANNOTATION_STATUS_TERMINAL:xe,ANNOTATION_TYPE_SUGGESTION:Ee,ATTRIBUTES:Te,AUTO_COMMENT_MODE:Mt,BUG_REPORT_AUTH_REQUIRED_ERROR:Oe,BUG_REPORT_EVENT_TYPE:$e,BUG_REPORT_SCHEMA_VERSION:1,BUG_REPORT_SUBMIT_FAILED_ERROR:Le,BUG_REPORT_SUB_EVENT_TYPE_CREATE:Ne,COMMENT_PRIVATE_MODE_TYPE_ORGANIZATION:ce,DEFAULT_CUSTOMER_METADATA:_e,DOCUMENT_TITLE_CHANGE_LISTENER_API_KEYS:wt,DRIVE_HOSTS:be,DRIVE_NEW_PROD_URL:"app.usesuperflow.com/drive",DRIVE_NEW_STAGING_URL:"superflow-portal-v2-staging.firebaseapp.com/drive",DRIVE_PROD_URL:"drive.usesuperflow.com",DRIVE_STAGING_URL:"superflow-file-viewer-staging.web.app",EMBED_MODE:St,EXCLUDED_API_KEYS_FROM_LATEST_VERSION:["I9R2VqG45F5AgpIicnht"],FEEDBACK_MODE:kt,FIGMA_DEMO_MODAL:te,GUEST_USERS:Ie,LIVE_DEMO_MODAL:Xt,ONBOARDING_AGENT_BUTTON_LABELS:me,ONBOARDING_AGENT_BUTTON_STATE:fe,ONBOARDING_AGENT_STATUS_MESSAGE_TYPE:$t,ONBOARDING_DIAGNOSTICS_MESSAGE_TYPE:Lt,ONBOARDING_DIAGNOSTICS_REQUEST_MESSAGE_TYPE:Ot,ONBOARDING_FAILED_AGENT_STATUSES:Rt,ONBOARDING_FETCH_ERROR:Ft,ONBOARDING_FINDINGS_FETCH_INTERVAL_MS:3e3,ONBOARDING_FINDINGS_FETCH_MAX_ATTEMPTS:10,ONBOARDING_FINDINGS_FETCH_MAX_ATTEMPTS_PER_RUN:30,ONBOARDING_MAX_AGENT_STATUSES:50,ONBOARDING_MAX_DISMISSED_PROJECTS:20,ONBOARDING_MODE:It,ONBOARDING_READY_MESSAGE_TYPE:Nt,ONBOARDING_STATUS_FIRST_MESSAGE_TIMEOUT_MS:2e4,ONBOARDING_STATUS_STALE_MS:Dt,ONBOARDING_VIEWPORT_GUTTER_PX:8,PREVIEW_LOCATION_PATH:_t,PREVIEW_NAVIGATE_MESSAGE_TYPE:Ut,PREVIEW_PROXY_HOSTS:jt,PROJECT_INSTALL:Qt,PROJECT_VERSION:Jt,PROJECT_VERSION_DEFAULT_KEY:qt,PROJECT_VERSION_KEY:Yt,PROXY_DISABLED_DEFAULT_API_KEYS:Ct,READ_ONLY_MODE:Tt,REVIEW_DOC_ID:Bt,REVIEW_MODE:Et,SCREENSHOT_DISABLED_HOSTS:Ce,SIDEBAR_BUTTON_COUNT_TYPE_FILTER:Ae,SIDEBAR_V1_DEFAULT_API_KEYS:xt,SNIPPYLY_COMMENT_ID:Ht,SNIPPYLY_TOKEN:Wt,SNIPPYLY_USER:Gt,SUPERFLOW_CONTENT_WARNING_SIDEBAR_OPEN:ge,SUPERFLOW_CUSTOMER_METADATA:ve,SUPERFLOW_DOCUMENT_METADATA:"sfDocumentMetadata",SUPERFLOW_GUEST_MODE:oe,SUPERFLOW_GUEST_MODE_ALLOW_SIGN_IN:de,SUPERFLOW_GUEST_USER_BANNER_OPENED:pe,SUPERFLOW_GUEST_USER_MODEL_OPENED:he,SUPERFLOW_GUEST_USER_NAME_MODEL_OPENED:"sfGuestUserNameModelOpened",SUPERFLOW_GUEST_USER_NAME_UPDATED:ue,SUPERFLOW_GUEST_USER_TOKEN:Kt,SUPERFLOW_NATIVE_SCREENSHOT_PERMISSION:we,SUPERFLOW_ONBOARDING_SIDEBAR_DISMISSED:Pt,SUPERFLOW_PAGE_COMMENTS_HIDDEN:zt,SUPERFLOW_PASSWORD_IS_VALID:ae,SUPERFLOW_PASSWORD_PROTECTED:ne,SUPERFLOW_PRIVATE_MODE:le,SUPERFLOW_QUERY_PARAMS_COMMENTS:re,SUPERFLOW_SAML_CONFIG:ye,SUPERFLOW_SIDEBAR_V2_ENABLED:yt,SUPERFLOW_USER_ADMIN:ie,SUPERFLOW_USER_TOKEN:Zt,SUPERFLOW_USE_PAGE_TITLE_AS_LOCATION_NAME:se,SUPERFLOW_VERSION:gt,SYSTEM_AGENT_IDS:Se,TAGS:Me,TELEMETRY_BUFFER_CAPS:De,TELEMETRY_REDACTION_RULES:Fe,TELEMETRY_SIZE_LIMITS:Re,TOUR_COMMENT_TOOLTIP:ee,UNKNOWN_AGENT_NAME:Vt,VELT_PROXY_FLAG:bt,VELT_SDK_DEVELOP_VERSION:ft,VELT_SDK_PROD_VERSION:mt,VELT_SDK_STAGING_VERSION:"3.0.92"});const Ve=!0,je="https://superflow-portal-v2-staging.firebaseapp.com/",Ue="https://superflow-portal-v2-staging.firebaseapp.com/settings/billing",ze="9dbcd2509e0fa90a5c81f038ce618e3f",Be="6d24f74f12f6fb84c87efa8f791cfb2e",He="https://us-central1-snipply-sdk-staging.cloudfunctions.net/sa",Ge="https://us-central1-snipply-sdk-staging.cloudfunctions.net/superflowtoolbarhandler",We=function(t){const e=[];let i=0;for(let o=0;o<t.length;o++){let n=t.charCodeAt(o);n<128?e[i++]=n:n<2048?(e[i++]=n>>6|192,e[i++]=63&n|128):55296==(64512&n)&&o+1<t.length&&56320==(64512&t.charCodeAt(o+1))?(n=65536+((1023&n)<<10)+(1023&t.charCodeAt(++o)),e[i++]=n>>18|240,e[i++]=n>>12&63|128,e[i++]=n>>6&63|128,e[i++]=63&n|128):(e[i++]=n>>12|224,e[i++]=n>>6&63|128,e[i++]=63&n|128)}return e},Ze={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();const i=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,o=[];for(let e=0;e<t.length;e+=3){const n=t[e],r=e+1<t.length,s=r?t[e+1]:0,a=e+2<t.length,l=a?t[e+2]:0,c=n>>2,d=(3&n)<<4|s>>4;let h=(15&s)<<2|l>>6,u=63&l;a||(u=64,r||(h=64)),o.push(i[c],i[d],i[h],i[u])}return o.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(We(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):function(t){const e=[];let i=0,o=0;for(;i<t.length;){const n=t[i++];if(n<128)e[o++]=String.fromCharCode(n);else if(n>191&&n<224){const r=t[i++];e[o++]=String.fromCharCode((31&n)<<6|63&r)}else if(n>239&&n<365){const r=((7&n)<<18|(63&t[i++])<<12|(63&t[i++])<<6|63&t[i++])-65536;e[o++]=String.fromCharCode(55296+(r>>10)),e[o++]=String.fromCharCode(56320+(1023&r))}else{const r=t[i++],s=t[i++];e[o++]=String.fromCharCode((15&n)<<12|(63&r)<<6|63&s)}}return e.join("")}(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();const i=e?this.charToByteMapWebSafe_:this.charToByteMap_,o=[];for(let e=0;e<t.length;){const n=i[t.charAt(e++)],r=e<t.length?i[t.charAt(e)]:0;++e;const s=e<t.length?i[t.charAt(e)]:64;++e;const a=e<t.length?i[t.charAt(e)]:64;if(++e,null==n||null==r||null==s||null==a)throw new Ke;const l=n<<2|r>>4;if(o.push(l),64!==s){const t=r<<4&240|s>>2;if(o.push(t),64!==a){const t=s<<6&192|a;o.push(t)}}}return o},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let t=0;t<this.ENCODED_VALS.length;t++)this.byteToCharMap_[t]=this.ENCODED_VALS.charAt(t),this.charToByteMap_[this.byteToCharMap_[t]]=t,this.byteToCharMapWebSafe_[t]=this.ENCODED_VALS_WEBSAFE.charAt(t),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[t]]=t,t>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}};class Ke extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const Ye=function(t){return function(t){const e=We(t);return Ze.encodeByteArray(e,!0)}(t).replace(/\./g,"")},Je=function(t){try{return Ze.decodeString(t,!0)}catch(t){console.error("base64Decode failed: ",t)}return null};
71
+ */class ut extends dt{constructor(t){if(super(t),this.it=R,t.type!==lt)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===R||null==t)return this.ft=void 0,this.it=t;if(t===D)return t;if("string"!=typeof t)throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this.ft;this.it=t;const e=[t];return e.raw=e,this.ft={_$litType$:this.constructor.resultType,strings:e,values:[]}}}ut.directiveName="unsafeHTML",ut.resultType=1;const pt=ct(ut);class vt{}vt.Events={GUEST_MODE_SIGN_IN_DIALOG_SHOWN:"guestModeSignInDialogShown",GUEST_MODE_NAME_DIALOG_SHOWN:"guestModeNameDialogShown",GUEST_MODE_SIGN_IN_BANNER_SHOWN:"guestModeSignInBannerShown",GUEST_MODE_SIGN_IN_BUTTON_CLICKED:"guestModeSignInButtonClicked",PASSWORD_PROTECTED_MODAL_CLOSE_BUTTON_CLICKED:"passwordProtectedModalCloseButtonClicked",PASSWORD_PROTECTED_MODAL_OPEN_BUTTON_CLICKED:"passwordProtectedModalOpenButtonClicked",TOOLBAR_EXPANDED:"toolbarExpanded",TOOLBAR_COLLAPSED:"toolbarCollapsed",TOOLBAR_NOTIFICATION_CLICKED:"toolbarNotificationClicked",GUEST_MODE_SKIP_BUTTON_CLICKED:"guestModeSkipButtonClicked",GUEST_MODE_SIGN_IN_NUDGE_SHOWN:"guestModeSignInNudgeShown",GUEST_MODE_NAME_NUDGE_SHOWN:"guestModeNameNudgeShown",GUEST_MODE_SIGN_IN_CLICKED:"guestModeSignInClicked",GUEST_MODE_PRESENT:"guestModePresent",GUEST_MODE_NAME_ADDED:"guestModeNameAdded",REVIEW_PASSWORD_ADDED:"reviewPasswordAdded",REVIEW_PASSWORD_REJECTED:"reviewPasswordRejected",REVIEW_PASSWORD_ACCEPTED:"reviewPasswordAccepted",PRIVATE_MODE_ENABLED:"privateModeEnabled",PRIVATE_MODE_DISABLED:"privateModeDisabled",VISIBILITY_OPTIONS_ENABLED:"visibilityOptionsEnabled",VISIBILITY_OPTIONS_DISABLED:"visibilityOptionsDisabled",VIEW_PROJECT_CLICKED:"viewProjectClicked",REPORT_BUG_CLICKED:"reportBugClicked",REPORT_BUG_SUBMITTED:"reportBugSubmitted",OPEN_MOBILE_CLICKED:"openMobileClicked",EXIT_REVIEW_MODE_CLICKED:"exitReviewModeClicked",SIGNOUT_CLICKED:"signoutClicked",SIGNIN_CLICKED:"signinClicked",SIGN_IN_REQUIRED:"signInRequired",USER_EMAIL_NOT_WHITELISTED:"userEmailNotWhitelisted",DOMAIN_NOT_WHITELISTED:"domainNotWhitelisted",DUPLICATE_SCRIPT_INSTALLED:"duplicateScriptInstalled",TOOLBAR_DISABLED:"toolbarDisabled",INVITE_MODAL_OPENED:"inviteModalOpened",INVITE_SENT:"inviteSent",QUALITY_CHECK_RUN_TOOLBAR_CLICKED:"qualityCheckRunFromToolbarClicked"};const gt="1.0.750",ft="6.0.5",mt="6.0.12",wt=["v3ogId1G43AFHehEOewv","rNYzMJd13L27xtfipmSK","aU1MxKP0rca2UXwKi8bl"],yt="sfSidebarV2Enabled",bt="sfUseProxy",Ct=["v3ogId1G43AFHehEOewv"],xt=[],Et="review",kt="feedback",St="sembed",Mt="scommentmode",Tt="sreadonly",At="sagentcomments",_t="spath",It="sonboarding",$t="sf-onboarding-agent-status",Nt="sf-onboarding-ready",Ot="sf-onboarding-diagnostics-request",Lt="sf-onboarding-diagnostics",Dt=3e5,Rt=["failed","systemError","error"],Ft={SDK_NOT_READY:"sdk-not-ready",SDK_RETURNED_NULL:"sdk-returned-null",FETCH_THREW:"fetch-threw"},Pt="sfOnboardingSidebarDismissed",Vt="Unknown Agent",jt=[{hostSuffix:"cloudfunctions.net",pathPrefix:"/previewproxy"},{hostSuffix:"api.velt.dev",pathPrefix:"/previewproxy"}],Ut="sf-preview-navigate",zt="sfPageCommentsHidden",Bt="sreviewId",Ht="scommentId",Gt="snippyly-user",Wt="st",Zt="_sfut",Kt="_sfgut",Yt="projectVersionKey",Jt="projectVersion",qt="sversion",Qt="sprojectInstall",Xt="sflivedemo",te="sffigmademo",ee="sfTourCommentTooltip",ie="sfUserAdmin",oe="sfGuestMode",ne="sfPasswordProtected",re="sfQueryParamsComments",se="sfUsePageTitleAsLocationName",ae="sfPasswordIsValid",le="sfPrivateMode",ce="organizationPrivate",de="sfGuestModeAllowSignIn",he="sfGuestUserModelOpened",ue="sfGuestUserNameUpdated",pe="sfGuestUserBannerOpened",ve="sfCustomerMetadata",ge="sfContentWarningSidebarOpen",fe={LOADING:"loading",RUNNING:"running",FINDINGS:"findings",CLEAN:"clean",IDLE:"idle"},me={QA_AGENTS:"QA Agents",LOADING:"Running QA Agents",RUNNING:"Running",RUNNING_SINGLE:"Running 1 QA Agent",FINDING_SINGLE:"1 Agent Finding",FINDINGS:"Agent Findings",NO_ISSUES_FOUND:"No Issues Found"},we="sfNativeScreenshotPermission",ye="sfSamlConfig",be=[{hostSuffix:"drive.usesuperflow.com",pathPrefix:"/"},{hostSuffix:"superflow-file-viewer-staging.web.app",pathPrefix:"/"},{hostSuffix:"app.usesuperflow.com",pathPrefix:"/drive"},{hostSuffix:"superflow-portal-v2-staging.firebaseapp.com",pathPrefix:"/drive"},{hostSuffix:"superflow-portal-v2-staging.web.app",pathPrefix:"/drive"},{hostSuffix:"superflow-portal-v2-prod.firebaseapp.com",pathPrefix:"/drive"},{hostSuffix:"superflow-portal-v2-prod.web.app",pathPrefix:"/drive"}],Ce=["app.usesuperflow.com","superflow-portal-v2-staging.firebaseapp.com"],xe="terminal",Ee="suggestion",ke={AGENT:"agent:",AGENT_TYPE_CUSTOM:"agentType:custom"},Se={SPELL_CHECK:"spell-check",BROKEN_LINKS:"broken-links",GRAMMAR_CHECK:"grammar-check"},Me={VELT_ROOT:"velt-root",VELT_PRESENCE:"velt-presence",VELT_CURSOR:"velt-cursor",VELT_COMMENT_TOOL:"velt-comment-tool",VELT_COMMENTS:"velt-comments",SNIPPYLY_TEXT_HIGHLIGHT:"snippyly-text-highlight",VELT_COMMENTS_SIDEBAR_LEGACY:"velt-comments-sidebar",VELT_COMMENTS_SIDEBAR_V2:"velt-comments-sidebar-v2",VELT_HUDDLE:"velt-huddle",VELT_RECORDER_NOTES:"velt-recorder-notes",VELT_RECORDER_CONTROL_PANEL:"velt-recorder-control-panel",VELT_ARROWS:"velt-arrows",VELT_NOTIFICATIONS_HISTORY_PANEL:"velt-notifications-history-panel"},Te={ENABLE_URL_NAVIGATION:"enable-url-navigation",URL_NAVIGATION:"url-navigation",CURRENT_LOCATION_SUFFIX:"current-location-suffix",SIDEBAR_BUTTON_COUNT_TYPE:"sidebar-button-count-type",CUSTOM_ACTIONS:"custom-actions"},Ae="filter",_e={customBranding:{logo:{logoMark:{lightUrl:'\n\t\t\t\t<svg viewBox="0 0 49 48" fill="none" xmlns="http://www.w3.org/2000/svg">\n\t\t\t\t\t<path d="M8 8C8 3.58172 11.5817 0 16 0V0C20.4183 0 24 3.58172 24 8V16H16C11.5817 16 8 12.4183 8 8V8Z" fill="#FFCD2E"/>\n\t\t\t\t\t<path d="M0 29C0 22.3726 5.37258 17 12 17H24V29C24 35.6274 18.6274 41 12 41V41C5.37258 41 0 35.6274 0 29V29Z" fill="#A259FE"/>\n\t\t\t\t\t<path d="M25 19C25 12.3726 30.3726 7 37 7V7C43.6274 7 49 12.3726 49 19V19C49 25.6274 43.6274 31 37 31H25V19Z" fill="#FF7162"/>\n\t\t\t\t\t<path d="M25 32H33C37.4183 32 41 35.5817 41 40V40C41 44.4183 37.4183 48 33 48V48C28.5817 48 25 44.4183 25 40V32Z" fill="#0DCF82"/>\n\t\t\t\t</svg>\n\t\t\t\t',darkUrl:'\n\t\t\t\t<svg viewBox="0 0 49 48" fill="none" xmlns="http://www.w3.org/2000/svg">\n\t\t\t\t\t<path d="M8 8C8 3.58172 11.5817 0 16 0V0C20.4183 0 24 3.58172 24 8V16H16C11.5817 16 8 12.4183 8 8V8Z" fill="#FFCD2E"/>\n\t\t\t\t\t<path d="M0 29C0 22.3726 5.37258 17 12 17H24V29C24 35.6274 18.6274 41 12 41V41C5.37258 41 0 35.6274 0 29V29Z" fill="#A259FE"/>\n\t\t\t\t\t<path d="M25 19C25 12.3726 30.3726 7 37 7V7C43.6274 7 49 12.3726 49 19V19C49 25.6274 43.6274 31 37 31H25V19Z" fill="#FF7162"/>\n\t\t\t\t\t<path d="M25 32H33C37.4183 32 41 35.5817 41 40V40C41 44.4183 37.4183 48 33 48V48C28.5817 48 25 44.4183 25 40V32Z" fill="#0DCF82"/>\n\t\t\t\t</svg>\n\t\t\t\t'},wordMark:{lightUrl:'\n\t\t\t\t<svg width="257" height="65" viewBox="0 0 257 65" fill="none" xmlns="http://www.w3.org/2000/svg">\n\t\t\t\t\t<path d="M8 16C8 11.5817 11.5817 8 16 8V8C20.4183 8 24 11.5817 24 16V24H16C11.5817 24 8 20.4183 8 16V16Z" fill="#FFCD2E"/>\n\t\t\t\t\t<path d="M0 37C0 30.3726 5.37258 25 12 25H24V37C24 43.6274 18.6274 49 12 49V49C5.37258 49 0 43.6274 0 37V37Z" fill="#A259FE"/>\n\t\t\t\t\t<path d="M25 27C25 20.3726 30.3726 15 37 15V15C43.6274 15 49 20.3726 49 27V27C49 33.6274 43.6274 39 37 39H25V27Z" fill="#FF7162"/>\n\t\t\t\t\t<path d="M25 40H33C37.4183 40 41 43.5817 41 48V48C41 52.4183 37.4183 56 33 56V56C28.5817 56 25 52.4183 25 48V40Z" fill="#0DCF82"/>\n\t\t\t\t\t<path d="M73.4 46.28C71.4533 46.28 69.6933 45.9467 68.12 45.28C66.5733 44.6133 65.3467 43.6533 64.44 42.4C63.5333 41.1467 63.0667 39.6667 63.04 37.96H69.04C69.12 39.1067 69.52 40.0133 70.24 40.68C70.9867 41.3467 72 41.68 73.28 41.68C74.5867 41.68 75.6133 41.3733 76.36 40.76C77.1067 40.12 77.48 39.2933 77.48 38.28C77.48 37.4533 77.2267 36.7733 76.72 36.24C76.2133 35.7067 75.5733 35.2933 74.8 35C74.0533 34.68 73.0133 34.3333 71.68 33.96C69.8667 33.4267 68.3867 32.9067 67.24 32.4C66.12 31.8667 65.1467 31.08 64.32 30.04C63.52 28.9733 63.12 27.56 63.12 25.8C63.12 24.1467 63.5333 22.7067 64.36 21.48C65.1867 20.2533 66.3467 19.32 67.84 18.68C69.3333 18.0133 71.04 17.68 72.96 17.68C75.84 17.68 78.1733 18.3867 79.96 19.8C81.7733 21.1867 82.7733 23.1333 82.96 25.64H76.8C76.7467 24.68 76.3333 23.8933 75.56 23.28C74.8133 22.64 73.8133 22.32 72.56 22.32C71.4667 22.32 70.5867 22.6 69.92 23.16C69.28 23.72 68.96 24.5333 68.96 25.6C68.96 26.3467 69.2 26.9733 69.68 27.48C70.1867 27.96 70.8 28.36 71.52 28.68C72.2667 28.9733 73.3067 29.32 74.64 29.72C76.4533 30.2533 77.9333 30.7867 79.08 31.32C80.2267 31.8533 81.2133 32.6533 82.04 33.72C82.8667 34.7867 83.28 36.1867 83.28 37.92C83.28 39.4133 82.8933 40.8 82.12 42.08C81.3467 43.36 80.2133 44.3867 78.72 45.16C77.2267 45.9067 75.4533 46.28 73.4 46.28ZM107.855 23.84V46H102.215V43.2C101.495 44.16 100.548 44.92 99.375 45.48C98.2283 46.0133 96.975 46.28 95.615 46.28C93.8817 46.28 92.3483 45.92 91.015 45.2C89.6817 44.4533 88.6283 43.3733 87.855 41.96C87.1083 40.52 86.735 38.8133 86.735 36.84V23.84H92.335V36.04C92.335 37.8 92.775 39.16 93.655 40.12C94.535 41.0533 95.735 41.52 97.255 41.52C98.8017 41.52 100.015 41.0533 100.895 40.12C101.775 39.16 102.215 37.8 102.215 36.04V23.84H107.855ZM116.98 27.04C117.7 26.0267 118.687 25.1867 119.94 24.52C121.22 23.8267 122.674 23.48 124.3 23.48C126.194 23.48 127.9 23.9467 129.42 24.88C130.967 25.8133 132.18 27.1467 133.06 28.88C133.967 30.5867 134.42 32.5733 134.42 34.84C134.42 37.1067 133.967 39.12 133.06 40.88C132.18 42.6133 130.967 43.96 129.42 44.92C127.9 45.88 126.194 46.36 124.3 46.36C122.674 46.36 121.234 46.0267 119.98 45.36C118.754 44.6933 117.754 43.8533 116.98 42.84V56.56H111.38V23.84H116.98V27.04ZM128.7 34.84C128.7 33.5067 128.42 32.36 127.86 31.4C127.327 30.4133 126.607 29.6667 125.7 29.16C124.82 28.6533 123.86 28.4 122.82 28.4C121.807 28.4 120.847 28.6667 119.94 29.2C119.06 29.7067 118.34 30.4533 117.78 31.44C117.247 32.4267 116.98 33.5867 116.98 34.92C116.98 36.2533 117.247 37.4133 117.78 38.4C118.34 39.3867 119.06 40.1467 119.94 40.68C120.847 41.1867 121.807 41.44 122.82 41.44C123.86 41.44 124.82 41.1733 125.7 40.64C126.607 40.1067 127.327 39.3467 127.86 38.36C128.42 37.3733 128.7 36.2 128.7 34.84ZM158.29 34.44C158.29 35.24 158.236 35.96 158.13 36.6H141.93C142.063 38.2 142.623 39.4533 143.61 40.36C144.596 41.2667 145.81 41.72 147.25 41.72C149.33 41.72 150.81 40.8267 151.69 39.04H157.73C157.09 41.1733 155.863 42.9333 154.05 44.32C152.236 45.68 150.01 46.36 147.37 46.36C145.236 46.36 143.316 45.8933 141.61 44.96C139.93 44 138.61 42.6533 137.65 40.92C136.716 39.1867 136.25 37.1867 136.25 34.92C136.25 32.6267 136.716 30.6133 137.65 28.88C138.583 27.1467 139.89 25.8133 141.57 24.88C143.25 23.9467 145.183 23.48 147.37 23.48C149.476 23.48 151.356 23.9333 153.01 24.84C154.69 25.7467 155.983 27.04 156.89 28.72C157.823 30.3733 158.29 32.28 158.29 34.44ZM152.49 32.84C152.463 31.4 151.943 30.2533 150.93 29.4C149.916 28.52 148.676 28.08 147.21 28.08C145.823 28.08 144.65 28.5067 143.69 29.36C142.756 30.1867 142.183 31.3467 141.97 32.84H152.49ZM167.177 27.28C167.897 26.1067 168.831 25.1867 169.977 24.52C171.151 23.8533 172.484 23.52 173.977 23.52V29.4H172.497C170.737 29.4 169.404 29.8133 168.497 30.64C167.617 31.4667 167.177 32.9067 167.177 34.96V46H161.577V23.84H167.177V27.28ZM188.309 28.44H184.429V46H178.749V28.44H176.229V23.84H178.749V22.72C178.749 20 179.522 18 181.069 16.72C182.616 15.44 184.949 14.84 188.069 14.92V19.64C186.709 19.6133 185.762 19.84 185.229 20.32C184.696 20.8 184.429 21.6667 184.429 22.92V23.84H188.309V28.44ZM197.538 16.4V46H191.938V16.4H197.538ZM211.711 46.36C209.578 46.36 207.658 45.8933 205.951 44.96C204.244 44 202.898 42.6533 201.911 40.92C200.951 39.1867 200.471 37.1867 200.471 34.92C200.471 32.6533 200.964 30.6533 201.951 28.92C202.964 27.1867 204.338 25.8533 206.071 24.92C207.804 23.96 209.738 23.48 211.871 23.48C214.004 23.48 215.938 23.96 217.671 24.92C219.404 25.8533 220.764 27.1867 221.751 28.92C222.764 30.6533 223.271 32.6533 223.271 34.92C223.271 37.1867 222.751 39.1867 221.711 40.92C220.698 42.6533 219.311 44 217.551 44.96C215.818 45.8933 213.871 46.36 211.711 46.36ZM211.711 41.48C212.724 41.48 213.671 41.24 214.551 40.76C215.458 40.2533 216.178 39.5067 216.711 38.52C217.244 37.5333 217.511 36.3333 217.511 34.92C217.511 32.8133 216.951 31.2 215.831 30.08C214.738 28.9333 213.391 28.36 211.791 28.36C210.191 28.36 208.844 28.9333 207.751 30.08C206.684 31.2 206.151 32.8133 206.151 34.92C206.151 37.0267 206.671 38.6533 207.711 39.8C208.778 40.92 210.111 41.48 211.711 41.48ZM256.499 23.84L250.019 46H243.979L239.939 30.52L235.899 46H229.819L223.299 23.84H228.979L232.899 40.72L237.139 23.84H243.059L247.219 40.68L251.139 23.84H256.499Z" fill="#141416"/>\n\t\t\t\t</svg>\n\t\t\t\t',darkUrl:'\n\t\t\t\t<svg width="257" height="65" viewBox="0 0 257 65" fill="none" xmlns="http://www.w3.org/2000/svg">\n\t\t\t\t\t<path d="M8 16C8 11.5817 11.5817 8 16 8V8C20.4183 8 24 11.5817 24 16V24H16C11.5817 24 8 20.4183 8 16V16Z" fill="#FFCD2E"/>\n\t\t\t\t\t<path d="M0 37C0 30.3726 5.37258 25 12 25H24V37C24 43.6274 18.6274 49 12 49V49C5.37258 49 0 43.6274 0 37V37Z" fill="#A259FE"/>\n\t\t\t\t\t<path d="M25 27C25 20.3726 30.3726 15 37 15V15C43.6274 15 49 20.3726 49 27V27C49 33.6274 43.6274 39 37 39H25V27Z" fill="#FF7162"/>\n\t\t\t\t\t<path d="M25 40H33C37.4183 40 41 43.5817 41 48V48C41 52.4183 37.4183 56 33 56V56C28.5817 56 25 52.4183 25 48V40Z" fill="#0DCF82"/>\n\t\t\t\t\t<path d="M73.4 46.28C71.4533 46.28 69.6933 45.9467 68.12 45.28C66.5733 44.6133 65.3467 43.6533 64.44 42.4C63.5333 41.1467 63.0667 39.6667 63.04 37.96H69.04C69.12 39.1067 69.52 40.0133 70.24 40.68C70.9867 41.3467 72 41.68 73.28 41.68C74.5867 41.68 75.6133 41.3733 76.36 40.76C77.1067 40.12 77.48 39.2933 77.48 38.28C77.48 37.4533 77.2267 36.7733 76.72 36.24C76.2133 35.7067 75.5733 35.2933 74.8 35C74.0533 34.68 73.0133 34.3333 71.68 33.96C69.8667 33.4267 68.3867 32.9067 67.24 32.4C66.12 31.8667 65.1467 31.08 64.32 30.04C63.52 28.9733 63.12 27.56 63.12 25.8C63.12 24.1467 63.5333 22.7067 64.36 21.48C65.1867 20.2533 66.3467 19.32 67.84 18.68C69.3333 18.0133 71.04 17.68 72.96 17.68C75.84 17.68 78.1733 18.3867 79.96 19.8C81.7733 21.1867 82.7733 23.1333 82.96 25.64H76.8C76.7467 24.68 76.3333 23.8933 75.56 23.28C74.8133 22.64 73.8133 22.32 72.56 22.32C71.4667 22.32 70.5867 22.6 69.92 23.16C69.28 23.72 68.96 24.5333 68.96 25.6C68.96 26.3467 69.2 26.9733 69.68 27.48C70.1867 27.96 70.8 28.36 71.52 28.68C72.2667 28.9733 73.3067 29.32 74.64 29.72C76.4533 30.2533 77.9333 30.7867 79.08 31.32C80.2267 31.8533 81.2133 32.6533 82.04 33.72C82.8667 34.7867 83.28 36.1867 83.28 37.92C83.28 39.4133 82.8933 40.8 82.12 42.08C81.3467 43.36 80.2133 44.3867 78.72 45.16C77.2267 45.9067 75.4533 46.28 73.4 46.28ZM107.855 23.84V46H102.215V43.2C101.495 44.16 100.548 44.92 99.375 45.48C98.2283 46.0133 96.975 46.28 95.615 46.28C93.8817 46.28 92.3483 45.92 91.015 45.2C89.6817 44.4533 88.6283 43.3733 87.855 41.96C87.1083 40.52 86.735 38.8133 86.735 36.84V23.84H92.335V36.04C92.335 37.8 92.775 39.16 93.655 40.12C94.535 41.0533 95.735 41.52 97.255 41.52C98.8017 41.52 100.015 41.0533 100.895 40.12C101.775 39.16 102.215 37.8 102.215 36.04V23.84H107.855ZM116.98 27.04C117.7 26.0267 118.687 25.1867 119.94 24.52C121.22 23.8267 122.674 23.48 124.3 23.48C126.194 23.48 127.9 23.9467 129.42 24.88C130.967 25.8133 132.18 27.1467 133.06 28.88C133.967 30.5867 134.42 32.5733 134.42 34.84C134.42 37.1067 133.967 39.12 133.06 40.88C132.18 42.6133 130.967 43.96 129.42 44.92C127.9 45.88 126.194 46.36 124.3 46.36C122.674 46.36 121.234 46.0267 119.98 45.36C118.754 44.6933 117.754 43.8533 116.98 42.84V56.56H111.38V23.84H116.98V27.04ZM128.7 34.84C128.7 33.5067 128.42 32.36 127.86 31.4C127.327 30.4133 126.607 29.6667 125.7 29.16C124.82 28.6533 123.86 28.4 122.82 28.4C121.807 28.4 120.847 28.6667 119.94 29.2C119.06 29.7067 118.34 30.4533 117.78 31.44C117.247 32.4267 116.98 33.5867 116.98 34.92C116.98 36.2533 117.247 37.4133 117.78 38.4C118.34 39.3867 119.06 40.1467 119.94 40.68C120.847 41.1867 121.807 41.44 122.82 41.44C123.86 41.44 124.82 41.1733 125.7 40.64C126.607 40.1067 127.327 39.3467 127.86 38.36C128.42 37.3733 128.7 36.2 128.7 34.84ZM158.29 34.44C158.29 35.24 158.236 35.96 158.13 36.6H141.93C142.063 38.2 142.623 39.4533 143.61 40.36C144.596 41.2667 145.81 41.72 147.25 41.72C149.33 41.72 150.81 40.8267 151.69 39.04H157.73C157.09 41.1733 155.863 42.9333 154.05 44.32C152.236 45.68 150.01 46.36 147.37 46.36C145.236 46.36 143.316 45.8933 141.61 44.96C139.93 44 138.61 42.6533 137.65 40.92C136.716 39.1867 136.25 37.1867 136.25 34.92C136.25 32.6267 136.716 30.6133 137.65 28.88C138.583 27.1467 139.89 25.8133 141.57 24.88C143.25 23.9467 145.183 23.48 147.37 23.48C149.476 23.48 151.356 23.9333 153.01 24.84C154.69 25.7467 155.983 27.04 156.89 28.72C157.823 30.3733 158.29 32.28 158.29 34.44ZM152.49 32.84C152.463 31.4 151.943 30.2533 150.93 29.4C149.916 28.52 148.676 28.08 147.21 28.08C145.823 28.08 144.65 28.5067 143.69 29.36C142.756 30.1867 142.183 31.3467 141.97 32.84H152.49ZM167.177 27.28C167.897 26.1067 168.831 25.1867 169.977 24.52C171.151 23.8533 172.484 23.52 173.977 23.52V29.4H172.497C170.737 29.4 169.404 29.8133 168.497 30.64C167.617 31.4667 167.177 32.9067 167.177 34.96V46H161.577V23.84H167.177V27.28ZM188.309 28.44H184.429V46H178.749V28.44H176.229V23.84H178.749V22.72C178.749 20 179.522 18 181.069 16.72C182.616 15.44 184.949 14.84 188.069 14.92V19.64C186.709 19.6133 185.762 19.84 185.229 20.32C184.696 20.8 184.429 21.6667 184.429 22.92V23.84H188.309V28.44ZM197.538 16.4V46H191.938V16.4H197.538ZM211.711 46.36C209.578 46.36 207.658 45.8933 205.951 44.96C204.244 44 202.898 42.6533 201.911 40.92C200.951 39.1867 200.471 37.1867 200.471 34.92C200.471 32.6533 200.964 30.6533 201.951 28.92C202.964 27.1867 204.338 25.8533 206.071 24.92C207.804 23.96 209.738 23.48 211.871 23.48C214.004 23.48 215.938 23.96 217.671 24.92C219.404 25.8533 220.764 27.1867 221.751 28.92C222.764 30.6533 223.271 32.6533 223.271 34.92C223.271 37.1867 222.751 39.1867 221.711 40.92C220.698 42.6533 219.311 44 217.551 44.96C215.818 45.8933 213.871 46.36 211.711 46.36ZM211.711 41.48C212.724 41.48 213.671 41.24 214.551 40.76C215.458 40.2533 216.178 39.5067 216.711 38.52C217.244 37.5333 217.511 36.3333 217.511 34.92C217.511 32.8133 216.951 31.2 215.831 30.08C214.738 28.9333 213.391 28.36 211.791 28.36C210.191 28.36 208.844 28.9333 207.751 30.08C206.684 31.2 206.151 32.8133 206.151 34.92C206.151 37.0267 206.671 38.6533 207.711 39.8C208.778 40.92 210.111 41.48 211.711 41.48ZM256.499 23.84L250.019 46H243.979L239.939 30.52L235.899 46H229.819L223.299 23.84H228.979L232.899 40.72L237.139 23.84H243.059L247.219 40.68L251.139 23.84H256.499Z" fill="white"/>\n\t\t\t\t</svg>\n\t\t\t\t'}}}},Ie=[{name:"Peppa Pig",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Fpeppa_pig.svg?alt=media&token=a9fc83f7-b347-4868-8d52-0e888f0de73a&_gl=1*jzxghx*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMTQ5LjQyLjAuMA.."},{name:"Dazzling Dalmatian",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Fdazzling_dalmatian.svg?alt=media&token=5842b24c-7e58-4bb5-96c2-d09aa11f7f9e&_gl=1*11ayw3z*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQxOTY4LjExLjAuMA.."},{name:"Rosy Rabbit",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Frosy_rabbit.svg?alt=media&token=4e65a9e3-080d-4416-839d-e761b6b37181&_gl=1*156om5t*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMjUzLjYwLjAuMA.."},{name:"Leo the Lion",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Fleo_the_lion.svg?alt=media&token=58d1296e-fefd-42ce-80ea-ae2cc830f1a9&_gl=1*1cz8e9q*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMTAwLjIwLjAuMA.."},{name:"Ducky Down",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Fducky_down.svg?alt=media&token=d67ae889-78c5-46e3-aaa9-3eb511fe90b3&_gl=1*cxyj7o*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQxOTkwLjYwLjAuMA.."},{name:"Merry Monkey",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Fmerry_monkey.svg?alt=media&token=5bd2f69a-7211-42df-9718-5339c467b2d1&_gl=1*1labjed*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMTE3LjMuMC4w"},{name:"Ecstatic Elephant",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Fecstatic_elephant.svg?alt=media&token=fbd2ba76-6c3a-47a7-beac-0460a2178b7d&_gl=1*aku3ps*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMDA3LjQzLjAuMA.."},{name:"Baby Bear",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Fbaby_bear.svg?alt=media&token=71d0c5fb-60aa-4304-adc1-635a83650bde&_gl=1*1dxajmf*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQxMjQyLjUyLjAuMA.."},{name:"Freddy Froglet",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Ffreddy_froglet.svg?alt=media&token=e3b2e292-6480-4507-9da3-21a62a1346d4&_gl=1*s4yycs*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMDQzLjcuMC4w"},{name:"Powerful Panda",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Fpowerful_panda.svg?alt=media&token=07f9d60f-aa14-4a77-ad5b-c48ee76db3f5&_gl=1*7gfuit*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMTkzLjYwLjAuMA.."},{name:"Curious Cat",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Fcurious_cat.svg?alt=media&token=dccf6824-3b7c-4e4e-8559-40fbb8ff6186&_gl=1*1nwi0ti*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQxOTM3LjQyLjAuMA.."},{name:"Playful Penguin",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Fplayful_penguin.svg?alt=media&token=c6d1b11a-43a6-4001-ae56-e04fd5a3f965&_gl=1*1xdxvkx*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMTYzLjI4LjAuMA.."},{name:"Kind Koala",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Fkind_koala.svg?alt=media&token=974396d6-6ccd-4367-8563-b27634849cb5&_gl=1*1w1gbnn*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMDgwLjQwLjAuMA.."},{name:"Tommy Tiger",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Ftommy_tiger.svg?alt=media&token=40a95ac7-cc91-4b74-859a-4e2e5964b967&_gl=1*1n0cr0n*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMjczLjQwLjAuMA.."},{name:"Wally Walrus",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Fwally_walrus.svg?alt=media&token=31e02ef2-c986-4724-b987-dca97f84f81b&_gl=1*y5by2c*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMjkxLjIyLjAuMA.."},{name:"Ricky Rhino",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Fricky_rhino.svg?alt=media&token=5d9dafe5-f4de-4f8b-94c1-49e01c776611&_gl=1*zyp4n2*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMjMxLjIyLjAuMA.."},{name:"Oliver Otter",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Foliver_otter.svg?alt=media&token=5298b869-0903-40b2-a702-224a3e0bcd95&_gl=1*aicppz*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMTMxLjYwLjAuMA.."},{name:"Reggie Ratling",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Freggie_ratling.svg?alt=media&token=f37fd4a0-9dbd-403a-bb82-81fdfb63cf88&_gl=1*16lzeql*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMjA3LjQ2LjAuMA.."},{name:"Gentle Giraffe",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Fgentle_giraffe.svg?alt=media&token=f097ec12-e8ce-4d26-bf32-43e470eb7907&_gl=1*11ctuwz*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMDYwLjYwLjAuMA.."},{name:"Fabulous Fox",photoUrl:"https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/avatars%2Ffabulous_fox.svg?alt=media&token=fe1a4236-af45-427f-a035-1eda417b0682&_gl=1*xyyv1g*_ga*NTc3MjEzMjIwLjE2NjEwODkwMDU.*_ga_CW55HF8NVT*MTY5NzE0MTIzNC4zMzMuMS4xNjk3MTQyMDIxLjI5LjAuMA.."}],$e="bugReport",Ne="create",Oe="Sign in to report a bug.",Le="Something went wrong. Please try again.",De={console:100,errors:25,network:25},Re={maxMessageChars:5e3,maxDigestBytes:2048,maxBundleBytes:262144,maxEntryChars:500,maxStackFrames:5,digestListSize:5};const Fe=[{pattern:/eyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]*/g,replacement:"[REDACTED_JWT]"},{pattern:/\b(sk|pk|rk)_(live|test)_[A-Za-z0-9]{8,}/g,replacement:"[REDACTED_STRIPE_KEY]"},{pattern:/\bAIza[0-9A-Za-z_-]{35}\b/g,replacement:"[REDACTED_FIREBASE_KEY]"},{pattern:/\bghp_[A-Za-z0-9]{20,}\b/g,replacement:"[REDACTED_GITHUB_TOKEN]"},{pattern:/\bxox[abprs]-[A-Za-z0-9-]{10,}\b/gi,replacement:"[REDACTED_SLACK_TOKEN]"},{pattern:/\b(?:sk|pk|api|key)[_-][A-Za-z0-9]{12,}\b/gi,replacement:"[REDACTED_API_KEY]"},{pattern:/\b[Bb]earer\s+[A-Za-z0-9._-]{16,}/g,replacement:"Bearer [REDACTED]"},{pattern:/\bAuthorization\s*:\s*(?:Bearer|Basic|Token|Digest)?\s*\S+/gi,replacement:"Authorization: [REDACTED]"},{pattern:/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,}\b/g,replacement:"[REDACTED_EMAIL]"},{pattern:/\b\d{4}[ -]\d{4}[ -]\d{4}[ -]\d{1,4}\b/g,replacement:"[REDACTED_CARD_NUMBER]"},{pattern:/\b\d{13,19}\b/g,replacement:function(t){try{return function(t){try{let e=0,i=!1;for(let o=t.length-1;o>=0;o-=1){let n=Number(t[o]);i&&(n*=2,n>9&&(n-=9)),e+=n,i=!i}return e%10==0}catch{return!0}}(t)?"[REDACTED_CARD_NUMBER]":t}catch{return"[REDACTED_CARD_NUMBER]"}}},{pattern:/\b[A-Fa-f0-9]{40,}\b/g,replacement:"[REDACTED_HEX]"},{pattern:/\b[A-Za-z0-9+/]{40,}={0,2}\b/g,replacement:"[REDACTED_BASE64]"}];var Pe=Object.freeze({__proto__:null,AGENT_COMMENTS_MODE:At,AGENT_FIELD_PREFIXES:ke,ANNOTATION_STATUS_TERMINAL:xe,ANNOTATION_TYPE_SUGGESTION:Ee,ATTRIBUTES:Te,AUTO_COMMENT_MODE:Mt,BUG_REPORT_AUTH_REQUIRED_ERROR:Oe,BUG_REPORT_EVENT_TYPE:$e,BUG_REPORT_SCHEMA_VERSION:1,BUG_REPORT_SUBMIT_FAILED_ERROR:Le,BUG_REPORT_SUB_EVENT_TYPE_CREATE:Ne,COMMENT_PRIVATE_MODE_TYPE_ORGANIZATION:ce,DEFAULT_CUSTOMER_METADATA:_e,DOCUMENT_TITLE_CHANGE_LISTENER_API_KEYS:wt,DRIVE_HOSTS:be,DRIVE_NEW_PROD_URL:"app.usesuperflow.com/drive",DRIVE_NEW_STAGING_URL:"superflow-portal-v2-staging.firebaseapp.com/drive",DRIVE_PROD_URL:"drive.usesuperflow.com",DRIVE_STAGING_URL:"superflow-file-viewer-staging.web.app",EMBED_MODE:St,EXCLUDED_API_KEYS_FROM_LATEST_VERSION:["I9R2VqG45F5AgpIicnht"],FEEDBACK_MODE:kt,FIGMA_DEMO_MODAL:te,GUEST_USERS:Ie,LIVE_DEMO_MODAL:Xt,ONBOARDING_AGENT_BUTTON_LABELS:me,ONBOARDING_AGENT_BUTTON_STATE:fe,ONBOARDING_AGENT_STATUS_MESSAGE_TYPE:$t,ONBOARDING_DIAGNOSTICS_MESSAGE_TYPE:Lt,ONBOARDING_DIAGNOSTICS_REQUEST_MESSAGE_TYPE:Ot,ONBOARDING_FAILED_AGENT_STATUSES:Rt,ONBOARDING_FETCH_ERROR:Ft,ONBOARDING_FINDINGS_FETCH_INTERVAL_MS:3e3,ONBOARDING_FINDINGS_FETCH_MAX_ATTEMPTS:10,ONBOARDING_FINDINGS_FETCH_MAX_ATTEMPTS_PER_RUN:30,ONBOARDING_MAX_AGENT_STATUSES:50,ONBOARDING_MAX_DISMISSED_PROJECTS:20,ONBOARDING_MODE:It,ONBOARDING_READY_MESSAGE_TYPE:Nt,ONBOARDING_STATUS_FIRST_MESSAGE_TIMEOUT_MS:2e4,ONBOARDING_STATUS_STALE_MS:Dt,ONBOARDING_VIEWPORT_GUTTER_PX:8,PREVIEW_LOCATION_PATH:_t,PREVIEW_NAVIGATE_MESSAGE_TYPE:Ut,PREVIEW_PROXY_HOSTS:jt,PROJECT_INSTALL:Qt,PROJECT_VERSION:Jt,PROJECT_VERSION_DEFAULT_KEY:qt,PROJECT_VERSION_KEY:Yt,PROXY_DISABLED_DEFAULT_API_KEYS:Ct,READ_ONLY_MODE:Tt,REVIEW_DOC_ID:Bt,REVIEW_MODE:Et,SCREENSHOT_DISABLED_HOSTS:Ce,SIDEBAR_BUTTON_COUNT_TYPE_FILTER:Ae,SIDEBAR_V1_DEFAULT_API_KEYS:xt,SNIPPYLY_COMMENT_ID:Ht,SNIPPYLY_TOKEN:Wt,SNIPPYLY_USER:Gt,SUPERFLOW_CONTENT_WARNING_SIDEBAR_OPEN:ge,SUPERFLOW_CUSTOMER_METADATA:ve,SUPERFLOW_DOCUMENT_METADATA:"sfDocumentMetadata",SUPERFLOW_GUEST_MODE:oe,SUPERFLOW_GUEST_MODE_ALLOW_SIGN_IN:de,SUPERFLOW_GUEST_USER_BANNER_OPENED:pe,SUPERFLOW_GUEST_USER_MODEL_OPENED:he,SUPERFLOW_GUEST_USER_NAME_MODEL_OPENED:"sfGuestUserNameModelOpened",SUPERFLOW_GUEST_USER_NAME_UPDATED:ue,SUPERFLOW_GUEST_USER_TOKEN:Kt,SUPERFLOW_NATIVE_SCREENSHOT_PERMISSION:we,SUPERFLOW_ONBOARDING_SIDEBAR_DISMISSED:Pt,SUPERFLOW_PAGE_COMMENTS_HIDDEN:zt,SUPERFLOW_PASSWORD_IS_VALID:ae,SUPERFLOW_PASSWORD_PROTECTED:ne,SUPERFLOW_PRIVATE_MODE:le,SUPERFLOW_QUERY_PARAMS_COMMENTS:re,SUPERFLOW_SAML_CONFIG:ye,SUPERFLOW_SIDEBAR_V2_ENABLED:yt,SUPERFLOW_USER_ADMIN:ie,SUPERFLOW_USER_TOKEN:Zt,SUPERFLOW_USE_PAGE_TITLE_AS_LOCATION_NAME:se,SUPERFLOW_VERSION:gt,SYSTEM_AGENT_IDS:Se,TAGS:Me,TELEMETRY_BUFFER_CAPS:De,TELEMETRY_REDACTION_RULES:Fe,TELEMETRY_SIZE_LIMITS:Re,TOUR_COMMENT_TOOLTIP:ee,UNKNOWN_AGENT_NAME:Vt,VELT_PROXY_FLAG:bt,VELT_SDK_DEVELOP_VERSION:ft,VELT_SDK_PROD_VERSION:mt,VELT_SDK_STAGING_VERSION:"3.0.92"});const Ve=!0,je="https://superflow-portal-v2-staging.firebaseapp.com/",Ue="https://superflow-portal-v2-staging.firebaseapp.com/settings/billing",ze="9dbcd2509e0fa90a5c81f038ce618e3f",Be="6d24f74f12f6fb84c87efa8f791cfb2e",He="https://us-central1-snipply-sdk-staging.cloudfunctions.net/sa",Ge="https://us-central1-snipply-sdk-staging.cloudfunctions.net/superflowtoolbarhandler",We=function(t){const e=[];let i=0;for(let o=0;o<t.length;o++){let n=t.charCodeAt(o);n<128?e[i++]=n:n<2048?(e[i++]=n>>6|192,e[i++]=63&n|128):55296==(64512&n)&&o+1<t.length&&56320==(64512&t.charCodeAt(o+1))?(n=65536+((1023&n)<<10)+(1023&t.charCodeAt(++o)),e[i++]=n>>18|240,e[i++]=n>>12&63|128,e[i++]=n>>6&63|128,e[i++]=63&n|128):(e[i++]=n>>12|224,e[i++]=n>>6&63|128,e[i++]=63&n|128)}return e},Ze={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();const i=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,o=[];for(let e=0;e<t.length;e+=3){const n=t[e],r=e+1<t.length,s=r?t[e+1]:0,a=e+2<t.length,l=a?t[e+2]:0,c=n>>2,d=(3&n)<<4|s>>4;let h=(15&s)<<2|l>>6,u=63&l;a||(u=64,r||(h=64)),o.push(i[c],i[d],i[h],i[u])}return o.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(We(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):function(t){const e=[];let i=0,o=0;for(;i<t.length;){const n=t[i++];if(n<128)e[o++]=String.fromCharCode(n);else if(n>191&&n<224){const r=t[i++];e[o++]=String.fromCharCode((31&n)<<6|63&r)}else if(n>239&&n<365){const r=((7&n)<<18|(63&t[i++])<<12|(63&t[i++])<<6|63&t[i++])-65536;e[o++]=String.fromCharCode(55296+(r>>10)),e[o++]=String.fromCharCode(56320+(1023&r))}else{const r=t[i++],s=t[i++];e[o++]=String.fromCharCode((15&n)<<12|(63&r)<<6|63&s)}}return e.join("")}(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();const i=e?this.charToByteMapWebSafe_:this.charToByteMap_,o=[];for(let e=0;e<t.length;){const n=i[t.charAt(e++)],r=e<t.length?i[t.charAt(e)]:0;++e;const s=e<t.length?i[t.charAt(e)]:64;++e;const a=e<t.length?i[t.charAt(e)]:64;if(++e,null==n||null==r||null==s||null==a)throw new Ke;const l=n<<2|r>>4;if(o.push(l),64!==s){const t=r<<4&240|s>>2;if(o.push(t),64!==a){const t=s<<6&192|a;o.push(t)}}}return o},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let t=0;t<this.ENCODED_VALS.length;t++)this.byteToCharMap_[t]=this.ENCODED_VALS.charAt(t),this.charToByteMap_[this.byteToCharMap_[t]]=t,this.byteToCharMapWebSafe_[t]=this.ENCODED_VALS_WEBSAFE.charAt(t),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[t]]=t,t>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}};class Ke extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const Ye=function(t){return function(t){const e=We(t);return Ze.encodeByteArray(e,!0)}(t).replace(/\./g,"")},Je=function(t){try{return Ze.decodeString(t,!0)}catch(t){console.error("base64Decode failed: ",t)}return null};
72
72
  /**
73
73
  * @license
74
74
  * Copyright 2022 Google LLC
@@ -4837,6 +4837,14 @@ class $c extends ma{}$c.Encryptor=class extends $c{processBlock(t,e){const i=t,o
4837
4837
  background: #8b5cf6;
4838
4838
  }
4839
4839
 
4840
+ .cws-severity-dot--grey {
4841
+ background: #a3a3a3;
4842
+ }
4843
+
4844
+ :host([theme="dark"]) .cws-severity-dot--grey {
4845
+ background: rgba(255, 255, 255, 0.35);
4846
+ }
4847
+
4840
4848
  /* Grouped findings: the count on a row that holds several, and the
4841
4849
  shared title/detail at the top of the list of them. */
4842
4850
 
@@ -4921,8 +4929,8 @@ class $c extends ma{}$c.Encryptor=class extends $c{processBlock(t,e){const i=t,o
4921
4929
  }
4922
4930
 
4923
4931
  /* A row expanded in place (a page comment, or one the page does not
4924
- hold yet): its suggestion, the items it covers and an Open comment
4925
- button, under the row and lined up with the title text. */
4932
+ hold yet): its suggestion and the items it covers, under the row and
4933
+ lined up with the title text. */
4926
4934
 
4927
4935
  .cws-finding-body {
4928
4936
  display: flex;
@@ -4975,26 +4983,6 @@ class $c extends ma{}$c.Encryptor=class extends $c{processBlock(t,e){const i=t,o
4975
4983
  max-width: 100%;
4976
4984
  }
4977
4985
 
4978
- .cws-open-comment {
4979
- font: inherit;
4980
- font-size: 13px;
4981
- font-weight: 500;
4982
- padding: 6px 12px;
4983
- border: none;
4984
- border-radius: 16px;
4985
- background: #f0f0f0;
4986
- color: #0a0a0a;
4987
- cursor: pointer;
4988
- }
4989
-
4990
- .cws-open-comment:hover {
4991
- background: #e5e5e5;
4992
- }
4993
-
4994
- .cws-open-comment:focus-visible {
4995
- outline: 2px solid #0a0a0a;
4996
- outline-offset: 2px;
4997
- }
4998
4986
 
4999
4987
  :host([theme="dark"]) .cws-finding-suggestion,
5000
4988
  :host([theme="dark"]) .cws-finding-item-label {
@@ -5009,18 +4997,6 @@ class $c extends ma{}$c.Encryptor=class extends $c{processBlock(t,e){const i=t,o
5009
4997
  color: rgba(255, 255, 255, 0.52);
5010
4998
  }
5011
4999
 
5012
- :host([theme="dark"]) .cws-open-comment {
5013
- background: rgba(255, 255, 255, 0.1);
5014
- color: #fff;
5015
- }
5016
-
5017
- :host([theme="dark"]) .cws-open-comment:hover {
5018
- background: rgba(255, 255, 255, 0.16);
5019
- }
5020
-
5021
- :host([theme="dark"]) .cws-open-comment:focus-visible {
5022
- outline-color: #fff;
5023
- }
5024
5000
 
5025
5001
  /* The chevron turns down on an expanded row. */
5026
5002
  .cws-list-row .cws-icon-shell svg {
@@ -5464,11 +5440,11 @@ class $c extends ma{}$c.Encryptor=class extends $c{processBlock(t,e){const i=t,o
5464
5440
  :host([theme="dark"]) .cws-list::-webkit-scrollbar-thumb:hover {
5465
5441
  background: rgba(255, 255, 255, 0.3);
5466
5442
  }
5467
- `,Qd="dark",Xd="Loading findings…",th="Running QA Agents",eh="No agent warnings found.",ih="running",oh="findings",nh="clean",rh="unavailable",sh="Couldn't finish this check",ah="#FFD978",lh="cws-spinner-gradient",ch=["critical","high","medium","low","info"],dh={critical:{tone:"red",label:"Critical"},high:{tone:"yellow",label:"High"},medium:{tone:"yellow",label:"Medium"},low:{tone:"purple",label:"Low"},info:{tone:"purple",label:"Info"}};function hh(){try{return L`
5443
+ `,Qd="dark",Xd="Loading findings…",th="Running QA Agents",eh="No agent warnings found.",ih="running",oh="findings",nh="clean",rh="unavailable",sh="Couldn't finish this check",ah="#FFD978",lh="cws-spinner-gradient",ch=["critical","high","medium","low","info"],dh={critical:{tone:"red",label:"Critical"},high:{tone:"yellow",label:"High"},medium:{tone:"yellow",label:"Medium"},low:{tone:"purple",label:"Low"},info:{tone:"purple",label:"Info"}},hh={tone:"grey",label:"No"};function uh(){try{return L`
5468
5444
  <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
5469
5445
  <path d="M7.5 5L12.5 10L7.5 15" stroke="white" stroke-opacity="0.52" stroke-width="1.66667" stroke-linecap="round" stroke-linejoin="round"/>
5470
5446
  </svg>
5471
- `}catch(t){return console.warn("Error in renderDarkChevronRightIcon: ",t),L``}}function uh(){try{return L`
5447
+ `}catch(t){return console.warn("Error in renderDarkChevronRightIcon: ",t),L``}}function ph(){try{return L`
5472
5448
  <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
5473
5449
  <g>
5474
5450
  <path opacity="0.12" d="M20 10C20 15.5228 15.5228 20 10 20C4.47715 20 0 15.5228 0 10C0 4.47715 4.47715 0 10 0C15.5228 0 20 4.47715 20 10ZM2 10C2 14.4183 5.58172 18 10 18C14.4183 18 18 14.4183 18 10C18 5.58172 14.4183 2 10 2C5.58172 2 2 5.58172 2 10Z" fill="white"/>
@@ -5481,7 +5457,7 @@ class $c extends ma{}$c.Encryptor=class extends $c{processBlock(t,e){const i=t,o
5481
5457
  </linearGradient>
5482
5458
  </defs>
5483
5459
  </svg>
5484
- `}catch(t){return console.warn("Error in renderDarkSpinnerIcon: ",t),L``}}const ph=[{keywords:["access"],render:function(t){try{return L`
5460
+ `}catch(t){return console.warn("Error in renderDarkSpinnerIcon: ",t),L``}}const vh=[{keywords:["access"],render:function(t){try{return L`
5485
5461
  <svg width="18" height="18" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" style="color: ${t}">
5486
5462
  <path d="M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
5487
5463
  <path d="M10 16.5l2 -3l2 3m-2 -3v-2l3 -1m-6 0l3 1" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
@@ -5518,11 +5494,11 @@ class $c extends ma{}$c.Encryptor=class extends $c{processBlock(t,e){const i=t,o
5518
5494
  <svg width="18" height="18" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg" style="color: ${t}">
5519
5495
  <path d="M15 8H15.01M3 15.9998L8 10.9998C8.928 10.1068 10.072 10.1068 11 10.9998L16 15.9998M14 13.9998L15 12.9998C15.928 12.1068 17.072 12.1068 18 12.9998L21 15.9998M3 6C3 5.20435 3.31607 4.44129 3.87868 3.87868C4.44129 3.31607 5.20435 3 6 3H18C18.7956 3 19.5587 3.31607 20.1213 3.87868C20.6839 4.44129 21 5.20435 21 6V18C21 18.7956 20.6839 19.5587 20.1213 20.1213C19.5587 20.6839 18.7956 21 18 21H6C5.20435 21 4.44129 20.6839 3.87868 20.1213C3.31607 19.5587 3 18.7956 3 18V6Z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
5520
5496
  </svg>
5521
- `}catch(t){return console.warn("Error in renderDarkAgentIconImage: ",t),L``}},color:"#4CD97B"}],vh={render:function(t){try{return L`
5497
+ `}catch(t){return console.warn("Error in renderDarkAgentIconImage: ",t),L``}},color:"#4CD97B"}],gh={render:function(t){try{return L`
5522
5498
  <svg width="18" height="18" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg" style="color: ${t}">
5523
5499
  <path d="M6.33317 7.33333H6.33984M9.6665 7.33333H9.67317M6.33317 10C6.55042 10.2217 6.80974 10.3979 7.09592 10.5181C7.38211 10.6384 7.68941 10.7003 7.99984 10.7003C8.31026 10.7003 8.61757 10.6384 8.90375 10.5181C9.18994 10.3979 9.44925 10.2217 9.6665 10M4.6665 3.33333H5.33317V2H10.6665V3.33333H11.3332C11.8636 3.33333 12.3723 3.54405 12.7474 3.91912C13.1225 4.29419 13.3332 4.8029 13.3332 5.33333V11.3333C13.3332 11.8638 13.1225 12.3725 12.7474 12.7475C12.3723 13.1226 11.8636 13.3333 11.3332 13.3333V14H4.6665V13.3333C4.13607 13.3333 3.62736 13.1226 3.25229 12.7475C2.87722 12.3725 2.6665 11.8638 2.6665 11.3333V5.33333C2.6665 4.8029 2.87722 4.29419 3.25229 3.91912C3.62736 3.54405 4.13607 3.33333 4.6665 3.33333Z" stroke="currentColor" stroke-width="1.33333" stroke-linecap="round"/>
5524
5500
  </svg>
5525
- `}catch(t){return console.warn("Error in renderDarkAgentIconLego: ",t),L``}},color:"#ffffff"};function gh(t,e){try{const i=`${null!=t?t:""} ${null!=e?e:""}`.toLowerCase(),o=ph.find((t=>t.keywords.some((t=>i.includes(t)))));return o?{render:o.render,color:o.color}:vh}catch(t){return console.warn("Error in resolveAgentIconInfo: ",t),vh}}var fh=function(t,e,i,o){for(var n,r=arguments.length,s=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,a=t.length-1;a>=0;a--)(n=t[a])&&(s=(r<3?n(s):r>3?n(e,i,s):n(e,i))||s);return r>3&&s&&Object.defineProperty(e,i,s),s};const mh="No issues found",wh="This finding isn't pinned on the page yet, so it's shown here in full.",yh="Back to QA agents",bh="Close",Ch=(t,e)=>{var i,o;const n={agentId:t.agentId,agentName:t.agentName,group:e};if(t.isRunning)return{...n,state:ih,count:0};if(e&&(null!==(i=e.warningCount)&&void 0!==i?i:0)>0)return{...n,state:oh,count:e.warningCount};const r=null!==(o=t.findingsCount)&&void 0!==o?o:0;return r>0&&!e&&!t.findingsResolved?t.findingsUnavailable?{...n,state:rh,count:0,title:"Couldn't load these findings"}:{...n,state:oh,count:r,pending:!0,title:Xd}:t.failed?{...n,state:rh,count:0,title:sh}:t.timedOut?{...n,state:rh,count:0,title:"Status not updating"}:{...n,state:nh,count:0,resolved:r>0}},xh=t=>{if("string"!=typeof t)return;const e=t.trim().toLowerCase();return ch.includes(e)?e:void 0},Eh=(t,e)=>t?e?ch.indexOf(t)<=ch.indexOf(e)?t:e:t:e,kh=t=>{var e,i,o,n;const r=null!==(i=null===(e=null==t?void 0:t.annotations)||void 0===e?void 0:e.length)&&void 0!==i?i:0;return r>1?r:1===r&&(null!==(n=null===(o=null==t?void 0:t.subItems)||void 0===o?void 0:o.length)&&void 0!==n?n:0)>1?t.subItems.length:r},Sh=(t,e)=>{var i;try{const o=[],n=new Set,r=Array.isArray(e)?e:[];for(const e of Array.isArray(t)?t:[]){if(!(null==e?void 0:e.agentId))continue;const t=r.find((t=>(null==t?void 0:t.agentId)===e.agentId));n.add(e.agentId),o.push(Ch(e,t))}for(const t of r){if(!(null==t?void 0:t.agentId)||n.has(t.agentId))continue;const e=null!==(i=t.warningCount)&&void 0!==i?i:0;o.push({agentId:t.agentId,agentName:t.agentName,state:e>0?oh:nh,count:e>0?e:0,group:t})}return o}catch(t){return console.warn("Error in deriveAgentRows: ",t),[]}},Mh=a`
5501
+ `}catch(t){return console.warn("Error in renderDarkAgentIconLego: ",t),L``}},color:"#ffffff"};function fh(t,e){try{const i=`${null!=t?t:""} ${null!=e?e:""}`.toLowerCase(),o=vh.find((t=>t.keywords.some((t=>i.includes(t)))));return o?{render:o.render,color:o.color}:gh}catch(t){return console.warn("Error in resolveAgentIconInfo: ",t),gh}}var mh=function(t,e,i,o){for(var n,r=arguments.length,s=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,a=t.length-1;a>=0;a--)(n=t[a])&&(s=(r<3?n(s):r>3?n(e,i,s):n(e,i))||s);return r>3&&s&&Object.defineProperty(e,i,s),s};const wh="No issues found",yh="This finding isn't pinned on the page yet, so it's shown here in full.",bh="Back to QA agents",Ch="Close",xh=(t,e)=>{var i,o;const n={agentId:t.agentId,agentName:t.agentName,group:e};if(t.isRunning)return{...n,state:ih,count:0};if(e&&(null!==(i=e.warningCount)&&void 0!==i?i:0)>0)return{...n,state:oh,count:e.warningCount};const r=null!==(o=t.findingsCount)&&void 0!==o?o:0;return r>0&&!e&&!t.findingsResolved?t.findingsUnavailable?{...n,state:rh,count:0,title:"Couldn't load these findings"}:{...n,state:oh,count:r,pending:!0,title:Xd}:t.failed?{...n,state:rh,count:0,title:sh}:t.timedOut?{...n,state:rh,count:0,title:"Status not updating"}:{...n,state:nh,count:0,resolved:r>0}},Eh=t=>{if("string"!=typeof t)return;const e=t.trim().toLowerCase();return ch.includes(e)?e:void 0},kh=(t,e)=>t?e?ch.indexOf(t)<=ch.indexOf(e)?t:e:t:e,Sh=t=>{var e,i,o,n;const r=null!==(i=null===(e=null==t?void 0:t.annotations)||void 0===e?void 0:e.length)&&void 0!==i?i:0;return r>1?r:1===r&&(null!==(n=null===(o=null==t?void 0:t.subItems)||void 0===o?void 0:o.length)&&void 0!==n?n:0)>1?t.subItems.length:r},Mh=(t,e)=>{var i;try{const o=[],n=new Set,r=Array.isArray(e)?e:[];for(const e of Array.isArray(t)?t:[]){if(!(null==e?void 0:e.agentId))continue;const t=r.find((t=>(null==t?void 0:t.agentId)===e.agentId));n.add(e.agentId),o.push(xh(e,t))}for(const t of r){if(!(null==t?void 0:t.agentId)||n.has(t.agentId))continue;const e=null!==(i=t.warningCount)&&void 0!==i?i:0;o.push({agentId:t.agentId,agentName:t.agentName,state:e>0?oh:nh,count:e>0?e:0,group:t})}return o}catch(t){return console.warn("Error in deriveAgentRows: ",t),[]}},Th=a`
5526
5502
  .cws-sr-only {
5527
5503
  position: absolute;
5528
5504
  width: 1px;
@@ -5554,12 +5530,12 @@ class $c extends ma{}$c.Encryptor=class extends $c{processBlock(t,e){const i=t,o
5554
5530
  line-height: 1.4;
5555
5531
  opacity: 0.7;
5556
5532
  }
5557
- `;let Th=class extends X{constructor(){super(...arguments),this.agentGroups=[],this.currentPageUrl="",this.theme="light",this.agentRunStatuses=[],this.loading=!1,this.unsyncedAnnotationIds=[],this.expandedFindingIds=new Set,this.openAccordions=new Set,this.currentView="agents",this.selectedAgentId="",this.selectedFindingGroup=null,this.userAdjustedAccordions=!1,this.getSelectedAgentGroup=()=>{var t;try{return null===(t=this.agentGroups)||void 0===t?void 0:t.find((t=>(null==t?void 0:t.agentId)===this.selectedAgentId))}catch(t){return void console.warn("Error in getSelectedAgentGroup: ",t)}},this.onAgentClick=t=>{try{this.selectedAgentId=t,this.selectedFindingGroup=null,this.currentView="agent-detail",this.userAdjustedAccordions=!1,this.autoOpenCurrentPageAccordion(t)}catch(t){console.warn("Error in onAgentClick: ",t)}},this.autoOpenCurrentPageAccordion=t=>{var e;try{const i=null===(e=this.agentGroups)||void 0===e?void 0:e.find((e=>(null==e?void 0:e.agentId)===t));if(!i)return;const o=this.groupWarningsByPage(i.warnings),n=null==o?void 0:o.find((t=>null==t?void 0:t.isCurrentPage));this.openAccordions=new Set,(null==n?void 0:n.pageUrl)&&this.openAccordions.add(n.pageUrl)}catch(t){console.warn("Error in autoOpenCurrentPageAccordion: ",t)}},this.onBackClick=()=>{try{if("finding-group"===this.currentView)return this.currentView="agent-detail",void(this.selectedFindingGroup=null);this.userAdjustedAccordions=!1,this.currentView="agents",this.selectedAgentId=""}catch(t){console.warn("Error in onBackClick: ",t)}},this.onWarningRowClick=(t,e="")=>{var i,o,n;try{const r=null===(i=null==t?void 0:t.annotations)||void 0===i?void 0:i[0];if(!r)return;if((null!==(n=null===(o=null==t?void 0:t.annotations)||void 0===o?void 0:o.length)&&void 0!==n?n:0)>1)return void this.openFindingGroup(t,e);if(this.isExpandableWarning(t))return void this.toggleFindingExpanded(t);if(kh(t)>1)return void this.openFindingGroup(t,e);this.dispatchEvent(new CustomEvent("content-warning-item-click",{bubbles:!0,composed:!0,detail:{annotation:r}}))}catch(t){console.warn("Error in onWarningRowClick: ",t)}},this.openFindingGroup=(t,e)=>{var i,o;try{this.selectedFindingGroup={pageUrl:e,primaryText:null!==(i=null==t?void 0:t.primaryText)&&void 0!==i?i:"",secondaryText:null!==(o=null==t?void 0:t.secondaryText)&&void 0!==o?o:""},this.currentView="finding-group"}catch(t){console.warn("Error in openFindingGroup: ",t)}},this.getSelectedFindingGroup=()=>{var t,e;try{const i=this.selectedFindingGroup,o=this.getSelectedAgentGroup();if(!i||!o)return;const n=null===(t=this.groupWarningsByPage(o.warnings))||void 0===t?void 0:t.find((t=>(null==t?void 0:t.pageUrl)===i.pageUrl));return null===(e=null==n?void 0:n.warnings)||void 0===e?void 0:e.find((t=>(null==t?void 0:t.primaryText)===i.primaryText&&(null==t?void 0:t.secondaryText)===i.secondaryText))}catch(t){return void console.warn("Error in getSelectedFindingGroup: ",t)}},this.onAddAllSuggestions=t=>{try{this.dispatchEvent(new CustomEvent("content-warning-sidebar-add-all",{bubbles:!0,composed:!0,detail:{agentId:t}}))}catch(t){console.warn("Error in onAddAllSuggestions: ",t)}},this.onCloseClick=()=>{try{this.dispatchEvent(new CustomEvent("content-warning-sidebar-close",{bubbles:!0,composed:!0}))}catch(t){console.warn("Error in onCloseClick: ",t)}},this.normalizeUrlForGrouping=t=>{try{if(!t)return"";const e=nd(t);null!==e&&""!==e&&(t=e);const i="false"!==localStorage.getItem("sfNormalizeParams");let o=t;if(null==t?void 0:t.startsWith("/"))i&&(o=t.split("?")[0].split("#")[0]);else{const e=new URL(t);o=i?(null==e?void 0:e.pathname)||"/":(null==e?void 0:e.pathname)+((null==e?void 0:e.search)||"")+((null==e?void 0:e.hash)||"")}return(null==o?void 0:o.startsWith("/"))?o.substring(1):o}catch{const e=t||"";return(null==e?void 0:e.startsWith("/"))?e.substring(1):e}},this.groupWarningsByPage=t=>{var e,i,o,n,r,s;try{const a=new Map;for(const l of t){if(!(null===(e=null==l?void 0:l.pageUrls)||void 0===e?void 0:e.length)){const t="__unknown__";a.has(t)||a.set(t,{displayUrl:"__unknown__",warnings:[]}),null===(o=null===(i=a.get(t))||void 0===i?void 0:i.warnings)||void 0===o||o.push(l);continue}const t=new Map;for(const e of l.pageUrls){const i=this.normalizeUrlForGrouping(e);t.has(i)||t.set(i,e)}for(const[e,i]of t){const t=(null===(n=l.annotations)||void 0===n?void 0:n.filter((t=>{var i,o,n;const r=(null===(i=null==t?void 0:t.pageInfo)||void 0===i?void 0:i.url)||(null===(o=null==t?void 0:t.location)||void 0===o?void 0:o.url)||(null===(n=null==t?void 0:t.agent)||void 0===n?void 0:n.url)||"";return this.normalizeUrlForGrouping(r)===e})))||[];if(0===t.length)continue;const o={...l,occurrences:t.length,annotations:t};a.has(e)||a.set(e,{displayUrl:i,warnings:[]}),null===(s=null===(r=a.get(e))||void 0===r?void 0:r.warnings)||void 0===s||s.push(o)}}const l=[],c=this.normalizeUrlForGrouping(this.currentPageUrl);for(const[t,{displayUrl:e,warnings:i}]of a){const o="__unknown__"===t?"Unknown":t;l.push({pageUrl:e,pagePath:o,isCurrentPage:t===c&&"__unknown__"!==t,warnings:i})}return l.sort(((t,e)=>{var i;return(null==t?void 0:t.isCurrentPage)?-1:(null==e?void 0:e.isCurrentPage)?1:null===(i=null==t?void 0:t.pagePath)||void 0===i?void 0:i.localeCompare(null==e?void 0:e.pagePath)})),l}catch(t){return console.warn("Error in groupWarningsByPage: ",t),[]}},this.toggleAccordion=t=>{try{this.userAdjustedAccordions=!0;const e=new Set(this.openAccordions);e.has(t)?e.delete(t):e.add(t),this.openAccordions=e}catch(t){console.warn("Error in toggleAccordion: ",t)}},this.buildAgentRows=()=>Sh(this.agentRunStatuses,this.agentGroups),this.getAgentRowStatusText=t=>{var e;try{if((null==t?void 0:t.state)===ih)return"Running";if((null==t?void 0:t.state)===oh){const e=`${t.count} ${1===t.count?"finding":"findings"}`;return t.pending?`${e}. ${Xd}`:e}return(null==t?void 0:t.state)===rh?null!==(e=t.title)&&void 0!==e?e:sh:(null==t?void 0:t.resolved)?"All findings resolved":mh}catch(t){return console.warn("Error in getAgentRowStatusText: ",t),""}},this.getRunStatusAnnouncement=()=>{try{const t=this.buildAgentRows();if(0===t.length)return this.loading?th:"";const e=t.filter((t=>t.state===ih)).length;if(e>0)return`Running ${e} of ${t.length} QA ${1===t.length?"agent":"agents"}`;const i=t.filter((t=>t.state===oh)).reduce(((t,e)=>t+e.count),0),o=t.filter((t=>t.state===rh)).length,n=i>0?`${i} ${1===i?"finding":"findings"}.`:o>0?"":`${mh}.`;return["QA agents finished.",n,o>0?`${o} ${1===o?"check":"checks"} could not finish.`:""].filter((t=>!!t)).join(" ")}catch(t){return console.warn("Error in getRunStatusAnnouncement: ",t),""}},this.onActivationKey=(t,e)=>{try{"Enter"!==(null==t?void 0:t.key)&&" "!==(null==t?void 0:t.key)&&"Spacebar"!==(null==t?void 0:t.key)||(t.preventDefault(),e())}catch(t){console.warn("Error in onActivationKey: ",t)}},this.isUnsyncedWarning=t=>{var e;try{const i=this.getWarningAnnotationId(t);return!!i&&(null!==(e=this.unsyncedAnnotationIds)&&void 0!==e?e:[]).includes(i)}catch(t){return console.warn("Error in isUnsyncedWarning: ",t),!1}},this.isPageLevelWarning=t=>{var e,i,o;try{return 1===(null!==(i=null===(e=null==t?void 0:t.annotations)||void 0===e?void 0:e.length)&&void 0!==i?i:0)&&!0===(null===(o=t.annotations[0])||void 0===o?void 0:o.isPageAnnotation)}catch(t){return console.warn("Error in isPageLevelWarning: ",t),!1}},this.isExpandableWarning=t=>{var e,i;return 1===(null!==(i=null===(e=null==t?void 0:t.annotations)||void 0===e?void 0:e.length)&&void 0!==i?i:0)&&(this.isPageLevelWarning(t)||this.isUnsyncedWarning(t))},this.onOpenCommentClick=(t,e)=>{try{t.stopPropagation(),this.dispatchEvent(new CustomEvent("content-warning-item-click",{bubbles:!0,composed:!0,detail:{annotation:e}}))}catch(t){console.warn("Error in onOpenCommentClick: ",t)}},this.getWarningAnnotationId=t=>{var e;const i=null===(e=null==t?void 0:t.annotations)||void 0===e?void 0:e[0];return`${(null==i?void 0:i.annotationId)||(null==i?void 0:i.id)||""}`},this.toggleFindingExpanded=t=>{try{const e=this.getWarningAnnotationId(t);if(!e)return;const i=new Set(this.expandedFindingIds);i.has(e)?i.delete(e):i.add(e),this.expandedFindingIds=i}catch(t){console.warn("Error in toggleFindingExpanded: ",t)}},this.getAgentIconInfo=(t,e)=>{try{return gh(t,e)}catch(t){return console.warn("Error in getAgentIconInfo: ",t),gh("","")}},this.onAgentRowClick=t=>{try{(null==t?void 0:t.state)===oh&&(null==t?void 0:t.group)&&this.onAgentClick(t.agentId)}catch(t){console.warn("Error in onAgentRowClick: ",t)}},this.renderWarningIcon=()=>{try{return L`
5533
+ `;let Ah=class extends X{constructor(){super(...arguments),this.agentGroups=[],this.currentPageUrl="",this.theme="light",this.agentRunStatuses=[],this.loading=!1,this.unsyncedAnnotationIds=[],this.expandedFindingIds=new Set,this.openAccordions=new Set,this.currentView="agents",this.selectedAgentId="",this.selectedFindingGroup=null,this.userAdjustedAccordions=!1,this.getSelectedAgentGroup=()=>{var t;try{return null===(t=this.agentGroups)||void 0===t?void 0:t.find((t=>(null==t?void 0:t.agentId)===this.selectedAgentId))}catch(t){return void console.warn("Error in getSelectedAgentGroup: ",t)}},this.onAgentClick=t=>{try{this.selectedAgentId=t,this.selectedFindingGroup=null,this.currentView="agent-detail",this.userAdjustedAccordions=!1,this.autoOpenCurrentPageAccordion(t)}catch(t){console.warn("Error in onAgentClick: ",t)}},this.autoOpenCurrentPageAccordion=t=>{var e;try{const i=null===(e=this.agentGroups)||void 0===e?void 0:e.find((e=>(null==e?void 0:e.agentId)===t));if(!i)return;const o=this.groupWarningsByPage(i.warnings),n=null==o?void 0:o.find((t=>null==t?void 0:t.isCurrentPage));this.openAccordions=new Set,(null==n?void 0:n.pageUrl)&&this.openAccordions.add(n.pageUrl)}catch(t){console.warn("Error in autoOpenCurrentPageAccordion: ",t)}},this.onBackClick=()=>{try{if("finding-group"===this.currentView)return this.currentView="agent-detail",void(this.selectedFindingGroup=null);this.userAdjustedAccordions=!1,this.currentView="agents",this.selectedAgentId=""}catch(t){console.warn("Error in onBackClick: ",t)}},this.onWarningRowClick=(t,e="")=>{var i,o,n;try{const r=null===(i=null==t?void 0:t.annotations)||void 0===i?void 0:i[0];if(!r)return;if((null!==(n=null===(o=null==t?void 0:t.annotations)||void 0===o?void 0:o.length)&&void 0!==n?n:0)>1)return void this.openFindingGroup(t,e);if(this.isExpandableWarning(t))return void this.toggleFindingExpanded(t);if(Sh(t)>1)return void this.openFindingGroup(t,e);this.dispatchEvent(new CustomEvent("content-warning-item-click",{bubbles:!0,composed:!0,detail:{annotation:r}}))}catch(t){console.warn("Error in onWarningRowClick: ",t)}},this.openFindingGroup=(t,e)=>{var i,o;try{this.selectedFindingGroup={pageUrl:e,primaryText:null!==(i=null==t?void 0:t.primaryText)&&void 0!==i?i:"",secondaryText:null!==(o=null==t?void 0:t.secondaryText)&&void 0!==o?o:""},this.currentView="finding-group"}catch(t){console.warn("Error in openFindingGroup: ",t)}},this.getSelectedFindingGroup=()=>{var t,e;try{const i=this.selectedFindingGroup,o=this.getSelectedAgentGroup();if(!i||!o)return;const n=null===(t=this.groupWarningsByPage(o.warnings))||void 0===t?void 0:t.find((t=>(null==t?void 0:t.pageUrl)===i.pageUrl));return null===(e=null==n?void 0:n.warnings)||void 0===e?void 0:e.find((t=>(null==t?void 0:t.primaryText)===i.primaryText&&(null==t?void 0:t.secondaryText)===i.secondaryText))}catch(t){return void console.warn("Error in getSelectedFindingGroup: ",t)}},this.onAddAllSuggestions=t=>{try{this.dispatchEvent(new CustomEvent("content-warning-sidebar-add-all",{bubbles:!0,composed:!0,detail:{agentId:t}}))}catch(t){console.warn("Error in onAddAllSuggestions: ",t)}},this.onCloseClick=()=>{try{this.dispatchEvent(new CustomEvent("content-warning-sidebar-close",{bubbles:!0,composed:!0}))}catch(t){console.warn("Error in onCloseClick: ",t)}},this.normalizeUrlForGrouping=t=>{try{if(!t)return"";const e=nd(t);null!==e&&""!==e&&(t=e);const i="false"!==localStorage.getItem("sfNormalizeParams");let o=t;if(null==t?void 0:t.startsWith("/"))i&&(o=t.split("?")[0].split("#")[0]);else{const e=new URL(t);o=i?(null==e?void 0:e.pathname)||"/":(null==e?void 0:e.pathname)+((null==e?void 0:e.search)||"")+((null==e?void 0:e.hash)||"")}return(null==o?void 0:o.startsWith("/"))?o.substring(1):o}catch{const e=t||"";return(null==e?void 0:e.startsWith("/"))?e.substring(1):e}},this.groupWarningsByPage=t=>{var e,i,o,n,r,s;try{const a=new Map;for(const l of t){if(!(null===(e=null==l?void 0:l.pageUrls)||void 0===e?void 0:e.length)){const t="__unknown__";a.has(t)||a.set(t,{displayUrl:"__unknown__",warnings:[]}),null===(o=null===(i=a.get(t))||void 0===i?void 0:i.warnings)||void 0===o||o.push(l);continue}const t=new Map;for(const e of l.pageUrls){const i=this.normalizeUrlForGrouping(e);t.has(i)||t.set(i,e)}for(const[e,i]of t){const t=(null===(n=l.annotations)||void 0===n?void 0:n.filter((t=>{var i,o,n;const r=(null===(i=null==t?void 0:t.pageInfo)||void 0===i?void 0:i.url)||(null===(o=null==t?void 0:t.location)||void 0===o?void 0:o.url)||(null===(n=null==t?void 0:t.agent)||void 0===n?void 0:n.url)||"";return this.normalizeUrlForGrouping(r)===e})))||[];if(0===t.length)continue;const o={...l,occurrences:t.length,annotations:t};a.has(e)||a.set(e,{displayUrl:i,warnings:[]}),null===(s=null===(r=a.get(e))||void 0===r?void 0:r.warnings)||void 0===s||s.push(o)}}const l=[],c=this.normalizeUrlForGrouping(this.currentPageUrl);for(const[t,{displayUrl:e,warnings:i}]of a){const o="__unknown__"===t?"Unknown":t;l.push({pageUrl:e,pagePath:o,isCurrentPage:t===c&&"__unknown__"!==t,warnings:i})}return l.sort(((t,e)=>{var i;return(null==t?void 0:t.isCurrentPage)?-1:(null==e?void 0:e.isCurrentPage)?1:null===(i=null==t?void 0:t.pagePath)||void 0===i?void 0:i.localeCompare(null==e?void 0:e.pagePath)})),l}catch(t){return console.warn("Error in groupWarningsByPage: ",t),[]}},this.toggleAccordion=t=>{try{this.userAdjustedAccordions=!0;const e=new Set(this.openAccordions);e.has(t)?e.delete(t):e.add(t),this.openAccordions=e}catch(t){console.warn("Error in toggleAccordion: ",t)}},this.buildAgentRows=()=>Mh(this.agentRunStatuses,this.agentGroups),this.getAgentRowStatusText=t=>{var e;try{if((null==t?void 0:t.state)===ih)return"Running";if((null==t?void 0:t.state)===oh){const e=`${t.count} ${1===t.count?"finding":"findings"}`;return t.pending?`${e}. ${Xd}`:e}return(null==t?void 0:t.state)===rh?null!==(e=t.title)&&void 0!==e?e:sh:(null==t?void 0:t.resolved)?"All findings resolved":wh}catch(t){return console.warn("Error in getAgentRowStatusText: ",t),""}},this.getRunStatusAnnouncement=()=>{try{const t=this.buildAgentRows();if(0===t.length)return this.loading?th:"";const e=t.filter((t=>t.state===ih)).length;if(e>0)return`Running ${e} of ${t.length} QA ${1===t.length?"agent":"agents"}`;const i=t.filter((t=>t.state===oh)).reduce(((t,e)=>t+e.count),0),o=t.filter((t=>t.state===rh)).length,n=i>0?`${i} ${1===i?"finding":"findings"}.`:o>0?"":`${wh}.`;return["QA agents finished.",n,o>0?`${o} ${1===o?"check":"checks"} could not finish.`:""].filter((t=>!!t)).join(" ")}catch(t){return console.warn("Error in getRunStatusAnnouncement: ",t),""}},this.onActivationKey=(t,e)=>{try{"Enter"!==(null==t?void 0:t.key)&&" "!==(null==t?void 0:t.key)&&"Spacebar"!==(null==t?void 0:t.key)||(t.preventDefault(),e())}catch(t){console.warn("Error in onActivationKey: ",t)}},this.isUnsyncedWarning=t=>{var e;try{const i=this.getWarningAnnotationId(t);return!!i&&(null!==(e=this.unsyncedAnnotationIds)&&void 0!==e?e:[]).includes(i)}catch(t){return console.warn("Error in isUnsyncedWarning: ",t),!1}},this.isPageLevelWarning=t=>{var e,i,o;try{return 1===(null!==(i=null===(e=null==t?void 0:t.annotations)||void 0===e?void 0:e.length)&&void 0!==i?i:0)&&!0===(null===(o=t.annotations[0])||void 0===o?void 0:o.isPageAnnotation)}catch(t){return console.warn("Error in isPageLevelWarning: ",t),!1}},this.isExpandableWarning=t=>{var e,i;return 1===(null!==(i=null===(e=null==t?void 0:t.annotations)||void 0===e?void 0:e.length)&&void 0!==i?i:0)&&(this.isPageLevelWarning(t)||this.isUnsyncedWarning(t))},this.getWarningAnnotationId=t=>{var e;const i=null===(e=null==t?void 0:t.annotations)||void 0===e?void 0:e[0];return`${(null==i?void 0:i.annotationId)||(null==i?void 0:i.id)||""}`},this.toggleFindingExpanded=t=>{try{const e=this.getWarningAnnotationId(t);if(!e)return;const i=new Set(this.expandedFindingIds);i.has(e)?i.delete(e):i.add(e),this.expandedFindingIds=i}catch(t){console.warn("Error in toggleFindingExpanded: ",t)}},this.getAgentIconInfo=(t,e)=>{try{return fh(t,e)}catch(t){return console.warn("Error in getAgentIconInfo: ",t),fh("","")}},this.onAgentRowClick=t=>{try{(null==t?void 0:t.state)===oh&&(null==t?void 0:t.group)&&this.onAgentClick(t.agentId)}catch(t){console.warn("Error in onAgentRowClick: ",t)}},this.renderWarningIcon=()=>{try{return L`
5558
5534
  <svg width="20" height="20" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
5559
5535
  <path d="M12.0003 10.2329V13.8332M12.0003 16.5334H12.0093M10.5268 5.36441L3.23087 17.546C3.08046 17.8064 3.00087 18.1017 3.00001 18.4025C2.99915 18.7033 3.07705 18.999 3.22596 19.2604C3.37487 19.5217 3.5896 19.7395 3.8488 19.8921C4.108 20.0446 4.40263 20.1267 4.70338 20.1301H19.2971C19.5978 20.1266 19.8922 20.0445 20.1513 19.892C20.4104 19.7395 20.625 19.5218 20.7739 19.2606C20.9228 18.9994 21.0007 18.7038 21 18.4032C20.9992 18.1025 20.9198 17.8073 20.7697 17.5469L13.4737 5.36351C13.3202 5.11015 13.1039 4.90064 12.8458 4.75524C12.5877 4.60984 12.2965 4.53345 12.0003 4.53345C11.704 4.53345 11.4128 4.60984 11.1547 4.75524C10.8966 4.90064 10.6803 5.11015 10.5268 5.36351V5.36441Z" stroke="#E69422" stroke-width="1.80014" stroke-linecap="round" stroke-linejoin="round"/>
5560
5536
  </svg>
5561
5537
  `}catch(t){return console.warn("Error in renderWarningIcon: ",t),L``}},this.renderBackIcon=()=>{try{return this.theme===Qd?L`
5562
- <div class="back-icon-wrapper" role="button" tabindex="0" aria-label=${yh}
5538
+ <div class="back-icon-wrapper" role="button" tabindex="0" aria-label=${bh}
5563
5539
  @click=${this.onBackClick}
5564
5540
  @keydown=${t=>this.onActivationKey(t,this.onBackClick)}>
5565
5541
  ${function(){try{return L`
@@ -5569,7 +5545,7 @@ class $c extends ma{}$c.Encryptor=class extends $c{processBlock(t,e){const i=t,o
5569
5545
  `}catch(t){return console.warn("Error in renderDarkBackChevronIcon: ",t),L``}}()}
5570
5546
  </div>
5571
5547
  `:L`
5572
- <div class="back-icon-wrapper" role="button" tabindex="0" aria-label=${yh}
5548
+ <div class="back-icon-wrapper" role="button" tabindex="0" aria-label=${bh}
5573
5549
  @click=${this.onBackClick}
5574
5550
  @keydown=${t=>this.onActivationKey(t,this.onBackClick)}>
5575
5551
  <svg class="back-icon" width="16" height="16" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
@@ -5577,7 +5553,7 @@ class $c extends ma{}$c.Encryptor=class extends $c{processBlock(t,e){const i=t,o
5577
5553
  </svg>
5578
5554
  </div>
5579
5555
  `}catch(t){return console.warn("Error in renderBackIcon: ",t),L``}},this.renderCloseIcon=()=>{try{return this.theme===Qd?L`
5580
- <div class="close-icon-wrapper cws-icon-shell" role="button" tabindex="0" aria-label=${bh}
5556
+ <div class="close-icon-wrapper cws-icon-shell" role="button" tabindex="0" aria-label=${Ch}
5581
5557
  @click=${this.onCloseClick}
5582
5558
  @keydown=${t=>this.onActivationKey(t,this.onCloseClick)}>
5583
5559
  ${function(){try{return L`
@@ -5589,7 +5565,7 @@ class $c extends ma{}$c.Encryptor=class extends $c{processBlock(t,e){const i=t,o
5589
5565
  `}catch(t){return console.warn("Error in renderDarkCloseIcon: ",t),L``}}()}
5590
5566
  </div>
5591
5567
  `:L`
5592
- <div class="close-icon-wrapper" role="button" tabindex="0" aria-label=${bh}
5568
+ <div class="close-icon-wrapper" role="button" tabindex="0" aria-label=${Ch}
5593
5569
  @click=${this.onCloseClick}
5594
5570
  @keydown=${t=>this.onActivationKey(t,this.onCloseClick)}>
5595
5571
  <svg class="close-icon" width="16" height="16" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
@@ -5706,7 +5682,7 @@ class $c extends ma{}$c.Encryptor=class extends $c{processBlock(t,e){const i=t,o
5706
5682
  </div>
5707
5683
  <div class="cws-agent-row-right">
5708
5684
  <div class="cws-icon-shell">
5709
- <div class="cws-spinner-icon">${uh()}</div>
5685
+ <div class="cws-spinner-icon">${ph()}</div>
5710
5686
  </div>
5711
5687
  </div>
5712
5688
  </div>
@@ -5729,7 +5705,7 @@ class $c extends ma{}$c.Encryptor=class extends $c{processBlock(t,e){const i=t,o
5729
5705
  </div>
5730
5706
  `}catch(t){return console.warn("Error in renderAgentRow: ",t),L``}},this.renderAgentRowStatus=t=>{try{return(null==t?void 0:t.state)===ih?L`
5731
5707
  <div class="cws-icon-shell">
5732
- <div class="cws-spinner-icon">${uh()}</div>
5708
+ <div class="cws-spinner-icon">${ph()}</div>
5733
5709
  </div>
5734
5710
  `:(null==t?void 0:t.state)===oh?L`
5735
5711
  <div class="cws-findings-pill">
@@ -5755,12 +5731,12 @@ class $c extends ma{}$c.Encryptor=class extends $c{processBlock(t,e){const i=t,o
5755
5731
  <path d="M5.83333 10L10 14.1667L18.3333 5.83333M1.66667 10L5.83333 14.1667M10 10L14.1667 5.83333" stroke="#0DCF82" stroke-width="1.66667" stroke-linecap="round" stroke-linejoin="round"/>
5756
5732
  </svg>
5757
5733
  `}catch(t){return console.warn("Error in renderDarkChecksIcon: ",t),L``}}()}</div>
5758
- `}catch(t){return console.warn("Error in renderAgentRowStatus: ",t),L``}},this.renderSeverityDot=t=>{const e=t?dh[t]:void 0;return e?L`<span class="cws-severity-dot cws-severity-dot--${e.tone}" role="img" aria-label="${e.label} severity"></span>`:R},this.renderFindingBody=(t,e,i=!1)=>{var o,n,r,s,a,l,c,d;try{const h=null===(o=null==t?void 0:t.annotations)||void 0===o?void 0:o[0],u=null!==(c=null!==(r=null===(n=null==h?void 0:h.agent)||void 0===n?void 0:n.reason)&&void 0!==r?r:null===(l=null===(a=null===(s=null==h?void 0:h.comments)||void 0===s?void 0:s[0])||void 0===a?void 0:a.agent)||void 0===l?void 0:l.reason)&&void 0!==c?c:{},p="string"==typeof(null==u?void 0:u.suggestion)?u.suggestion.trim():"",v=i?[]:null!==(d=null==t?void 0:t.subItems)&&void 0!==d?d:[],g=!i&&!(!(null==t?void 0:t.severity)||!dh[t.severity]);return p||v.length||!e?L`
5759
- <div class="cws-finding-body${g?" cws-finding-body--dot":""}">
5760
- ${p?L`<span class="cws-finding-suggestion">${p}</span>`:R}
5761
- ${v.length?L`
5734
+ `}catch(t){return console.warn("Error in renderAgentRowStatus: ",t),L``}},this.renderSeverityDot=t=>{const e=t&&dh[t]||hh;return L`<span class="cws-severity-dot cws-severity-dot--${e.tone}" role="img" aria-label="${e.label} severity"></span>`},this.renderFindingBody=(t,e=!1)=>{var i,o,n,r,s,a,l,c;try{const d=null===(i=null==t?void 0:t.annotations)||void 0===i?void 0:i[0],h=null!==(l=null!==(n=null===(o=null==d?void 0:d.agent)||void 0===o?void 0:o.reason)&&void 0!==n?n:null===(a=null===(s=null===(r=null==d?void 0:d.comments)||void 0===r?void 0:r[0])||void 0===s?void 0:s.agent)||void 0===a?void 0:a.reason)&&void 0!==l?l:{},u="string"==typeof(null==h?void 0:h.suggestion)?h.suggestion.trim():"",p=e?[]:null!==(c=null==t?void 0:t.subItems)&&void 0!==c?c:[],v=!e;return u||p.length?L`
5735
+ <div class="cws-finding-body${v?" cws-finding-body--dot":""}">
5736
+ ${u?L`<span class="cws-finding-suggestion">${u}</span>`:R}
5737
+ ${p.length?L`
5762
5738
  <ul class="cws-finding-items">
5763
- ${v.map((t=>L`
5739
+ ${p.map((t=>L`
5764
5740
  <li class="cws-finding-item">
5765
5741
  <span class="cws-finding-item-label">${null==t?void 0:t.label}</span>
5766
5742
  ${(null==t?void 0:t.detail)?L`<span class="cws-finding-item-detail">${t.detail}</span>`:R}
@@ -5768,32 +5744,27 @@ class $c extends ma{}$c.Encryptor=class extends $c{processBlock(t,e){const i=t,o
5768
5744
  `))}
5769
5745
  </ul>
5770
5746
  `:R}
5771
- ${e?R:L`
5772
- <button class="cws-open-comment" type="button" @click=${t=>this.onOpenCommentClick(t,h)}>
5773
- Open comment
5774
- </button>
5775
- `}
5776
5747
  </div>
5777
- `:R}catch(t){return console.warn("Error in renderFindingBody: ",t),R}},this.renderGenericRow=(t,e="")=>{var i,o;try{const n=this.theme===Qd,r=kh(t),s=(null!==(o=null===(i=null==t?void 0:t.annotations)||void 0===i?void 0:i.length)&&void 0!==o?o:0)>1?"findings":"items",a=this.isExpandableWarning(t),l=r>1&&!a,c=a&&this.isUnsyncedWarning(t),d=a&&this.expandedFindingIds.has(this.getWarningAnnotationId(t));return L`
5748
+ `:R}catch(t){return console.warn("Error in renderFindingBody: ",t),R}},this.renderGenericRow=(t,e="")=>{var i,o;try{const n=this.theme===Qd,r=Sh(t),s=(null!==(o=null===(i=null==t?void 0:t.annotations)||void 0===i?void 0:i.length)&&void 0!==o?o:0)>1?"findings":"items",a=this.isExpandableWarning(t),l=r>1&&!a,c=a&&this.isUnsyncedWarning(t),d=a&&this.expandedFindingIds.has(this.getWarningAnnotationId(t));return L`
5778
5749
  <div class="${`cws-list-row${c?" cws-list-row--unsynced":""}${d?" cws-list-row--expanded":""}`}${l?" cws-list-row--group":""}" role="button" tabindex="0"
5779
5750
  aria-expanded=${a?d?"true":"false":R}
5780
5751
  aria-label=${l?`${null==t?void 0:t.primaryText}, ${r} ${s}`:R}
5781
5752
  @click=${()=>this.onWarningRowClick(t,e)}
5782
5753
  @keydown=${i=>this.onActivationKey(i,(()=>this.onWarningRowClick(t,e)))}>
5783
- <div class="cws-list-row-content${(null==t?void 0:t.severity)&&dh[t.severity]?" cws-list-row-content--dot":""}">
5754
+ <div class="cws-list-row-content cws-list-row-content--dot">
5784
5755
  <span class="cws-generic-primary${d?" cws-generic-primary--full":""}" title=${(null==t?void 0:t.primaryText)||R}>${this.renderSeverityDot(null==t?void 0:t.severity)}${null==t?void 0:t.primaryText}</span>
5785
5756
  ${(null==t?void 0:t.secondaryText)?L`
5786
5757
  <span class="cws-generic-secondary${d?" cws-generic-secondary--full":""}" title=${(null==t?void 0:t.secondaryText)||R}>${null==t?void 0:t.secondaryText}</span>
5787
5758
  `:""}
5788
5759
  ${d&&c?L`
5789
- <span class="cws-generic-secondary cws-generic-secondary--full cws-finding-note">${wh}</span>
5760
+ <span class="cws-generic-secondary cws-generic-secondary--full cws-finding-note">${yh}</span>
5790
5761
  `:""}
5791
5762
  </div>
5792
5763
  ${n?L`
5793
5764
  ${r>1?L`<span class="cws-group-count" aria-hidden="true">${r}</span>`:R}
5794
- <div class="cws-icon-shell" aria-hidden="true">${hh()}</div>`:L`<span class="cws-occurrence-badge">${null==t?void 0:t.occurrences}</span>`}
5765
+ <div class="cws-icon-shell" aria-hidden="true">${uh()}</div>`:L`<span class="cws-occurrence-badge">${null==t?void 0:t.occurrences}</span>`}
5795
5766
  </div>
5796
- ${d?this.renderFindingBody(t,c):R}
5767
+ ${d?this.renderFindingBody(t):R}
5797
5768
  `}catch(t){return console.warn("Error in renderGenericRow: ",t),L``}},this.getFindingGroupEntries=t=>{var e,i;try{const o=null!==(e=null==t?void 0:t.annotations)&&void 0!==e?e:[];return o.length>1?o.map(((t,e)=>{const i=(t=>{var e,i,o,n,r,s,a,l;try{const c=null!==(s=null!==(i=null===(e=null==t?void 0:t.agent)||void 0===e?void 0:e.reason)&&void 0!==i?i:null===(r=null===(n=null===(o=null==t?void 0:t.comments)||void 0===o?void 0:o[0])||void 0===n?void 0:n.agent)||void 0===r?void 0:r.reason)&&void 0!==s?s:{},d=t=>"string"==typeof t?t.replace(/\s+/g," ").trim():"",h=t=>t.length>60?`${t.slice(0,59).trimEnd()}…`:t,u=d(null===(a=null==t?void 0:t.targetElement)||void 0===a?void 0:a.targetText)||d(null===(l=null==t?void 0:t.targetTextRange)||void 0===l?void 0:l.text)||d(null==c?void 0:c.targetText);if(u)return h(u);const p="string"==typeof(null==c?void 0:c.htmlSnippet)?c.htmlSnippet:"";if(!p)return"";const v=document.createElement("template");v.innerHTML=p;const g=d(v.content.textContent);if(g)return h(g);const f=v.content.querySelector("[aria-label], [alt], [title], [placeholder]");return h(d(null==f?void 0:f.getAttribute("aria-label"))||d(null==f?void 0:f.getAttribute("alt"))||d(null==f?void 0:f.getAttribute("title"))||d(null==f?void 0:f.getAttribute("placeholder")))}catch(t){return console.warn("Error in describeFindingTarget: ",t),""}})(t);return{label:i?`“${i}”`:`Finding ${e+1}`,detail:`${e+1} of ${o.length}`,annotation:t}})):(null!==(i=null==t?void 0:t.subItems)&&void 0!==i?i:[]).map(((t,e,i)=>({label:(null==t?void 0:t.label)?`“${t.label}”`:`Item ${e+1}`,detail:(null==t?void 0:t.detail)||`${e+1} of ${i.length}`,annotation:o[0]})))}catch(t){return console.warn("Error in getFindingGroupEntries: ",t),[]}},this.renderFindingGroupItem=(t,e)=>{try{const i={...t,occurrences:1,annotations:[e.annotation],subItems:void 0},o=this.isExpandableWarning(i),n=o&&this.isUnsyncedWarning(i),r=o&&this.expandedFindingIds.has(this.getWarningAnnotationId(i));return L`
5798
5769
  <div class="cws-list-row cws-list-row--group-item${r?" cws-list-row--expanded":""}" role="button" tabindex="0"
5799
5770
  aria-expanded=${o?r?"true":"false":R}
@@ -5803,13 +5774,13 @@ class $c extends ma{}$c.Encryptor=class extends $c{processBlock(t,e){const i=t,o
5803
5774
  <span class="cws-generic-primary${r?" cws-generic-primary--full":""}" title=${e.label}>${e.label}</span>
5804
5775
  <span class="cws-generic-secondary" title=${e.detail}>${e.detail}</span>
5805
5776
  ${r&&n?L`
5806
- <span class="cws-generic-secondary cws-generic-secondary--full cws-finding-note">${wh}</span>
5777
+ <span class="cws-generic-secondary cws-generic-secondary--full cws-finding-note">${yh}</span>
5807
5778
  `:""}
5808
5779
  </div>
5809
- ${this.theme===Qd?L`<div class="cws-icon-shell" aria-hidden="true">${hh()}</div>`:R}
5780
+ ${this.theme===Qd?L`<div class="cws-icon-shell" aria-hidden="true">${uh()}</div>`:R}
5810
5781
  </div>
5811
- ${r?this.renderFindingBody(i,n,!0):R}
5812
- `}catch(t){return console.warn("Error in renderFindingGroupItem: ",t),L``}},this.renderFindingGroupView=t=>{var e,i,o,n;try{const r="cws-header-title"+(this.theme===Qd?" cws-header-title--detail":""),s=null!==(i=null===(e=this.getSelectedAgentGroup())||void 0===e?void 0:e.agentName)&&void 0!==i?i:"",a=!(!(null==t?void 0:t.severity)||!dh[t.severity]),l=this.getFindingGroupEntries(t);return L`
5782
+ ${r?this.renderFindingBody(i,!0):R}
5783
+ `}catch(t){return console.warn("Error in renderFindingGroupItem: ",t),L``}},this.renderFindingGroupView=t=>{var e,i,o,n;try{const r="cws-header-title"+(this.theme===Qd?" cws-header-title--detail":""),s=null!==(i=null===(e=this.getSelectedAgentGroup())||void 0===e?void 0:e.agentName)&&void 0!==i?i:"",a=this.getFindingGroupEntries(t);return L`
5813
5784
  <div class="cws-header">
5814
5785
  <div class="cws-header-left">
5815
5786
  ${this.renderBackIcon()}
@@ -5823,13 +5794,13 @@ class $c extends ma{}$c.Encryptor=class extends $c{processBlock(t,e){const i=t,o
5823
5794
  <div class="cws-list">
5824
5795
  <!-- A tree: a line runs down from the dot, and the findings sit indented beside it. -->
5825
5796
  <div class="cws-group-tree">
5826
- <div class="cws-group-summary${a?" cws-list-row-content--dot":""}">
5797
+ <div class="cws-group-summary cws-list-row-content--dot">
5827
5798
  <span class="cws-generic-primary cws-generic-primary--full">${this.renderSeverityDot(null==t?void 0:t.severity)}${null==t?void 0:t.primaryText}</span>
5828
5799
  ${(null==t?void 0:t.secondaryText)?L`<span class="cws-generic-secondary cws-generic-secondary--full">${t.secondaryText}</span>`:""}
5829
- <span class="cws-group-summary-count">${l.length} ${(null!==(n=null===(o=null==t?void 0:t.annotations)||void 0===o?void 0:o.length)&&void 0!==n?n:0)>1?"findings":"items"}</span>
5800
+ <span class="cws-group-summary-count">${a.length} ${(null!==(n=null===(o=null==t?void 0:t.annotations)||void 0===o?void 0:o.length)&&void 0!==n?n:0)>1?"findings":"items"}</span>
5830
5801
  </div>
5831
5802
  <div class="cws-page-warnings cws-group-items">
5832
- ${l.map((e=>this.renderFindingGroupItem(t,e)))}
5803
+ ${a.map((e=>this.renderFindingGroupItem(t,e)))}
5833
5804
  </div>
5834
5805
  </div>
5835
5806
  </div>
@@ -5845,12 +5816,12 @@ class $c extends ma{}$c.Encryptor=class extends $c{processBlock(t,e){const i=t,o
5845
5816
  </div>
5846
5817
  <div class="cws-divider"></div>
5847
5818
  <div class="cws-empty-state"><span>Agent not found.</span></div>
5848
- `}const e=t.agentId,i=this.renderGenericRow;return this.renderGroupedListView(t.agentName,t.warnings,i,e,`No issues found for ${t.agentName}`)}catch(t){return console.warn("Error in renderAgentDetailView: ",t),L``}},this.renderCurrentView=()=>{try{if("agents"===this.currentView)return this.renderAgentsView();if("finding-group"===this.currentView){const t=this.getSelectedFindingGroup();if(t&&kh(t)>1)return this.renderFindingGroupView(t)}return this.renderAgentDetailView()}catch(t){return console.warn("Error in renderCurrentView: ",t),L``}}}willUpdate(t){try{"agent-detail"===this.currentView&&this.selectedAgentId&&!this.userAdjustedAccordions&&(t.has("agentGroups")||t.has("currentPageUrl"))&&this.autoOpenCurrentPageAccordion(this.selectedAgentId)}catch(t){console.warn("Error in willUpdate: ",t)}}render(){try{return L`
5819
+ `}const e=t.agentId,i=this.renderGenericRow;return this.renderGroupedListView(t.agentName,t.warnings,i,e,`No issues found for ${t.agentName}`)}catch(t){return console.warn("Error in renderAgentDetailView: ",t),L``}},this.renderCurrentView=()=>{try{if("agents"===this.currentView)return this.renderAgentsView();if("finding-group"===this.currentView){const t=this.getSelectedFindingGroup();if(t&&Sh(t)>1)return this.renderFindingGroupView(t)}return this.renderAgentDetailView()}catch(t){return console.warn("Error in renderCurrentView: ",t),L``}}}willUpdate(t){try{"agent-detail"===this.currentView&&this.selectedAgentId&&!this.userAdjustedAccordions&&(t.has("agentGroups")||t.has("currentPageUrl"))&&this.autoOpenCurrentPageAccordion(this.selectedAgentId)}catch(t){console.warn("Error in willUpdate: ",t)}}render(){try{return L`
5849
5820
  <div class="cws-panel">
5850
5821
  ${this.renderCurrentView()}
5851
5822
  ${this.theme===Qd?L`<div class="cws-sr-only" role="status" aria-live="polite">${this.getRunStatusAnnouncement()}</div>`:R}
5852
5823
  </div>
5853
- `}catch(t){return console.warn("Error in render: ",t),L``}}};Th.styles=[qd,Mh],fh([ot({type:Array})],Th.prototype,"agentGroups",void 0),fh([ot({type:String})],Th.prototype,"currentPageUrl",void 0),fh([ot({type:String,reflect:!0})],Th.prototype,"theme",void 0),fh([ot({type:Array})],Th.prototype,"agentRunStatuses",void 0),fh([ot({type:Boolean})],Th.prototype,"loading",void 0),fh([ot({type:Array})],Th.prototype,"unsyncedAnnotationIds",void 0),fh([nt()],Th.prototype,"expandedFindingIds",void 0),fh([nt()],Th.prototype,"openAccordions",void 0),fh([nt()],Th.prototype,"currentView",void 0),fh([nt()],Th.prototype,"selectedAgentId",void 0),fh([nt()],Th.prototype,"selectedFindingGroup",void 0),Th=fh([et("content-warning-sidebar")],Th);function Ah(){try{return"undefined"!=typeof localStorage&&"true"===localStorage.getItem("sfScreenShotDebug")}catch{return!1}}function _h(t){return new Promise((e=>{let i=Math.max(1,t);const o=()=>{i-=1,i<=0?e():requestAnimationFrame(o)};requestAnimationFrame(o)}))}function Ih(t,e,i=600){const o=t.requestVideoFrameCallback;return"function"!=typeof o?_h(e+2):new Promise((n=>{let r=Math.max(1,e),s=!1;const a=()=>{s||(s=!0,clearTimeout(l),n())},l=setTimeout(a,Math.max(0,i)),c=()=>{s||(r-=1,r<=0?a():o.call(t,c))};o.call(t,c)}))}function $h(t,e,i,o,n){const r=Math.max(0,Math.round(e)),s=Math.max(0,Math.round(i)),a=Math.max(1,Math.min(Math.round(o),t.width-r)),l=Math.max(1,Math.min(Math.round(n),t.height-s)),c=document.createElement("canvas");c.width=a,c.height=l;const d=c.getContext("2d");if(!d)throw new Error("canvas-crop-failed");return d.drawImage(t,r,s,a,l,0,0,a,l),c}function Nh(t,e){const i=Math.max(t.width,t.height);if(i<=e)return{canvas:t,ratio:1};const o=e/i,n=Math.max(1,Math.round(t.width*o)),r=Math.max(1,Math.round(t.height*o)),s=document.createElement("canvas");s.width=n,s.height=r;const a=s.getContext("2d");return a?(a.imageSmoothingEnabled=!0,a.imageSmoothingQuality="high",a.drawImage(t,0,0,n,r),{canvas:s,ratio:o}):{canvas:t,ratio:1}}function Oh(t,e,i){return new Promise((o=>{t.toBlob((t=>o(t)),e,i)}))}async function Lh(t,e=.9){const i=await Oh(t,"image/webp",e);if(i&&"image/webp"===i.type)return{blob:i,type:i.type};const o=await Oh(t,"image/png");if(o)return{blob:o,type:"image/png"};throw new Error("canvas-encode-failed")}const Dh=["superflow-toolbar","snippyly-plugin","velt-shadow-dom-internal","snippyly-comment-pin-portal","snippyly-comment-pin","snippyly-area-pin-portal","velt-comment-pin-portal","velt-comment-pin","velt-area-pin-portal","snippyly-recorder-control-panel-internal","snippyly-live-state-sync-overlay",".comment-annotation-number","velt-comments","velt-comments-sidebar","velt-comments-sidebar-v2","velt-comment-tool","velt-cursor","velt-presence","velt-huddle","velt-arrows","velt-areas","velt-recorder-notes","velt-recorder-control-panel","velt-notifications-history-panel","velt-rewriter","velt-toast-popup","velt-root"],Rh=["snippyly-text-highlight","snippyly-comment-text-portal","snippyly-comment-text","velt-comment-text-portal","velt-comment-text"],Fh="sf-capture-hide-widgets",Ph="data-sf-capture-keep";let Vh=null,jh=null,Uh=[],zh=new WeakSet,Bh=null;function Hh(...t){Ah()&&"undefined"!=typeof console&&console.log("[sf-capture][exclude]",...t)}const Gh=new Set(Dh.map((t=>t.toLowerCase())));function Wh(t){return t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function Zh(t){const e=Wh(t);return[`snippyly-comment-pin-portal[id="${e}"]`,`velt-comment-pin-portal[id="${e}"]`,`velt-comment-pin-portal[data-velt-id="${e}"]`,`snippyly-area-pin-portal[id="${e}"]`,`velt-area-pin-portal[id="${e}"]`,`velt-area-pin-portal[data-velt-id="${e}"]`,`snippyly-text-highlight[data-velt-id="${e}"]`,`velt-text-highlight[data-velt-id="${e}"]`].join(", ")}function Kh(t){if(!t)return!1;const e=Wh(t);return!!document.querySelector(`snippyly-comment-pin-portal[id="${e}"] snippyly-comment-pin, velt-comment-pin-portal[id="${e}"] velt-comment-pin, velt-comment-pin-portal[data-velt-id="${e}"] velt-comment-pin`)||(!!document.querySelector(`snippyly-text-highlight[data-velt-id="${e}"], velt-text-highlight[data-velt-id="${e}"]`)||!!document.querySelector(`snippyly-area-pin-portal[id="${e}"], velt-area-pin-portal[id="${e}"], velt-area-pin-portal[data-velt-id="${e}"]`))}function Yh(t){const e=Array.from(document.querySelectorAll(Zh(t)));for(const t of e){(i=t).setAttribute(Ph,""),i.querySelectorAll("*").forEach((t=>t.setAttribute(Ph,"")));let e=t.parentElement;for(;e;)e.setAttribute(Ph,""),e=e.parentElement}var i;return e}function Jh(t,e){if(!Ah()||!t||"undefined"==typeof document)return;const i=t=>{const e=t.getBoundingClientRect();return[Math.round(e.x),Math.round(e.y),Math.round(e.width),Math.round(e.height)]},o=document.getElementById(Fh),n=document.querySelector(Zh(t));if(Hh(`[${e}] hideStyle=${!!o} keptHost=${!!n}`+(n?` keep=${n.hasAttribute(Ph)} display=${getComputedStyle(n).display}`:"")),n){Hh(`[${e}] kept host subtree:`,Array.from(n.querySelectorAll("*")).map((t=>{const e=t.shadowRoot;return{tag:t.tagName.toLowerCase(),keep:t.hasAttribute(Ph),display:getComputedStyle(t).display,vis:getComputedStyle(t).visibility,rect:i(t),painted:t.getClientRects().length>0,shadowKids:e?e.childElementCount:-1}})))}const r=Array.from(document.querySelectorAll("velt-shadow-dom-internal")).map((t=>({keep:t.hasAttribute(Ph),display:getComputedStyle(t).display,rect:i(t)}))).filter((t=>"none"!==t.display));Hh(`[${e}] visible <velt-shadow-dom-internal>: ${r.length}`,r);const s=Wh(t),a="snippyly-comment-pin, velt-comment-pin",l=document.querySelector(`snippyly-area-pin-portal[id="${s}"], velt-area-pin-portal[id="${s}"], velt-area-pin-portal[data-velt-id="${s}"]`);if(l){const o=e=>{const i=e.closest("snippyly-area-pin-portal, velt-area-pin-portal");if(i){const e=i.getAttribute("id")||i.getAttribute("data-velt-id")||"";return`area#${e.slice(0,6)}${e===t?"(FOCUSED)":""}`}const o=e.parentElement;return o?o.tagName.toLowerCase():"(detached)"},n=Array.from(document.querySelectorAll(".line")),r=Array.from(document.querySelectorAll(a));Hh(`[${e}] AREA focus: portal kept=${l.hasAttribute(Ph)} display=${getComputedStyle(l).display} rect=${JSON.stringify(i(l))} innerLines=${l.querySelectorAll(".line").length} innerPins=${l.querySelectorAll(a).length}`),Hh(`[${e}] AREA .line owners (total ${n.length}):`,Array.from(new Set(n.map(o)))),Hh(`[${e}] AREA <comment-pin> owners (total ${r.length}):`,r.map((t=>({owner:o(t),keep:t.hasAttribute(Ph),display:getComputedStyle(t).display,painted:t.getClientRects().length>0}))))}}function qh(){document.querySelectorAll('[style*="cursor"]').forEach((t=>{const e=t.style.getPropertyValue("cursor");if(!e)return;if(zh.has(t))return void("none"!==e&&t.style.setProperty("cursor","none","important"));if("none"===e)return;const i=t.style.getPropertyPriority("cursor");Uh.push({el:t,value:e,priority:i,isPin:e.includes("url(")&&"important"===i}),zh.add(t),t.style.setProperty("cursor","none","important")})),Hh(`neutralized inline cursor(s): tracked=${Uh.length}`)}function Qh(t){Xh();let e=!1;if(t){const o=Yh(t);e=o.length>0,function(t,e){if(Ah()){Hh("keepAnnotationId =",JSON.stringify(t));for(const t of["snippyly-comment-pin-portal","velt-comment-pin-portal","snippyly-area-pin-portal","velt-area-pin-portal","snippyly-comment-text-portal","velt-comment-text-portal","snippyly-text-highlight","velt-text-highlight","velt-comment-text"]){const e=Array.from(document.querySelectorAll(t));Hh(`candidates <${t}>: ${e.length}`,e.map((t=>({id:t.getAttribute("id"),"data-velt-id":t.getAttribute("data-velt-id")}))))}Hh(`matched kept host(s): ${e.length}`),e.forEach(((t,e)=>{const i=[t.tagName.toLowerCase()];let o=t.parentElement;for(;o;){const t=o.tagName.toLowerCase();i.push(Gh.has(t)?`${t}(EXCLUDED-ANCESTOR)`:t),o=o.parentElement}Hh(` match[${e}] chain (self -> root):`,i.join(" > "))})),0===e.length&&Hh("No host matched the annotationId — the marker will be hidden. Compare the annotationId above against the candidate id / data-velt-id values.")}}(t,o),e&&(i=t)&&"undefined"!=typeof MutationObserver&&(jh=i,Vh=new MutationObserver((()=>{jh&&Yh(jh)})),Vh.observe(document.documentElement,{childList:!0,subtree:!0}))}var i;const o=t=>e?`${t}:not([${Ph}])`:t,n=`${Dh.map(o).join(",\n")} { display: none !important; }`,r=`${Rh.map(o).join(",\n")} { display: contents !important; color: inherit !important; -webkit-text-fill-color: inherit !important; background-color: transparent !important; border-bottom-color: transparent !important; text-decoration: none !important; box-shadow: none !important; }`,s=document.createElement("style");s.id=Fh,s.textContent=`${n}\n${r}\n* { cursor: none !important; }`,document.head.appendChild(s),qh(),"undefined"!=typeof MutationObserver&&(Bh=new MutationObserver((()=>qh())),Bh.observe(document.documentElement,{attributes:!0,subtree:!0,attributeFilter:["style"]})),Hh(`injected hide stylesheet (keptAny=${e}, hide=${Dh.length}, neutralize=${Rh.length})`)}function Xh(){var t;null===(t=document.getElementById(Fh))||void 0===t||t.remove(),Bh&&(Bh.disconnect(),Bh=null),Uh.forEach((({el:t,value:e,priority:i,isPin:o})=>{o?t.style.removeProperty("cursor"):t.style.setProperty("cursor",e,i)})),Uh=[],zh=new WeakSet,Vh&&(Vh.disconnect(),Vh=null),jh=null,document.querySelectorAll(`[${Ph}]`).forEach((t=>t.removeAttribute(Ph)))}function tu(){var t;const e=null===(t=navigator.userAgentData)||void 0===t?void 0:t.brands;if(e&&e.length)return e.some((t=>/Chromium|Google Chrome|Microsoft Edge/i.test(t.brand)));const i=navigator.userAgent;return/Chrome|Chromium|Edg\//.test(i)&&!/Firefox|FxiOS/.test(i)}function eu(){return!("undefined"==typeof navigator||!navigator.mediaDevices||"function"!=typeof navigator.mediaDevices.getDisplayMedia)&&(tu()||function(){const t=navigator.userAgent;return/Safari/.test(t)&&/Apple/.test(navigator.vendor||"")&&!/Chrome|Chromium|CriOS|Edg\/|FxiOS|Android/.test(t)}())}class iu{constructor(){this.name="native",this.stream=null,this.video=null,this.surface=void 0,this.cropEl=null,this.lastDebug=null,this.initPromise=null,this.onEnded=null}isSupported(){return"undefined"!=typeof navigator&&!!navigator.mediaDevices&&"function"==typeof navigator.mediaDevices.getDisplayMedia}getCapability(){return tu()?"tab-region":"screen-crop"}isActive(){return!!this.stream&&!!this.video}getSurface(){return this.surface}getDebugInfo(){return this.lastDebug}async init(){if(!this.isSupported())throw new Error("native-not-supported");if(!this.isActive())return this.initPromise||(this.initPromise=this.runInit().finally((()=>{this.initPromise=null}))),this.initPromise}async runInit(){var t;const e=this.getCapability(),i="tab-region"===e?{video:{displaySurface:"browser"},preferCurrentTab:!0,selfBrowserSurface:"include",audio:!1}:{video:!0,audio:!1};let o;try{o=await navigator.mediaDevices.getDisplayMedia(i)}catch(t){throw t&&"object"==typeof t&&(t.sfNativeExpected=!0),t}let n=null;try{const i=o.getVideoTracks()[0];if(!i)throw new Error("native-no-video-track");if(this.surface=i.getSettings().displaySurface,"tab-region"===e){if("browser"!==this.surface){const e=null!==(t=this.surface)&&void 0!==t?t:"screen";throw new Error(`Shared a ${e}; re-init and pick "This tab".`)}await this.applyViewportCrop(i)}if(i.addEventListener("ended",(()=>this.handleEnded())),n=document.createElement("video"),n.srcObject=o,n.muted=!0,n.setAttribute("playsinline",""),n.style.cssText="position:fixed;left:-99999px;top:0;width:1px;height:1px;opacity:0;pointer-events:none;",document.body.appendChild(n),await n.play(),"ended"===i.readyState)throw new Error("native-share-ended-during-init");this.stream=o,this.video=n}catch(t){throw o.getTracks().forEach((t=>t.stop())),n&&(n.srcObject=null,n.remove()),this.removeCropEl(),this.surface=void 0,t}}async capture(t={}){if(!this.stream||!this.video)throw new Error("capture-not-initialized");const e=t.focusAnnotationId;Ah()&&"undefined"!=typeof console&&console.log("[sf-capture][native] capture(): focusAnnotationId =",JSON.stringify(e));const i=performance.now(),o=this.video;return"tab-region"===this.getCapability()?this.captureTabRegion(o,i,e):this.captureScreenCrop(o,i,e)}async captureTabRegion(t,e,i){if("browser"!==this.surface)throw new Error("not-sharing-this-tab");const{canvas:o,page:n,frameW:r,frameH:s}=await this.grabFullFrame(t,i);let a=o;const l=n.viewportW*n.dpr;if(l>0&&r>1.5*l)throw new Error("frame-larger-than-viewport");const c=r/n.viewportW,d=Math.min(r,Math.round(n.viewportW*c)),h=Math.round(n.viewportH*c),u=a.height>h+2||a.width>d+2;u&&(a=$h(a,0,0,d,h)),this.lastDebug={capability:"tab-region",surface:this.surface,cropApplied:!!this.cropEl,frameW:r,frameH:s,viewportW:n.viewportW,viewportH:n.viewportH,dpr:n.dpr,cssToFrame:c,croppedW:a.width,croppedH:a.height,clampedHeight:u},this.logDebug();const p=Nh(a,2560);a=p.canvas;const{blob:v,type:g}=await Lh(a,.9),f=performance.now()-e;return{blob:v,width:a.width,height:a.height,mode:this.name,durationMs:f,page:n,scope:"viewport",blobType:g,markerMapping:{scaleX:c*p.ratio,scaleY:c*p.ratio,originXCss:n.scrollX,originYCss:n.scrollY}}}async captureScreenCrop(t,e,i){const{canvas:o,page:n,frameW:r,frameH:s}=await this.grabFullFrame(t,i),a=this.computeScreenCrop(r,s);let l=$h(o,a.cropX,a.cropY,a.cropW,a.cropH);const c=a.scale;this.lastDebug={capability:"screen-crop",surface:this.surface,cropApplied:!1,frameW:r,frameH:s,viewportW:n.viewportW,viewportH:n.viewportH,dpr:n.dpr,cssToFrame:c,croppedW:l.width,croppedH:l.height,clampedHeight:!0,screenCrop:a},this.logDebug();const d=Nh(l,2560);l=d.canvas;const{blob:h,type:u}=await Lh(l,.9),p=performance.now()-e;return{blob:h,width:l.width,height:l.height,mode:this.name,durationMs:p,page:n,scope:"viewport",blobType:u,markerMapping:{scaleX:c*d.ratio,scaleY:c*d.ratio,originXCss:n.scrollX,originYCss:n.scrollY}}}computeScreenCrop(t,e){const i=window.innerWidth,o=window.innerHeight,n=Math.max(0,window.outerHeight-window.innerHeight),r="window"===this.surface,s=r?window.outerWidth:window.screen.width,a=r?window.screenX:0,l=r?window.screenY:0,c=s>0?t/s:1,d=window.screenX-a,h=window.screenY+n-l;let u=Math.round(d*c),p=Math.round(h*c),v=Math.round(i*c),g=Math.round(o*c);return u=Math.max(0,Math.min(u,t-1)),p=Math.max(0,Math.min(p,e-1)),v=Math.max(1,Math.min(v,t-u)),g=Math.max(1,Math.min(g,e-p)),{cropX:u,cropY:p,cropW:v,cropH:g,scale:c,chromeTopCss:n,surfaceWidthCss:s}}async grabFullFrame(t,e){e&&await function(t,e=1200){return!t||Kh(t)?Promise.resolve(!!t&&Kh(t)):new Promise((i=>{let o=!1;const n=e=>{o||(o=!0,clearTimeout(s),r.disconnect(),Hh(`waitForAnnotationHost(${JSON.stringify(t)}) -> ${e?"found":"timeout"}`),i(e))},r=new MutationObserver((()=>{Kh(t)&&n(!0)}));r.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["id","data-velt-id"]});const s=setTimeout((()=>n(!1)),Math.max(0,e))}))}(e),Qh(e),Jh(e,"post-hide");try{await _h(2),await Ih(t,3),await Ih(t,1);const i=function(){const t=document.documentElement;return{scrollX:window.scrollX,scrollY:window.scrollY,viewportW:t.clientWidth,viewportH:t.clientHeight,dpr:window.devicePixelRatio||1}}(),o=t.videoWidth,n=t.videoHeight;if(!o||!n)throw new Error("capture-no-frame");const r=document.createElement("canvas");r.width=o,r.height=n;const s=r.getContext("2d");if(!s)throw new Error("canvas-2d-unavailable");return Jh(e,"pre-draw"),s.drawImage(t,0,0),{canvas:r,page:i,frameW:o,frameH:n}}finally{Xh()}}logDebug(){Ah()&&"undefined"!=typeof console&&console.info("[sf-capture][native]",this.lastDebug)}dispose(){this.stream&&this.stream.getTracks().forEach((t=>t.stop())),this.video&&(this.video.srcObject=null,this.video.remove()),this.removeCropEl(),this.stream=null,this.video=null,this.surface=void 0}handleEnded(){var t;this.removeCropEl(),this.stream=null,this.video&&(this.video.srcObject=null,this.video.remove()),this.video=null,this.surface=void 0,null===(t=this.onEnded)||void 0===t||t.call(this)}async applyViewportCrop(t){const e=window.CropTarget,i=t;if(e&&"function"==typeof i.cropTo)try{const t=document.createElement("div");t.setAttribute("data-sf-capture-viewport",""),t.style.cssText="position:fixed;inset:0;pointer-events:none;opacity:0;z-index:-1;margin:0;",document.body.appendChild(t),this.cropEl=t;const o=await e.fromElement(t);await i.cropTo(o)}catch{this.removeCropEl()}}removeCropEl(){var t;null===(t=this.cropEl)||void 0===t||t.remove(),this.cropEl=null}}var ou=function(t,e,i,o){for(var n,r=arguments.length,s=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,a=t.length-1;a>=0;a--)(n=t[a])&&(s=(r<3?n(s):r>3?n(e,i,s):n(e,i))||s);return r>3&&s&&Object.defineProperty(e,i,s),s};class nu extends X{constructor(){super(),this._loadPlugin=!1,this.comments=[],this.addCommentMode=!1,this.showTourCommentTooltip=!1,this.firstCommentNudge=!1,this.allFeatureDisabled=!1,this.planLimitLocked=!1,this.projectDeleted=!1,this.resolvedVeltFeatureGates=[],this.allFeatureRestricted=!1,this.guestMode=!1,this._expanded=!0,this.loading=!0,this._isPlanExpired=null,this.showOnboardingModal=!0,this.embedMode=!1,this.readOnlyMode=!1,this.autoCommentModeRequested=!1,this.autoCommentModeArmedOnce=!1,this.agentCommentsModeRequested=!1,this.previewLocationPath="",this.onboardingMode=!1,this.showLiveDemoModal=!1,this.showFigmaDemoModal=!1,this.showGuestModeSignInModal=!1,this.defaultGuestModeSignInModalConfig={title:"Sign in to notify your team",description:"Notify your team about your latest comments.",closeOnClickOutside:!1,showLeaveCommentButton:!0},this.guestModeSignInModalConfig=JSON.parse(JSON.stringify(this.defaultGuestModeSignInModalConfig)),this.showGuestModeNameModal=!1,this.guestModeSignInBannerVisible=!1,this.guestUserNameInput="",this.guestUserModelOpened=!1,this.guestUserNameUpdated=!1,this.guestUserNameUpdateLoading=!1,this.projectIdSupplied=!1,this.staging=Ve,this._autoLocation=!0,this.copyLinkTooltip="Copy Link",this.invalidApiKey=!1,this._isUserGlobalContact=!1,this.showQrCode=!1,this.qrCodeLoading=!1,this.qrCodeError=!1,this.customLoginEnabledLocally=null,this.customLoginEnabled=null,this.exitReviewModeCalled=!1,this.addCommentCount=0,this._privateCommentModeEnabled=!1,this.superflowToolbarMoved=!1,this._darkMode=!1,this.allowGuestModeSignIn=!0,this._queryParamsComments=!1,this._usePageTitleAsLocationName=!1,this.toolbarEnabled=!1,this.toolbarEnabledApiCalled=!1,this.passwordProtected=!1,this.isPasswordValid=!1,this.password="",this.validatingPasswordLoading=!1,this.showPasswordProtectedModal=!1,this.showInvalidPassword=!1,this.skipGuestNameModal=!1,this._totalViews={},this.totalViewsCount=0,this.inviteUrl="",this.showModalOnceCommentIsModeIsOff=!1,this.showInviteModal=!1,this.showBugReportModal=!1,this.featureAccess=null,this.hasAgentAccess=!1,this.hasPrivateCommentsAccess=!1,this.isPrivateCommentsEnabledOnWorkspace=!1,this.visibilityOptionsEnabled=!1,this.hasContentWarnings=!1,this.contentWarningsCount=0,this.showContentWarningSidebar=!1,this.showAgentCommentsInSidebar=!1,this.pageCommentsHidden=!1,this.veltProxyToggleVisible=!1,this.nativeScreenshotEnabled=!1,this.nativeScreenshotDenied=!1,this.capturingScreenshot=!1,this.nativeCapture=new iu,this.screenshotChain=Promise.resolve(),this.pendingScreenshotCount=0,this.nativeScreenshotEnabling=!1,this.addCommentAnnotationSubscribedEl=void 0,this.isSettingSidebarData=!1,this.agentGroups=[],this.agentNameMap=new Map,this.agentNamesFetched=!1,this.agentRunStatuses=[],this.agentRunStatusTimedOut=!1,this.agentRunStatusLastMessageAt=0,this.agentRunStatusSettled=!1,this.agentRunStatusListening=!1,this.agentRunStatusWatchdogTimer=null,this.lastStreamAnnotations=[],this.streamEmissionCount=0,this.lastStreamEmissionAt=0,this.onboardingLastFetchCount=-1,this.onboardingLastFetchError="",this.onboardingFetchedAnnotations=[],this.onboardingFetchedAt=0,this.onboardingFindingsFetchTimer=null,this.onboardingFindingsFetchAttempts=0,this.onboardingFetchAttemptsByAgent=new Map,this.onboardingFindingsFetchInFlight=!1,this.onboardingOpenedAgentIds=new Set,this.onboardingFetchResolvedAgentIds=new Set,this.onboardingRemovedAnnotationIds=new Set,this.onboardingUnsyncedAnnotationIds=[],this.onboardingViewportListening=!1,this.onboardingPanelResizeObserver=null,this.onboardingObservedPanel=null,this.onboardingClampFrame=null,this.locationChangeListenerAttached=!1,this.portalOrigins=null,this.spellingSuggestionPagePathMap=new Map,this.grammarSuggestionPagePathMap=new Map,this.processingAnnotationIds=new Set,this.subscriptions=[],this.onApiKeyChange=()=>{try{this.apiKey&&(null===window||void 0===window?void 0:window.onSuperflowLoad)&&"function"==typeof window.onSuperflowLoad&&window.onSuperflowLoad()}catch(t){console.warn("Error in onApiKeyChange: ",t),vd("Error in onApiKeyChange: ",t)}},this.checkCustomLoginEnabled=async()=>{var t;try{const e=await Md(this.apiKey);this.customLoginEnabled=!!(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.customLoginEnabled),this.customLoginEnabled&&this.loginWithCustomUser()}catch(t){this.customLoginEnabled=!1,console.warn("Error in checkCustomLoginEnabled: ",t),vd("Error in checkCustomLoginEnabled: ",t)}},this.isRunningUnderPreviewProxy=(t=document.location)=>{try{const e=(null==t?void 0:t.hostname)||"",i=(null==t?void 0:t.pathname)||"";return jt.some((({hostSuffix:t,pathPrefix:o})=>(e===t||e.endsWith(`.${t}`))&&i.startsWith(o)))}catch(t){return console.warn("Error in isRunningUnderPreviewProxy: ",t),!1}},this.getEffectiveCurrentPageUrl=()=>{try{return this.isRunningUnderPreviewProxy()&&this.previewLocationPath?this.previewLocationPath:window.location.href}catch(t){return console.warn("Error in getEffectiveCurrentPageUrl: ",t),window.location.href}},this.previewProxyReadOnlyGuardInstalled=!1,this.previewProxyReadOnlyStyleObserver=null,this.previewProxyReadOnlySweepScheduled=!1,this.isPreviewProxyReadOnlyViewer=()=>{try{return this.isRunningUnderPreviewProxy()&&"Admin"!==this.snippylyUserRole}catch(t){return console.warn("Error in isPreviewProxyReadOnlyViewer: ",t),!1}},this.isSuggestionActionEventPath=t=>{try{return(t||[]).some((t=>{const e="string"==typeof(null==t?void 0:t.tagName)?t.tagName.toLowerCase():"";if(e.startsWith("velt-comment-dialog-suggestion-action")||e.startsWith("velt-comment-dialog-legacy-suggestion-action"))return!0;const i=null==t?void 0:t.classList;return!!(null==i?void 0:i.contains)&&(i.contains("sf-accept-btn")||i.contains("sf-reject-btn")||i.contains("velt-suggestion-actions"))}))}catch(t){return console.warn("Error in isSuggestionActionEventPath: ",t),!1}},this.setupPreviewProxySuggestionReadOnlyGuard=()=>{try{if(this.previewProxyReadOnlyGuardInstalled)return;this.previewProxyReadOnlyGuardInstalled=!0,document.addEventListener("click",(t=>{try{if(!this.isPreviewProxyReadOnlyViewer())return;const e="function"==typeof t.composedPath?t.composedPath():[];this.isSuggestionActionEventPath(e)&&(t.stopImmediatePropagation(),t.preventDefault(),console.warn("[CWS Toolbar] Suggestion accept/reject is read-only for preview viewers. Click ignored."))}catch(t){console.warn("Error in preview-proxy read-only click guard: ",t)}}),{capture:!0})}catch(t){console.warn("Error in setupPreviewProxySuggestionReadOnlyGuard: ",t),vd("Error in setupPreviewProxySuggestionReadOnlyGuard: ",t)}},this.applyPreviewProxyReadOnlyStyles=()=>{try{if(!this.isPreviewProxyReadOnlyViewer())return void this.removePreviewProxyReadOnlyStyles();this.sweepPreviewProxyReadOnlyStyles(),this.previewProxyReadOnlyStyleObserver||(this.previewProxyReadOnlyStyleObserver=new MutationObserver((()=>{try{if(this.previewProxyReadOnlySweepScheduled)return;this.previewProxyReadOnlySweepScheduled=!0,requestAnimationFrame((()=>{this.previewProxyReadOnlySweepScheduled=!1,this.isPreviewProxyReadOnlyViewer()&&this.sweepPreviewProxyReadOnlyStyles()}))}catch(t){console.warn("Error in preview-proxy read-only style observer: ",t)}})),this.previewProxyReadOnlyStyleObserver.observe(document.body,{childList:!0,subtree:!0}))}catch(t){console.warn("Error in applyPreviewProxyReadOnlyStyles: ",t),vd("Error in applyPreviewProxyReadOnlyStyles: ",t)}},this.sweepPreviewProxyReadOnlyStyles=()=>{try{this.injectPreviewProxyReadOnlyStyle(document.head);const t=e=>{e.querySelectorAll("*").forEach((e=>{var i,o;const n=(null===(o=null===(i=e.tagName)||void 0===i?void 0:i.toLowerCase)||void 0===o?void 0:o.call(i))||"";if(!n.startsWith("velt-")&&!n.startsWith("snippyly-"))return;const r=e.shadowRoot;r&&(this.injectPreviewProxyReadOnlyStyle(r),t(r))}))};t(document.body)}catch(t){console.warn("Error in sweepPreviewProxyReadOnlyStyles: ",t)}},this.injectPreviewProxyReadOnlyStyle=t=>{try{if(t.querySelector(`style[${nu.PREVIEW_READONLY_STYLE_ATTR}]`))return;const e=document.createElement("style");e.setAttribute(nu.PREVIEW_READONLY_STYLE_ATTR,"true"),e.textContent=nu.PREVIEW_READONLY_CSS,t.appendChild(e)}catch(t){console.warn("Error in injectPreviewProxyReadOnlyStyle: ",t)}},this.removePreviewProxyReadOnlyStyles=()=>{try{this.previewProxyReadOnlyStyleObserver&&(this.previewProxyReadOnlyStyleObserver.disconnect(),this.previewProxyReadOnlyStyleObserver=null);const t=`style[${nu.PREVIEW_READONLY_STYLE_ATTR}]`;document.querySelectorAll(t).forEach((t=>t.remove()));const e=i=>{i.querySelectorAll("*").forEach((i=>{const o=i.shadowRoot;o&&(o.querySelectorAll(t).forEach((t=>t.remove())),e(o))}))};e(document.body)}catch(t){console.warn("Error in removePreviewProxyReadOnlyStyles: ",t)}},this.isDriveOrPreviewHost=(t=document.location)=>{try{const e=(null==t?void 0:t.hostname)||"",i=(null==t?void 0:t.pathname)||"";return be.some((({hostSuffix:t,pathPrefix:o})=>(e===t||e.endsWith(`.${t}`))&&i.startsWith(o)))||this.isRunningUnderPreviewProxy(t)}catch(t){return console.warn("Error in isDriveOrPreviewHost: ",t),!1}},this.loginWithCustomUser=()=>{try{this.customLoginEnabled?(Kc(Zt),this.loadPlugin&&this.documentId&&this.identifySnippyly()):console.warn("Identify call not allowed.")}catch(t){console.warn("Error in loginWithCustomUser: ",t),vd("Error in loginWithCustomUser: ",t)}},this.addWindowClickEventListener=()=>{try{this.windowClickEventListener||(this.windowClickEventListener=()=>{this.menuOpenedId&&(this.menuOpenedId=void 0)},window.addEventListener("click",this.windowClickEventListener))}catch(t){console.warn("Error in addWindowClickEventListener: ",t),vd("Error in addWindowClickEventListener: ",t)}},this.removeWindowClickEventListener=()=>{try{window.removeEventListener("click",this.windowClickEventListener),this.windowClickEventListener=void 0}catch(t){console.warn("Error in removeWindowClickEventListener: ",t),vd("Error in removeWindowClickEventListener: ",t)}},this.onWindowLocationChange=()=>{this.checkUrl()},this.setWindowEventListner=()=>{try{if(this.locationChangeListenerAttached)return;window.addEventListener("locationchange",this.onWindowLocationChange),this.locationChangeListenerAttached=!0}catch(t){console.warn("Error in setWindowEventListner: ",t),vd("Error in setWindowEventListner: ",t)}},this.removeWindowLocationChangeListener=()=>{try{window.removeEventListener("locationchange",this.onWindowLocationChange),this.locationChangeListenerAttached=!1}catch(t){console.warn("Error in removeWindowLocationChangeListener: ",t),vd("Error in removeWindowLocationChangeListener: ",t)}},this.urlChangeListener=()=>{try{const t=history.pushState;history.pushState=function(){const e=t.apply(this,arguments);return window.dispatchEvent(new Event("pushstate")),window.dispatchEvent(new Event("locationchange")),e};const e=history.replaceState;history.replaceState=function(){const t=e.apply(this,arguments);return window.dispatchEvent(new Event("replacestate")),window.dispatchEvent(new Event("locationchange")),t},window.addEventListener("popstate",(()=>{window.dispatchEvent(new Event("locationchange"))}))}catch(t){console.warn("Error in urlChangeListener: ",t),vd("Error in urlChangeListener: ",t)}},this.checkUrl=()=>{try{this.setInviteUrl();const t=new URL(document.location),e=t.searchParams;e.has(Ht)&&Wc(Et,"true",!1);let i=!1;for(const t of[St,Mt,Tt,At,It]){if(!e.has(t))continue;const o=t!==It||this.isFramedByPortal();"true"===e.get(t)&&o?Wc(t,"true",!1,"sessionStorage"):Kc(t,"sessionStorage"),e.delete(t),i=!0}this.embedMode="true"===Zc(St,!1,"sessionStorage"),this.readOnlyMode="true"===Zc(Tt,!1,"sessionStorage"),this.autoCommentModeRequested=!this.readOnlyMode&&"true"===Zc(Mt,!1,"sessionStorage"),this.agentCommentsModeRequested="true"===Zc(At,!1,"sessionStorage"),this.onboardingMode="true"===Zc(It,!1,"sessionStorage")&&this.canHonourStoredOnboardingFlag(),this.autoOpenOnboardingSidebar();const o=e.get(_t);if(o&&(Wc(_t,o,!1,"sessionStorage"),e.delete(_t),i=!0),this.previewLocationPath=Zc(_t,!1,"sessionStorage")||"",this.pageCommentsHidden="true"===Zc(zt,!1,"sessionStorage"),i&&window.history.replaceState({},document.title,t.href),(null==e?void 0:e.has(Qt))&&!Zc(Qt)?this.showOnboardingModal=!0:this.showOnboardingModal=!1,null==e?void 0:e.has(Xt))if(Zc(Xt,!1,"sessionStorage")){this.showLiveDemoModal=!1;const t=new URL(document.location);t.searchParams.delete(Xt),window.history.replaceState({},null===document||void 0===document?void 0:document.title,t.toString())}else this.showLiveDemoModal=!0;else this.showLiveDemoModal=!1;if(null==e?void 0:e.has(te))if(Zc(te,!1)){this.showFigmaDemoModal=!1;const t=new URL(document.location);t.searchParams.delete(te),window.history.replaceState({},null===document||void 0===document?void 0:document.title,t.toString())}else this.showFigmaDemoModal=!0;else this.showFigmaDemoModal=!1;if(e.has(Wt)||e.has("snippyly_google_token")){if(e.has(Wt)){const t=decodeURIComponent(e.get(Wt)),i=qc(t,ze,Be),o=i&&JSON.parse(i);if(o){const t={};t.userId=o.uid,t.name=o.displayName,t.email=o.email,t.photoUrl=null==o?void 0:o.photoURL;const e=JSON.stringify(t),i=Jc(e,ze,Be);Wc(Zt,i,!0),Kc(ie)}}else if(e.has("snippyly_google_token")){const t=JSON.parse(atob(e.get("snippyly_google_token"))),i={};i.userId=t.uid,i.name=t.displayName,i.email=t.email,i.photoUrl=null==t?void 0:t.photoURL,Wc(Gt,JSON.stringify(i),!0)}e.delete(Wt),e.delete("snippyly_google_token"),window.history.replaceState({},document.title,t.href)}e.has(Et)?(Wc(Et,"true",!1),Kc(kt),e.delete(Et),window.history.replaceState({},document.title,t.href),this.loadPluginUI()):e.has(kt)||Zc(Et,!1)&&this.loadPluginUI(),e.has(kt)?(Wc(kt,"true",!1),Kc(Et),e.delete(kt),window.history.replaceState({},document.title,t.href),this.loadPluginUI()):e.has(Et)||Zc(kt,!1)&&this.loadPluginUI(),this.setVersionInUrl(),this.startAgentRunStatusListener()}catch(t){console.warn("Error in checkUrl: ",t),vd("Error in checkUrl: ",t)}},this.setInviteUrl=()=>{try{const t=new URL(document.location);t.searchParams.has(Et)||t.searchParams.set(Et,"true"),this.inviteUrl=t.toString()}catch(t){console.warn("Error in setInviteUrl: ",t),vd("Error in setInviteUrl: ",t)}},this.detectVersion=()=>{try{if(this.projectVersionKey){const t=new URL(document.location).searchParams;if(t.get(this.projectVersionKey))this.projectVersion=t.get(this.projectVersionKey);else if(window.snippylyInitialLoadUrl){const t=new URL(window.snippylyInitialLoadUrl).searchParams;t.get(this.projectVersionKey)&&(this.projectVersion=t.get(this.projectVersionKey))}this.projectVersion&&Wc(Jt,this.projectVersion,!1,"sessionStorage")}else{const t=new URL(document.location).searchParams;(t.has(Et)||t.has(kt))&&t.has(qt)&&(Wc(Yt,qt,!1,"sessionStorage"),this.projectVersion=t.get(qt),this.projectVersion&&Wc(Jt,this.projectVersion,!1,"sessionStorage"))}}catch(t){console.warn("Error in detectVersion: ",t),vd("Error in detectVersion: ",t)}},this.setVersionInUrl=()=>{try{const t=this.projectVersionKey||Zc(Yt,!1,"sessionStorage"),e=this.projectVersion||Zc(Jt,!1,"sessionStorage");if(t&&e){const i=new URL(document.location),o=i.searchParams;o.get(t)||(o.set(t,e),window.history.replaceState({},document.title,i.href))}}catch(t){console.warn("Error in setVersionInUrl: ",t),vd("Error in setVersionInUrl: ",t)}},this.loadPluginUI=async()=>{var t,e,i,o,n,r,s,a;try{if(!this.apiKey)return;if(!this.projectId)return;if(this.loadPlugin)return this.generateLocation(),this.setLocation(),this.setPreviewLocationFromPath(),void setTimeout((()=>{var t;if(this.usePageTitleAsLocationName){const e=document.title;(null===(t=this.location)||void 0===t?void 0:t.locationName)!==e&&(this.generateLocation(),this.setLocation({forceSetLocation:!0}),this.setPreviewLocationFromPath())}}),4e3);if(this.toolbarEnabledApiCalled||await this.detectToolbarEnabled(),!this.toolbarEnabled)return;wt.includes(this.apiKey)&&this.listenToDocumentTitleChange();const l=Qc();l&&!(null==l?void 0:l.isAnonymous)&&(this.loading=!0);try{this.customerMetadata=await this.getCustomerMetadata()}catch(t){console.warn("Error in getCustomerMetadata: ",t),vd("Error in getCustomerMetadata: ",t)}Gc(ae)&&(this.isPasswordValid=Gc(ae));const c=await yd(this.apiKey,this.projectId);"error"===c.status&&console.warn("getProjectConfig failed for projectId (treating project as valid): ",this.projectId),this.projectDeleted=od(c,this.isDriveOrPreviewHost(),this.projectIdSupplied),this.applyVeltFeatureGates(),this.projectConfig="ok"===c.status?c.config:null,this.guestMode=!!(null===(t=this.projectConfig)||void 0===t?void 0:t.guestMode)||this.guestMode,this.allowGuestModeSignIn=!!(null===(i=null===(e=this.projectConfig)||void 0===e?void 0:e.guestModeConfig)||void 0===i?void 0:i.allowSignIn),this.queryParamsComments=!!(null===(o=this.projectConfig)||void 0===o?void 0:o.queryParamsComments),this.usePageTitleAsLocationName=!!(null===(n=this.projectConfig)||void 0===n?void 0:n.usePageTitleAsLocationName),(null===(r=this.projectConfig)||void 0===r?void 0:r.guestModeConfig)||(this.allowGuestModeSignIn=!0),this.passwordProtected=!!(null===(a=null===(s=this.projectConfig)||void 0===s?void 0:s.passwordProtected)||void 0===a?void 0:a.enabled),this.applyVeltFeatureGates(),Wc(oe,this.guestMode+"",!0),Wc(de,this.allowGuestModeSignIn+"",!0),Wc(ne,this.passwordProtected+"",!0),Wc(re,this.queryParamsComments+"",!0),Wc(se,this.usePageTitleAsLocationName+"",!0),this.loadPlugin=!0,this.projectDeleted||this.mountVeltCollaborationElements();try{const t=new URL(document.location),e=t.searchParams;let i=!1;e.has("wireframe")&&"true"===e.get("wireframe")&&(sessionStorage.setItem("velt-wireframe","true"),e.delete("wireframe"),i=!0),e.get("velt-version")&&(sessionStorage.setItem("velt-version",e.get("velt-version")),e.delete("velt-version"),i=!0),e.get("velt-env")&&(sessionStorage.setItem("velt-env",e.get("velt-env")),e.delete("velt-env"),i=!0),i&&window.history.replaceState({},document.title,t.href)}catch(t){}this.initializeSnippyly()}catch(t){this.loading=!1,console.warn("Error in loadPluginUI: ",t),vd("Error in loadPluginUI: ",t)}},this.listenToDocumentTitleChange=()=>{try{this.documentTitleChangeInterval||(this.documentTitleChangeInterval=setInterval((()=>{var t,e,i;const o="true"===sessionStorage.getItem("debugDocumentTitleChange");if(o&&(console.log("*** listenToDocumentTitleChange ***"),console.log("usePageTitleAsLocationName: ",this.usePageTitleAsLocationName)),this.usePageTitleAsLocationName){const n=document.title;o&&(console.log("location name: ",null===(t=this.location)||void 0===t?void 0:t.locationName),console.log("title: ",n),console.log("changed: ",(null===(e=this.location)||void 0===e?void 0:e.locationName)!==n)),(null===(i=this.location)||void 0===i?void 0:i.locationName)!==n&&(o&&console.log("%c triggering location update!","color: green; font-weight: bold;"),this.generateLocation(),this.setLocation({forceSetLocation:!0}),this.setPreviewLocationFromPath())}}),2e3))}catch(t){vd("Error in listenToDocumentTitleChange: ",t)}},this.initializeSnippyly=async()=>{var t,e,o,n,r,s,a,l,c,d,h,u,p,v,g,f,m,w,y,b,C,x,E,k,S,M,T,A;try{let _=this.staging?ft:mt;this.veltVersion&&(_=this.veltVersion);let I=this.staging,$=!1;if((null===sessionStorage||void 0===sessionStorage?void 0:sessionStorage.getItem("velt-version"))&&(_=sessionStorage.getItem("velt-version")),null===sessionStorage||void 0===sessionStorage?void 0:sessionStorage.getItem("velt-env")){"staging"===sessionStorage.getItem("velt-env")&&(I=!1,$=!0)}this.apiKey;this.veltProxyToggleVisible=!1;const N=void 0;if(await i(this.apiKey,{options:{develop:I,staging:$,version:_,velt:!0,proxyDomain:"https://cdn.velt.dev"},...N?{proxyConfig:N}:{}}),!window.Velt)return;if(this.replayVeltFeatureGates(),this.autoTranslation&&(null===Velt||void 0===Velt?void 0:Velt.enableAutoTranslation)&&(null===Velt||void 0===Velt||Velt.enableAutoTranslation()),this.projectDeleted||this.mountCommentSidebar(),Velt){null===Velt||void 0===Velt||Velt.sf(!0);try{window.dispatchEvent(new CustomEvent("onVeltLoad",{detail:{Velt}})),(null===window||void 0===window?void 0:window.onSnippylyLoad)&&(null===window||void 0===window||window.onSnippylyLoad(Velt))}catch(t){}document.body.style.setProperty("--velt-default-font-family","'Poppins', sans-serif"),(()=>{try{if(!document.getElementById("superflowFontLink3")){const t=document.createElement("link");t.rel="stylesheet",t.href="https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/fonts%2Fpoppins%2Fpoppins.css?alt=media&token=5f31a0f2-5f67-4974-bf56-78ae655f2b68",t.id="superflowFontLink3",document.head.appendChild(t)}}catch(t){console.warn("Error in loadPoppinsFont: ",t),vd("Error in loadPoppinsFont: ",t)}})()}if(Velt&&(hd({sdkVersion:null===Velt||void 0===Velt?void 0:Velt.version,sdkType:"client"}),console.log(`Velt Version: ${(null===Velt||void 0===Velt?void 0:Velt.version)||"unknown"}`),console.log(`Superflow Toolbar Version: ${gt}`)),this.generateDocumentId(),(null===Velt||void 0===Velt?void 0:Velt.on)&&"function"==typeof(null===Velt||void 0===Velt?void 0:Velt.on)){const e=Qc(),i="true"===sessionStorage.getItem("debugUserUpdateEvent");this.previousVeltUserId=null!==(t=null==e?void 0:e.userId)&&void 0!==t?t:"default",i&&console.log("[Superflow Debug] Initialized previousVeltUserId:",this.previousVeltUserId),Velt.on("userUpdate").subscribe((async t=>{if(i&&console.log("User from event: UserUpdate",t),t){const e=t.userId;i&&console.log("[Superflow Debug] userUpdate event fired:",{previousVeltUserId:this.previousVeltUserId,currentUserId:e,userChanged:this.previousVeltUserId!==e}),this.previousVeltUserId!==e&&(i&&console.log("[Superflow Debug] User changed, calling setDocumentAndLocation"),await this.setDocumentAndLocation()),this.previousVeltUserId=e}})),i&&console.log("[Superflow Debug] Performing initial setDocumentAndLocation"),await this.setDocumentAndLocation()}else await this.setDocumentAndLocation();if(setTimeout((()=>{var t;if(this.usePageTitleAsLocationName){const e=document.title;(null===(t=this.location)||void 0===t?void 0:t.locationName)!==e&&(this.generateLocation(),this.setLocation({forceSetLocation:!0}),this.setPreviewLocationFromPath())}}),4e3),this.commentElement=null===Velt||void 0===Velt?void 0:Velt.getCommentElement(),this.contactElement=null===Velt||void 0===Velt?void 0:Velt.getContactElement(),this.rewriterElement=null===Velt||void 0===Velt?void 0:Velt.getRewriterElement(),this.presenceElement=null===Velt||void 0===Velt?void 0:Velt.getPresenceElement(),this.commentElement){this.readOnlyMode?"function"==typeof this.commentElement.enableTextComments&&this.commentElement.enableTextComments(!1):this.commentElement.enableTextComments(!0),this.customLoginEnabledLocally||this.commentElement.enableSignInButton(!0),this.commentElement.enableAttachments(!0),(null===(e=this.commentElement)||void 0===e?void 0:e.showScreenSizeInfo)&&this.commentElement.showScreenSizeInfo(!0),(null===(o=this.commentElement)||void 0===o?void 0:o.enableDeviceInfo)&&this.commentElement.enableDeviceInfo(!0),this.commentElement.enableCommentIndex(!0),this.applyPageCommentsVisibility(),this.commentElement.onCommentModeChange&&this.commentElement.onCommentModeChange().subscribe((t=>{if(t&&this.readOnlyMode)return this.disableCommentMode(),void(this.addCommentMode=!1);this.addCommentMode=t,t&&this.unhidePageCommentsIfHidden(),t&&this.autoCommentModeRequested&&(this.autoCommentModeArmedOnce=!0,this.firstCommentNudge&&(this.firstCommentNudge=!1,this.showTourCommentTooltip=!1),Wc(ee,"true")),t&&this.promptNativeScreenshotForCommentMode(),this.addCommentMode||this.showModalOnceCommentIsModeIsOff&&(this.addCommentCount>=2&&!Zc(he)&&(this.allowGuestModeSignIn?this.openGuestModeSignInModal():this.openGuestModeNameModel(),Wc(he,"true"),this.showModalOnceCommentIsModeIsOff=!1),this.addCommentCount>=5&&!this.showGuestModeSignInModal&&!Zc(pe,!1,"sessionStorage")&&(this.showGuestModeSignInBanner(),Wc(pe,"true",!1,"sessionStorage"),this.showModalOnceCommentIsModeIsOff=!1))})),(null===(n=this.commentElement)||void 0===n?void 0:n.enableOrphanComments)&&this.commentElement.enableOrphanComments(),!this.readOnlyMode&&(null===(r=this.commentElement)||void 0===r?void 0:r.enablePersistentCommentMode)&&this.commentElement.enablePersistentCommentMode(),this.readOnlyMode||this.showFirstCommentNudge(),(null===(s=this.commentElement)||void 0===s?void 0:s.enableGhostComments)&&this.commentElement.enableGhostComments();const t=null===window||void 0===window?void 0:window.SUPERFLOW_CUSTOM_STATUSES;t&&"object"==typeof t&&(null===(a=this.commentElement)||void 0===a?void 0:a.setCustomStatus)&&this.commentElement.setCustomStatus(t),(null===(l=this.commentElement)||void 0===l?void 0:l.enableMinimap)&&!this.embedMode&&this.commentElement.enableMinimap(),(null===(c=this.commentElement)||void 0===c?void 0:c.setDStrategy)&&(null===(d=this.commentElement)||void 0===d||d.setDStrategy("dynamicId")),(null===(h=this.commentElement)||void 0===h?void 0:h.enableSidebarButtonOnCommentDialog)&&this.commentElement.enableSidebarButtonOnCommentDialog(),(null===(u=this.commentElement)||void 0===u?void 0:u.enableHotkey)&&this.commentElement.enableHotkey(),(null===(p=this.commentElement)||void 0===p?void 0:p.enableDeviceIndicatorOnCommentPins)&&this.commentElement.enableDeviceIndicatorOnCommentPins(),(null===(v=this.commentElement)||void 0===v?void 0:v.enableLazyLoadResolvedComments)&&this.commentElement.enableLazyLoadResolvedComments(),(null===(g=this.commentElement)||void 0===g?void 0:g.enableDraftConfirmation)&&this.commentElement.enableDraftConfirmation(),this.applyScreenshotSetting(),this.ensureAddCommentAnnotationSubscription(),(null===(w=null===(m=null===(f=this.customerMetadata)||void 0===f?void 0:f.superflow)||void 0===m?void 0:m.advancedFeatures)||void 0===w?void 0:w.hasCustomStatus)&&this.setCustomStatuses(),this.setQueryParamsCommentsInSdk(),this.checkToEnableUpgradeButton(),this.setupSidebarAgentCommentFilter(),this.setupVeltButtonClickListener(),this.maybeApplyVisibilityOptionsToCommentElement()}this.applyStorageFeatureAccess(),this.selectionElement=Velt.getSelectionElement(),this.selectionElement&&this.selectionElement.enableLiveSelection(!0),this.rewriterElement&&(null===(y=this.rewriterElement)||void 0===y||y.enableRewriter()),this.presenceElement&&(null===(b=this.presenceElement)||void 0===b?void 0:b.enableFlockMode)&&(null===(C=this.presenceElement)||void 0===C||C.enableFlockMode(!0)),(null===Velt||void 0===Velt?void 0:Velt.getDocElement)&&(this.docElement=Velt.getDocElement()),null===(S=(null===(x=this.docElement)||void 0===x?void 0:x.getDocumentMetadata)?null===(E=this.docElement)||void 0===E?void 0:E.getDocumentMetadata():null===(k=null===Velt||void 0===Velt?void 0:Velt.docService)||void 0===k?void 0:k.getDocumentMetadata$())||void 0===S||S.subscribe((t=>{var e,i;const o=(null===(e=null==t?void 0:t.superflow)||void 0===e?void 0:e.versions)?Object.values(null===(i=null==t?void 0:t.superflow)||void 0===i?void 0:i.versions):[],n=new URL(document.location).searchParams.get("version");if(n){const t=o.find((t=>t.id===n));t&&(this.version={id:t.id,name:t.versionName||t.id},this.setLocation())}})),(null===Velt||void 0===Velt?void 0:Velt.getViewsElement)&&(this.viewsElement=Velt.getViewsElement()),(null===(M=this.viewsElement)||void 0===M?void 0:M.getUniqueViewsByUser)&&(null===(A=null===(T=this.viewsElement)||void 0===T?void 0:T.getUniqueViewsByUser())||void 0===A||A.subscribe((t=>{this.totalViews=t}))),this.identifySnippyly()}catch(t){this.loading=!1,console.warn("Error in initializeSnippyly: ",t),vd("Error in initializeSnippyly: ",t)}},this.generateDocumentId=()=>{try{this.documentId=Uc(Bc(window.location.origin))+"",this.projectId&&(this.documentId=this.projectId+""),this.serverDocumentId=(t=this.documentId+"")?`${Uc(t)}`:void 0}catch(t){console.warn("Error in generateDocumentId: ",t),vd("Error in generateDocumentId: ",t)}var t},this.setDocumentAndLocation=async()=>{try{if(this.projectDeleted)return void console.warn("setDocumentAndLocation skipped: project no longer exists");this.generateDocumentId(),this.previousLocation=null,await(null===Velt||void 0===Velt?void 0:Velt.setDocumentId(this.documentId+"")),hd({documentId:this.serverDocumentId,clientDocumentId:this.documentId}),this.generateLocation(),this.setLocation(),this.setPreviewLocationFromPath()}catch(t){console.warn("Error in setDocumentAndLocation: ",t),vd("Error in setDocumentAndLocation: ",t)}},this.setPreviewLocationFromPath=()=>{try{if(!this.agentCommentsModeRequested||!this.previewLocationPath)return;if(!window.Velt||!(null===Velt||void 0===Velt?void 0:Velt.setLocation))return;const t={url:this.previewLocationPath},e=Hc(JSON.parse(JSON.stringify(t)));e&&(t.id=`${e}`),this.location=t,null===Velt||void 0===Velt||Velt.setLocation(JSON.parse(JSON.stringify(t))),hd({clientLocation:t}),this.previousLocation=JSON.parse(JSON.stringify(t)),this.onVeltLocationChange()}catch(t){console.warn("Error in setPreviewLocationFromPath: ",t),vd("Error in setPreviewLocationFromPath: ",t)}},this.checkToEnableUpgradeButton=()=>{var t,e;try{this.isPlanExpired&&this.isUserGlobalContact?(null===(t=this.commentElement)||void 0===t?void 0:t.enableUpgradeButton)&&this.commentElement.enableUpgradeButton():(null===(e=this.commentElement)||void 0===e?void 0:e.disableUpgradeButton)&&this.commentElement.disableUpgradeButton()}catch(t){console.warn("Error in checkToEnableUpgradeButton: ",t),vd("Error in checkToEnableUpgradeButton: ",t)}},this.getCustomerMetadata=async()=>{try{const t=await xd(this.apiKey);return(t=>{try{const e=t?JSON.stringify(t):"false";Wc(ve,e)}catch(t){console.warn("Error in setCustomerMetadataToStorage: ",t),vd("Error in setCustomerMetadataToStorage: ",t)}})(t),t}catch(t){console.warn("Error in getCustomerMetadata: ",t),vd("Error in getCustomerMetadata: ",t);const e=(()=>{try{const t=Zc(ve);return t?"false"===t?JSON.parse(JSON.stringify(_e)):JSON.parse(t):null}catch(t){return console.warn("Error in getCustomerMetadataFromStorage: ",t),vd("Error in getCustomerMetadataFromStorage: ",t),null}})();if(e)return e}},this.setCustomStatuses=async()=>{var t;try{const e=await Ed(this.apiKey);if((null==e?void 0:e.success)&&(null==e?void 0:e.data)){const i=Object.values(e.data),o=this.sortCustomStatuses(i);o.length>0&&(null===(t=this.commentElement)||void 0===t?void 0:t.setCustomStatus)&&this.commentElement.setCustomStatus(o)}}catch(t){console.warn("Error in setCustomStatuses: ",t),vd("Error in setCustomStatuses: ",t)}},this.sortCustomStatuses=t=>{try{const e=[...t].sort(((t,e)=>("number"==typeof t.order?t.order:Number.MAX_SAFE_INTEGER)-("number"==typeof e.order?e.order:Number.MAX_SAFE_INTEGER)));return e}catch(e){return console.warn("Error in sortCustomStatuses: ",e),vd("Error in sortCustomStatuses: ",e),t}},this.getSamlConfig=async()=>{try{const t=await Td(this.apiKey);return(t=>{try{if(t){const e=JSON.stringify(t);Wc(ye,e,!0)}}catch(t){console.warn("Error in setSamlConfigToStorage: ",t),vd("Error in setSamlConfigToStorage: ",t)}})(t),t}catch(t){console.warn("Error in getSamlConfig: ",t),vd("Error in getSamlConfig: ",t);const e=(()=>{try{const t=Zc(ye,!0);return t?JSON.parse(t):null}catch(t){return console.warn("Error in getSamlConfigFromStorage: ",t),vd("Error in getSamlConfigFromStorage: ",t),null}})();if(e)return e}},this.setLogos=()=>{var t,e,i,o,n,r,s,a,l,c,d,h;try{let u="light";this.privateCommentModeEnabled&&(u="dark");const p=null===(i=null===(e=null===(t=this.customerMetadata)||void 0===t?void 0:t.superflow)||void 0===e?void 0:e.customBranding)||void 0===i?void 0:i.logoMark,v=null===(r=null===(n=null===(o=null==Pe?void 0:_e)||void 0===o?void 0:o.customBranding)||void 0===n?void 0:n.logo)||void 0===r?void 0:r.logoMark,g=null===(l=null===(a=null===(s=this.customerMetadata)||void 0===s?void 0:s.superflow)||void 0===a?void 0:a.customBranding)||void 0===l?void 0:l.wordMark,f=null===(h=null===(d=null===(c=null==Pe?void 0:_e)||void 0===c?void 0:c.customBranding)||void 0===d?void 0:d.logo)||void 0===h?void 0:h.wordMark;switch(u){case"light":this.logoMark=(null==p?void 0:p.lightUrl)||(null==p?void 0:p.darkUrl)||(null==v?void 0:v.lightUrl),this.wordMark=(null==g?void 0:g.lightUrl)||(null==g?void 0:g.darkUrl)||(null==f?void 0:f.lightUrl);break;case"dark":this.logoMark=(null==p?void 0:p.darkUrl)||(null==p?void 0:p.lightUrl)||(null==v?void 0:v.darkUrl),this.wordMark=(null==g?void 0:g.darkUrl)||(null==g?void 0:g.lightUrl)||(null==f?void 0:f.darkUrl)}}catch(t){console.warn("Error in setLogos: ",t),vd("Error in setLogos: ",t)}},this.getAlertIcon=()=>L`
5824
+ `}catch(t){return console.warn("Error in render: ",t),L``}}};Ah.styles=[qd,Th],mh([ot({type:Array})],Ah.prototype,"agentGroups",void 0),mh([ot({type:String})],Ah.prototype,"currentPageUrl",void 0),mh([ot({type:String,reflect:!0})],Ah.prototype,"theme",void 0),mh([ot({type:Array})],Ah.prototype,"agentRunStatuses",void 0),mh([ot({type:Boolean})],Ah.prototype,"loading",void 0),mh([ot({type:Array})],Ah.prototype,"unsyncedAnnotationIds",void 0),mh([nt()],Ah.prototype,"expandedFindingIds",void 0),mh([nt()],Ah.prototype,"openAccordions",void 0),mh([nt()],Ah.prototype,"currentView",void 0),mh([nt()],Ah.prototype,"selectedAgentId",void 0),mh([nt()],Ah.prototype,"selectedFindingGroup",void 0),Ah=mh([et("content-warning-sidebar")],Ah);function _h(){try{return"undefined"!=typeof localStorage&&"true"===localStorage.getItem("sfScreenShotDebug")}catch{return!1}}function Ih(t){return new Promise((e=>{let i=Math.max(1,t);const o=()=>{i-=1,i<=0?e():requestAnimationFrame(o)};requestAnimationFrame(o)}))}function $h(t,e,i=600){const o=t.requestVideoFrameCallback;return"function"!=typeof o?Ih(e+2):new Promise((n=>{let r=Math.max(1,e),s=!1;const a=()=>{s||(s=!0,clearTimeout(l),n())},l=setTimeout(a,Math.max(0,i)),c=()=>{s||(r-=1,r<=0?a():o.call(t,c))};o.call(t,c)}))}function Nh(t,e,i,o,n){const r=Math.max(0,Math.round(e)),s=Math.max(0,Math.round(i)),a=Math.max(1,Math.min(Math.round(o),t.width-r)),l=Math.max(1,Math.min(Math.round(n),t.height-s)),c=document.createElement("canvas");c.width=a,c.height=l;const d=c.getContext("2d");if(!d)throw new Error("canvas-crop-failed");return d.drawImage(t,r,s,a,l,0,0,a,l),c}function Oh(t,e){const i=Math.max(t.width,t.height);if(i<=e)return{canvas:t,ratio:1};const o=e/i,n=Math.max(1,Math.round(t.width*o)),r=Math.max(1,Math.round(t.height*o)),s=document.createElement("canvas");s.width=n,s.height=r;const a=s.getContext("2d");return a?(a.imageSmoothingEnabled=!0,a.imageSmoothingQuality="high",a.drawImage(t,0,0,n,r),{canvas:s,ratio:o}):{canvas:t,ratio:1}}function Lh(t,e,i){return new Promise((o=>{t.toBlob((t=>o(t)),e,i)}))}async function Dh(t,e=.9){const i=await Lh(t,"image/webp",e);if(i&&"image/webp"===i.type)return{blob:i,type:i.type};const o=await Lh(t,"image/png");if(o)return{blob:o,type:"image/png"};throw new Error("canvas-encode-failed")}const Rh=["superflow-toolbar","snippyly-plugin","velt-shadow-dom-internal","snippyly-comment-pin-portal","snippyly-comment-pin","snippyly-area-pin-portal","velt-comment-pin-portal","velt-comment-pin","velt-area-pin-portal","snippyly-recorder-control-panel-internal","snippyly-live-state-sync-overlay",".comment-annotation-number","velt-comments","velt-comments-sidebar","velt-comments-sidebar-v2","velt-comment-tool","velt-cursor","velt-presence","velt-huddle","velt-arrows","velt-areas","velt-recorder-notes","velt-recorder-control-panel","velt-notifications-history-panel","velt-rewriter","velt-toast-popup","velt-root"],Fh=["snippyly-text-highlight","snippyly-comment-text-portal","snippyly-comment-text","velt-comment-text-portal","velt-comment-text"],Ph="sf-capture-hide-widgets",Vh="data-sf-capture-keep";let jh=null,Uh=null,zh=[],Bh=new WeakSet,Hh=null;function Gh(...t){_h()&&"undefined"!=typeof console&&console.log("[sf-capture][exclude]",...t)}const Wh=new Set(Rh.map((t=>t.toLowerCase())));function Zh(t){return t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function Kh(t){const e=Zh(t);return[`snippyly-comment-pin-portal[id="${e}"]`,`velt-comment-pin-portal[id="${e}"]`,`velt-comment-pin-portal[data-velt-id="${e}"]`,`snippyly-area-pin-portal[id="${e}"]`,`velt-area-pin-portal[id="${e}"]`,`velt-area-pin-portal[data-velt-id="${e}"]`,`snippyly-text-highlight[data-velt-id="${e}"]`,`velt-text-highlight[data-velt-id="${e}"]`].join(", ")}function Yh(t){if(!t)return!1;const e=Zh(t);return!!document.querySelector(`snippyly-comment-pin-portal[id="${e}"] snippyly-comment-pin, velt-comment-pin-portal[id="${e}"] velt-comment-pin, velt-comment-pin-portal[data-velt-id="${e}"] velt-comment-pin`)||(!!document.querySelector(`snippyly-text-highlight[data-velt-id="${e}"], velt-text-highlight[data-velt-id="${e}"]`)||!!document.querySelector(`snippyly-area-pin-portal[id="${e}"], velt-area-pin-portal[id="${e}"], velt-area-pin-portal[data-velt-id="${e}"]`))}function Jh(t){const e=Array.from(document.querySelectorAll(Kh(t)));for(const t of e){(i=t).setAttribute(Vh,""),i.querySelectorAll("*").forEach((t=>t.setAttribute(Vh,"")));let e=t.parentElement;for(;e;)e.setAttribute(Vh,""),e=e.parentElement}var i;return e}function qh(t,e){if(!_h()||!t||"undefined"==typeof document)return;const i=t=>{const e=t.getBoundingClientRect();return[Math.round(e.x),Math.round(e.y),Math.round(e.width),Math.round(e.height)]},o=document.getElementById(Ph),n=document.querySelector(Kh(t));if(Gh(`[${e}] hideStyle=${!!o} keptHost=${!!n}`+(n?` keep=${n.hasAttribute(Vh)} display=${getComputedStyle(n).display}`:"")),n){Gh(`[${e}] kept host subtree:`,Array.from(n.querySelectorAll("*")).map((t=>{const e=t.shadowRoot;return{tag:t.tagName.toLowerCase(),keep:t.hasAttribute(Vh),display:getComputedStyle(t).display,vis:getComputedStyle(t).visibility,rect:i(t),painted:t.getClientRects().length>0,shadowKids:e?e.childElementCount:-1}})))}const r=Array.from(document.querySelectorAll("velt-shadow-dom-internal")).map((t=>({keep:t.hasAttribute(Vh),display:getComputedStyle(t).display,rect:i(t)}))).filter((t=>"none"!==t.display));Gh(`[${e}] visible <velt-shadow-dom-internal>: ${r.length}`,r);const s=Zh(t),a="snippyly-comment-pin, velt-comment-pin",l=document.querySelector(`snippyly-area-pin-portal[id="${s}"], velt-area-pin-portal[id="${s}"], velt-area-pin-portal[data-velt-id="${s}"]`);if(l){const o=e=>{const i=e.closest("snippyly-area-pin-portal, velt-area-pin-portal");if(i){const e=i.getAttribute("id")||i.getAttribute("data-velt-id")||"";return`area#${e.slice(0,6)}${e===t?"(FOCUSED)":""}`}const o=e.parentElement;return o?o.tagName.toLowerCase():"(detached)"},n=Array.from(document.querySelectorAll(".line")),r=Array.from(document.querySelectorAll(a));Gh(`[${e}] AREA focus: portal kept=${l.hasAttribute(Vh)} display=${getComputedStyle(l).display} rect=${JSON.stringify(i(l))} innerLines=${l.querySelectorAll(".line").length} innerPins=${l.querySelectorAll(a).length}`),Gh(`[${e}] AREA .line owners (total ${n.length}):`,Array.from(new Set(n.map(o)))),Gh(`[${e}] AREA <comment-pin> owners (total ${r.length}):`,r.map((t=>({owner:o(t),keep:t.hasAttribute(Vh),display:getComputedStyle(t).display,painted:t.getClientRects().length>0}))))}}function Qh(){document.querySelectorAll('[style*="cursor"]').forEach((t=>{const e=t.style.getPropertyValue("cursor");if(!e)return;if(Bh.has(t))return void("none"!==e&&t.style.setProperty("cursor","none","important"));if("none"===e)return;const i=t.style.getPropertyPriority("cursor");zh.push({el:t,value:e,priority:i,isPin:e.includes("url(")&&"important"===i}),Bh.add(t),t.style.setProperty("cursor","none","important")})),Gh(`neutralized inline cursor(s): tracked=${zh.length}`)}function Xh(t){tu();let e=!1;if(t){const o=Jh(t);e=o.length>0,function(t,e){if(_h()){Gh("keepAnnotationId =",JSON.stringify(t));for(const t of["snippyly-comment-pin-portal","velt-comment-pin-portal","snippyly-area-pin-portal","velt-area-pin-portal","snippyly-comment-text-portal","velt-comment-text-portal","snippyly-text-highlight","velt-text-highlight","velt-comment-text"]){const e=Array.from(document.querySelectorAll(t));Gh(`candidates <${t}>: ${e.length}`,e.map((t=>({id:t.getAttribute("id"),"data-velt-id":t.getAttribute("data-velt-id")}))))}Gh(`matched kept host(s): ${e.length}`),e.forEach(((t,e)=>{const i=[t.tagName.toLowerCase()];let o=t.parentElement;for(;o;){const t=o.tagName.toLowerCase();i.push(Wh.has(t)?`${t}(EXCLUDED-ANCESTOR)`:t),o=o.parentElement}Gh(` match[${e}] chain (self -> root):`,i.join(" > "))})),0===e.length&&Gh("No host matched the annotationId — the marker will be hidden. Compare the annotationId above against the candidate id / data-velt-id values.")}}(t,o),e&&(i=t)&&"undefined"!=typeof MutationObserver&&(Uh=i,jh=new MutationObserver((()=>{Uh&&Jh(Uh)})),jh.observe(document.documentElement,{childList:!0,subtree:!0}))}var i;const o=t=>e?`${t}:not([${Vh}])`:t,n=`${Rh.map(o).join(",\n")} { display: none !important; }`,r=`${Fh.map(o).join(",\n")} { display: contents !important; color: inherit !important; -webkit-text-fill-color: inherit !important; background-color: transparent !important; border-bottom-color: transparent !important; text-decoration: none !important; box-shadow: none !important; }`,s=document.createElement("style");s.id=Ph,s.textContent=`${n}\n${r}\n* { cursor: none !important; }`,document.head.appendChild(s),Qh(),"undefined"!=typeof MutationObserver&&(Hh=new MutationObserver((()=>Qh())),Hh.observe(document.documentElement,{attributes:!0,subtree:!0,attributeFilter:["style"]})),Gh(`injected hide stylesheet (keptAny=${e}, hide=${Rh.length}, neutralize=${Fh.length})`)}function tu(){var t;null===(t=document.getElementById(Ph))||void 0===t||t.remove(),Hh&&(Hh.disconnect(),Hh=null),zh.forEach((({el:t,value:e,priority:i,isPin:o})=>{o?t.style.removeProperty("cursor"):t.style.setProperty("cursor",e,i)})),zh=[],Bh=new WeakSet,jh&&(jh.disconnect(),jh=null),Uh=null,document.querySelectorAll(`[${Vh}]`).forEach((t=>t.removeAttribute(Vh)))}function eu(){var t;const e=null===(t=navigator.userAgentData)||void 0===t?void 0:t.brands;if(e&&e.length)return e.some((t=>/Chromium|Google Chrome|Microsoft Edge/i.test(t.brand)));const i=navigator.userAgent;return/Chrome|Chromium|Edg\//.test(i)&&!/Firefox|FxiOS/.test(i)}function iu(){return!("undefined"==typeof navigator||!navigator.mediaDevices||"function"!=typeof navigator.mediaDevices.getDisplayMedia)&&(eu()||function(){const t=navigator.userAgent;return/Safari/.test(t)&&/Apple/.test(navigator.vendor||"")&&!/Chrome|Chromium|CriOS|Edg\/|FxiOS|Android/.test(t)}())}class ou{constructor(){this.name="native",this.stream=null,this.video=null,this.surface=void 0,this.cropEl=null,this.lastDebug=null,this.initPromise=null,this.onEnded=null}isSupported(){return"undefined"!=typeof navigator&&!!navigator.mediaDevices&&"function"==typeof navigator.mediaDevices.getDisplayMedia}getCapability(){return eu()?"tab-region":"screen-crop"}isActive(){return!!this.stream&&!!this.video}getSurface(){return this.surface}getDebugInfo(){return this.lastDebug}async init(){if(!this.isSupported())throw new Error("native-not-supported");if(!this.isActive())return this.initPromise||(this.initPromise=this.runInit().finally((()=>{this.initPromise=null}))),this.initPromise}async runInit(){var t;const e=this.getCapability(),i="tab-region"===e?{video:{displaySurface:"browser"},preferCurrentTab:!0,selfBrowserSurface:"include",audio:!1}:{video:!0,audio:!1};let o;try{o=await navigator.mediaDevices.getDisplayMedia(i)}catch(t){throw t&&"object"==typeof t&&(t.sfNativeExpected=!0),t}let n=null;try{const i=o.getVideoTracks()[0];if(!i)throw new Error("native-no-video-track");if(this.surface=i.getSettings().displaySurface,"tab-region"===e){if("browser"!==this.surface){const e=null!==(t=this.surface)&&void 0!==t?t:"screen";throw new Error(`Shared a ${e}; re-init and pick "This tab".`)}await this.applyViewportCrop(i)}if(i.addEventListener("ended",(()=>this.handleEnded())),n=document.createElement("video"),n.srcObject=o,n.muted=!0,n.setAttribute("playsinline",""),n.style.cssText="position:fixed;left:-99999px;top:0;width:1px;height:1px;opacity:0;pointer-events:none;",document.body.appendChild(n),await n.play(),"ended"===i.readyState)throw new Error("native-share-ended-during-init");this.stream=o,this.video=n}catch(t){throw o.getTracks().forEach((t=>t.stop())),n&&(n.srcObject=null,n.remove()),this.removeCropEl(),this.surface=void 0,t}}async capture(t={}){if(!this.stream||!this.video)throw new Error("capture-not-initialized");const e=t.focusAnnotationId;_h()&&"undefined"!=typeof console&&console.log("[sf-capture][native] capture(): focusAnnotationId =",JSON.stringify(e));const i=performance.now(),o=this.video;return"tab-region"===this.getCapability()?this.captureTabRegion(o,i,e):this.captureScreenCrop(o,i,e)}async captureTabRegion(t,e,i){if("browser"!==this.surface)throw new Error("not-sharing-this-tab");const{canvas:o,page:n,frameW:r,frameH:s}=await this.grabFullFrame(t,i);let a=o;const l=n.viewportW*n.dpr;if(l>0&&r>1.5*l)throw new Error("frame-larger-than-viewport");const c=r/n.viewportW,d=Math.min(r,Math.round(n.viewportW*c)),h=Math.round(n.viewportH*c),u=a.height>h+2||a.width>d+2;u&&(a=Nh(a,0,0,d,h)),this.lastDebug={capability:"tab-region",surface:this.surface,cropApplied:!!this.cropEl,frameW:r,frameH:s,viewportW:n.viewportW,viewportH:n.viewportH,dpr:n.dpr,cssToFrame:c,croppedW:a.width,croppedH:a.height,clampedHeight:u},this.logDebug();const p=Oh(a,2560);a=p.canvas;const{blob:v,type:g}=await Dh(a,.9),f=performance.now()-e;return{blob:v,width:a.width,height:a.height,mode:this.name,durationMs:f,page:n,scope:"viewport",blobType:g,markerMapping:{scaleX:c*p.ratio,scaleY:c*p.ratio,originXCss:n.scrollX,originYCss:n.scrollY}}}async captureScreenCrop(t,e,i){const{canvas:o,page:n,frameW:r,frameH:s}=await this.grabFullFrame(t,i),a=this.computeScreenCrop(r,s);let l=Nh(o,a.cropX,a.cropY,a.cropW,a.cropH);const c=a.scale;this.lastDebug={capability:"screen-crop",surface:this.surface,cropApplied:!1,frameW:r,frameH:s,viewportW:n.viewportW,viewportH:n.viewportH,dpr:n.dpr,cssToFrame:c,croppedW:l.width,croppedH:l.height,clampedHeight:!0,screenCrop:a},this.logDebug();const d=Oh(l,2560);l=d.canvas;const{blob:h,type:u}=await Dh(l,.9),p=performance.now()-e;return{blob:h,width:l.width,height:l.height,mode:this.name,durationMs:p,page:n,scope:"viewport",blobType:u,markerMapping:{scaleX:c*d.ratio,scaleY:c*d.ratio,originXCss:n.scrollX,originYCss:n.scrollY}}}computeScreenCrop(t,e){const i=window.innerWidth,o=window.innerHeight,n=Math.max(0,window.outerHeight-window.innerHeight),r="window"===this.surface,s=r?window.outerWidth:window.screen.width,a=r?window.screenX:0,l=r?window.screenY:0,c=s>0?t/s:1,d=window.screenX-a,h=window.screenY+n-l;let u=Math.round(d*c),p=Math.round(h*c),v=Math.round(i*c),g=Math.round(o*c);return u=Math.max(0,Math.min(u,t-1)),p=Math.max(0,Math.min(p,e-1)),v=Math.max(1,Math.min(v,t-u)),g=Math.max(1,Math.min(g,e-p)),{cropX:u,cropY:p,cropW:v,cropH:g,scale:c,chromeTopCss:n,surfaceWidthCss:s}}async grabFullFrame(t,e){e&&await function(t,e=1200){return!t||Yh(t)?Promise.resolve(!!t&&Yh(t)):new Promise((i=>{let o=!1;const n=e=>{o||(o=!0,clearTimeout(s),r.disconnect(),Gh(`waitForAnnotationHost(${JSON.stringify(t)}) -> ${e?"found":"timeout"}`),i(e))},r=new MutationObserver((()=>{Yh(t)&&n(!0)}));r.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["id","data-velt-id"]});const s=setTimeout((()=>n(!1)),Math.max(0,e))}))}(e),Xh(e),qh(e,"post-hide");try{await Ih(2),await $h(t,3),await $h(t,1);const i=function(){const t=document.documentElement;return{scrollX:window.scrollX,scrollY:window.scrollY,viewportW:t.clientWidth,viewportH:t.clientHeight,dpr:window.devicePixelRatio||1}}(),o=t.videoWidth,n=t.videoHeight;if(!o||!n)throw new Error("capture-no-frame");const r=document.createElement("canvas");r.width=o,r.height=n;const s=r.getContext("2d");if(!s)throw new Error("canvas-2d-unavailable");return qh(e,"pre-draw"),s.drawImage(t,0,0),{canvas:r,page:i,frameW:o,frameH:n}}finally{tu()}}logDebug(){_h()&&"undefined"!=typeof console&&console.info("[sf-capture][native]",this.lastDebug)}dispose(){this.stream&&this.stream.getTracks().forEach((t=>t.stop())),this.video&&(this.video.srcObject=null,this.video.remove()),this.removeCropEl(),this.stream=null,this.video=null,this.surface=void 0}handleEnded(){var t;this.removeCropEl(),this.stream=null,this.video&&(this.video.srcObject=null,this.video.remove()),this.video=null,this.surface=void 0,null===(t=this.onEnded)||void 0===t||t.call(this)}async applyViewportCrop(t){const e=window.CropTarget,i=t;if(e&&"function"==typeof i.cropTo)try{const t=document.createElement("div");t.setAttribute("data-sf-capture-viewport",""),t.style.cssText="position:fixed;inset:0;pointer-events:none;opacity:0;z-index:-1;margin:0;",document.body.appendChild(t),this.cropEl=t;const o=await e.fromElement(t);await i.cropTo(o)}catch{this.removeCropEl()}}removeCropEl(){var t;null===(t=this.cropEl)||void 0===t||t.remove(),this.cropEl=null}}var nu=function(t,e,i,o){for(var n,r=arguments.length,s=r<3?e:null===o?o=Object.getOwnPropertyDescriptor(e,i):o,a=t.length-1;a>=0;a--)(n=t[a])&&(s=(r<3?n(s):r>3?n(e,i,s):n(e,i))||s);return r>3&&s&&Object.defineProperty(e,i,s),s};class ru extends X{constructor(){super(),this._loadPlugin=!1,this.comments=[],this.addCommentMode=!1,this.showTourCommentTooltip=!1,this.firstCommentNudge=!1,this.allFeatureDisabled=!1,this.planLimitLocked=!1,this.projectDeleted=!1,this.resolvedVeltFeatureGates=[],this.allFeatureRestricted=!1,this.guestMode=!1,this._expanded=!0,this.loading=!0,this._isPlanExpired=null,this.showOnboardingModal=!0,this.embedMode=!1,this.readOnlyMode=!1,this.autoCommentModeRequested=!1,this.autoCommentModeArmedOnce=!1,this.agentCommentsModeRequested=!1,this.previewLocationPath="",this.onboardingMode=!1,this.showLiveDemoModal=!1,this.showFigmaDemoModal=!1,this.showGuestModeSignInModal=!1,this.defaultGuestModeSignInModalConfig={title:"Sign in to notify your team",description:"Notify your team about your latest comments.",closeOnClickOutside:!1,showLeaveCommentButton:!0},this.guestModeSignInModalConfig=JSON.parse(JSON.stringify(this.defaultGuestModeSignInModalConfig)),this.showGuestModeNameModal=!1,this.guestModeSignInBannerVisible=!1,this.guestUserNameInput="",this.guestUserModelOpened=!1,this.guestUserNameUpdated=!1,this.guestUserNameUpdateLoading=!1,this.projectIdSupplied=!1,this.staging=Ve,this._autoLocation=!0,this.copyLinkTooltip="Copy Link",this.invalidApiKey=!1,this._isUserGlobalContact=!1,this.showQrCode=!1,this.qrCodeLoading=!1,this.qrCodeError=!1,this.customLoginEnabledLocally=null,this.customLoginEnabled=null,this.exitReviewModeCalled=!1,this.addCommentCount=0,this._privateCommentModeEnabled=!1,this.superflowToolbarMoved=!1,this._darkMode=!1,this.allowGuestModeSignIn=!0,this._queryParamsComments=!1,this._usePageTitleAsLocationName=!1,this.toolbarEnabled=!1,this.toolbarEnabledApiCalled=!1,this.passwordProtected=!1,this.isPasswordValid=!1,this.password="",this.validatingPasswordLoading=!1,this.showPasswordProtectedModal=!1,this.showInvalidPassword=!1,this.skipGuestNameModal=!1,this._totalViews={},this.totalViewsCount=0,this.inviteUrl="",this.showModalOnceCommentIsModeIsOff=!1,this.showInviteModal=!1,this.showBugReportModal=!1,this.featureAccess=null,this.hasAgentAccess=!1,this.hasPrivateCommentsAccess=!1,this.isPrivateCommentsEnabledOnWorkspace=!1,this.visibilityOptionsEnabled=!1,this.hasContentWarnings=!1,this.contentWarningsCount=0,this.showContentWarningSidebar=!1,this.showAgentCommentsInSidebar=!1,this.pageCommentsHidden=!1,this.veltProxyToggleVisible=!1,this.nativeScreenshotEnabled=!1,this.nativeScreenshotDenied=!1,this.capturingScreenshot=!1,this.nativeCapture=new ou,this.screenshotChain=Promise.resolve(),this.pendingScreenshotCount=0,this.nativeScreenshotEnabling=!1,this.addCommentAnnotationSubscribedEl=void 0,this.isSettingSidebarData=!1,this.agentGroups=[],this.agentNameMap=new Map,this.agentNamesFetched=!1,this.agentRunStatuses=[],this.agentRunStatusTimedOut=!1,this.agentRunStatusLastMessageAt=0,this.agentRunStatusSettled=!1,this.agentRunStatusListening=!1,this.agentRunStatusWatchdogTimer=null,this.lastStreamAnnotations=[],this.streamEmissionCount=0,this.lastStreamEmissionAt=0,this.onboardingLastFetchCount=-1,this.onboardingLastFetchError="",this.onboardingFetchedAnnotations=[],this.onboardingFetchedAt=0,this.onboardingFindingsFetchTimer=null,this.onboardingFindingsFetchAttempts=0,this.onboardingFetchAttemptsByAgent=new Map,this.onboardingFindingsFetchInFlight=!1,this.onboardingOpenedAgentIds=new Set,this.onboardingFetchResolvedAgentIds=new Set,this.onboardingRemovedAnnotationIds=new Set,this.onboardingUnsyncedAnnotationIds=[],this.onboardingViewportListening=!1,this.onboardingPanelResizeObserver=null,this.onboardingObservedPanel=null,this.onboardingClampFrame=null,this.locationChangeListenerAttached=!1,this.portalOrigins=null,this.spellingSuggestionPagePathMap=new Map,this.grammarSuggestionPagePathMap=new Map,this.processingAnnotationIds=new Set,this.subscriptions=[],this.onApiKeyChange=()=>{try{this.apiKey&&(null===window||void 0===window?void 0:window.onSuperflowLoad)&&"function"==typeof window.onSuperflowLoad&&window.onSuperflowLoad()}catch(t){console.warn("Error in onApiKeyChange: ",t),vd("Error in onApiKeyChange: ",t)}},this.checkCustomLoginEnabled=async()=>{var t;try{const e=await Md(this.apiKey);this.customLoginEnabled=!!(null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.customLoginEnabled),this.customLoginEnabled&&this.loginWithCustomUser()}catch(t){this.customLoginEnabled=!1,console.warn("Error in checkCustomLoginEnabled: ",t),vd("Error in checkCustomLoginEnabled: ",t)}},this.isRunningUnderPreviewProxy=(t=document.location)=>{try{const e=(null==t?void 0:t.hostname)||"",i=(null==t?void 0:t.pathname)||"";return jt.some((({hostSuffix:t,pathPrefix:o})=>(e===t||e.endsWith(`.${t}`))&&i.startsWith(o)))}catch(t){return console.warn("Error in isRunningUnderPreviewProxy: ",t),!1}},this.getEffectiveCurrentPageUrl=()=>{try{return this.isRunningUnderPreviewProxy()&&this.previewLocationPath?this.previewLocationPath:window.location.href}catch(t){return console.warn("Error in getEffectiveCurrentPageUrl: ",t),window.location.href}},this.previewProxyReadOnlyGuardInstalled=!1,this.previewProxyReadOnlyStyleObserver=null,this.previewProxyReadOnlySweepScheduled=!1,this.isPreviewProxyReadOnlyViewer=()=>{try{return this.isRunningUnderPreviewProxy()&&"Admin"!==this.snippylyUserRole}catch(t){return console.warn("Error in isPreviewProxyReadOnlyViewer: ",t),!1}},this.isSuggestionActionEventPath=t=>{try{return(t||[]).some((t=>{const e="string"==typeof(null==t?void 0:t.tagName)?t.tagName.toLowerCase():"";if(e.startsWith("velt-comment-dialog-suggestion-action")||e.startsWith("velt-comment-dialog-legacy-suggestion-action"))return!0;const i=null==t?void 0:t.classList;return!!(null==i?void 0:i.contains)&&(i.contains("sf-accept-btn")||i.contains("sf-reject-btn")||i.contains("velt-suggestion-actions"))}))}catch(t){return console.warn("Error in isSuggestionActionEventPath: ",t),!1}},this.setupPreviewProxySuggestionReadOnlyGuard=()=>{try{if(this.previewProxyReadOnlyGuardInstalled)return;this.previewProxyReadOnlyGuardInstalled=!0,document.addEventListener("click",(t=>{try{if(!this.isPreviewProxyReadOnlyViewer())return;const e="function"==typeof t.composedPath?t.composedPath():[];this.isSuggestionActionEventPath(e)&&(t.stopImmediatePropagation(),t.preventDefault(),console.warn("[CWS Toolbar] Suggestion accept/reject is read-only for preview viewers. Click ignored."))}catch(t){console.warn("Error in preview-proxy read-only click guard: ",t)}}),{capture:!0})}catch(t){console.warn("Error in setupPreviewProxySuggestionReadOnlyGuard: ",t),vd("Error in setupPreviewProxySuggestionReadOnlyGuard: ",t)}},this.applyPreviewProxyReadOnlyStyles=()=>{try{if(!this.isPreviewProxyReadOnlyViewer())return void this.removePreviewProxyReadOnlyStyles();this.sweepPreviewProxyReadOnlyStyles(),this.previewProxyReadOnlyStyleObserver||(this.previewProxyReadOnlyStyleObserver=new MutationObserver((()=>{try{if(this.previewProxyReadOnlySweepScheduled)return;this.previewProxyReadOnlySweepScheduled=!0,requestAnimationFrame((()=>{this.previewProxyReadOnlySweepScheduled=!1,this.isPreviewProxyReadOnlyViewer()&&this.sweepPreviewProxyReadOnlyStyles()}))}catch(t){console.warn("Error in preview-proxy read-only style observer: ",t)}})),this.previewProxyReadOnlyStyleObserver.observe(document.body,{childList:!0,subtree:!0}))}catch(t){console.warn("Error in applyPreviewProxyReadOnlyStyles: ",t),vd("Error in applyPreviewProxyReadOnlyStyles: ",t)}},this.sweepPreviewProxyReadOnlyStyles=()=>{try{this.injectPreviewProxyReadOnlyStyle(document.head);const t=e=>{e.querySelectorAll("*").forEach((e=>{var i,o;const n=(null===(o=null===(i=e.tagName)||void 0===i?void 0:i.toLowerCase)||void 0===o?void 0:o.call(i))||"";if(!n.startsWith("velt-")&&!n.startsWith("snippyly-"))return;const r=e.shadowRoot;r&&(this.injectPreviewProxyReadOnlyStyle(r),t(r))}))};t(document.body)}catch(t){console.warn("Error in sweepPreviewProxyReadOnlyStyles: ",t)}},this.injectPreviewProxyReadOnlyStyle=t=>{try{if(t.querySelector(`style[${ru.PREVIEW_READONLY_STYLE_ATTR}]`))return;const e=document.createElement("style");e.setAttribute(ru.PREVIEW_READONLY_STYLE_ATTR,"true"),e.textContent=ru.PREVIEW_READONLY_CSS,t.appendChild(e)}catch(t){console.warn("Error in injectPreviewProxyReadOnlyStyle: ",t)}},this.removePreviewProxyReadOnlyStyles=()=>{try{this.previewProxyReadOnlyStyleObserver&&(this.previewProxyReadOnlyStyleObserver.disconnect(),this.previewProxyReadOnlyStyleObserver=null);const t=`style[${ru.PREVIEW_READONLY_STYLE_ATTR}]`;document.querySelectorAll(t).forEach((t=>t.remove()));const e=i=>{i.querySelectorAll("*").forEach((i=>{const o=i.shadowRoot;o&&(o.querySelectorAll(t).forEach((t=>t.remove())),e(o))}))};e(document.body)}catch(t){console.warn("Error in removePreviewProxyReadOnlyStyles: ",t)}},this.isDriveOrPreviewHost=(t=document.location)=>{try{const e=(null==t?void 0:t.hostname)||"",i=(null==t?void 0:t.pathname)||"";return be.some((({hostSuffix:t,pathPrefix:o})=>(e===t||e.endsWith(`.${t}`))&&i.startsWith(o)))||this.isRunningUnderPreviewProxy(t)}catch(t){return console.warn("Error in isDriveOrPreviewHost: ",t),!1}},this.loginWithCustomUser=()=>{try{this.customLoginEnabled?(Kc(Zt),this.loadPlugin&&this.documentId&&this.identifySnippyly()):console.warn("Identify call not allowed.")}catch(t){console.warn("Error in loginWithCustomUser: ",t),vd("Error in loginWithCustomUser: ",t)}},this.addWindowClickEventListener=()=>{try{this.windowClickEventListener||(this.windowClickEventListener=()=>{this.menuOpenedId&&(this.menuOpenedId=void 0)},window.addEventListener("click",this.windowClickEventListener))}catch(t){console.warn("Error in addWindowClickEventListener: ",t),vd("Error in addWindowClickEventListener: ",t)}},this.removeWindowClickEventListener=()=>{try{window.removeEventListener("click",this.windowClickEventListener),this.windowClickEventListener=void 0}catch(t){console.warn("Error in removeWindowClickEventListener: ",t),vd("Error in removeWindowClickEventListener: ",t)}},this.onWindowLocationChange=()=>{this.checkUrl()},this.setWindowEventListner=()=>{try{if(this.locationChangeListenerAttached)return;window.addEventListener("locationchange",this.onWindowLocationChange),this.locationChangeListenerAttached=!0}catch(t){console.warn("Error in setWindowEventListner: ",t),vd("Error in setWindowEventListner: ",t)}},this.removeWindowLocationChangeListener=()=>{try{window.removeEventListener("locationchange",this.onWindowLocationChange),this.locationChangeListenerAttached=!1}catch(t){console.warn("Error in removeWindowLocationChangeListener: ",t),vd("Error in removeWindowLocationChangeListener: ",t)}},this.urlChangeListener=()=>{try{const t=history.pushState;history.pushState=function(){const e=t.apply(this,arguments);return window.dispatchEvent(new Event("pushstate")),window.dispatchEvent(new Event("locationchange")),e};const e=history.replaceState;history.replaceState=function(){const t=e.apply(this,arguments);return window.dispatchEvent(new Event("replacestate")),window.dispatchEvent(new Event("locationchange")),t},window.addEventListener("popstate",(()=>{window.dispatchEvent(new Event("locationchange"))}))}catch(t){console.warn("Error in urlChangeListener: ",t),vd("Error in urlChangeListener: ",t)}},this.checkUrl=()=>{try{this.setInviteUrl();const t=new URL(document.location),e=t.searchParams;e.has(Ht)&&Wc(Et,"true",!1);let i=!1;for(const t of[St,Mt,Tt,At,It]){if(!e.has(t))continue;const o=t!==It||this.isFramedByPortal();"true"===e.get(t)&&o?Wc(t,"true",!1,"sessionStorage"):Kc(t,"sessionStorage"),e.delete(t),i=!0}this.embedMode="true"===Zc(St,!1,"sessionStorage"),this.readOnlyMode="true"===Zc(Tt,!1,"sessionStorage"),this.autoCommentModeRequested=!this.readOnlyMode&&"true"===Zc(Mt,!1,"sessionStorage"),this.agentCommentsModeRequested="true"===Zc(At,!1,"sessionStorage"),this.onboardingMode="true"===Zc(It,!1,"sessionStorage")&&this.canHonourStoredOnboardingFlag(),this.autoOpenOnboardingSidebar();const o=e.get(_t);if(o&&(Wc(_t,o,!1,"sessionStorage"),e.delete(_t),i=!0),this.previewLocationPath=Zc(_t,!1,"sessionStorage")||"",this.pageCommentsHidden="true"===Zc(zt,!1,"sessionStorage"),i&&window.history.replaceState({},document.title,t.href),(null==e?void 0:e.has(Qt))&&!Zc(Qt)?this.showOnboardingModal=!0:this.showOnboardingModal=!1,null==e?void 0:e.has(Xt))if(Zc(Xt,!1,"sessionStorage")){this.showLiveDemoModal=!1;const t=new URL(document.location);t.searchParams.delete(Xt),window.history.replaceState({},null===document||void 0===document?void 0:document.title,t.toString())}else this.showLiveDemoModal=!0;else this.showLiveDemoModal=!1;if(null==e?void 0:e.has(te))if(Zc(te,!1)){this.showFigmaDemoModal=!1;const t=new URL(document.location);t.searchParams.delete(te),window.history.replaceState({},null===document||void 0===document?void 0:document.title,t.toString())}else this.showFigmaDemoModal=!0;else this.showFigmaDemoModal=!1;if(e.has(Wt)||e.has("snippyly_google_token")){if(e.has(Wt)){const t=decodeURIComponent(e.get(Wt)),i=qc(t,ze,Be),o=i&&JSON.parse(i);if(o){const t={};t.userId=o.uid,t.name=o.displayName,t.email=o.email,t.photoUrl=null==o?void 0:o.photoURL;const e=JSON.stringify(t),i=Jc(e,ze,Be);Wc(Zt,i,!0),Kc(ie)}}else if(e.has("snippyly_google_token")){const t=JSON.parse(atob(e.get("snippyly_google_token"))),i={};i.userId=t.uid,i.name=t.displayName,i.email=t.email,i.photoUrl=null==t?void 0:t.photoURL,Wc(Gt,JSON.stringify(i),!0)}e.delete(Wt),e.delete("snippyly_google_token"),window.history.replaceState({},document.title,t.href)}e.has(Et)?(Wc(Et,"true",!1),Kc(kt),e.delete(Et),window.history.replaceState({},document.title,t.href),this.loadPluginUI()):e.has(kt)||Zc(Et,!1)&&this.loadPluginUI(),e.has(kt)?(Wc(kt,"true",!1),Kc(Et),e.delete(kt),window.history.replaceState({},document.title,t.href),this.loadPluginUI()):e.has(Et)||Zc(kt,!1)&&this.loadPluginUI(),this.setVersionInUrl(),this.startAgentRunStatusListener()}catch(t){console.warn("Error in checkUrl: ",t),vd("Error in checkUrl: ",t)}},this.setInviteUrl=()=>{try{const t=new URL(document.location);t.searchParams.has(Et)||t.searchParams.set(Et,"true"),this.inviteUrl=t.toString()}catch(t){console.warn("Error in setInviteUrl: ",t),vd("Error in setInviteUrl: ",t)}},this.detectVersion=()=>{try{if(this.projectVersionKey){const t=new URL(document.location).searchParams;if(t.get(this.projectVersionKey))this.projectVersion=t.get(this.projectVersionKey);else if(window.snippylyInitialLoadUrl){const t=new URL(window.snippylyInitialLoadUrl).searchParams;t.get(this.projectVersionKey)&&(this.projectVersion=t.get(this.projectVersionKey))}this.projectVersion&&Wc(Jt,this.projectVersion,!1,"sessionStorage")}else{const t=new URL(document.location).searchParams;(t.has(Et)||t.has(kt))&&t.has(qt)&&(Wc(Yt,qt,!1,"sessionStorage"),this.projectVersion=t.get(qt),this.projectVersion&&Wc(Jt,this.projectVersion,!1,"sessionStorage"))}}catch(t){console.warn("Error in detectVersion: ",t),vd("Error in detectVersion: ",t)}},this.setVersionInUrl=()=>{try{const t=this.projectVersionKey||Zc(Yt,!1,"sessionStorage"),e=this.projectVersion||Zc(Jt,!1,"sessionStorage");if(t&&e){const i=new URL(document.location),o=i.searchParams;o.get(t)||(o.set(t,e),window.history.replaceState({},document.title,i.href))}}catch(t){console.warn("Error in setVersionInUrl: ",t),vd("Error in setVersionInUrl: ",t)}},this.loadPluginUI=async()=>{var t,e,i,o,n,r,s,a;try{if(!this.apiKey)return;if(!this.projectId)return;if(this.loadPlugin)return this.generateLocation(),this.setLocation(),this.setPreviewLocationFromPath(),void setTimeout((()=>{var t;if(this.usePageTitleAsLocationName){const e=document.title;(null===(t=this.location)||void 0===t?void 0:t.locationName)!==e&&(this.generateLocation(),this.setLocation({forceSetLocation:!0}),this.setPreviewLocationFromPath())}}),4e3);if(this.toolbarEnabledApiCalled||await this.detectToolbarEnabled(),!this.toolbarEnabled)return;wt.includes(this.apiKey)&&this.listenToDocumentTitleChange();const l=Qc();l&&!(null==l?void 0:l.isAnonymous)&&(this.loading=!0);try{this.customerMetadata=await this.getCustomerMetadata()}catch(t){console.warn("Error in getCustomerMetadata: ",t),vd("Error in getCustomerMetadata: ",t)}Gc(ae)&&(this.isPasswordValid=Gc(ae));const c=await yd(this.apiKey,this.projectId);"error"===c.status&&console.warn("getProjectConfig failed for projectId (treating project as valid): ",this.projectId),this.projectDeleted=od(c,this.isDriveOrPreviewHost(),this.projectIdSupplied),this.applyVeltFeatureGates(),this.projectConfig="ok"===c.status?c.config:null,this.guestMode=!!(null===(t=this.projectConfig)||void 0===t?void 0:t.guestMode)||this.guestMode,this.allowGuestModeSignIn=!!(null===(i=null===(e=this.projectConfig)||void 0===e?void 0:e.guestModeConfig)||void 0===i?void 0:i.allowSignIn),this.queryParamsComments=!!(null===(o=this.projectConfig)||void 0===o?void 0:o.queryParamsComments),this.usePageTitleAsLocationName=!!(null===(n=this.projectConfig)||void 0===n?void 0:n.usePageTitleAsLocationName),(null===(r=this.projectConfig)||void 0===r?void 0:r.guestModeConfig)||(this.allowGuestModeSignIn=!0),this.passwordProtected=!!(null===(a=null===(s=this.projectConfig)||void 0===s?void 0:s.passwordProtected)||void 0===a?void 0:a.enabled),this.applyVeltFeatureGates(),Wc(oe,this.guestMode+"",!0),Wc(de,this.allowGuestModeSignIn+"",!0),Wc(ne,this.passwordProtected+"",!0),Wc(re,this.queryParamsComments+"",!0),Wc(se,this.usePageTitleAsLocationName+"",!0),this.loadPlugin=!0,this.projectDeleted||this.mountVeltCollaborationElements();try{const t=new URL(document.location),e=t.searchParams;let i=!1;e.has("wireframe")&&"true"===e.get("wireframe")&&(sessionStorage.setItem("velt-wireframe","true"),e.delete("wireframe"),i=!0),e.get("velt-version")&&(sessionStorage.setItem("velt-version",e.get("velt-version")),e.delete("velt-version"),i=!0),e.get("velt-env")&&(sessionStorage.setItem("velt-env",e.get("velt-env")),e.delete("velt-env"),i=!0),i&&window.history.replaceState({},document.title,t.href)}catch(t){}this.initializeSnippyly()}catch(t){this.loading=!1,console.warn("Error in loadPluginUI: ",t),vd("Error in loadPluginUI: ",t)}},this.listenToDocumentTitleChange=()=>{try{this.documentTitleChangeInterval||(this.documentTitleChangeInterval=setInterval((()=>{var t,e,i;const o="true"===sessionStorage.getItem("debugDocumentTitleChange");if(o&&(console.log("*** listenToDocumentTitleChange ***"),console.log("usePageTitleAsLocationName: ",this.usePageTitleAsLocationName)),this.usePageTitleAsLocationName){const n=document.title;o&&(console.log("location name: ",null===(t=this.location)||void 0===t?void 0:t.locationName),console.log("title: ",n),console.log("changed: ",(null===(e=this.location)||void 0===e?void 0:e.locationName)!==n)),(null===(i=this.location)||void 0===i?void 0:i.locationName)!==n&&(o&&console.log("%c triggering location update!","color: green; font-weight: bold;"),this.generateLocation(),this.setLocation({forceSetLocation:!0}),this.setPreviewLocationFromPath())}}),2e3))}catch(t){vd("Error in listenToDocumentTitleChange: ",t)}},this.initializeSnippyly=async()=>{var t,e,o,n,r,s,a,l,c,d,h,u,p,v,g,f,m,w,y,b,C,x,E,k,S,M,T,A;try{let _=this.staging?ft:mt;this.veltVersion&&(_=this.veltVersion);let I=this.staging,$=!1;if((null===sessionStorage||void 0===sessionStorage?void 0:sessionStorage.getItem("velt-version"))&&(_=sessionStorage.getItem("velt-version")),null===sessionStorage||void 0===sessionStorage?void 0:sessionStorage.getItem("velt-env")){"staging"===sessionStorage.getItem("velt-env")&&(I=!1,$=!0)}this.apiKey;this.veltProxyToggleVisible=!1;const N=void 0;if(await i(this.apiKey,{options:{develop:I,staging:$,version:_,velt:!0,proxyDomain:"https://cdn.velt.dev"},...N?{proxyConfig:N}:{}}),!window.Velt)return;if(this.replayVeltFeatureGates(),this.autoTranslation&&(null===Velt||void 0===Velt?void 0:Velt.enableAutoTranslation)&&(null===Velt||void 0===Velt||Velt.enableAutoTranslation()),this.projectDeleted||this.mountCommentSidebar(),Velt){null===Velt||void 0===Velt||Velt.sf(!0);try{window.dispatchEvent(new CustomEvent("onVeltLoad",{detail:{Velt}})),(null===window||void 0===window?void 0:window.onSnippylyLoad)&&(null===window||void 0===window||window.onSnippylyLoad(Velt))}catch(t){}document.body.style.setProperty("--velt-default-font-family","'Poppins', sans-serif"),(()=>{try{if(!document.getElementById("superflowFontLink3")){const t=document.createElement("link");t.rel="stylesheet",t.href="https://firebasestorage.googleapis.com/v0/b/snippyly-sdk-external/o/fonts%2Fpoppins%2Fpoppins.css?alt=media&token=5f31a0f2-5f67-4974-bf56-78ae655f2b68",t.id="superflowFontLink3",document.head.appendChild(t)}}catch(t){console.warn("Error in loadPoppinsFont: ",t),vd("Error in loadPoppinsFont: ",t)}})()}if(Velt&&(hd({sdkVersion:null===Velt||void 0===Velt?void 0:Velt.version,sdkType:"client"}),console.log(`Velt Version: ${(null===Velt||void 0===Velt?void 0:Velt.version)||"unknown"}`),console.log(`Superflow Toolbar Version: ${gt}`)),this.generateDocumentId(),(null===Velt||void 0===Velt?void 0:Velt.on)&&"function"==typeof(null===Velt||void 0===Velt?void 0:Velt.on)){const e=Qc(),i="true"===sessionStorage.getItem("debugUserUpdateEvent");this.previousVeltUserId=null!==(t=null==e?void 0:e.userId)&&void 0!==t?t:"default",i&&console.log("[Superflow Debug] Initialized previousVeltUserId:",this.previousVeltUserId),Velt.on("userUpdate").subscribe((async t=>{if(i&&console.log("User from event: UserUpdate",t),t){const e=t.userId;i&&console.log("[Superflow Debug] userUpdate event fired:",{previousVeltUserId:this.previousVeltUserId,currentUserId:e,userChanged:this.previousVeltUserId!==e}),this.previousVeltUserId!==e&&(i&&console.log("[Superflow Debug] User changed, calling setDocumentAndLocation"),await this.setDocumentAndLocation()),this.previousVeltUserId=e}})),i&&console.log("[Superflow Debug] Performing initial setDocumentAndLocation"),await this.setDocumentAndLocation()}else await this.setDocumentAndLocation();if(setTimeout((()=>{var t;if(this.usePageTitleAsLocationName){const e=document.title;(null===(t=this.location)||void 0===t?void 0:t.locationName)!==e&&(this.generateLocation(),this.setLocation({forceSetLocation:!0}),this.setPreviewLocationFromPath())}}),4e3),this.commentElement=null===Velt||void 0===Velt?void 0:Velt.getCommentElement(),this.contactElement=null===Velt||void 0===Velt?void 0:Velt.getContactElement(),this.rewriterElement=null===Velt||void 0===Velt?void 0:Velt.getRewriterElement(),this.presenceElement=null===Velt||void 0===Velt?void 0:Velt.getPresenceElement(),this.commentElement){this.readOnlyMode?"function"==typeof this.commentElement.enableTextComments&&this.commentElement.enableTextComments(!1):this.commentElement.enableTextComments(!0),this.customLoginEnabledLocally||this.commentElement.enableSignInButton(!0),this.commentElement.enableAttachments(!0),(null===(e=this.commentElement)||void 0===e?void 0:e.showScreenSizeInfo)&&this.commentElement.showScreenSizeInfo(!0),(null===(o=this.commentElement)||void 0===o?void 0:o.enableDeviceInfo)&&this.commentElement.enableDeviceInfo(!0),this.commentElement.enableCommentIndex(!0),this.applyPageCommentsVisibility(),this.commentElement.onCommentModeChange&&this.commentElement.onCommentModeChange().subscribe((t=>{if(t&&this.readOnlyMode)return this.disableCommentMode(),void(this.addCommentMode=!1);this.addCommentMode=t,t&&this.unhidePageCommentsIfHidden(),t&&this.autoCommentModeRequested&&(this.autoCommentModeArmedOnce=!0,this.firstCommentNudge&&(this.firstCommentNudge=!1,this.showTourCommentTooltip=!1),Wc(ee,"true")),t&&this.promptNativeScreenshotForCommentMode(),this.addCommentMode||this.showModalOnceCommentIsModeIsOff&&(this.addCommentCount>=2&&!Zc(he)&&(this.allowGuestModeSignIn?this.openGuestModeSignInModal():this.openGuestModeNameModel(),Wc(he,"true"),this.showModalOnceCommentIsModeIsOff=!1),this.addCommentCount>=5&&!this.showGuestModeSignInModal&&!Zc(pe,!1,"sessionStorage")&&(this.showGuestModeSignInBanner(),Wc(pe,"true",!1,"sessionStorage"),this.showModalOnceCommentIsModeIsOff=!1))})),(null===(n=this.commentElement)||void 0===n?void 0:n.enableOrphanComments)&&this.commentElement.enableOrphanComments(),!this.readOnlyMode&&(null===(r=this.commentElement)||void 0===r?void 0:r.enablePersistentCommentMode)&&this.commentElement.enablePersistentCommentMode(),this.readOnlyMode||this.showFirstCommentNudge(),(null===(s=this.commentElement)||void 0===s?void 0:s.enableGhostComments)&&this.commentElement.enableGhostComments();const t=null===window||void 0===window?void 0:window.SUPERFLOW_CUSTOM_STATUSES;t&&"object"==typeof t&&(null===(a=this.commentElement)||void 0===a?void 0:a.setCustomStatus)&&this.commentElement.setCustomStatus(t),(null===(l=this.commentElement)||void 0===l?void 0:l.enableMinimap)&&!this.embedMode&&this.commentElement.enableMinimap(),(null===(c=this.commentElement)||void 0===c?void 0:c.setDStrategy)&&(null===(d=this.commentElement)||void 0===d||d.setDStrategy("dynamicId")),(null===(h=this.commentElement)||void 0===h?void 0:h.enableSidebarButtonOnCommentDialog)&&this.commentElement.enableSidebarButtonOnCommentDialog(),(null===(u=this.commentElement)||void 0===u?void 0:u.enableHotkey)&&this.commentElement.enableHotkey(),(null===(p=this.commentElement)||void 0===p?void 0:p.enableDeviceIndicatorOnCommentPins)&&this.commentElement.enableDeviceIndicatorOnCommentPins(),(null===(v=this.commentElement)||void 0===v?void 0:v.enableLazyLoadResolvedComments)&&this.commentElement.enableLazyLoadResolvedComments(),(null===(g=this.commentElement)||void 0===g?void 0:g.enableDraftConfirmation)&&this.commentElement.enableDraftConfirmation(),this.applyScreenshotSetting(),this.ensureAddCommentAnnotationSubscription(),(null===(w=null===(m=null===(f=this.customerMetadata)||void 0===f?void 0:f.superflow)||void 0===m?void 0:m.advancedFeatures)||void 0===w?void 0:w.hasCustomStatus)&&this.setCustomStatuses(),this.setQueryParamsCommentsInSdk(),this.checkToEnableUpgradeButton(),this.setupSidebarAgentCommentFilter(),this.setupVeltButtonClickListener(),this.maybeApplyVisibilityOptionsToCommentElement()}this.applyStorageFeatureAccess(),this.selectionElement=Velt.getSelectionElement(),this.selectionElement&&this.selectionElement.enableLiveSelection(!0),this.rewriterElement&&(null===(y=this.rewriterElement)||void 0===y||y.enableRewriter()),this.presenceElement&&(null===(b=this.presenceElement)||void 0===b?void 0:b.enableFlockMode)&&(null===(C=this.presenceElement)||void 0===C||C.enableFlockMode(!0)),(null===Velt||void 0===Velt?void 0:Velt.getDocElement)&&(this.docElement=Velt.getDocElement()),null===(S=(null===(x=this.docElement)||void 0===x?void 0:x.getDocumentMetadata)?null===(E=this.docElement)||void 0===E?void 0:E.getDocumentMetadata():null===(k=null===Velt||void 0===Velt?void 0:Velt.docService)||void 0===k?void 0:k.getDocumentMetadata$())||void 0===S||S.subscribe((t=>{var e,i;const o=(null===(e=null==t?void 0:t.superflow)||void 0===e?void 0:e.versions)?Object.values(null===(i=null==t?void 0:t.superflow)||void 0===i?void 0:i.versions):[],n=new URL(document.location).searchParams.get("version");if(n){const t=o.find((t=>t.id===n));t&&(this.version={id:t.id,name:t.versionName||t.id},this.setLocation())}})),(null===Velt||void 0===Velt?void 0:Velt.getViewsElement)&&(this.viewsElement=Velt.getViewsElement()),(null===(M=this.viewsElement)||void 0===M?void 0:M.getUniqueViewsByUser)&&(null===(A=null===(T=this.viewsElement)||void 0===T?void 0:T.getUniqueViewsByUser())||void 0===A||A.subscribe((t=>{this.totalViews=t}))),this.identifySnippyly()}catch(t){this.loading=!1,console.warn("Error in initializeSnippyly: ",t),vd("Error in initializeSnippyly: ",t)}},this.generateDocumentId=()=>{try{this.documentId=Uc(Bc(window.location.origin))+"",this.projectId&&(this.documentId=this.projectId+""),this.serverDocumentId=(t=this.documentId+"")?`${Uc(t)}`:void 0}catch(t){console.warn("Error in generateDocumentId: ",t),vd("Error in generateDocumentId: ",t)}var t},this.setDocumentAndLocation=async()=>{try{if(this.projectDeleted)return void console.warn("setDocumentAndLocation skipped: project no longer exists");this.generateDocumentId(),this.previousLocation=null,await(null===Velt||void 0===Velt?void 0:Velt.setDocumentId(this.documentId+"")),hd({documentId:this.serverDocumentId,clientDocumentId:this.documentId}),this.generateLocation(),this.setLocation(),this.setPreviewLocationFromPath()}catch(t){console.warn("Error in setDocumentAndLocation: ",t),vd("Error in setDocumentAndLocation: ",t)}},this.setPreviewLocationFromPath=()=>{try{if(!this.agentCommentsModeRequested||!this.previewLocationPath)return;if(!window.Velt||!(null===Velt||void 0===Velt?void 0:Velt.setLocation))return;const t={url:this.previewLocationPath},e=Hc(JSON.parse(JSON.stringify(t)));e&&(t.id=`${e}`),this.location=t,null===Velt||void 0===Velt||Velt.setLocation(JSON.parse(JSON.stringify(t))),hd({clientLocation:t}),this.previousLocation=JSON.parse(JSON.stringify(t)),this.onVeltLocationChange()}catch(t){console.warn("Error in setPreviewLocationFromPath: ",t),vd("Error in setPreviewLocationFromPath: ",t)}},this.checkToEnableUpgradeButton=()=>{var t,e;try{this.isPlanExpired&&this.isUserGlobalContact?(null===(t=this.commentElement)||void 0===t?void 0:t.enableUpgradeButton)&&this.commentElement.enableUpgradeButton():(null===(e=this.commentElement)||void 0===e?void 0:e.disableUpgradeButton)&&this.commentElement.disableUpgradeButton()}catch(t){console.warn("Error in checkToEnableUpgradeButton: ",t),vd("Error in checkToEnableUpgradeButton: ",t)}},this.getCustomerMetadata=async()=>{try{const t=await xd(this.apiKey);return(t=>{try{const e=t?JSON.stringify(t):"false";Wc(ve,e)}catch(t){console.warn("Error in setCustomerMetadataToStorage: ",t),vd("Error in setCustomerMetadataToStorage: ",t)}})(t),t}catch(t){console.warn("Error in getCustomerMetadata: ",t),vd("Error in getCustomerMetadata: ",t);const e=(()=>{try{const t=Zc(ve);return t?"false"===t?JSON.parse(JSON.stringify(_e)):JSON.parse(t):null}catch(t){return console.warn("Error in getCustomerMetadataFromStorage: ",t),vd("Error in getCustomerMetadataFromStorage: ",t),null}})();if(e)return e}},this.setCustomStatuses=async()=>{var t;try{const e=await Ed(this.apiKey);if((null==e?void 0:e.success)&&(null==e?void 0:e.data)){const i=Object.values(e.data),o=this.sortCustomStatuses(i);o.length>0&&(null===(t=this.commentElement)||void 0===t?void 0:t.setCustomStatus)&&this.commentElement.setCustomStatus(o)}}catch(t){console.warn("Error in setCustomStatuses: ",t),vd("Error in setCustomStatuses: ",t)}},this.sortCustomStatuses=t=>{try{const e=[...t].sort(((t,e)=>("number"==typeof t.order?t.order:Number.MAX_SAFE_INTEGER)-("number"==typeof e.order?e.order:Number.MAX_SAFE_INTEGER)));return e}catch(e){return console.warn("Error in sortCustomStatuses: ",e),vd("Error in sortCustomStatuses: ",e),t}},this.getSamlConfig=async()=>{try{const t=await Td(this.apiKey);return(t=>{try{if(t){const e=JSON.stringify(t);Wc(ye,e,!0)}}catch(t){console.warn("Error in setSamlConfigToStorage: ",t),vd("Error in setSamlConfigToStorage: ",t)}})(t),t}catch(t){console.warn("Error in getSamlConfig: ",t),vd("Error in getSamlConfig: ",t);const e=(()=>{try{const t=Zc(ye,!0);return t?JSON.parse(t):null}catch(t){return console.warn("Error in getSamlConfigFromStorage: ",t),vd("Error in getSamlConfigFromStorage: ",t),null}})();if(e)return e}},this.setLogos=()=>{var t,e,i,o,n,r,s,a,l,c,d,h;try{let u="light";this.privateCommentModeEnabled&&(u="dark");const p=null===(i=null===(e=null===(t=this.customerMetadata)||void 0===t?void 0:t.superflow)||void 0===e?void 0:e.customBranding)||void 0===i?void 0:i.logoMark,v=null===(r=null===(n=null===(o=null==Pe?void 0:_e)||void 0===o?void 0:o.customBranding)||void 0===n?void 0:n.logo)||void 0===r?void 0:r.logoMark,g=null===(l=null===(a=null===(s=this.customerMetadata)||void 0===s?void 0:s.superflow)||void 0===a?void 0:a.customBranding)||void 0===l?void 0:l.wordMark,f=null===(h=null===(d=null===(c=null==Pe?void 0:_e)||void 0===c?void 0:c.customBranding)||void 0===d?void 0:d.logo)||void 0===h?void 0:h.wordMark;switch(u){case"light":this.logoMark=(null==p?void 0:p.lightUrl)||(null==p?void 0:p.darkUrl)||(null==v?void 0:v.lightUrl),this.wordMark=(null==g?void 0:g.lightUrl)||(null==g?void 0:g.darkUrl)||(null==f?void 0:f.lightUrl);break;case"dark":this.logoMark=(null==p?void 0:p.darkUrl)||(null==p?void 0:p.lightUrl)||(null==v?void 0:v.darkUrl),this.wordMark=(null==g?void 0:g.darkUrl)||(null==g?void 0:g.lightUrl)||(null==f?void 0:f.darkUrl)}}catch(t){console.warn("Error in setLogos: ",t),vd("Error in setLogos: ",t)}},this.getAlertIcon=()=>L`
5854
5825
  <svg class="error-icon" width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
5855
5826
  <path d="M12 3C10.22 3 8.47991 3.52784 6.99987 4.51677C5.51983 5.50571 4.36628 6.91131 3.68509 8.55585C3.0039 10.2004 2.82567 12.01 3.17294 13.7558C3.5202 15.5016 4.37737 17.1053 5.63604 18.364C6.89471 19.6226 8.49836 20.4798 10.2442 20.8271C11.99 21.1743 13.7996 20.9961 15.4442 20.3149C17.0887 19.6337 18.4943 18.4802 19.4832 17.0001C20.4722 15.5201 21 13.78 21 12C20.9975 9.61382 20.0485 7.3261 18.3612 5.63882C16.6739 3.95154 14.3862 3.00252 12 3ZM12 19.6154C10.4938 19.6154 9.02146 19.1687 7.76912 18.332C6.51678 17.4952 5.5407 16.3058 4.96431 14.9143C4.38792 13.5227 4.23711 11.9916 4.53095 10.5143C4.82479 9.03707 5.55008 7.68014 6.61511 6.61511C7.68014 5.55008 9.03708 4.82478 10.5143 4.53094C11.9916 4.2371 13.5228 4.38791 14.9143 4.9643C16.3058 5.54069 17.4952 6.51677 18.332 7.76912C19.1688 9.02146 19.6154 10.4938 19.6154 12C19.6131 14.019 18.81 15.9547 17.3824 17.3824C15.9547 18.81 14.019 19.6131 12 19.6154ZM11.3077 12.6923V7.84615C11.3077 7.66254 11.3806 7.48645 11.5105 7.35662C11.6403 7.22678 11.8164 7.15385 12 7.15385C12.1836 7.15385 12.3597 7.22678 12.4895 7.35662C12.6194 7.48645 12.6923 7.66254 12.6923 7.84615V12.6923C12.6923 12.8759 12.6194 13.052 12.4895 13.1818C12.3597 13.3117 12.1836 13.3846 12 13.3846C11.8164 13.3846 11.6403 13.3117 11.5105 13.1818C11.3806 13.052 11.3077 12.8759 11.3077 12.6923ZM13.0385 15.8077C13.0385 16.0131 12.9776 16.2139 12.8635 16.3846C12.7493 16.5554 12.5872 16.6885 12.3974 16.7671C12.2076 16.8457 11.9988 16.8663 11.7974 16.8262C11.596 16.7861 11.4109 16.6872 11.2657 16.542C11.1205 16.3968 11.0216 16.2117 10.9815 16.0103C10.9414 15.8088 10.962 15.6 11.0406 15.4103C11.1192 15.2205 11.2523 15.0583 11.4231 14.9442C11.5938 14.8301 11.7946 14.7692 12 14.7692C12.2754 14.7692 12.5396 14.8786 12.7343 15.0734C12.9291 15.2681 13.0385 15.5323 13.0385 15.8077Z" fill="currentColor"/>
5856
5827
  </svg>
@@ -5862,7 +5833,7 @@ class $c extends ma{}$c.Encryptor=class extends $c{processBlock(t,e){const i=t,o
5862
5833
  ${pt(this.wordMark)}
5863
5834
  `:L`
5864
5835
  <img src=${this.wordMark} />
5865
- `}catch(t){return console.warn("Error in getWordMark: ",t),L``}},this.generateLocation=()=>{try{if(this.autoLocation){const t=new URL(document.location).searchParams,e=new URL(document.location);e.searchParams.delete(Et),e.searchParams.delete(kt),e.searchParams.delete(Bt),e.searchParams.delete(Ht),e.searchParams.delete(Qt),e.searchParams.delete(Xt);const i=t.get(qt)||this.projectVersion;this.queryParamsComments||(e.search="");let o=(t=>{try{return t.replace(/#.*$/,"")}catch(e){return console.warn("Error in removeHashFromUrl: ",e),vd("Error in removeHashFromUrl: ",e),t}})(e.href);this.projectId&&(o=null==o?void 0:o.replace(window.location.origin,"")),this.location={url:o,version:i}}}catch(t){console.warn("Error in generateLocation: ",t),vd("Error in generateLocation: ",t)}},this.setLocation=t=>{var e,i,o,n;try{if(this.autoLocation&&window.Velt&&(null===Velt||void 0===Velt?void 0:Velt.setLocation)){if(this.version?(this.location||(this.location={}),this.location.version=this.version):this.location&&delete this.location.version,!(null==t?void 0:t.forceSetLocation)&&this.previousLocation&&(null===(e=this.previousLocation)||void 0===e?void 0:e.url)===(null===(i=this.location)||void 0===i?void 0:i.url)&&(null===(o=this.previousLocation)||void 0===o?void 0:o.version)===(null===(n=this.location)||void 0===n?void 0:n.version))return;const r=Hc(JSON.parse(JSON.stringify(this.location)));if(r?this.location.id=`${r}`:delete this.location.id,this.usePageTitleAsLocationName){const t=document.title;t&&(this.location.locationName=t)}null===Velt||void 0===Velt||Velt.setLocation(JSON.parse(JSON.stringify(this.location))),hd({clientLocation:this.location}),this.previousLocation=JSON.parse(JSON.stringify(this.location)),this.onVeltLocationChange()}}catch(t){console.warn("Error in setLocation: ",t),vd("Error in setLocation: ",t)}},this.onVeltLocationChange=()=>{try{window.dispatchEvent(new CustomEvent("veltLocationChange",{detail:this.location}))}catch(t){console.warn("Error in onVeltLocationChange: ",t),vd("Error in onVeltLocationChange: ",t)}},this.identifySnippyly=async()=>{var t,e,i,o;let n="",r="";try{this.invalidApiKey=!1;let o,s={name:"Default User",email:"default@usesuperflow.com",userId:"default",isAnonymous:!0,organizationId:this.apiKey};o=this.customLoginEnabled&&this.providedUser?this.providedUser:Qc(),Hs("[Superflow][identify] resolved user (pre-iam)",{source:this.customLoginEnabled&&this.providedUser?"providedUser":"token",email:null==o?void 0:o.email,userId:null==o?void 0:o.userId,name:null==o?void 0:o.name,isAnonymous:null==o?void 0:o.isAnonymous});const a=await this.getSamlConfig(),l=new URL(document.location);if(l.searchParams.has(Wt)&&l.searchParams.delete(Wt),a&&(this.signInUrl=`${je}saml/${a.slug}/login?redirect_url=${encodeURIComponent(null==l?void 0:l.toString())}&source=sf`,window.Superflow.signInUrl=this.signInUrl),(null==o?void 0:o.email)&&(s=o),s.isAnonymous)delete s.groupId;else{const t=Velt.getDocumentId()||this.serverDocumentId;t&&(s.groupId=t+"")}if(this.customLoginEnabledLocally||(null===(t=null==s?void 0:s.contacts)||void 0===t?void 0:t.length)&&(s.contacts=[]),n=null==s?void 0:s.email,r=null==s?void 0:s.userId,(null==s?void 0:s.isAnonymous)&&this.projectId&&this.guestMode){const t=td(!0,this.apiKey);t&&(s=JSON.parse(JSON.stringify(t)))}(null==s?void 0:s.isAnonymous)||(this.loading=!0);const c={};(null==s?void 0:s.groupId)&&(c.groupId=null==s?void 0:s.groupId),s.organizationId=this.apiKey;const d=await wd(this.apiKey,this.projectId||"",null==s?void 0:s.email,null==s?void 0:s.userId),h=null==d?void 0:d.isAdmin;this.snippylyUserRole=h?"Admin":"Commenter",this.applyPreviewProxyReadOnlyStyles(),Hs("[Superflow][identify] iamResponse",d,{isAdminUser:h,snippylyUserRole:this.snippylyUserRole,email:null==s?void 0:s.email,userId:null==s?void 0:s.userId});const u=!(this.customLoginEnabled&&this.providedUser),p=((t,e)=>!(!e||(null==t?void 0:t.isAnonymous)||(null==t?void 0:t.isGuest)||!(null==t?void 0:t.userId)))(s,u),v=p&&((t,e)=>{try{if(!t||!e)return!1;const i=!!e.name&&e.name!==t.name,o=!!e.photoUrl&&e.photoUrl!==t.photoUrl;return Hs("[Superflow][identity] hasProfileChanged",{nameChanged:i,photoChanged:o,localName:t.name,savedName:e.name,localPhotoUrl:t.photoUrl,savedPhotoUrl:e.photoUrl}),i||o}catch(t){return console.warn("Error in hasProfileChanged: ",t),vd("Error in hasProfileChanged: ",t),!1}})(s,d);if(Hs("[Superflow][identify] enrichment gate",{cameFromToken:u,willEnrichIdentity:p,profileChanged:v,forceReset:v,isAnonymous:null==s?void 0:s.isAnonymous,isGuest:null==s?void 0:s.isGuest,userId:null==s?void 0:s.userId,nameBefore:null==s?void 0:s.name}),p&&(s=((t,e)=>t&&e?{...t,name:e.name||t.name,photoUrl:e.photoUrl||t.photoUrl}:t)(s,d),Hs("[Superflow][identify] enriched user",{nameAfter:null==s?void 0:s.name,photoUrl:null==s?void 0:s.photoUrl})),h&&(c.isAdmin=h,h&&this.allFeatureDisabled&&(this.allFeatureDisabled=!1)),this.restoreContentWarningSidebarState(),!this.projectDeleted&&(null==s?void 0:s.userId)&&!(null==s?void 0:s.isGuest)&&!(null==s?void 0:s.isAnonymous)&&this.documentId)try{await Id(this.apiKey,this.documentId,s.userId,s.name,s.email)}catch(t){vd("checkDocumentUserAndCreateError",t)}Hs("[Superflow][identify] setVeltAuthProvider options",{forceReset:v,profileChanged:v,userName:null==s?void 0:s.name,userId:null==s?void 0:s.userId});const[g]=await Promise.all([Velt.setVeltAuthProvider({user:s,options:{throwError:!0,forceReset:v},retryConfig:{retryCount:3,retryDelay:1e3},generateToken:async()=>await kd(this.apiKey,null==s?void 0:s.userId,c),onError:t=>{console.log("Error signing to velt - ",t),this.invalidApiKey=!0}}),this.fetchAndApplyFeatureAccess()]);if(this.hasAgentAccess&&this.insertShadowDOM(),this.invalidApiKey)throw"Invalid Api Key - Domain Not Whitelisted";p&&((t=>{try{const e={userId:null==t?void 0:t.userId,name:null==t?void 0:t.name,email:null==t?void 0:t.email,photoUrl:null==t?void 0:t.photoUrl},i=Jc(JSON.stringify(e),ze,Be);Wc(Zt,i,!0)}catch(t){console.warn("Error in saveUserToken: ",t),vd("Error in saveUserToken: ",t)}})(s),Hs("[Superflow][identify] token rewritten post-signin, re-read",{persistedName:null===(e=Qc())||void 0===e?void 0:e.name})),Hs("[Superflow][identify] velt auth response",{name:null==g?void 0:g.name,email:null==g?void 0:g.email,userId:null==g?void 0:g.userId,userSnippylyId:null==g?void 0:g.userSnippylyId,tokenUserProperties:c}),ud(JSON.parse(JSON.stringify(g||{}))),(null==s?void 0:s.isAnonymous)||(this.snippylyUser=JSON.parse(JSON.stringify(s)),Hs("[Superflow][identify] this.snippylyUser (rendered) name",null===(i=this.snippylyUser)||void 0===i?void 0:i.name));const f=JSON.parse(JSON.stringify(g||{}));if((null==f?void 0:f.userSnippylyId)&&!(null==f?void 0:f.isGuest)&&this.checkToMigrateGuestUser(f),Velt.getUserRole$().subscribe((t=>{var e;t&&(this.loading=!1,null===(e=this.commentElement)||void 0===e||e.enablePriority())})),this.contactListSubscription=Velt.getContactElement().getContactList().subscribe((t=>{var e;this.loading=!1,(null===(e=null==t?void 0:t.organizationUsers)||void 0===e?void 0:e.length)>0&&(this.checkPrivateCommentModeFromStorage(),this.contactListSubscription&&(this.contactListSubscription.unsubscribe(),this.contactListSubscription=null))})),(null===Velt||void 0===Velt?void 0:Velt.isPlanExpired$)&&(null===Velt||void 0===Velt||Velt.isPlanExpired$().subscribe((t=>{this.isPlanExpired=t}),(t=>{this.isPlanExpired=!1,console.warn("Error in isPlanExpired$: ",t),vd("Error in isPlanExpired$: ",t)}))),null===Velt||void 0===Velt?void 0:Velt.on){let t;null===Velt||void 0===Velt||Velt.on("initUpdate").subscribe((e=>{"setDocumentsSuccess"===e.event&&(t&&(t.unsubscribe(),t=null),t=null===Velt||void 0===Velt?void 0:Velt.getDocumentMetadata().subscribe((async t=>{await this.handleDocumentMetadataUpdate(t)}),(t=>{console.warn("Error in getDocumentMetadata: ",t),vd("Error in getDocumentMetadata: ",t)})))}))}hd({clientUserId:null==s?void 0:s.userId});try{pd(s)}catch(t){console.warn("Error in trackIdentifyEvent: ",t)}this.getComments(),this.checkGlobalUserContact(),this.showFirstCommentNudge(),setTimeout((()=>{Zc(ee)||this.autoCommentModeArmedOnce||(this.showTourCommentTooltip=!0)}),2e3)}catch(t){if(this.loading=!1,this.signInError=!0,t&&"string"==typeof t&&(null===(o=null==t?void 0:t.toLowerCase())||void 0===o?void 0:o.includes("invalid"))){this.invalidApiKey=!0,gd(vt.Events.DOMAIN_NOT_WHITELISTED),this.projectId&&md(this.apiKey,this.projectId);if(new URL(document.location).searchParams.has(Qt))this.isSigningInUserAdmin=!0;else if(Zc(ie))this.isSigningInUserAdmin="true"===Zc(ie,!0);else{const t=await wd(this.apiKey,this.projectId||"",n,r);this.isSigningInUserAdmin=!!(null==t?void 0:t.isAdmin),Wc(ie,this.isSigningInUserAdmin+"",!0)}}console.warn("Error in identifySnippyly: ",t),vd("Error in identifySnippyly: ",t)}},this.handleDocumentMetadataUpdate=async t=>{try{if(!t)return;const e=await yd(this.apiKey,null==t?void 0:t.clientDocumentId);od(e,this.isDriveOrPreviewHost(),this.projectIdSupplied)&&this.lockForDeletedProject(),this.setProjectConfigVariables("ok"===e.status?e.config:null),await this.fetchAndApplyFeatureAccess()}catch(t){console.warn("Error in handleDocumentMetadataUpdate: ",t),vd("Error in handleDocumentMetadataUpdate: ",t)}},this.lockForDeletedProject=()=>{this.projectDeleted=!0,this.applyVeltFeatureGates(),this.unmountVeltCollaborationElements()},this.fetchAndApplyFeatureAccess=async()=>{var t,e;try{const i=await Nd(this.apiKey);if("error"===i.status||!i.featureAccess)return void console.warn("getFeatureAccess failed or returned no data; keeping the last known feature access");this.featureAccess=i.featureAccess,this.planLimitLocked=(t=>{var e;try{return!0===(null===(e=null==t?void 0:t.planStatus)||void 0===e?void 0:e.isOverPlanLimits)}catch(t){return!1}})(this.featureAccess),this.applyVeltFeatureGates(),this.applyStorageFeatureAccess();const o=null===(t=this.featureAccess)||void 0===t?void 0:t[$d.Agents];this.hasAgentAccess=!0===(null==o?void 0:o.hasAccess);const n=null===(e=this.featureAccess)||void 0===e?void 0:e[$d.WorkspacePrivateComments];this.hasPrivateCommentsAccess=!0===(null==n?void 0:n.hasAccess),this.isPrivateCommentsEnabledOnWorkspace=!0===(null==n?void 0:n.isPrivateCommentsEnabled),!this.canShowPrivateCommentToggle&&this.privateCommentModeEnabled&&(this.disablePrivateCommentModeOnCommentElement(),this.privateCommentModeEnabled=!1,Wc(le,"false")),this.maybeApplyVisibilityOptionsToCommentElement()}catch(t){console.warn("Error in fetchAndApplyFeatureAccess: ",t),vd("Error in fetchAndApplyFeatureAccess: ",t)}},this.insertShadowDOM=()=>{try{if(document.querySelector("velt-wireframe"))return;const t=document.querySelector("velt-comments");t&&t.setAttribute("shadow-dom","true");const e=document.querySelector(`${Me.VELT_COMMENTS_SIDEBAR_LEGACY}, ${Me.VELT_COMMENTS_SIDEBAR_V2}`);e&&e.setAttribute("shadow-dom","true")}catch(t){console.warn("Error in insertShadowDOM: ",t),vd("Error in insertShadowDOM: ",t)}},this.applyStorageFeatureAccess=()=>{try{if(!this.featureAccess||!this.commentElement)return;const t=this.featureAccess[$d.Storage];(null==t?void 0:t.hasUsageExhausted)&&(this.commentElement.disableAttachments(),this.commentElement.setRecordings("none"))}catch(t){vd("Error in applyStorageFeatureAccess: ",t)}},this.checkToMigrateGuestUser=async t=>{try{const e=td(!1,this.apiKey);e&&(await Sd(this.apiKey,this.projectId||"",e,t,!0),Kc(Kt))}catch(t){console.warn("Error in checkToMigrationGuestUser: ",t),vd("Error in checkToMigrationGuestUser: ",t)}},this.getComments=()=>{try{this.commentElement&&this.commentSubscription&&this.commentSubscription.unsubscribe()}catch(t){console.warn("Error in getComments: ",t),vd("Error in getComments: ",t)}},this.handleCommentSelection=t=>{var e,i,o,n,r,s,a,l,c,d;try{if(!1===(null==t?void 0:t.selected))return void(null===(e=null===Velt||void 0===Velt?void 0:Velt.setUiState)||void 0===e||e.call(Velt,{showButtons:!1}));const h=null==t?void 0:t.annotation;if(!h||!this.isAgentAnnotation(h))return void(null===(i=null===Velt||void 0===Velt?void 0:Velt.setUiState)||void 0===i||i.call(Velt,{showButtons:!1}));const u=null===(n=null===(o=null==h?void 0:h.agent)||void 0===o?void 0:o.result)||void 0===n?void 0:n.incorrectWord,p=(null===(r=null==h?void 0:h.pageInfo)||void 0===r?void 0:r.path)||(null===(s=null==h?void 0:h.location)||void 0===s?void 0:s.path)||(null===(a=null==h?void 0:h.agent)||void 0===a?void 0:a.path);if(!u||!p)return void(null===(l=null===Velt||void 0===Velt?void 0:Velt.setUiState)||void 0===l||l.call(Velt,{showButtons:!1}));const v=this.normalizePagePath(p),g=u,f=null===(d=null===(c=null==h?void 0:h.agent)||void 0===c?void 0:c.result)||void 0===d?void 0:d.type;let m,w="";"grammar"===f?(m=this.grammarSuggestionPagePathMap,w="grammar"):(m=this.spellingSuggestionPagePathMap,w="spelling");const y=null==m?void 0:m.get(g);((null==y?void 0:y.get(v))||0)<=1?Velt.setUiState({showButtons:!1,warningType:w}):Velt.setUiState({showButtons:!0,warningType:w})}catch(t){console.warn("Error in handleCommentSelection: ",t),vd("Error in handleCommentSelection: ",t)}},this.processAgentComments=t=>{var e,i,o;try{const n=Array.isArray(t)?t:[];n.length&&!this.agentNamesFetched&&this.apiKey&&this.fetchAgentNames();const r=n.filter((t=>{var e;const i=(null===(e=null==t?void 0:t.status)||void 0===e?void 0:e.type)===xe;return this.isAgentAnnotation(t)&&!i}));if(this.sidebarV2Enabled&&!this.showAgentCommentsInSidebar&&0===r.length&&this.agentGroups.length>0)return;if(0===r.length)return this.hasContentWarnings=!1,this.contentWarningsCount=0,this.agentGroups=[],this.spellingSuggestionPagePathMap=new Map,void(this.grammarSuggestionPagePathMap=new Map);const s=new Map;for(const t of r){const i=this.extractAgentId((null===(e=null==t?void 0:t.agent)||void 0===e?void 0:e.agentFields)||[]);if(!i)continue;const o=s.get(i);o?o.push(t):s.set(i,[t])}const a=[],l=new Map,c=new Map;for(const[t,e]of s){const n=this.isCustomAgent((null===(o=null===(i=e[0])||void 0===i?void 0:i.agent)||void 0===o?void 0:o.agentFields)||[]),r=this.resolveAgentDisplayName(t),{warnings:s,warningCount:d}=this.buildAgentWarnings(t,e,l,c);a.push({agentId:t,agentName:r,isCustom:n,warningCount:d,warnings:s,annotations:e})}if(a.sort(((t,e)=>e.warningCount-t.warningCount)),this.agentGroups=a,this.onboardingMode)for(const t of a)this.onboardingOpenedAgentIds.add(t.agentId);const d=a.reduce(((t,e)=>t+e.warningCount),0);this.contentWarningsCount=d,this.hasContentWarnings=d>0,this.spellingSuggestionPagePathMap=l,this.grammarSuggestionPagePathMap=c}catch(t){console.warn("Error in processAgentComments: ",t),vd("Error in processAgentComments: ",t)}},this.extractAgentId=t=>{try{if(!Array.isArray(t)||0===t.length)return null;for(const e of t)if(null==e?void 0:e.startsWith(ke.AGENT))return e.substring(ke.AGENT.length);return null}catch(t){return console.warn("Error in extractAgentId: ",t),null}},this.isCustomAgent=t=>{try{return!!Array.isArray(t)&&t.includes(ke.AGENT_TYPE_CUSTOM)}catch(t){return console.warn("Error in isCustomAgent: ",t),!1}},this.resolveAgentDisplayName=t=>{var e,i;try{return null!==(i=null===(e=this.agentNameMap)||void 0===e?void 0:e.get(t))&&void 0!==i?i:this.getAgentNameFromId(t)}catch(t){return console.warn("Error in resolveAgentDisplayName: ",t),Vt}},this.getAgentNameFromId=t=>{try{return t&&/^[a-z]+(-[a-z]+)*$/.test(t)?t.split("-").map((t=>`${t.charAt(0).toUpperCase()}${t.slice(1)}`)).join(" "):Vt}catch(t){return console.warn("Error in getAgentNameFromId: ",t),Vt}},this.fetchAgentNames=async()=>{var t,e,i;try{this.agentNamesFetched=!0;const{getAgents:o}=await Promise.resolve().then((function(){return Fd})),n=await o(this.apiKey),r=new Map;for(const i of n){const o=null!==(t=null==i?void 0:i.id)&&void 0!==t?t:"",n=null!==(e=null==i?void 0:i.name)&&void 0!==e?e:"";o&&n&&r.set(o,n)}if(this.agentNameMap=r,(null===(i=this.agentGroups)||void 0===i?void 0:i.length)>0){const t=this.agentGroups.map((t=>({...t,agentName:this.resolveAgentDisplayName(t.agentId)})));this.agentGroups=t}}catch(t){this.agentNamesFetched=!1,console.warn("Error in fetchAgentNames: ",t)}},this.sanitiseAgentRunStatusRows=t=>{try{const e=[],i=Array.isArray(t)?t.slice(0,50):[];for(const t of i){const i=null==t?void 0:t.agentId;if("string"!=typeof i||0===i.length)continue;const o=("string"==typeof(null==t?void 0:t.name)&&t.name.length>0?t.name:this.resolveAgentDisplayName(i)).slice(0,80),n="string"==typeof(null==t?void 0:t.status)&&Rt.includes(t.status),r=!0!==(null==t?void 0:t.terminal)&&!n,s=null==t?void 0:t.findings,a="number"==typeof s&&Number.isFinite(s)&&s>=0?Math.floor(s):0;e.push(n?{agentId:i,agentName:o,isRunning:r,findingsCount:a,failed:!0}:{agentId:i,agentName:o,isRunning:r,findingsCount:a})}return e}catch(t){return console.warn("Error in sanitiseAgentRunStatusRows: ",t),vd("Error in sanitiseAgentRunStatusRows: ",t),[]}},this.getPortalOrigins=()=>{try{if(this.portalOrigins)return this.portalOrigins;const t=new Set;for(const e of[je,Ue])try{const{origin:i,hostname:o,protocol:n}=new URL(e);t.add(i),o.endsWith(".firebaseapp.com")?t.add(`${n}//${o.replace(/\.firebaseapp\.com$/,".web.app")}`):o.endsWith(".web.app")&&t.add(`${n}//${o.replace(/\.web\.app$/,".firebaseapp.com")}`)}catch{}return this.portalOrigins=[...t],this.portalOrigins}catch(t){return console.warn("Error in getPortalOrigins: ",t),vd("Error in getPortalOrigins: ",t),[]}},this.isAllowedPortalOrigin=t=>{try{if("string"!=typeof t||0===t.length||"null"===t)return!1;if(this.getPortalOrigins().includes(t))return!0;const{protocol:e,hostname:i}=new URL(t);return!("http:"!==e&&"https:"!==e||"localhost"!==i&&"127.0.0.1"!==i)}catch{return!1}},this.readAncestorOrigins=()=>{var t;try{const e=null===(t=window.location)||void 0===t?void 0:t.ancestorOrigins;return e?Array.from(e):null}catch{return null}},this.readDocumentReferrer=()=>{try{return document.referrer||""}catch{return""}},this.getParentFrameOrigin=()=>{try{if(!window.parent||window.parent===window)return null;const t=this.readAncestorOrigins();if(t)return t[0]||null;const e=this.readDocumentReferrer();return e?new URL(e).origin:null}catch{return null}},this.isFramedByPortal=()=>{try{return this.isAllowedPortalOrigin(this.getParentFrameOrigin())}catch(t){return console.warn("Error in isFramedByPortal: ",t),vd("Error in isFramedByPortal: ",t),!1}},this.canHonourStoredOnboardingFlag=()=>{try{if(!window.parent||window.parent===window)return!1;const t=this.readAncestorOrigins();return!t||this.isAllowedPortalOrigin(t[0])}catch(t){return console.warn("Error in canHonourStoredOnboardingFlag: ",t),vd("Error in canHonourStoredOnboardingFlag: ",t),!1}},this.getPortalTargetOrigin=()=>{try{const t=this.getParentFrameOrigin();return t&&this.isAllowedPortalOrigin(t)?t:"*"}catch{return"*"}},this.startAgentRunStatusListener=()=>{try{if(!this.onboardingMode||!this.isConnected)return void this.stopAgentRunStatusListener();if(this.agentRunStatusListening)return;if(!window.parent||window.parent===window)return void(this.agentRunStatusSettled=!0);if(window.addEventListener("message",this.onAgentRunStatusMessage),this.agentRunStatusListening=!0,this.startOnboardingViewportListener(),window.parent.postMessage({type:Nt},this.getPortalTargetOrigin()),this.agentRunStatusSettled){if(this.agentRunStatuses.some((t=>null==t?void 0:t.isRunning))){const t=this.agentRunStatusLastMessageAt>0?Date.now()-this.agentRunStatusLastMessageAt:0;this.armAgentRunStatusWatchdog(Math.max(0,Dt-t))}}else this.armAgentRunStatusWatchdog(2e4);this.ensureOnboardingFindingsLoaded()}catch(t){console.warn("Error in startAgentRunStatusListener: ",t),vd("Error in startAgentRunStatusListener: ",t)}},this.stopAgentRunStatusListener=()=>{try{window.removeEventListener("message",this.onAgentRunStatusMessage),this.agentRunStatusListening=!1,this.clearAgentRunStatusWatchdog(),this.clearOnboardingFindingsFetch(),this.stopOnboardingViewportListener()}catch(t){console.warn("Error in stopAgentRunStatusListener: ",t),vd("Error in stopAgentRunStatusListener: ",t)}},this.onAgentRunStatusMessage=t=>{try{if(!this.onboardingMode)return;if(!window.parent||window.parent===window||(null==t?void 0:t.source)!==window.parent)return;if(!this.isAllowedPortalOrigin(null==t?void 0:t.origin))return;const e=null==t?void 0:t.data;if((null==e?void 0:e.type)===Ot)return void this.postOnboardingDiagnostics(t.origin);if((null==e?void 0:e.type)!==$t||!Array.isArray(null==e?void 0:e.agents))return;this.agentRunStatuses=this.sanitiseAgentRunStatusRows(e.agents),this.agentRunStatusTimedOut=!1,this.agentRunStatusLastMessageAt=Date.now();const i=!0===(null==e?void 0:e.allTerminal);(this.agentRunStatuses.length>0||i)&&(this.agentRunStatusSettled=!0);this.agentRunStatuses.some((t=>null==t?void 0:t.isRunning))?this.armAgentRunStatusWatchdog(Dt):this.agentRunStatusSettled&&this.clearAgentRunStatusWatchdog(),this.ensureOnboardingFindingsLoaded()}catch(t){console.warn("Error in onAgentRunStatusMessage: ",t),vd("Error in onAgentRunStatusMessage: ",t)}},this.postOnboardingDiagnostics=t=>{var e,i,o,n,r,s;try{if(!this.onboardingMode||!window.parent||window.parent===window||!this.isAllowedPortalOrigin(t))return;const a=(null!==(e=this.lastStreamAnnotations)&&void 0!==e?e:[]).filter((t=>this.isAgentAnnotation(t))).length;window.parent.postMessage({type:Lt,at:(new Date).toISOString(),version:gt,identity:{hasUser:!!this.snippylyUser,isGuest:!!(null===(i=this.snippylyUser)||void 0===i?void 0:i.isGuest),isAnonymous:!!(null===(o=this.snippylyUser)||void 0===o?void 0:o.isAnonymous),hasRole:!!this.snippylyUserRole,loading:this.loading},sdk:{hasCommentElement:!!this.commentElement,hasDocumentId:!!this.documentId,hasLocationPath:!!this.previewLocationPath,sidebarV2:this.sidebarV2Enabled,showAgentCommentsInSidebar:this.showAgentCommentsInSidebar,agentCommentsModeRequested:this.agentCommentsModeRequested,privateCommentsEnabled:this.isPrivateCommentsEnabledOnWorkspace,hasPrivateCommentsAccess:this.hasPrivateCommentsAccess},stream:{emissions:this.streamEmissionCount,lastEmissionAt:this.lastStreamEmissionAt?new Date(this.lastStreamEmissionAt).toISOString():null,lastSize:(null!==(n=this.lastStreamAnnotations)&&void 0!==n?n:[]).length,agentAnnotations:a},fetch:{attempts:this.onboardingFindingsFetchAttempts,inFlight:this.onboardingFindingsFetchInFlight,pending:null!==this.onboardingFindingsFetchTimer,lastCount:this.onboardingLastFetchCount,lastError:this.onboardingLastFetchError,fetchedAt:this.onboardingFetchedAt?new Date(this.onboardingFetchedAt).toISOString():null,unsynced:this.onboardingUnsyncedAnnotationIds.length},groups:(null!==(r=this.agentGroups)&&void 0!==r?r:[]).map((t=>({agentId:null==t?void 0:t.agentId,count:null==t?void 0:t.warningCount}))),statuses:(null!==(s=this.agentRunStatuses)&&void 0!==s?s:[]).map((t=>({agentId:null==t?void 0:t.agentId,isRunning:null==t?void 0:t.isRunning,findingsCount:null==t?void 0:t.findingsCount,failed:!!(null==t?void 0:t.failed),timedOut:!!(null==t?void 0:t.timedOut)}))),missing:this.getAgentIdsMissingFindings(),sidebarOpen:this.showContentWarningSidebar,settled:this.agentRunStatusSettled},t)}catch(t){console.warn("Error in postOnboardingDiagnostics: ",t),vd("Error in postOnboardingDiagnostics: ",t)}},this.isOnboardingAgentResolved=t=>{try{return this.onboardingOpenedAgentIds.has(t)||this.onboardingFetchResolvedAgentIds.has(t)}catch(t){return console.warn("Error in isOnboardingAgentResolved: ",t),!1}},this.getAgentIdsMissingFindings=()=>{var t,e;try{const i=new Set((null!==(t=this.agentGroups)&&void 0!==t?t:[]).map((t=>null==t?void 0:t.agentId)));return(null!==(e=this.agentRunStatuses)&&void 0!==e?e:[]).filter((t=>{var e;return!(null==t?void 0:t.isRunning)&&(null!==(e=null==t?void 0:t.findingsCount)&&void 0!==e?e:0)>0})).map((t=>null==t?void 0:t.agentId)).filter((t=>!!t&&!i.has(t)&&!this.isOnboardingAgentResolved(t)))}catch(t){return console.warn("Error in getAgentIdsMissingFindings: ",t),vd("Error in getAgentIdsMissingFindings: ",t),[]}},this.getFetchableMissingAgentIds=()=>{try{return this.onboardingFindingsFetchAttempts>=30?[]:this.getAgentIdsMissingFindings().filter((t=>{var e;return(null!==(e=this.onboardingFetchAttemptsByAgent.get(t))&&void 0!==e?e:0)<10}))}catch(t){return console.warn("Error in getFetchableMissingAgentIds: ",t),vd("Error in getFetchableMissingAgentIds: ",t),[]}},this.isOnboardingFindingsLoadExhausted=t=>{var e;try{return null===this.onboardingFindingsFetchTimer&&!this.onboardingFindingsFetchInFlight&&((null!==(e=this.onboardingFetchAttemptsByAgent.get(t))&&void 0!==e?e:0)>=10||this.onboardingFindingsFetchAttempts>=30)}catch(t){return console.warn("Error in isOnboardingFindingsLoadExhausted: ",t),!1}},this.getDisplayAgentRunStatuses=()=>{var t,e;try{if(!this.onboardingMode)return this.agentRunStatuses;const i=new Set((null!==(t=this.agentGroups)&&void 0!==t?t:[]).map((t=>null==t?void 0:t.agentId)));return(null!==(e=this.agentRunStatuses)&&void 0!==e?e:[]).map((t=>{var e;return(null==t?void 0:t.isRunning)||0===(null!==(e=null==t?void 0:t.findingsCount)&&void 0!==e?e:0)||i.has(null==t?void 0:t.agentId)?t:this.isOnboardingAgentResolved(t.agentId)?{...t,findingsResolved:!0}:this.isOnboardingFindingsLoadExhausted(t.agentId)?{...t,findingsUnavailable:!0}:t}))}catch(t){return console.warn("Error in getDisplayAgentRunStatuses: ",t),vd("Error in getDisplayAgentRunStatuses: ",t),this.agentRunStatuses}},this.ensureOnboardingFindingsLoaded=()=>{try{if(!this.onboardingMode||!this.agentRunStatusListening)return;if(null!==this.onboardingFindingsFetchTimer||this.onboardingFindingsFetchInFlight)return;if(0===this.getFetchableMissingAgentIds().length)return;this.onboardingFindingsFetchTimer=setTimeout((()=>this.fetchOnboardingFindings()),3e3)}catch(t){console.warn("Error in ensureOnboardingFindingsLoaded: ",t),vd("Error in ensureOnboardingFindingsLoaded: ",t)}},this.clearOnboardingFindingsFetch=()=>{try{null!==this.onboardingFindingsFetchTimer&&(clearTimeout(this.onboardingFindingsFetchTimer),this.onboardingFindingsFetchTimer=null)}catch(t){console.warn("Error in clearOnboardingFindingsFetch: ",t),vd("Error in clearOnboardingFindingsFetch: ",t)}},this.countOnboardingFetchAttempt=t=>{var e;this.onboardingFindingsFetchAttempts+=1;for(const i of t)this.onboardingFetchAttemptsByAgent.set(i,(null!==(e=this.onboardingFetchAttemptsByAgent.get(i))&&void 0!==e?e:0)+1)},this.fetchOnboardingFindings=async()=>{var t;try{if(this.onboardingFindingsFetchTimer=null,!this.onboardingMode)return;const e=this.getFetchableMissingAgentIds();if(0===e.length)return;if(this.countOnboardingFetchAttempt(e),"function"!=typeof(null===(t=this.commentElement)||void 0===t?void 0:t.fetchCommentAnnotations)||!this.documentId)return this.onboardingLastFetchError=Ft.SDK_NOT_READY,this.ensureOnboardingFindingsLoaded(),void this.requestUpdate();this.onboardingFindingsFetchInFlight=!0;const i=await this.commentElement.fetchCommentAnnotations({documentIds:[`${this.documentId}`]});if(this.onboardingFindingsFetchInFlight=!1,!this.onboardingMode)return;if(null===(null==i?void 0:i.data)||void 0===(null==i?void 0:i.data))this.onboardingLastFetchCount=0,this.onboardingLastFetchError=Ft.SDK_RETURNED_NULL;else{const t=this.flattenFetchedAnnotations(i);this.onboardingLastFetchCount=t.length,this.onboardingLastFetchError="",this.applyOnboardingFetchResult(t)}this.ensureOnboardingFindingsLoaded(),this.requestUpdate()}catch(t){this.onboardingFindingsFetchInFlight=!1,this.onboardingLastFetchError=Ft.FETCH_THREW,console.warn("Error in fetchOnboardingFindings: ",t),vd("Error in fetchOnboardingFindings: ",t),this.ensureOnboardingFindingsLoaded(),this.requestUpdate()}},this.applyOnboardingFetchResult=t=>{var e,i,o;try{const n=(Array.isArray(t)?t:[]).filter((t=>{const e=null==t?void 0:t.annotationId;return!!e&&!this.onboardingRemovedAnnotationIds.has(e)&&this.isAgentAnnotation(t)})),r=new Map;for(const t of n){const n=this.extractAgentId((null===(e=null==t?void 0:t.agent)||void 0===e?void 0:e.agentFields)||[]);if(!n)continue;const s=(null===(i=null==t?void 0:t.status)||void 0===i?void 0:i.type)!==xe;r.set(n,null!==(o=r.get(n))&&void 0!==o&&o||s)}for(const[t,e]of r)e?this.onboardingFetchResolvedAgentIds.delete(t):this.onboardingFetchResolvedAgentIds.add(t);this.onboardingFetchedAnnotations=n,this.onboardingFetchedAt=Date.now(),this.processAgentComments(this.mergeOnboardingFetchedAnnotations(this.lastStreamAnnotations))}catch(t){console.warn("Error in applyOnboardingFetchResult: ",t),vd("Error in applyOnboardingFetchResult: ",t)}},this.flattenFetchedAnnotations=t=>{try{const e=null==t?void 0:t.data;if(Array.isArray(e))return e;if(!e||"object"!=typeof e)return[];const i=[];for(const t of Object.values(e))Array.isArray(t)&&i.push(...t);return i}catch(t){return console.warn("Error in flattenFetchedAnnotations: ",t),vd("Error in flattenFetchedAnnotations: ",t),[]}},this.mergeOnboardingFetchedAnnotations=t=>{var e;try{const i=Array.isArray(t)?t:[];if(!this.onboardingMode)return i;if(0===this.onboardingFetchedAnnotations.length)return this.setOnboardingUnsyncedAnnotationIds([]),i;const o=new Set(i.map((t=>null==t?void 0:t.annotationId)));if(this.sidebarV2Enabled&&!this.showAgentCommentsInSidebar){const t=new Map,n=(null!==(e=this.agentGroups)&&void 0!==e?e:[]).flatMap((t=>{var e;return null!==(e=null==t?void 0:t.annotations)&&void 0!==e?e:[]}));for(const e of[...n,...this.onboardingFetchedAnnotations]){const i=null==e?void 0:e.annotationId;!i||o.has(i)||t.has(i)||this.onboardingRemovedAnnotationIds.has(i)||t.set(i,e)}return t.size>0?[...i,...t.values()]:i}return this.onboardingFetchedAnnotations=this.onboardingFetchedAnnotations.filter((t=>{const e=null==t?void 0:t.annotationId;return!!e&&!o.has(e)&&!this.onboardingRemovedAnnotationIds.has(e)})),this.setOnboardingUnsyncedAnnotationIds(this.onboardingFetchedAnnotations.map((t=>t.annotationId))),this.onboardingFetchedAnnotations.length>0?[...i,...this.onboardingFetchedAnnotations]:i}catch(e){return console.warn("Error in mergeOnboardingFetchedAnnotations: ",e),vd("Error in mergeOnboardingFetchedAnnotations: ",e),Array.isArray(t)?t:[]}},this.setOnboardingUnsyncedAnnotationIds=t=>{try{const e=[...t].sort();e.join("\n")!==this.onboardingUnsyncedAnnotationIds.join("\n")&&(this.onboardingUnsyncedAnnotationIds=e)}catch(t){console.warn("Error in setOnboardingUnsyncedAnnotationIds: ",t)}},this.armAgentRunStatusWatchdog=t=>{try{this.clearAgentRunStatusWatchdog(),this.agentRunStatusWatchdogTimer=setTimeout((()=>this.applyAgentRunStatusTimeout()),t)}catch(t){console.warn("Error in armAgentRunStatusWatchdog: ",t),vd("Error in armAgentRunStatusWatchdog: ",t)}},this.clearAgentRunStatusWatchdog=()=>{try{null!==this.agentRunStatusWatchdogTimer&&(clearTimeout(this.agentRunStatusWatchdogTimer),this.agentRunStatusWatchdogTimer=null)}catch(t){console.warn("Error in clearAgentRunStatusWatchdog: ",t),vd("Error in clearAgentRunStatusWatchdog: ",t)}},this.applyAgentRunStatusTimeout=()=>{try{this.agentRunStatusWatchdogTimer=null,this.agentRunStatuses.some((t=>null==t?void 0:t.isRunning))&&(this.agentRunStatuses=this.agentRunStatuses.map((t=>(null==t?void 0:t.isRunning)?{...t,isRunning:!1,timedOut:!0}:t)),this.agentRunStatusTimedOut=!0),this.agentRunStatusSettled=!0}catch(t){console.warn("Error in applyAgentRunStatusTimeout: ",t),vd("Error in applyAgentRunStatusTimeout: ",t)}},this.startOnboardingViewportListener=()=>{try{if(this.onboardingViewportListening)return;window.addEventListener("resize",this.scheduleOnboardingViewportClamp),this.onboardingViewportListening=!0}catch(t){console.warn("Error in startOnboardingViewportListener: ",t),vd("Error in startOnboardingViewportListener: ",t)}},this.stopOnboardingViewportListener=()=>{var t;try{window.removeEventListener("resize",this.scheduleOnboardingViewportClamp),this.onboardingViewportListening=!1,null===(t=this.onboardingPanelResizeObserver)||void 0===t||t.disconnect(),this.onboardingPanelResizeObserver=null,this.onboardingObservedPanel=null,null!==this.onboardingClampFrame&&(cancelAnimationFrame(this.onboardingClampFrame),this.onboardingClampFrame=null)}catch(t){console.warn("Error in stopOnboardingViewportListener: ",t),vd("Error in stopOnboardingViewportListener: ",t)}},this.observeOnboardingPanel=()=>{var t,e,i;try{if(!this.agentRunStatusListening||"undefined"==typeof ResizeObserver)return;const o=null!==(e=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector(".onboarding-container content-warning-sidebar"))&&void 0!==e?e:null;if(o===this.onboardingObservedPanel)return;if(null===(i=this.onboardingPanelResizeObserver)||void 0===i||i.disconnect(),this.onboardingObservedPanel=o,!o)return;this.onboardingPanelResizeObserver||(this.onboardingPanelResizeObserver=new ResizeObserver((()=>this.scheduleOnboardingViewportClamp()))),this.onboardingPanelResizeObserver.observe(o)}catch(t){console.warn("Error in observeOnboardingPanel: ",t),vd("Error in observeOnboardingPanel: ",t)}},this.scheduleOnboardingViewportClamp=()=>{try{if(!this.onboardingMode||null!==this.onboardingClampFrame)return;this.onboardingClampFrame=requestAnimationFrame((()=>{this.onboardingClampFrame=null,this.clampOnboardingPanelToViewport()}))}catch(t){console.warn("Error in scheduleOnboardingViewportClamp: ",t),vd("Error in scheduleOnboardingViewportClamp: ",t)}},this.getOnboardingViewportClampOffset=(t,e,i)=>{let o=0,n=0;return t.right>e-8&&(o=e-8-t.right),t.left+o<8&&(o=8-t.left),t.bottom>i-8&&(n=i-8-t.bottom),t.top+n<8&&(n=8-t.top),{dx:o,dy:n}},this.readTranslate=t=>{var e;try{const i=window.getComputedStyle(t).transform;if(!i||"none"===i)return{x:0,y:0};const o=new(null!==(e=window.DOMMatrixReadOnly)&&void 0!==e?e:window.WebKitCSSMatrix)(i);return{x:Number(o.m41)||0,y:Number(o.m42)||0}}catch{return{x:0,y:0}}},this.clampOnboardingPanelToViewport=t=>{var e;try{const i=null!=t?t:null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector(".snippyly-plugin-container.onboarding-container");if(!i)return;const o=[i.getBoundingClientRect()],n=i.querySelector("content-warning-sidebar");n&&o.push(n.getBoundingClientRect());const r=o.filter((t=>t.width>0||t.height>0));if(0===r.length)return;const s={left:Math.min(...r.map((t=>t.left))),top:Math.min(...r.map((t=>t.top))),right:Math.max(...r.map((t=>t.right))),bottom:Math.max(...r.map((t=>t.bottom)))},{dx:a,dy:l}=this.getOnboardingViewportClampOffset(s,window.innerWidth,window.innerHeight);if(Math.abs(a)<.5&&Math.abs(l)<.5)return;const{x:c,y:d}=this.readTranslate(i);i.style.transform=`translate(${Math.round(c+a)}px, ${Math.round(d+l)}px)`}catch(t){console.warn("Error in clampOnboardingPanelToViewport: ",t),vd("Error in clampOnboardingPanelToViewport: ",t)}},this.buildAgentWarnings=(t,e,i,o)=>{try{return t===Se.BROKEN_LINKS?this.buildBrokenLinkWarnings(e):t===Se.SPELL_CHECK||t===Se.GRAMMAR_CHECK?this.buildSpellCheckWarnings(e,i,o):this.buildGenericWarnings(e)}catch(t){return console.warn("Error in buildAgentWarnings: ",t),{warnings:[],warningCount:0}}},this.buildBrokenLinkWarnings=t=>{var e,i,o,n,r,s,a,l,c,d,h,u,p;try{const v=new Map;for(const g of t){const t=(null===(e=null==g?void 0:g.pageInfo)||void 0===e?void 0:e.url)||(null===(i=null==g?void 0:g.location)||void 0===i?void 0:i.url)||(null===(o=null==g?void 0:g.agent)||void 0===o?void 0:o.url)||"",f=(null===(n=null==g?void 0:g.agent)||void 0===n?void 0:n.reason)||{},m=f.url||(null===(r=null==g?void 0:g.targetTextRange)||void 0===r?void 0:r.text)||(null===(a=null===(s=null==g?void 0:g.agent)||void 0===s?void 0:s.result)||void 0===a?void 0:a.url)||(null===(c=null===(l=null==g?void 0:g.agent)||void 0===l?void 0:l.result)||void 0===c?void 0:c.link)||t,w=f.issue||f.description||(null===(h=null===(d=null==g?void 0:g.agent)||void 0===d?void 0:d.result)||void 0===h?void 0:h.statusCode)||(null===(p=null===(u=null==g?void 0:g.agent)||void 0===u?void 0:u.result)||void 0===p?void 0:p.status)||"",y=(null==m?void 0:m.toLowerCase())||"";if(v.has(y)){const e=v.get(y);e.occurrences+=1,t&&!e.pageUrls.includes(t)&&e.pageUrls.push(t),e.annotations.push(g)}else v.set(y,{primaryText:m||"",secondaryText:String(w),occurrences:1,pageUrls:t?[t]:[],annotations:[g]})}const g=Array.from(v.values());return{warnings:g,warningCount:g.length}}catch(t){return console.warn("Error in buildBrokenLinkWarnings: ",t),{warnings:[],warningCount:0}}},this.buildSpellCheckWarnings=(t,e,i)=>{var o,n,r,s,a,l,c,d,h,u,p,v,g,f,m,w,y,b,C;try{const x=new Map;for(const E of t){const t=(null===(o=null==E?void 0:E.pageInfo)||void 0===o?void 0:o.url)||(null===(n=null==E?void 0:E.location)||void 0===n?void 0:n.url)||(null===(r=null==E?void 0:E.agent)||void 0===r?void 0:r.url)||"",k=(null===(s=null==E?void 0:E.pageInfo)||void 0===s?void 0:s.path)||(null===(a=null==E?void 0:E.location)||void 0===a?void 0:a.path)||(null===(l=null==E?void 0:E.agent)||void 0===l?void 0:l.path)||"",S=this.normalizePagePath(k),M=null!==(d=null!==(c=null==E?void 0:E.comments)&&void 0!==c?c:null==E?void 0:E.commentData)&&void 0!==d?d:[],T=null!==(p=null===(u=null===(h=null==M?void 0:M[0])||void 0===h?void 0:h.commentText)||void 0===u?void 0:u.trim())&&void 0!==p?p:"",A=(null===(g=null===(v=null==E?void 0:E.agent)||void 0===v?void 0:v.result)||void 0===g?void 0:g.incorrectWord)||(null===(f=null==E?void 0:E.targetElement)||void 0===f?void 0:f.targetText)||T||"",_=(null===(w=null===(m=null==E?void 0:E.agent)||void 0===m?void 0:m.result)||void 0===w?void 0:w.suggestions)||[],I=Array.isArray(_)?_[0]||"":_||"",$=null===(b=null===(y=null==E?void 0:E.agent)||void 0===y?void 0:y.result)||void 0===b?void 0:b.type,N=A||"";A||console.warn("[CWS] Spell check annotation missing incorrectWord. agent.result:",null===(C=null==E?void 0:E.agent)||void 0===C?void 0:C.result,"targetElement:",null==E?void 0:E.targetElement,"comments:",M);const O="grammar"===$?i:e;O.has(N)||O.set(N,new Map);const L=O.get(N),D=L.get(S)||0;if(L.set(S,D+1),x.has(N)){const e=x.get(N);e.occurrences+=1,t&&!e.pageUrls.includes(t)&&e.pageUrls.push(t),e.annotations.push(E)}else x.set(N,{primaryText:A||"",secondaryText:I||"",occurrences:1,pageUrls:t?[t]:[],annotations:[E]})}const E=Array.from(x.values());return{warnings:E,warningCount:E.length}}catch(t){return console.warn("Error in buildSpellCheckWarnings: ",t),{warnings:[],warningCount:0}}},this.splitFindingHeading=t=>{var e;try{if("string"!=typeof t||!t.trim())return null;const i=document.createElement("template");i.innerHTML=t;const o=Array.from(i.content.childNodes).filter((t=>{var e;return!(t.nodeType===Node.TEXT_NODE&&!(null===(e=t.textContent)||void 0===e?void 0:e.trim()))})),n=o[0];if(!n||!["B","STRONG"].includes(n.nodeName))return null;const r=(null===(e=n.textContent)||void 0===e?void 0:e.replace(/\s+/g," ").trim())||"";if(!r)return null;let s="";for(const t of o.slice(1))s+="BR"===t.nodeName?"\n":t.textContent||"";return{title:r,detail:s.split("\n").map((t=>t.replace(/\s+/g," ").trim())).find(Boolean)||""}}catch(t){return console.warn("Error in splitFindingHeading: ",t),null}},this.buildFindingSubItems=t=>{try{return(Array.isArray(null==t?void 0:t.missing)?t.missing:[]).map((t=>{const e="string"==typeof(null==t?void 0:t.text)?t.text.replace(/\s+/g," ").trim():"";if(!e)return null;const i="heading"===(null==t?void 0:t.kind)?"Section":"Link",o="string"==typeof(null==t?void 0:t.href)?t.href.trim().replace(/^https?:\/\//i,"").replace(/^www\./i,"").replace(/\/$/,""):"",n=o.length>40?`${o.slice(0,39)}…`:o;return{label:e,detail:n?`${i} · ${n}`:i}})).filter(Boolean)}catch(t){return console.warn("Error in buildFindingSubItems: ",t),[]}},this.buildGenericWarnings=t=>{var e,i,o,n,r,s,a,l,c,d,h,u,p,v,g,f,m,w,y,b,C,x,E,k;try{const S=new Map;for(const M of t){const t=(null===(e=null==M?void 0:M.pageInfo)||void 0===e?void 0:e.url)||(null===(i=null==M?void 0:M.location)||void 0===i?void 0:i.url)||(null===(o=null==M?void 0:M.agent)||void 0===o?void 0:o.url)||"",T=null!==(r=null!==(n=null==M?void 0:M.comments)&&void 0!==n?n:null==M?void 0:M.commentData)&&void 0!==r?r:[],A=null==T?void 0:T[0],_=null!==(p=null!==(d=null!==(a=null===(s=null==A?void 0:A.commentText)||void 0===s?void 0:s.trim())&&void 0!==a?a:null===(c=null===(l=null==M?void 0:M.agent)||void 0===l?void 0:l.result)||void 0===c?void 0:c.incorrectWord)&&void 0!==d?d:null===(u=null===(h=null==M?void 0:M.targetElement)||void 0===h?void 0:h.targetText)||void 0===u?void 0:u.trim())&&void 0!==p?p:"",I=null!==(b=null!==(m=null===(f=null===(g=null===(v=null==M?void 0:M.agent)||void 0===v?void 0:v.result)||void 0===g?void 0:g.suggestions)||void 0===f?void 0:f[0])&&void 0!==m?m:null===(y=null===(w=null==M?void 0:M.agent)||void 0===w?void 0:w.result)||void 0===y?void 0:y.suggestion)&&void 0!==b?b:"",$=null!==(k=null!==(x=null===(C=null==M?void 0:M.agent)||void 0===C?void 0:C.reason)&&void 0!==x?x:null===(E=null==A?void 0:A.agent)||void 0===E?void 0:E.reason)&&void 0!==k?k:{},N="string"==typeof(null==$?void 0:$.title)?$.title.trim():"",O="string"==typeof(null==$?void 0:$.description)?$.description.trim():"",L=N?null:this.splitFindingHeading(null==A?void 0:A.commentHtml),D=N||(null==L?void 0:L.title)||_,R=I||(N?O:null==L?void 0:L.detail)||"",F=xh(null==$?void 0:$.severity),P=this.buildFindingSubItems($),V=_||(null==M?void 0:M.annotationId)||(null==M?void 0:M.id)||"";if(S.has(V)){const e=S.get(V);e.occurrences+=1,t&&!e.pageUrls.includes(t)&&e.pageUrls.push(t),e.annotations.push(M),e.severity=Eh(e.severity,F)}else S.set(V,{primaryText:D||"No text",secondaryText:R||"",occurrences:1,pageUrls:t?[t]:[],annotations:[M],...F?{severity:F}:{},...P.length>1?{subItems:P}:{}})}const M=Array.from(S.values());return{warnings:M,warningCount:M.length}}catch(t){return console.warn("Error in buildGenericWarnings: ",t),{warnings:[],warningCount:0}}},this.normalizePagePath=t=>{try{return t?(null==t?void 0:t.startsWith("/"))?t.substring(1):t:""}catch(e){return console.warn("Error in normalizePagePath: ",e),t||""}},this.setQueryParamsCommentsInSdk=()=>{var t,e,i,o,n;try{const r="true"===sessionStorage.getItem("debugQueryParamsComments");r&&console.log("setQueryParamsCommentsInSdk commentElement",this.commentElement),this.commentElement&&(r&&console.log("setQueryParamsCommentsInSdk queryParamsComments",this.queryParamsComments),this.queryParamsComments&&(null===(t=this.commentElement)||void 0===t?void 0:t.enableQueryParamsComments)?(r&&console.log("enableQueryParamsComments this.commentElement?.enableQueryParamsComments",null===(e=this.commentElement)||void 0===e?void 0:e.enableQueryParamsComments),null===(i=this.commentElement)||void 0===i||i.enableQueryParamsComments()):!this.queryParamsComments&&(null===(o=this.commentElement)||void 0===o?void 0:o.disableQueryParamsComments)&&(r&&console.log("disableQueryParamsComments"),null===(n=this.commentElement)||void 0===n||n.disableQueryParamsComments()))}catch(t){console.warn("Error in setQueryParamsCommentsInSdk: ",t),vd("Error in setQueryParamsCommentsInSdk: ",t)}},this.checkGlobalUserContact=()=>{try{this.contactElement&&this.contactElement.isUserGlobalContact().subscribe((t=>{this.isUserGlobalContact=t}))}catch(t){console.warn("Error in checkGlobalUserContact: ",t),vd("Error in checkGlobalUserContact: ",t)}},this.applyVeltFeatureGates=()=>{try{const t=(t=>{try{return(null==t?void 0:t.passwordGateActive)||(null==t?void 0:t.planLimitLocked)||(null==t?void 0:t.planExpired)||(null==t?void 0:t.projectDeleted)?[...id]:[]}catch(t){return[]}})({passwordGateActive:this.passwordProtected&&!this.isPasswordValid,planLimitLocked:this.planLimitLocked,planExpired:!0===this.isPlanExpired,projectDeleted:this.projectDeleted});this.resolvedVeltFeatureGates=t,this.pushVeltFeatureGates(t)}catch(t){console.warn("Error in applyVeltFeatureGates: ",t),vd("Error in applyVeltFeatureGates: ",t)}},this.pushVeltFeatureGates=t=>{const e=globalThis.Velt;e&&"function"==typeof e.disableFeatures&&e.disableFeatures(t)},this.replayVeltFeatureGates=()=>{try{this.pushVeltFeatureGates(this.resolvedVeltFeatureGates)}catch(t){console.warn("Error in replayVeltFeatureGates: ",t),vd("Error in replayVeltFeatureGates: ",t)}},this.setProjectConfigVariables=t=>{var e,i,o,n;try{const r="Admin"===this.snippylyUserRole;this.allFeatureDisabled=!r&&(null!==(e=null==t?void 0:t.disabled)&&void 0!==e&&e),this.allFeatureRestricted=null!==(i=null==t?void 0:t.restricted)&&void 0!==i&&i,this.guestMode=null!==(o=null==t?void 0:t.guestMode)&&void 0!==o&&o,this.allowGuestModeSignIn=!!(null===(n=null==t?void 0:t.guestModeConfig)||void 0===n?void 0:n.allowSignIn),(null==t?void 0:t.guestModeConfig)||(this.allowGuestModeSignIn=!0),this.guestMode&&gd(vt.Events.GUEST_MODE_PRESENT),this.passwordProtected=!1,this.queryParamsComments=!!(null==t?void 0:t.queryParamsComments),this.usePageTitleAsLocationName=!!(null==t?void 0:t.usePageTitleAsLocationName),this.applyVeltFeatureGates(),Wc(oe,this.guestMode+"",!0),Wc(de,this.allowGuestModeSignIn+"",!0),Wc(ne,this.passwordProtected+"",!0),Wc(re,this.queryParamsComments+"",!0),Wc(se,this.usePageTitleAsLocationName+"",!0)}catch(t){console.warn("Error in setProjectConfigVariables: ",t),vd("Error in setProjectConfigVariables: ",t)}},this.toggleSnippylyPluginToolbar=()=>{try{this.expanded=!this.expanded,this.expanded?gd(vt.Events.TOOLBAR_EXPANDED):gd(vt.Events.TOOLBAR_COLLAPSED)}catch(t){console.warn("Error in toggleSnippylyPluginToolbar: ",t),vd("Error in toggleSnippylyPluginToolbar: ",t)}},this.enablePrivateCommentModeOnCommentElement=()=>{try{if(!this.commentElement||"function"!=typeof this.commentElement.enablePrivateMode)return;this.commentElement.enablePrivateMode({type:ce})}catch(t){console.warn("Error in enablePrivateCommentModeOnCommentElement: ",t),vd("Error in enablePrivateCommentModeOnCommentElement: ",t)}},this.disablePrivateCommentModeOnCommentElement=()=>{try{if(!this.commentElement||"function"!=typeof this.commentElement.disablePrivateMode)return;this.commentElement.disablePrivateMode()}catch(t){console.warn("Error in disablePrivateCommentModeOnCommentElement: ",t),vd("Error in disablePrivateCommentModeOnCommentElement: ",t)}},this.enableVisibilityOptionsOnCommentElement=()=>{try{if(this.visibilityOptionsEnabled)return;if(!this.commentElement||"function"!=typeof this.commentElement.enableVisibilityOptions)return;this.commentElement.enableVisibilityOptions(),this.visibilityOptionsEnabled=!0,gd(vt.Events.VISIBILITY_OPTIONS_ENABLED)}catch(t){console.warn("Error in enableVisibilityOptionsOnCommentElement: ",t),vd("Error in enableVisibilityOptionsOnCommentElement: ",t)}},this.disableVisibilityOptionsOnCommentElement=()=>{try{if(!this.visibilityOptionsEnabled)return;if(!this.commentElement||"function"!=typeof this.commentElement.disableVisibilityOptions)return void(this.visibilityOptionsEnabled=!1);this.commentElement.disableVisibilityOptions(),this.visibilityOptionsEnabled=!1,gd(vt.Events.VISIBILITY_OPTIONS_DISABLED)}catch(t){console.warn("Error in disableVisibilityOptionsOnCommentElement: ",t),vd("Error in disableVisibilityOptionsOnCommentElement: ",t)}},this.maybeApplyVisibilityOptionsToCommentElement=()=>{"Admin"===this.snippylyUserRole&&this.canShowPrivateCommentToggle?this.enableVisibilityOptionsOnCommentElement():this.disableVisibilityOptionsOnCommentElement()},this.togglePrivateCommentMode=()=>{try{this.commentElement&&(this.privateCommentModeEnabled?(this.disablePrivateCommentModeOnCommentElement(),this.privateCommentModeEnabled=!1,gd(vt.Events.PRIVATE_MODE_DISABLED)):(this.enablePrivateCommentModeOnCommentElement(),this.privateCommentModeEnabled=!0,gd(vt.Events.PRIVATE_MODE_ENABLED)),Wc(le,this.privateCommentModeEnabled.toString()))}catch(t){console.warn("Error in togglePrivateCommentMode: ",t),vd("Error in togglePrivateCommentMode: ",t)}},this.checkPrivateCommentModeFromStorage=()=>{try{!this.allFeatureDisabled&&"Admin"===this.snippylyUserRole&&this.canShowPrivateCommentToggle&&Zc(le)&&(this.privateCommentModeEnabled="true"===Zc(le),this.privateCommentModeEnabled&&this.enablePrivateCommentModeOnCommentElement())}catch(t){console.warn("Error in checkPrivateCommentModeFromStorage: ",t),vd("Error in checkPrivateCommentModeFromStorage: ",t)}},this.loginWithGoogle=()=>{try{if(gd(vt.Events.SIGNIN_CLICKED),this.loading||this.customLoginEnabledLocally)return;const t=this.buildSignInUrlWithParams(this.signInUrl||"");window.open(t,"_self")}catch(t){console.warn("Error in loginWithGoogle: ",t),vd("Error in loginWithGoogle: ",t)}},this.buildSignInUrlWithParams=t=>{try{const e=new URL(t);return this.apiKey&&e.searchParams.set("apiKey",this.apiKey),this.projectId&&e.searchParams.set("projectId",this.projectId),e.toString()}catch(e){return console.warn("Error in buildSignInUrlWithParams: ",e),vd("Error in buildSignInUrlWithParams: ",e),t}},this.getQRCode=async()=>{if(!this.qrCodeLoading)try{this.qrCodeLoading=!0,this.qrCodeError=!1;const t=new URL(window.location.href);null==t||t.searchParams.set("review","true");const e=null==t?void 0:t.toString();if(!e)return void(this.qrCodeError=!0);const i=Jc(e,ze,Be),o=await Od(i);"ok"===o.status?this.qrCode=o.qrcode:this.qrCodeError=!0}catch(t){this.qrCodeError=!0,console.warn("Error in getQRCode: ",t),vd("Error in getQRCode: ",t)}finally{this.qrCodeLoading=!1}},this.retryQRCode=async()=>{try{this.qrCodeError=!1,await this.getQRCode()}catch(t){console.warn("Error in retryQRCode: ",t),vd("Error in retryQRCode: ",t)}},this.toggleQRCodeVisibility=async()=>{try{if(gd(vt.Events.OPEN_MOBILE_CLICKED),this.showQrCode&&this.qrCodeLoading)return;this.showQrCode=!this.showQrCode,this.showQrCode&&!this.qrCode&&await this.getQRCode()}catch(t){console.warn("Error in toggleQRCodeVisibility: ",t),vd("Error in toggleQRCodeVisibility: ",t)}},this.onUserInviteToolClick=()=>{var t;(null===(t=this.snippylyUser)||void 0===t?void 0:t.isGuest)?(this.guestModeSignInModalConfig.title="Sign in to invite others.",this.guestModeSignInModalConfig.description="Invite team members to comment on this project.",this.guestModeSignInModalConfig.showLeaveCommentButton=!1,this.guestModeSignInModalConfig.closeOnClickOutside=!0,this.openGuestModeSignInModal()):this.openInviteModal()},this.openInviteModal=()=>{this.showInviteModal=!0,gd(vt.Events.INVITE_MODAL_OPENED)},this.closeInviteModal=()=>{this.showInviteModal=!1},this.onInviteSuccess=()=>{this.closeInviteModal(),gd(vt.Events.INVITE_SENT)},this.removeSnippyly=async()=>{try{gd(vt.Events.EXIT_REVIEW_MODE_CLICKED),this.exitReviewModeCalled=!0,Kc(Et),Kc(kt),Kc(Bt),Kc(Yt,"sessionStorage"),Kc(Jt,"sessionStorage");const t=new URL(document.location),e=t.searchParams;e.delete(Bt),e.delete(Et),e.delete(Ht),e.delete(kt),this.projectVersionKey&&e.delete(this.projectVersionKey),e.delete(qt),e.delete(Qt),e.delete(Xt),this.projectVersion=void 0,this.projectVersionKey=void 0,delete window.snippylyInitialLoadUrl,window.history.replaceState({},document.title,t.href),window.location.reload()}catch(t){console.warn("Error in removeSnippyly: ",t),vd("Error in removeSnippyly: ",t)}},this.signOutUser=async()=>{try{gd(vt.Events.SIGNOUT_CLICKED),this.subscriptions.forEach((t=>{t&&t.unsubscribe&&(null==t||t.unsubscribe())})),this.contactListSubscription&&(this.contactListSubscription.unsubscribe(),this.contactListSubscription=null),await Velt.signOutUser(),Kc(Gt),Kc(Zt),Kc(ie),Kc(le),this.snippylyUser=void 0,window.open(this.signOutUrl,"_self")}catch(t){console.warn("Error in signOutUser: ",t),vd("Error in signOutUser: ",t)}},this.toggleMenu=(t,e)=>{try{t.stopPropagation(),this.menuOpenedId===e?this.menuOpenedId=void 0:this.menuOpenedId=e}catch(t){console.warn("Error in toggleMenu: ",t),vd("Error in toggleMenu: ",t)}},this.copyLink=()=>{try{navigator.clipboard.writeText(window.location.href),this.copyLinkTooltip="Link copied!",setTimeout((()=>{this.copyLinkTooltip="Copy Link"}),2e3)}catch(t){console.warn("Error in copyLink: ",t),vd("Error in copyLink: ",t)}},this.goToAdminPortal=()=>{try{let t=`${je}`;Velt&&(null===Velt||void 0===Velt?void 0:Velt.getDocumentId)&&this.serverDocumentId&&(t=`${je}/dashboard/project/comment/${this.apiKey}/${this.serverDocumentId}`),gd(vt.Events.VIEW_PROJECT_CLICKED),window.open(t,"_blank")}catch(t){console.warn("Error in goToAdminPortal: ",t),vd("Error in goToAdminPortal: ",t)}},this.openBugReportModal=()=>{try{this.showBugReportModal=!0,gd(vt.Events.REPORT_BUG_CLICKED)}catch(t){console.warn("Error in openBugReportModal: ",t),vd("Error in openBugReportModal: ",t)}},this.closeBugReportModal=()=>{try{this.showBugReportModal=!1}catch(t){console.warn("Error in closeBugReportModal: ",t),vd("Error in closeBugReportModal: ",t)}},this.goToAdminPortalDashboard=()=>{try{let t=`${je}`;Velt&&(null===Velt||void 0===Velt?void 0:Velt.getDocumentId)&&this.serverDocumentId&&(t=`${je}/dashboard`),window.open(t,"_blank")}catch(t){console.warn("Error in goToAdminPortalDashboard: ",t),vd("Error in goToAdminPortalDashboard: ",t)}},this.joinCommunity=()=>{try{window.open("https://join.slack.com/t/superflowusers/shared_invite/zt-1q3jzsddt-NEb~uu9RXscLfxOIDGQXJw","_blank")}catch(t){console.warn("Error in joinCommunity: ",t),vd("Error in joinCommunity: ",t)}},this.onboardingNextClick=()=>{try{this.showOnboardingModal=!1,Wc(Qt,"true");const t=new URL(document.location);t.searchParams.delete(Qt),window.history.replaceState({},document.title,t.href)}catch(t){console.warn("Error in onboardingNextClick: ",t),vd("Error in onboardingNextClick: ",t)}},this.onLiveDemoModalNextClick=()=>{try{this.showLiveDemoModal=!1,Wc(Xt,"true",!1,"sessionStorage");const t=new URL(document.location);t.searchParams.delete(Xt),window.history.replaceState({},document.title,t.href)}catch(t){console.warn("Error in onLiveDemoModalNextClick: ",t),vd("Error in onLiveDemoModalNextClick: ",t)}},this.onFigmaDemoModalNextClick=()=>{try{this.showFigmaDemoModal=!1;const t=new URL(document.location);t.searchParams.delete(te),window.history.replaceState({},document.title,t.href)}catch(t){console.warn("Error in onFigmaDemoModalNextClick: ",t),vd("Error in onFigmaDemoModalNextClick: ",t)}},this.onUpgradePlanClick=()=>{try{window.open(Ue,"_blank")}catch(t){console.warn("Error in onUpgradePlanClick: ",t),vd("Error in onUpgradePlanClick: ",t)}},this.onTourCommentTooltipClick=()=>{try{this.showTourCommentTooltip=!1,Wc(ee,"true"),this.firstCommentNudge&&(this.firstCommentNudge=!1,this.autoCommentModeArmedOnce=!0)}catch(t){console.warn("Error in onTourCommentTooltipClick: ",t),vd("Error in onTourCommentTooltipClick: ",t)}},this.onGuestModeChipSignInButtonClick=()=>{try{gd(vt.Events.GUEST_MODE_SIGN_IN_BUTTON_CLICKED),this.loginWithGoogle()}catch(t){console.warn("Error in onGuestModeChipSignInButtonClick: ",t),vd("Error in onGuestModeChipSignInButtonClick: ",t)}},this.openGuestModeSignInModal=()=>{try{this.showGuestModeSignInModal=!0,gd(vt.Events.GUEST_MODE_SIGN_IN_DIALOG_SHOWN)}catch(t){console.warn("Error in openGuestModeSignInModal: ",t),vd("Error in openGuestModeSignInModal: ",t)}},this.closeGuestModeSignInModal=()=>{try{this.showGuestModeSignInModal=!1,this.guestModeSignInModalConfig=JSON.parse(JSON.stringify(this.defaultGuestModeSignInModalConfig))}catch(t){console.warn("Error in closeGuestModeSignInModal: ",t),vd("Error in closeGuestModeSignInModal: ",t)}},this.onGuestModeSignInModalSignInButtonClick=()=>{try{gd(vt.Events.GUEST_MODE_SIGN_IN_BUTTON_CLICKED),this.loginWithGoogle()}catch(t){console.warn("Error in onGuestModeSignInModalSignInButtonClick: ",t),vd("Error in onGuestModeSignInModalSignInButtonClick: ",t)}},this.openGuestModeNameModel=t=>{try{t&&(t.stopPropagation(),t.preventDefault()),this.skipGuestNameModal||(this.showGuestModeNameModal=!0,gd(vt.Events.GUEST_MODE_NAME_NUDGE_SHOWN))}catch(t){console.warn("Error in openGuestModeNameModel: ",t),vd("Error in openGuestModeNameModel: ",t)}},this.closeGuestModeNameModel=()=>{try{this.showGuestModeNameModal=!1}catch(t){console.warn("Error in closeGuestModeNameModel: ",t),vd("Error in closeGuestModeNameModel: ",t)}},this.onGuestModeNameModalSkipButtonClick=()=>{try{gd(vt.Events.GUEST_MODE_SKIP_BUTTON_CLICKED),this.showGuestModeNameModal=!1}catch(t){console.warn("Error in onGuestModeNameModalSkipButtonClick: ",t),vd("Error in onGuestModeNameModalSkipButtonClick: ",t)}},this.onPasswordProtectedModalCloseButtonClick=()=>{try{gd(vt.Events.PASSWORD_PROTECTED_MODAL_CLOSE_BUTTON_CLICKED),this.showPasswordProtectedModal=!1,this.password="",this.showInvalidPassword=!1}catch(t){console.warn("Error in onPasswordProtectedModalCloseButtonClick: ",t),vd("Error in onPasswordProtectedModalCloseButtonClick: ",t)}},this.onPasswordProtectedModalOpenButtonClick=()=>{try{gd(vt.Events.PASSWORD_PROTECTED_MODAL_OPEN_BUTTON_CLICKED),this.showPasswordProtectedModal=!0}catch(t){console.warn("Error in onPasswordProtectedModalOpenButtonClick: ",t),vd("Error in onPasswordProtectedModalOpenButtonClick: ",t)}},this.showGuestModeSignInBanner=()=>{try{this.guestModeSignInBannerVisible=!0,gd(vt.Events.GUEST_MODE_SIGN_IN_NUDGE_SHOWN)}catch(t){console.warn("Error in showGuestModeSignInBanner: ",t),vd("Error in showGuestModeSignInBanner: ",t)}},this.hideGuestModeSignInBanner=()=>{try{this.guestModeSignInBannerVisible=!1}catch(t){console.warn("Error in hideGuestModeSignInBanner: ",t),vd("Error in hideGuestModeSignInBanner: ",t)}},this.onGuestModeBannerSignInButtonClick=()=>{try{gd(vt.Events.GUEST_MODE_SIGN_IN_CLICKED),this.loginWithGoogle()}catch(t){console.warn("Error in onGuestModeBannerSignInButtonClick: ",t),vd("Error in onGuestModeBannerSignInButtonClick: ",t)}},this.updateGuestUserName=async()=>{var t;try{if(!(null===(t=this.guestUserNameInput)||void 0===t?void 0:t.trim()))return;if(this.guestUserNameUpdateLoading)return;const e=td(!0,this.apiKey);if(e){const t=JSON.parse(JSON.stringify(e));e.name=this.guestUserNameInput,e.photoUrl=null,this.guestUserNameUpdateLoading=!0,(t=>{try{const e=JSON.stringify(t),i=Jc(e,ze,Be);Wc(Kt,i,!0)}catch(t){console.warn("Error in updateGuestUser: ",t),vd("Error in updateGuestUser: ",t)}})(e),await Velt.identify(e),this.snippylyUser=JSON.parse(JSON.stringify(e)),await Sd(this.apiKey,this.projectId||"",t,e),this.showGuestModeNameModal=!1,this.guestUserNameUpdated=!0,this.guestUserNameUpdateLoading=!1,Wc(ue,"true"),gd(vt.Events.GUEST_MODE_NAME_ADDED,{oldName:null==t?void 0:t.name,newName:null==e?void 0:e.name})}this.closeGuestModeNameModel()}catch(t){console.warn("Error in updateGuestUserName: ",t),vd("Error in updateGuestUserName: ",t)}},this.submitPassword=async()=>{var t;try{if(gd(vt.Events.REVIEW_PASSWORD_ADDED),!(null===(t=this.password)||void 0===t?void 0:t.trim()))return;if(this.validatingPasswordLoading)return;this.validatingPasswordLoading=!0,this.isPasswordValid=await bd(this.apiKey,this.projectId,this.password),function(t,e){try{const i="object"==typeof e?JSON.stringify(e):e;localStorage.setItem(t,i)}catch(t){console.warn("Error in setLocalStorage: ",t)}}(ae,this.isPasswordValid),this.isPasswordValid?(this.password="",this.onPasswordProtectedModalCloseButtonClick(),this.showInvalidPassword=!1,this.applyVeltFeatureGates(),gd(vt.Events.REVIEW_PASSWORD_ACCEPTED)):(this.showInvalidPassword=!0,gd(vt.Events.REVIEW_PASSWORD_REJECTED)),this.validatingPasswordLoading=!1}catch(t){console.warn("Error in submitPassword: ",t),vd("Error in submitPassword: ",t)}},this.updateUserName=async()=>{var t;try{if(!(null===(t=this.guestUserNameInput)||void 0===t?void 0:t.trim()))return;if(this.guestUserNameUpdateLoading)return;this.guestUserNameUpdateLoading=!0;const e=JSON.parse(JSON.stringify(this.snippylyUser)),i=JSON.parse(JSON.stringify(this.snippylyUser));i.name=this.guestUserNameInput,await Sd(this.apiKey,this.projectId||"",e,i),await Velt.updateUser(i),this.snippylyUser=JSON.parse(JSON.stringify(i));const o=Qc();o.name=i.name;const n=JSON.stringify(o),r=Jc(n,ze,Be);Wc(Zt,r,!0),this.guestUserNameUpdateLoading=!1,this.guestUserNameInput="",this.closeGuestModeNameModel()}catch(t){console.warn("Error in updateUserName: ",t),vd("Error in updateUserName: ",t)}},this.isAgentAnnotation=t=>{var e;try{const i=null!==this.extractAgentId((null===(e=null==t?void 0:t.agent)||void 0===e?void 0:e.agentFields)||[]),o=(null==t?void 0:t.type)===Ee,n=(null==t?void 0:t.commentType)===Ee;return i||o||n}catch(t){return console.warn("Error in isAgentAnnotation: ",t),!1}},this.getSidebarGroupExpansionMap=()=>{var t,e,i,o,n;try{const r=document.querySelector(Me.VELT_COMMENTS_SIDEBAR_LEGACY),s=null===(n=null===(o=null===(i=null===(e=null===(t=null==r?void 0:r._ngElementStrategy)||void 0===t?void 0:t.componentRef)||void 0===e?void 0:e.instance)||void 0===i?void 0:i.componentConfigSignal)||void 0===o?void 0:o.call(i))||void 0===n?void 0:n.virtualScrollData;if(!Array.isArray(s))return;const a=new Map;return s.forEach((t=>{var e,i;if("group"!==(null==t?void 0:t.type))return;const o=null===(e=null==t?void 0:t.data)||void 0===e?void 0:e.displayName,n=null===(i=null==t?void 0:t.data)||void 0===i?void 0:i.isExpanded;"string"==typeof o&&"boolean"==typeof n&&a.set(o,n)})),a}catch(t){return void console.warn("Error in getSidebarGroupExpansionMap: ",t)}},this.filterAgentCommentsFromSidebar=(t,e)=>{try{if(this.isSettingSidebarData)return;if(!t||!this.commentElement)return;const i=t.commentAnnotations;if(!Array.isArray(i))return;if(this.processAgentComments(this.mergeOnboardingFetchedAnnotations(i)),this.ensureOnboardingFindingsLoaded(),this.sidebarV2Enabled)return;if(this.showAgentCommentsInSidebar)return;const o=Array.isArray(null==t?void 0:t.systemFilteredAnnotations)?t.systemFilteredAnnotations:[],n=new Set(o.map((t=>(null==t?void 0:t.annotationId)||(null==t?void 0:t.id))).filter((t=>Boolean(t)))),r=[];i.forEach((t=>{if(this.isAgentAnnotation(t))return;const e=(null==t?void 0:t.annotationId)||(null==t?void 0:t.id);e&&n.has(e)&&r.push(t)}));const s=new Map;r.forEach((t=>{var e,i,o,n;const r=(null===(e=null==t?void 0:t.pageInfo)||void 0===e?void 0:e.path)||(null===(i=null==t?void 0:t.pageInfo)||void 0===i?void 0:i.url)||(null===(o=null==t?void 0:t.location)||void 0===o?void 0:o.path)||"/";s.has(r)||s.set(r,[]),null===(n=s.get(r))||void 0===n||n.push(t)}));const a=[],l=new URL(window.location.href).pathname,c="/"+this.normalizePagePath(l);s.forEach(((t,i)=>{const o=null==e?void 0:e.get(i);a.push({groupId:i,groupName:i,isExpanded:"boolean"==typeof o?o:i===c,annotations:t})})),this.isSettingSidebarData=!0,this.commentElement.setCommentSidebarData(a,{grouping:!0}),this.isSettingSidebarData=!1}catch(t){this.isSettingSidebarData=!1,console.warn("Error in filterAgentCommentsFromSidebar: ",t),vd("Error in filterAgentCommentsFromSidebar: ",t)}},this.mountVeltCollaborationElements=()=>{if(!document.querySelector(Me.VELT_COMMENTS)){const t=document.createElement(Me.VELT_COMMENTS);t.setAttribute("filter-comments-on-dom","true"),t.setAttribute("shadow-dom","true"),null==t||t.addEventListener("onSignIn",(()=>{this.loginWithGoogle()})),null==t||t.addEventListener("onUpgrade",(()=>{this.onUpgradePlanClick()})),t.addEventListener("onCommentAdd",(()=>{this.addCommentCount++})),t.addEventListener("onCommentUpdate",(t=>{var e,i;(null===(e=this.snippylyUser)||void 0===e?void 0:e.isGuest)&&"newlyAdded"===(null===(i=null==t?void 0:t.detail)||void 0===i?void 0:i.type)&&(this.addCommentCount>=2&&(this.showModalOnceCommentIsModeIsOff=!0),this.addCommentCount>=5&&!this.showModalOnceCommentIsModeIsOff&&(this.showModalOnceCommentIsModeIsOff=!0))})),window.document.body.appendChild(t)}if(!document.querySelector(Me.VELT_CURSOR)){const t=document.createElement(Me.VELT_CURSOR);window.document.body.appendChild(t)}if(!document.querySelector(Me.VELT_HUDDLE)){const t=document.createElement(Me.VELT_HUDDLE);window.document.body.appendChild(t)}if(!document.querySelector(Me.VELT_RECORDER_NOTES)){const t=document.createElement(Me.VELT_RECORDER_NOTES);window.document.body.appendChild(t)}if(!document.querySelector(Me.VELT_RECORDER_CONTROL_PANEL)){const t=document.createElement(Me.VELT_RECORDER_CONTROL_PANEL);window.document.body.appendChild(t)}if(!document.querySelector(Me.VELT_ARROWS)){const t=document.createElement(Me.VELT_ARROWS);window.document.body.appendChild(t)}},this.unmountVeltCollaborationElements=()=>{try{document.querySelectorAll(nu.COLLABORATION_TAGS.join(", ")).forEach((t=>t.remove()))}catch(t){console.warn("Error in unmountVeltCollaborationElements: ",t),vd("Error in unmountVeltCollaborationElements: ",t)}},this.mountCommentSidebar=()=>{const t=this.sidebarV2Enabled,e=t?Me.VELT_COMMENTS_SIDEBAR_V2:Me.VELT_COMMENTS_SIDEBAR_LEGACY,i=t?Me.VELT_COMMENTS_SIDEBAR_LEGACY:Me.VELT_COMMENTS_SIDEBAR_V2;if(document.querySelectorAll(i).forEach((t=>t.remove())),!document.querySelector(e)){const i=document.createElement(e);i.setAttribute("shadow-dom","true"),i.setAttribute(t?Te.URL_NAVIGATION:Te.ENABLE_URL_NAVIGATION,"true"),i.setAttribute(Te.CURRENT_LOCATION_SUFFIX,"true"),e===Me.VELT_COMMENTS_SIDEBAR_LEGACY&&(i.setAttribute(Te.SIDEBAR_BUTTON_COUNT_TYPE,Ae),i.setAttribute(Te.CUSTOM_ACTIONS,"true")),window.document.body.appendChild(i)}},this.setCommentSidebarVisibility=t=>{var e,i,o,n,r,s,a,l;try{if(t===this.showAgentCommentsInSidebar)return;if(this.sidebarV2Enabled)return t?null===(i=null===(e=this.commentElement)||void 0===e?void 0:e.disableFilterCommentsOnDom)||void 0===i||i.call(e):null===(n=null===(o=this.commentElement)||void 0===o?void 0:o.enableFilterCommentsOnDom)||void 0===n||n.call(o),void(this.showAgentCommentsInSidebar=t);const c=document.querySelector(Me.VELT_COMMENTS_SIDEBAR_LEGACY);if(!c)return;t?(c.removeAttribute(Te.SIDEBAR_BUTTON_COUNT_TYPE),c.removeAttribute(Te.CUSTOM_ACTIONS),null===(s=null===(r=this.commentElement)||void 0===r?void 0:r.disableFilterCommentsOnDom)||void 0===s||s.call(r)):(c.setAttribute(Te.SIDEBAR_BUTTON_COUNT_TYPE,Ae),c.setAttribute(Te.CUSTOM_ACTIONS,"true"),null===(l=null===(a=this.commentElement)||void 0===a?void 0:a.enableFilterCommentsOnDom)||void 0===l||l.call(a)),this.showAgentCommentsInSidebar=t}catch(t){console.warn("Error in setCommentSidebarVisibility: ",t),vd("Error in setCommentSidebarVisibility: ",t)}},this.toggleCommentSidebarVisibility=()=>{try{this.setCommentSidebarVisibility(!this.showAgentCommentsInSidebar),this.menuOpenedId=void 0}catch(t){console.warn("Error in toggleCommentSidebarVisibility: ",t),vd("Error in toggleCommentSidebarVisibility: ",t)}},this.applyPageCommentsVisibility=()=>{try{const t=this.commentElement;if(!t)return;this.pageCommentsHidden?"function"==typeof t.hideCommentsOnDom&&t.hideCommentsOnDom():"function"==typeof t.showCommentsOnDom&&t.showCommentsOnDom()}catch(t){console.warn("Error in applyPageCommentsVisibility: ",t),vd("Error in applyPageCommentsVisibility: ",t)}},this.togglePageCommentsVisibility=()=>{try{this.pageCommentsHidden=!this.pageCommentsHidden,this.pageCommentsHidden?Wc(zt,"true",!1,"sessionStorage"):Kc(zt,"sessionStorage"),this.applyPageCommentsVisibility(),this.menuOpenedId=void 0}catch(t){console.warn("Error in togglePageCommentsVisibility: ",t),vd("Error in togglePageCommentsVisibility: ",t)}},this.unhidePageCommentsIfHidden=()=>{try{if(!this.pageCommentsHidden)return;this.pageCommentsHidden=!1,Kc(zt,"sessionStorage"),this.applyPageCommentsVisibility()}catch(t){console.warn("Error in unhidePageCommentsIfHidden: ",t)}},this.toggleSidebarV2=()=>{try{Wc(yt,this.sidebarV2Enabled?"false":"true",!1,"sessionStorage"),window.location.reload()}catch(t){console.warn("Error in toggleSidebarV2: ",t),vd("Error in toggleSidebarV2: ",t)}},this.toggleVeltProxy=()=>{try{if(!this.veltProxyToggleVisible)return;t=!this.veltProxyEnabled,Wc(bt,t?"true":"false"),window.location.reload()}catch(t){console.warn("Error in toggleVeltProxy: ",t),vd("Error in toggleVeltProxy: ",t)}var t},this.isScreenshotDisabledHost=()=>{try{return Ce.includes(window.location.hostname)}catch{return!1}},this.getScreenshotMode=()=>{var t,e,i;return"local"===(null===(i=null===(e=null===(t=this.customerMetadata)||void 0===t?void 0:t.superflow)||void 0===e?void 0:e.advancedFeatures)||void 0===i?void 0:i.screenshotMode)?"local":"basic"},this.logCaptureTrigger=(...t)=>{Ah()&&"undefined"!=typeof console&&console.warn("[sf-capture][trigger]",...t)},this.ensureAddCommentAnnotationSubscription=()=>{var t,e,i;this.commentElement&&"function"==typeof this.commentElement.on?this.addCommentAnnotationSubscription&&this.addCommentAnnotationSubscribedEl===this.commentElement?this.logCaptureTrigger("addCommentAnnotation subscription already attached"):(this.addCommentAnnotationSubscription&&(null===(i=(e=this.addCommentAnnotationSubscription).unsubscribe)||void 0===i||i.call(e),this.addCommentAnnotationSubscription=void 0,this.logCaptureTrigger("addCommentAnnotation re-subscribing: comment element changed")),this.addCommentAnnotationSubscription=this.commentElement.on("addCommentAnnotation").subscribe((t=>this.onAddCommentAnnotation(t))),this.addCommentAnnotationSubscribedEl=this.commentElement,this.logCaptureTrigger("addCommentAnnotation subscription attached")):this.logCaptureTrigger("addCommentAnnotation subscription NOT attached: commentElement.on unavailable",{hasCommentElement:!!this.commentElement,hasOn:"function"==typeof(null===(t=this.commentElement)||void 0===t?void 0:t.on)})},this.applyScreenshotSetting=()=>{var t,e,i,o,n,r,s,a,l,c,d,h,u;if(this.commentElement)return this.isScreenshotDisabledHost()?(null===(e=(t=this.commentElement).disableScreenshot)||void 0===e||e.call(t),void(this.nativeScreenshotEnabled&&(this.nativeScreenshotEnabled=!1,this.nativeCapture.dispose()))):void(this.nativeScreenshotEnabled?null===(o=(i=this.commentElement).disableScreenshot)||void 0===o||o.call(i):(null===(s=null===(r=null===(n=this.customerMetadata)||void 0===n?void 0:n.superflow)||void 0===r?void 0:r.advancedFeatures)||void 0===s?void 0:s.takeScreenshotOnComments)?"local"!==this.getScreenshotMode()?null===(u=(h=this.commentElement).enableScreenshot)||void 0===u||u.call(h):null===(d=(c=this.commentElement).disableScreenshot)||void 0===d||d.call(c):null===(l=(a=this.commentElement).disableScreenshot)||void 0===l||l.call(a))},this.canUseNativeScreenshot=()=>{var t,e,i;return!this.isScreenshotDisabledHost()&&(eu()&&"local"===this.getScreenshotMode()&&!!(null===(i=null===(e=null===(t=this.customerMetadata)||void 0===t?void 0:t.superflow)||void 0===e?void 0:e.advancedFeatures)||void 0===i?void 0:i.takeScreenshotOnComments))},this.getNativeScreenshotPermission=()=>{const t=Zc(we,!1,"sessionStorage");return"granted"===t||"denied"===t?t:null},this.setNativeScreenshotPermission=t=>{Wc(we,t,!1,"sessionStorage"),this.nativeScreenshotDenied="denied"===t},this.clearNativeScreenshotPermission=()=>{Kc(we,"sessionStorage"),this.nativeScreenshotDenied=!1},this.promptNativeScreenshotForCommentMode=()=>{this.nativeScreenshotEnabled||this.nativeScreenshotEnabling||!this.canUseNativeScreenshot()||(this.logCaptureTrigger("commentMode enter: requesting screen share"),this.enableNativeScreenshot())},this.toggleNativeScreenshot=async()=>{try{if(!this.canUseNativeScreenshot())return;this.nativeScreenshotEnabled?(this.disableNativeScreenshot(),this.setNativeScreenshotPermission("denied")):(this.clearNativeScreenshotPermission(),await this.enableNativeScreenshot()),this.menuOpenedId=void 0}catch(t){console.warn("Error in toggleNativeScreenshot: ",t),vd("Error in toggleNativeScreenshot: ",t)}},this.enableNativeScreenshot=()=>(this.nativeScreenshotEnabling&&this.nativeScreenshotEnablingPromise||(this.nativeScreenshotEnabling=!0,this.nativeScreenshotEnablingPromise=this.performEnableNativeScreenshot()),this.nativeScreenshotEnablingPromise),this.performEnableNativeScreenshot=async()=>{var t,e;try{if(await this.nativeCapture.init(),!this.nativeCapture.isActive())return this.nativeScreenshotEnabled=!1,void this.nativeCapture.dispose();this.nativeScreenshotEnabled=!0,this.setNativeScreenshotPermission("granted"),null===(e=null===(t=this.commentElement)||void 0===t?void 0:t.disableScreenshot)||void 0===e||e.call(t),this.ensureAddCommentAnnotationSubscription()}catch(t){this.nativeScreenshotEnabled=!1,this.nativeCapture.dispose(),!function(t){var e;const i=t,o=null!==(e=null==i?void 0:i.message)&&void 0!==e?e:"";return!0===(null==i?void 0:i.sfNativeExpected)||"native-share-ended-during-init"===o||"native-not-supported"===o}(t)?console.warn("Native screenshot enable failed/cancelled: ",t):(this.setNativeScreenshotPermission("denied"),Ah()&&"undefined"!=typeof console&&console.info("[sf-capture][native] enable skipped (expected):",t))}finally{this.nativeScreenshotEnabling=!1,this.nativeScreenshotEnablingPromise=void 0}},this.disableNativeScreenshot=()=>{try{this.nativeScreenshotEnabled=!1,this.nativeCapture.dispose(),this.restoreSdkScreenshot()}catch(t){console.warn("Error in disableNativeScreenshot: ",t),vd("Error in disableNativeScreenshot: ",t)}},this.handleNativeScreenshotStreamEnded=()=>{try{const t=this.nativeScreenshotEnabled;if(this.nativeScreenshotEnabled=!1,!t)return;this.setNativeScreenshotPermission("denied"),this.restoreSdkScreenshot(),this.requestUpdate()}catch(t){console.warn("Error in handleNativeScreenshotStreamEnded: ",t),vd("Error in handleNativeScreenshotStreamEnded: ",t)}},this.restoreSdkScreenshot=()=>{var t,e,i,o,n;this.isScreenshotDisabledHost()||"basic"===this.getScreenshotMode()&&(null===(i=null===(e=null===(t=this.customerMetadata)||void 0===t?void 0:t.superflow)||void 0===e?void 0:e.advancedFeatures)||void 0===i?void 0:i.takeScreenshotOnComments)&&(null===(n=null===(o=this.commentElement)||void 0===o?void 0:o.enableScreenshot)||void 0===n||n.call(o))},this.onAddCommentAnnotation=async t=>{var e,i,o,n,r,s,a,l,c;try{if(this.logCaptureTrigger("addCommentAnnotation event",{nativeScreenshotEnabled:this.nativeScreenshotEnabled,captureActive:this.nativeCapture.isActive(),dataKeys:t?Object.keys(t):null,commentAnnotationKeys:(null==t?void 0:t.commentAnnotation)?Object.keys(t.commentAnnotation):null}),!this.nativeScreenshotEnabled&&!this.canUseNativeScreenshot())return void this.logCaptureTrigger("skip: native screenshot unavailable");if(!this.nativeScreenshotEnabled){const t=this.nativeScreenshotEnabling&&!!this.nativeScreenshotEnablingPromise;if(!t&&null!==this.getNativeScreenshotPermission())return void this.logCaptureTrigger("skip: native screenshot not enabled (share decision recorded, no prompt in flight)");if(this.logCaptureTrigger(t?"comment add: share prompt already in flight, awaiting its outcome":"comment add: share never requested this session, prompting"),await this.enableNativeScreenshot(),!this.nativeScreenshotEnabled)return void this.logCaptureTrigger("skip: screen share not granted")}const d=null!==(o=null!==(e=null==t?void 0:t.annotationId)&&void 0!==e?e:null===(i=null==t?void 0:t.commentAnnotation)||void 0===i?void 0:i.annotationId)&&void 0!==o?o:null==t?void 0:t.id,h=null!==(l=null!==(a=null!==(r=null===(n=null==t?void 0:t.commentAnnotation)||void 0===n?void 0:n.comments)&&void 0!==r?r:null===(s=null==t?void 0:t.commentAnnotation)||void 0===s?void 0:s.commentData)&&void 0!==a?a:null==t?void 0:t.comments)&&void 0!==l?l:null==t?void 0:t.commentData,u=null===(c=null==h?void 0:h[0])||void 0===c?void 0:c.commentId;if(!d||!u)return void this.logCaptureTrigger("skip: missing ids",{annotationId:d,commentId:u,data:t});this.captureAndAttachScreenshot(d,u)}catch(t){console.warn("Error in onAddCommentAnnotation: ",t),vd("Error in onAddCommentAnnotation: ",t)}},this.captureAndAttachScreenshot=(t,e)=>this.nativeCapture.isActive()?(this.pendingScreenshotCount+=1,this.capturingScreenshot=!0,this.screenshotChain=this.screenshotChain.catch((()=>{})).then((()=>this.runCaptureAndAttach(t,e))).finally((()=>{this.pendingScreenshotCount=Math.max(0,this.pendingScreenshotCount-1),0===this.pendingScreenshotCount&&(this.capturingScreenshot=!1)})),this.screenshotChain):(this.logCaptureTrigger("skip: native capture not active",{annotationId:t,commentId:e}),Promise.resolve()),this.runCaptureAndAttach=async(t,e)=>{var i,o,n,r;try{this.logCaptureTrigger("capture start",{annotationId:t,commentId:e});const s=await this.nativeCapture.capture({focusAnnotationId:t}),a="image/webp"===s.blobType?"webp":"png",l=new File([s.blob],`screenshot-${t}.${a}`,{type:s.blobType}),c=await(null===(o=null===(i=this.commentElement)||void 0===i?void 0:i.addAttachment)||void 0===o?void 0:o.call(i,{annotationId:t,commentId:e,files:[l]}));if(c&&Array.isArray(c)&&c.length>0&&(null===(n=c[0])||void 0===n?void 0:n.valid)){const i=null===(r=c[0])||void 0===r?void 0:r.attachment;await this.commentElement.updateComment({annotationId:t,comment:{commentId:e,attachments:[i]},merge:!0}),this.logCaptureTrigger("capture attached",{annotationId:t,commentId:e})}else console.warn("Invalid screenshot file")}catch(t){console.warn("Native screenshot capture/attach failed: ",t),vd("Native screenshot capture/attach failed: ",t)}},this.setupSidebarAgentCommentFilter=()=>{var t,e,i,o,n,r;try{if(!this.commentElement)return;if("function"==typeof this.commentElement.on&&(this.commentElement.on("commentSidebarDataInit").subscribe((t=>{this.filterAgentCommentsFromSidebar(t)})),this.commentElement.on("commentSidebarDataUpdate").subscribe((t=>{const e=this.getSidebarGroupExpansionMap();this.filterAgentCommentsFromSidebar(t,e)}))),this.setupAgentWarningsHydration(),this.agentCommentsModeRequested)return this.setCommentSidebarVisibility(!0),void(this.showAgentCommentsInSidebar||(null===(e=null===(t=this.commentElement)||void 0===t?void 0:t.disableFilterCommentsOnDom)||void 0===e||e.call(t),this.showAgentCommentsInSidebar=!0));this.sidebarV2Enabled&&(this.showAgentCommentsInSidebar?null===(o=null===(i=this.commentElement)||void 0===i?void 0:i.disableFilterCommentsOnDom)||void 0===o||o.call(i):null===(r=null===(n=this.commentElement)||void 0===n?void 0:n.enableFilterCommentsOnDom)||void 0===r||r.call(n))}catch(t){console.warn("Error in setupSidebarAgentCommentFilter: ",t),vd("Error in setupSidebarAgentCommentFilter: ",t)}},this.setupAgentWarningsHydration=()=>{try{if(!this.commentElement||"function"!=typeof this.commentElement.getAllCommentAnnotations||!this.documentId)return;const t=this.commentElement.getAllCommentAnnotations(this.documentId+"");if(!t||"function"!=typeof t.subscribe)return;const e=t.subscribe((t=>{try{if(this.streamEmissionCount+=1,this.lastStreamEmissionAt=Date.now(),!this.sidebarV2Enabled&&!this.showAgentCommentsInSidebar)return;this.lastStreamAnnotations=Array.isArray(t)?t:[],this.processAgentComments(this.mergeOnboardingFetchedAnnotations(this.lastStreamAnnotations)),this.ensureOnboardingFindingsLoaded()}catch(t){console.warn("Error in agent-warnings hydration subscription: ",t),vd("Error in agent-warnings hydration subscription: ",t)}}));this.subscriptions.push(e)}catch(t){console.warn("Error in setupAgentWarningsHydration: ",t),vd("Error in setupAgentWarningsHydration: ",t)}},this.getContentWarningsDisplayCount=()=>{try{return this.contentWarningsCount>99?"99+":`${this.contentWarningsCount}`}catch(t){return console.warn("Error in getContentWarningsDisplayCount: ",t),"0"}},this.onContentWarningsButtonClick=()=>{try{this.showContentWarningSidebar=!this.showContentWarningSidebar}catch(t){console.warn("Error in onContentWarningsButtonClick: ",t),vd("Error in onContentWarningsButtonClick: ",t)}},this.onContentWarningSidebarClose=()=>{try{this.showContentWarningSidebar=!1}catch(t){console.warn("Error in onContentWarningSidebarClose: ",t)}},this.getOnboardingDismissedProjectIds=()=>{try{const t=Zc(Pt,!1,"sessionStorage");if(!t)return[];try{const e=JSON.parse(t);if(Array.isArray(e))return e.filter((t=>"string"==typeof t&&t.length>0))}catch{}return[t]}catch(t){return console.warn("Error in getOnboardingDismissedProjectIds: ",t),vd("Error in getOnboardingDismissedProjectIds: ",t),[]}},this.setOnboardingDismissedProjectIds=t=>{try{const e=t.slice(-20);if(0===e.length)return void Kc(Pt,"sessionStorage");Wc(Pt,JSON.stringify(e),!1,"sessionStorage")}catch(t){console.warn("Error in setOnboardingDismissedProjectIds: ",t),vd("Error in setOnboardingDismissedProjectIds: ",t)}},this.recordOnboardingSidebarDismissal=()=>{try{if(!this.projectId)return;const t=`${this.projectId}`,e=this.getOnboardingDismissedProjectIds().filter((e=>e!==t));this.setOnboardingDismissedProjectIds([...e,t])}catch(t){console.warn("Error in recordOnboardingSidebarDismissal: ",t),vd("Error in recordOnboardingSidebarDismissal: ",t)}},this.clearOnboardingSidebarDismissal=()=>{try{if(!this.projectId)return;const t=`${this.projectId}`,e=this.getOnboardingDismissedProjectIds();if(!e.includes(t))return;this.setOnboardingDismissedProjectIds(e.filter((e=>e!==t)))}catch(t){console.warn("Error in clearOnboardingSidebarDismissal: ",t),vd("Error in clearOnboardingSidebarDismissal: ",t)}},this.canShowTourCommentTooltip=()=>{try{return!(this.allFeatureDisabled||this.readOnlyMode||!this.showTourCommentTooltip)&&!(this.onboardingMode&&this.showContentWarningSidebar)}catch(t){return console.warn("Error in canShowTourCommentTooltip: ",t),vd("Error in canShowTourCommentTooltip: ",t),!1}},this.autoOpenOnboardingSidebar=()=>{try{if(!this.onboardingMode||this.allFeatureDisabled)return;if(!this.projectId)return;if(this.getOnboardingDismissedProjectIds().includes(`${this.projectId}`))return;this.showContentWarningSidebar=!0}catch(t){console.warn("Error in autoOpenOnboardingSidebar: ",t),vd("Error in autoOpenOnboardingSidebar: ",t)}},this.restoreContentWarningSidebarState=()=>{var t,e;try{if(this.onboardingMode)return this.autoOpenOnboardingSidebar(),void(this.showContentWarningSidebar&&(this.showAgentCommentsInSidebar?null===(e=null===(t=this.commentElement)||void 0===t?void 0:t.disableFilterCommentsOnDom)||void 0===e||e.call(t):this.setCommentSidebarVisibility(!0)));const i="true"===Zc(ge,!1,"sessionStorage"),o=new URL(window.location.href).searchParams.has(Ht);if(!i)return;if(!o)return;if(this.allFeatureDisabled||"Admin"!==this.snippylyUserRole)return;this.showContentWarningSidebar=!0}catch(t){console.warn("Error in restoreContentWarningSidebarState: ",t),vd("Error in restoreContentWarningSidebarState: ",t)}},this.navigateTo=t=>{try{window.location.href=t}catch(t){console.warn("Error in navigateTo: ",t),vd("Error in navigateTo: ",t)}},this.onContentWarningSidebarAddAll=()=>{},this.onContentWarningItemClick=t=>{var e,i,o;try{const n=null===(e=null==t?void 0:t.detail)||void 0===e?void 0:e.annotation;if(!(null==n?void 0:n.annotationId)&&!(null==n?void 0:n.id))return;const r=(null==n?void 0:n.annotationId)||(null==n?void 0:n.id),s=null===(i=null==n?void 0:n.pageInfo)||void 0===i?void 0:i.url;if(s&&!this.isCurrentPageUrl(s)){if(this.showContentWarningSidebar&&Wc(ge,"true",!1,"sessionStorage"),this.isRunningUnderPreviewProxy()){return void(!(null!==nd(s))&&window.parent&&window.parent!==window&&window.parent.postMessage({type:Ut,url:s,annotationId:r},"*"))}const t=new URL(s);return t.searchParams.set(Ht,r),void this.navigateTo(t.toString())}(null===(o=this.commentElement)||void 0===o?void 0:o.selectCommentByAnnotationId)&&this.commentElement.selectCommentByAnnotationId(r),setTimeout((()=>{var t;(null===(t=this.commentElement)||void 0===t?void 0:t.scrollToCommentByAnnotationId)&&this.commentElement.scrollToCommentByAnnotationId(r)}),150)}catch(t){console.warn("Error in onContentWarningItemClick: ",t),vd("Error in onContentWarningItemClick: ",t)}},this.isCurrentPageUrl=t=>{var e;try{const i=null!==(e=nd(t))&&void 0!==e?e:new URL(t).pathname;return i===(this.isRunningUnderPreviewProxy()?this.previewLocationPath||"/":window.location.pathname)}catch{return!1}},this.setupVeltButtonClickListener=()=>{try{if(!(null===Velt||void 0===Velt?void 0:Velt.on))return void console.warn("[CWS Toolbar] Velt.on not available for button click listener");Velt.on("veltButtonClick").subscribe((t=>{var e;try{if(!t)return;const i=null===(e=null==t?void 0:t.buttonContext)||void 0===e?void 0:e.clickedButtonId,o=null==t?void 0:t.commentAnnotation,n=(null==o?void 0:o.annotationId)||(null==o?void 0:o.id),r="accept-suggestion"===i||"reject-suggestion"===i;if(r&&n&&this.processingAnnotationIds.has(n))return;if(r&&this.isRunningUnderPreviewProxy()&&"Admin"!==this.snippylyUserRole)return void console.warn("[CWS Toolbar] Only admins can accept or reject suggestions. Ignoring under the preview proxy:",i);"prev-suggestion"===i?this.navigateSuggestion(o,"prev"):"next-suggestion"===i?this.navigateSuggestion(o,"next"):"accept-suggestion"===i?this.handleAcceptSuggestion(o):"reject-suggestion"===i&&this.handleDeclineSuggestion(o)}catch(t){console.warn("Error in veltButtonClick handler: ",t)}})),this.commentElement.onCommentSelectionChange().subscribe((t=>{this.handleCommentSelection(t)}))}catch(t){console.warn("Error in setupVeltButtonClickListener: ",t),vd("Error in setupVeltButtonClickListener: ",t)}},this.navigateSuggestion=(t,e)=>{var i,o,n,r,s;try{if(!t)return void console.warn("[CWS Toolbar] No annotation provided for navigation");const a=null===(o=null===(i=null==t?void 0:t.agent)||void 0===i?void 0:i.result)||void 0===o?void 0:o.incorrectWord;if(!a)return void console.warn("[CWS Toolbar] No incorrectWord found on annotation");const l=this.findMatchingWarning(a);if(!l)return void console.warn("[CWS Toolbar] No matching warning found for word:",a);const c=null===(n=null==t?void 0:t.pageInfo)||void 0===n?void 0:n.path,d=this.normalizePagePath(c),h=null===(r=null==l?void 0:l.annotations)||void 0===r?void 0:r.filter((t=>{var e;const i=null===(e=null==t?void 0:t.pageInfo)||void 0===e?void 0:e.path;return this.normalizePagePath(i)===d}));if(!(null==h?void 0:h.length)||h.length<=1)return;const u=(null==t?void 0:t.annotationId)||(null==t?void 0:t.id),p=h.findIndex((t=>((null==t?void 0:t.annotationId)||(null==t?void 0:t.id))===u));if(-1===p)return void console.warn("[CWS Toolbar] Current annotation not found in warning group");let v;v="next"===e?(p+1)%h.length:(p-1+h.length)%h.length;const g=h[v],f=(null==g?void 0:g.annotationId)||(null==g?void 0:g.id);f&&((null===(s=this.commentElement)||void 0===s?void 0:s.selectCommentByAnnotationId)&&this.commentElement.selectCommentByAnnotationId(f),setTimeout((()=>{var t;(null===(t=this.commentElement)||void 0===t?void 0:t.scrollToCommentByAnnotationId)&&this.commentElement.scrollToCommentByAnnotationId(f)}),150))}catch(t){console.warn("Error in navigateSuggestion: ",t),vd("Error in navigateSuggestion: ",t)}},this.findMatchingWarning=t=>{var e;try{for(const i of this.agentGroups){const o=null===(e=null==i?void 0:i.warnings)||void 0===e?void 0:e.find((e=>(null==e?void 0:e.primaryText)===t));if(o)return o}return null}catch(t){return console.warn("Error in findMatchingWarning: ",t),null}},this.removeAnnotationFromWarnings=t=>{var e,i,o;try{if(!t)return;const n=e=>{var i,o,n,r;for(const s of e){const e=null===(i=null==s?void 0:s.annotations)||void 0===i?void 0:i.find((e=>((null==e?void 0:e.annotationId)||(null==e?void 0:e.id))===t));if(e){const t="grammar"===(null===(n=null===(o=null==e?void 0:e.agent)||void 0===o?void 0:o.result)||void 0===n?void 0:n.type)?this.grammarSuggestionPagePathMap:this.spellingSuggestionPagePathMap,i=(null==s?void 0:s.primaryText)||"",a=null===(r=null==e?void 0:e.pageInfo)||void 0===r?void 0:r.path,l=this.normalizePagePath(a);if(i&&l&&t.has(i)){const e=t.get(i),o=e.get(l)||0;o>1?e.set(l,o-1):(e.delete(l),0===e.size&&t.delete(i))}return}}};for(const t of this.agentGroups)(null==t?void 0:t.agentId)!==Se.SPELL_CHECK&&(null==t?void 0:t.agentId)!==Se.GRAMMAR_CHECK||n(t.warnings);const r=null!==(o=null===(i=null===(e=this.agentGroups)||void 0===e?void 0:e.map((e=>{var i,o,n,r,s;const a=null!==(n=null===(o=null===(i=null==e?void 0:e.warnings)||void 0===i?void 0:i.map((e=>{var i;const o=null===(i=null==e?void 0:e.annotations)||void 0===i?void 0:i.filter((e=>((null==e?void 0:e.annotationId)||(null==e?void 0:e.id))!==t));return o&&0!==o.length?{...e,annotations:o,occurrences:o.length}:null})))||void 0===o?void 0:o.filter((t=>null!==t)))&&void 0!==n?n:[],l=null!==(s=null===(r=null==e?void 0:e.annotations)||void 0===r?void 0:r.filter((e=>((null==e?void 0:e.annotationId)||(null==e?void 0:e.id))!==t)))&&void 0!==s?s:[];return 0===a.length?null:{...e,warnings:a,warningCount:a.length,annotations:l}})))||void 0===i?void 0:i.filter((t=>null!==t)))&&void 0!==o?o:[];this.agentGroups=r;const s=r.reduce(((t,e)=>t+e.warningCount),0);this.contentWarningsCount=s,this.hasContentWarnings=s>0,this.onboardingFetchedAnnotations=this.onboardingFetchedAnnotations.filter((e=>((null==e?void 0:e.annotationId)||(null==e?void 0:e.id))!==t)),this.onboardingMode&&(this.onboardingRemovedAnnotationIds.add(t),this.setOnboardingUnsyncedAnnotationIds(this.onboardingFetchedAnnotations.map((t=>null==t?void 0:t.annotationId))))}catch(t){console.warn("Error in removeAnnotationFromWarnings: ",t)}},this.setSuggestionButtonsLoading=(t,e,i)=>{try{const o=i||document.querySelector(".velt-comment-dialog.selected");if(!o)return;const n=o.querySelector(".sf-accept-btn"),r=o.querySelector(".sf-reject-btn");if(e){const e="accept"===t?n:r,i="accept"===t?r:n;null==e||e.classList.add("sf-btn-loading"),null==i||i.classList.add("sf-btn-disabled")}else null==n||n.classList.remove("sf-btn-loading","sf-btn-disabled"),null==r||r.classList.remove("sf-btn-loading","sf-btn-disabled")}catch(t){console.warn("Error in setSuggestionButtonsLoading: ",t)}},this.handleAcceptSuggestion=async t=>{var e,i,o;try{const n=(null==t?void 0:t.annotationId)||(null==t?void 0:t.id);if(!n)return void console.warn("[CWS Toolbar] handleAcceptSuggestion: No annotationId found",t);if(this.processingAnnotationIds.has(n))return;const r=(null===(e=this.snippylyUser)||void 0===e?void 0:e.userId)||(null===(i=this.snippylyUser)||void 0===i?void 0:i.uid),s=(null===(o=this.snippylyUser)||void 0===o?void 0:o.email)||"";if(!r)return void console.warn("[CWS Toolbar] handleAcceptSuggestion: No user available");if(!this.documentId)return void console.warn("[CWS Toolbar] handleAcceptSuggestion: No documentId available");this.processingAnnotationIds.add(n);const a=document.querySelector(".velt-comment-dialog.selected");this.setSuggestionButtonsLoading("accept",!0,a);try{await Ld(this.apiKey,this.apiKey,this.documentId+"",n,{userId:r,email:s}),this.removeAnnotationFromWarnings(n)}finally{this.processingAnnotationIds.delete(n),this.setSuggestionButtonsLoading("accept",!1,a)}}catch(t){console.warn("Error in handleAcceptSuggestion: ",t),vd("Error in handleAcceptSuggestion: ",t)}},this.handleDeclineSuggestion=async t=>{var e,i,o;try{const n=(null==t?void 0:t.annotationId)||(null==t?void 0:t.id);if(!n)return void console.warn("[CWS Toolbar] handleDeclineSuggestion: No annotationId found",t);if(this.processingAnnotationIds.has(n))return;if(!this.documentId)return void console.warn("[CWS Toolbar] handleDeclineSuggestion: No documentId available");this.processingAnnotationIds.add(n);const r=document.querySelector(".velt-comment-dialog.selected");this.setSuggestionButtonsLoading("reject",!0,r);const s=(null===(e=this.snippylyUser)||void 0===e?void 0:e.userId)||(null===(i=this.snippylyUser)||void 0===i?void 0:i.uid),a=(null===(o=this.snippylyUser)||void 0===o?void 0:o.email)||"";try{await Dd(this.apiKey,this.apiKey,this.documentId+"",n,s?{userId:s,email:a}:void 0),this.removeAnnotationFromWarnings(n)}finally{this.processingAnnotationIds.delete(n),this.setSuggestionButtonsLoading("reject",!1,r)}}catch(t){console.warn("Error in handleDeclineSuggestion: ",t),vd("Error in handleDeclineSuggestion: ",t)}},this.showFirstCommentNudge=()=>{try{if(!this.autoCommentModeRequested||this.autoCommentModeArmedOnce||this.addCommentMode)return;this.firstCommentNudge=!0,this.showTourCommentTooltip=!0}catch(t){console.warn("Error in showFirstCommentNudge: ",t),vd("Error in showFirstCommentNudge: ",t)}},this.disableCommentMode=()=>{var t;try{(null===(t=this.commentElement)||void 0===t?void 0:t.disableCommentMode)&&this.commentElement.disableCommentMode()}catch(t){console.warn("Error in disableAddCommentMode: ",t),vd("Error in disableAddCommentMode: ",t)}},this.disableCommentModeButton=()=>{try{return this.addCommentMode?L`
5836
+ `}catch(t){return console.warn("Error in getWordMark: ",t),L``}},this.generateLocation=()=>{try{if(this.autoLocation){const t=new URL(document.location).searchParams,e=new URL(document.location);e.searchParams.delete(Et),e.searchParams.delete(kt),e.searchParams.delete(Bt),e.searchParams.delete(Ht),e.searchParams.delete(Qt),e.searchParams.delete(Xt);const i=t.get(qt)||this.projectVersion;this.queryParamsComments||(e.search="");let o=(t=>{try{return t.replace(/#.*$/,"")}catch(e){return console.warn("Error in removeHashFromUrl: ",e),vd("Error in removeHashFromUrl: ",e),t}})(e.href);this.projectId&&(o=null==o?void 0:o.replace(window.location.origin,"")),this.location={url:o,version:i}}}catch(t){console.warn("Error in generateLocation: ",t),vd("Error in generateLocation: ",t)}},this.setLocation=t=>{var e,i,o,n;try{if(this.autoLocation&&window.Velt&&(null===Velt||void 0===Velt?void 0:Velt.setLocation)){if(this.version?(this.location||(this.location={}),this.location.version=this.version):this.location&&delete this.location.version,!(null==t?void 0:t.forceSetLocation)&&this.previousLocation&&(null===(e=this.previousLocation)||void 0===e?void 0:e.url)===(null===(i=this.location)||void 0===i?void 0:i.url)&&(null===(o=this.previousLocation)||void 0===o?void 0:o.version)===(null===(n=this.location)||void 0===n?void 0:n.version))return;const r=Hc(JSON.parse(JSON.stringify(this.location)));if(r?this.location.id=`${r}`:delete this.location.id,this.usePageTitleAsLocationName){const t=document.title;t&&(this.location.locationName=t)}null===Velt||void 0===Velt||Velt.setLocation(JSON.parse(JSON.stringify(this.location))),hd({clientLocation:this.location}),this.previousLocation=JSON.parse(JSON.stringify(this.location)),this.onVeltLocationChange()}}catch(t){console.warn("Error in setLocation: ",t),vd("Error in setLocation: ",t)}},this.onVeltLocationChange=()=>{try{window.dispatchEvent(new CustomEvent("veltLocationChange",{detail:this.location}))}catch(t){console.warn("Error in onVeltLocationChange: ",t),vd("Error in onVeltLocationChange: ",t)}},this.identifySnippyly=async()=>{var t,e,i,o;let n="",r="";try{this.invalidApiKey=!1;let o,s={name:"Default User",email:"default@usesuperflow.com",userId:"default",isAnonymous:!0,organizationId:this.apiKey};o=this.customLoginEnabled&&this.providedUser?this.providedUser:Qc(),Hs("[Superflow][identify] resolved user (pre-iam)",{source:this.customLoginEnabled&&this.providedUser?"providedUser":"token",email:null==o?void 0:o.email,userId:null==o?void 0:o.userId,name:null==o?void 0:o.name,isAnonymous:null==o?void 0:o.isAnonymous});const a=await this.getSamlConfig(),l=new URL(document.location);if(l.searchParams.has(Wt)&&l.searchParams.delete(Wt),a&&(this.signInUrl=`${je}saml/${a.slug}/login?redirect_url=${encodeURIComponent(null==l?void 0:l.toString())}&source=sf`,window.Superflow.signInUrl=this.signInUrl),(null==o?void 0:o.email)&&(s=o),s.isAnonymous)delete s.groupId;else{const t=Velt.getDocumentId()||this.serverDocumentId;t&&(s.groupId=t+"")}if(this.customLoginEnabledLocally||(null===(t=null==s?void 0:s.contacts)||void 0===t?void 0:t.length)&&(s.contacts=[]),n=null==s?void 0:s.email,r=null==s?void 0:s.userId,(null==s?void 0:s.isAnonymous)&&this.projectId&&this.guestMode){const t=td(!0,this.apiKey);t&&(s=JSON.parse(JSON.stringify(t)))}(null==s?void 0:s.isAnonymous)||(this.loading=!0);const c={};(null==s?void 0:s.groupId)&&(c.groupId=null==s?void 0:s.groupId),s.organizationId=this.apiKey;const d=await wd(this.apiKey,this.projectId||"",null==s?void 0:s.email,null==s?void 0:s.userId),h=null==d?void 0:d.isAdmin;this.snippylyUserRole=h?"Admin":"Commenter",this.applyPreviewProxyReadOnlyStyles(),Hs("[Superflow][identify] iamResponse",d,{isAdminUser:h,snippylyUserRole:this.snippylyUserRole,email:null==s?void 0:s.email,userId:null==s?void 0:s.userId});const u=!(this.customLoginEnabled&&this.providedUser),p=((t,e)=>!(!e||(null==t?void 0:t.isAnonymous)||(null==t?void 0:t.isGuest)||!(null==t?void 0:t.userId)))(s,u),v=p&&((t,e)=>{try{if(!t||!e)return!1;const i=!!e.name&&e.name!==t.name,o=!!e.photoUrl&&e.photoUrl!==t.photoUrl;return Hs("[Superflow][identity] hasProfileChanged",{nameChanged:i,photoChanged:o,localName:t.name,savedName:e.name,localPhotoUrl:t.photoUrl,savedPhotoUrl:e.photoUrl}),i||o}catch(t){return console.warn("Error in hasProfileChanged: ",t),vd("Error in hasProfileChanged: ",t),!1}})(s,d);if(Hs("[Superflow][identify] enrichment gate",{cameFromToken:u,willEnrichIdentity:p,profileChanged:v,forceReset:v,isAnonymous:null==s?void 0:s.isAnonymous,isGuest:null==s?void 0:s.isGuest,userId:null==s?void 0:s.userId,nameBefore:null==s?void 0:s.name}),p&&(s=((t,e)=>t&&e?{...t,name:e.name||t.name,photoUrl:e.photoUrl||t.photoUrl}:t)(s,d),Hs("[Superflow][identify] enriched user",{nameAfter:null==s?void 0:s.name,photoUrl:null==s?void 0:s.photoUrl})),h&&(c.isAdmin=h,h&&this.allFeatureDisabled&&(this.allFeatureDisabled=!1)),this.restoreContentWarningSidebarState(),!this.projectDeleted&&(null==s?void 0:s.userId)&&!(null==s?void 0:s.isGuest)&&!(null==s?void 0:s.isAnonymous)&&this.documentId)try{await Id(this.apiKey,this.documentId,s.userId,s.name,s.email)}catch(t){vd("checkDocumentUserAndCreateError",t)}Hs("[Superflow][identify] setVeltAuthProvider options",{forceReset:v,profileChanged:v,userName:null==s?void 0:s.name,userId:null==s?void 0:s.userId});const[g]=await Promise.all([Velt.setVeltAuthProvider({user:s,options:{throwError:!0,forceReset:v},retryConfig:{retryCount:3,retryDelay:1e3},generateToken:async()=>await kd(this.apiKey,null==s?void 0:s.userId,c),onError:t=>{console.log("Error signing to velt - ",t),this.invalidApiKey=!0}}),this.fetchAndApplyFeatureAccess()]);if(this.hasAgentAccess&&this.insertShadowDOM(),this.invalidApiKey)throw"Invalid Api Key - Domain Not Whitelisted";p&&((t=>{try{const e={userId:null==t?void 0:t.userId,name:null==t?void 0:t.name,email:null==t?void 0:t.email,photoUrl:null==t?void 0:t.photoUrl},i=Jc(JSON.stringify(e),ze,Be);Wc(Zt,i,!0)}catch(t){console.warn("Error in saveUserToken: ",t),vd("Error in saveUserToken: ",t)}})(s),Hs("[Superflow][identify] token rewritten post-signin, re-read",{persistedName:null===(e=Qc())||void 0===e?void 0:e.name})),Hs("[Superflow][identify] velt auth response",{name:null==g?void 0:g.name,email:null==g?void 0:g.email,userId:null==g?void 0:g.userId,userSnippylyId:null==g?void 0:g.userSnippylyId,tokenUserProperties:c}),ud(JSON.parse(JSON.stringify(g||{}))),(null==s?void 0:s.isAnonymous)||(this.snippylyUser=JSON.parse(JSON.stringify(s)),Hs("[Superflow][identify] this.snippylyUser (rendered) name",null===(i=this.snippylyUser)||void 0===i?void 0:i.name));const f=JSON.parse(JSON.stringify(g||{}));if((null==f?void 0:f.userSnippylyId)&&!(null==f?void 0:f.isGuest)&&this.checkToMigrateGuestUser(f),Velt.getUserRole$().subscribe((t=>{var e;t&&(this.loading=!1,null===(e=this.commentElement)||void 0===e||e.enablePriority())})),this.contactListSubscription=Velt.getContactElement().getContactList().subscribe((t=>{var e;this.loading=!1,(null===(e=null==t?void 0:t.organizationUsers)||void 0===e?void 0:e.length)>0&&(this.checkPrivateCommentModeFromStorage(),this.contactListSubscription&&(this.contactListSubscription.unsubscribe(),this.contactListSubscription=null))})),(null===Velt||void 0===Velt?void 0:Velt.isPlanExpired$)&&(null===Velt||void 0===Velt||Velt.isPlanExpired$().subscribe((t=>{this.isPlanExpired=t}),(t=>{this.isPlanExpired=!1,console.warn("Error in isPlanExpired$: ",t),vd("Error in isPlanExpired$: ",t)}))),null===Velt||void 0===Velt?void 0:Velt.on){let t;null===Velt||void 0===Velt||Velt.on("initUpdate").subscribe((e=>{"setDocumentsSuccess"===e.event&&(t&&(t.unsubscribe(),t=null),t=null===Velt||void 0===Velt?void 0:Velt.getDocumentMetadata().subscribe((async t=>{await this.handleDocumentMetadataUpdate(t)}),(t=>{console.warn("Error in getDocumentMetadata: ",t),vd("Error in getDocumentMetadata: ",t)})))}))}hd({clientUserId:null==s?void 0:s.userId});try{pd(s)}catch(t){console.warn("Error in trackIdentifyEvent: ",t)}this.getComments(),this.checkGlobalUserContact(),this.showFirstCommentNudge(),setTimeout((()=>{Zc(ee)||this.autoCommentModeArmedOnce||(this.showTourCommentTooltip=!0)}),2e3)}catch(t){if(this.loading=!1,this.signInError=!0,t&&"string"==typeof t&&(null===(o=null==t?void 0:t.toLowerCase())||void 0===o?void 0:o.includes("invalid"))){this.invalidApiKey=!0,gd(vt.Events.DOMAIN_NOT_WHITELISTED),this.projectId&&md(this.apiKey,this.projectId);if(new URL(document.location).searchParams.has(Qt))this.isSigningInUserAdmin=!0;else if(Zc(ie))this.isSigningInUserAdmin="true"===Zc(ie,!0);else{const t=await wd(this.apiKey,this.projectId||"",n,r);this.isSigningInUserAdmin=!!(null==t?void 0:t.isAdmin),Wc(ie,this.isSigningInUserAdmin+"",!0)}}console.warn("Error in identifySnippyly: ",t),vd("Error in identifySnippyly: ",t)}},this.handleDocumentMetadataUpdate=async t=>{try{if(!t)return;const e=await yd(this.apiKey,null==t?void 0:t.clientDocumentId);od(e,this.isDriveOrPreviewHost(),this.projectIdSupplied)&&this.lockForDeletedProject(),this.setProjectConfigVariables("ok"===e.status?e.config:null),await this.fetchAndApplyFeatureAccess()}catch(t){console.warn("Error in handleDocumentMetadataUpdate: ",t),vd("Error in handleDocumentMetadataUpdate: ",t)}},this.lockForDeletedProject=()=>{this.projectDeleted=!0,this.applyVeltFeatureGates(),this.unmountVeltCollaborationElements()},this.fetchAndApplyFeatureAccess=async()=>{var t,e;try{const i=await Nd(this.apiKey);if("error"===i.status||!i.featureAccess)return void console.warn("getFeatureAccess failed or returned no data; keeping the last known feature access");this.featureAccess=i.featureAccess,this.planLimitLocked=(t=>{var e;try{return!0===(null===(e=null==t?void 0:t.planStatus)||void 0===e?void 0:e.isOverPlanLimits)}catch(t){return!1}})(this.featureAccess),this.applyVeltFeatureGates(),this.applyStorageFeatureAccess();const o=null===(t=this.featureAccess)||void 0===t?void 0:t[$d.Agents];this.hasAgentAccess=!0===(null==o?void 0:o.hasAccess);const n=null===(e=this.featureAccess)||void 0===e?void 0:e[$d.WorkspacePrivateComments];this.hasPrivateCommentsAccess=!0===(null==n?void 0:n.hasAccess),this.isPrivateCommentsEnabledOnWorkspace=!0===(null==n?void 0:n.isPrivateCommentsEnabled),!this.canShowPrivateCommentToggle&&this.privateCommentModeEnabled&&(this.disablePrivateCommentModeOnCommentElement(),this.privateCommentModeEnabled=!1,Wc(le,"false")),this.maybeApplyVisibilityOptionsToCommentElement()}catch(t){console.warn("Error in fetchAndApplyFeatureAccess: ",t),vd("Error in fetchAndApplyFeatureAccess: ",t)}},this.insertShadowDOM=()=>{try{if(document.querySelector("velt-wireframe"))return;const t=document.querySelector("velt-comments");t&&t.setAttribute("shadow-dom","true");const e=document.querySelector(`${Me.VELT_COMMENTS_SIDEBAR_LEGACY}, ${Me.VELT_COMMENTS_SIDEBAR_V2}`);e&&e.setAttribute("shadow-dom","true")}catch(t){console.warn("Error in insertShadowDOM: ",t),vd("Error in insertShadowDOM: ",t)}},this.applyStorageFeatureAccess=()=>{try{if(!this.featureAccess||!this.commentElement)return;const t=this.featureAccess[$d.Storage];(null==t?void 0:t.hasUsageExhausted)&&(this.commentElement.disableAttachments(),this.commentElement.setRecordings("none"))}catch(t){vd("Error in applyStorageFeatureAccess: ",t)}},this.checkToMigrateGuestUser=async t=>{try{const e=td(!1,this.apiKey);e&&(await Sd(this.apiKey,this.projectId||"",e,t,!0),Kc(Kt))}catch(t){console.warn("Error in checkToMigrationGuestUser: ",t),vd("Error in checkToMigrationGuestUser: ",t)}},this.getComments=()=>{try{this.commentElement&&this.commentSubscription&&this.commentSubscription.unsubscribe()}catch(t){console.warn("Error in getComments: ",t),vd("Error in getComments: ",t)}},this.handleCommentSelection=t=>{var e,i,o,n,r,s,a,l,c,d;try{if(!1===(null==t?void 0:t.selected))return void(null===(e=null===Velt||void 0===Velt?void 0:Velt.setUiState)||void 0===e||e.call(Velt,{showButtons:!1}));const h=null==t?void 0:t.annotation;if(!h||!this.isAgentAnnotation(h))return void(null===(i=null===Velt||void 0===Velt?void 0:Velt.setUiState)||void 0===i||i.call(Velt,{showButtons:!1}));const u=null===(n=null===(o=null==h?void 0:h.agent)||void 0===o?void 0:o.result)||void 0===n?void 0:n.incorrectWord,p=(null===(r=null==h?void 0:h.pageInfo)||void 0===r?void 0:r.path)||(null===(s=null==h?void 0:h.location)||void 0===s?void 0:s.path)||(null===(a=null==h?void 0:h.agent)||void 0===a?void 0:a.path);if(!u||!p)return void(null===(l=null===Velt||void 0===Velt?void 0:Velt.setUiState)||void 0===l||l.call(Velt,{showButtons:!1}));const v=this.normalizePagePath(p),g=u,f=null===(d=null===(c=null==h?void 0:h.agent)||void 0===c?void 0:c.result)||void 0===d?void 0:d.type;let m,w="";"grammar"===f?(m=this.grammarSuggestionPagePathMap,w="grammar"):(m=this.spellingSuggestionPagePathMap,w="spelling");const y=null==m?void 0:m.get(g);((null==y?void 0:y.get(v))||0)<=1?Velt.setUiState({showButtons:!1,warningType:w}):Velt.setUiState({showButtons:!0,warningType:w})}catch(t){console.warn("Error in handleCommentSelection: ",t),vd("Error in handleCommentSelection: ",t)}},this.processAgentComments=t=>{var e,i,o;try{const n=Array.isArray(t)?t:[];n.length&&!this.agentNamesFetched&&this.apiKey&&this.fetchAgentNames();const r=n.filter((t=>{var e;const i=(null===(e=null==t?void 0:t.status)||void 0===e?void 0:e.type)===xe;return this.isAgentAnnotation(t)&&!i}));if(this.sidebarV2Enabled&&!this.showAgentCommentsInSidebar&&0===r.length&&this.agentGroups.length>0)return;if(0===r.length)return this.hasContentWarnings=!1,this.contentWarningsCount=0,this.agentGroups=[],this.spellingSuggestionPagePathMap=new Map,void(this.grammarSuggestionPagePathMap=new Map);const s=new Map;for(const t of r){const i=this.extractAgentId((null===(e=null==t?void 0:t.agent)||void 0===e?void 0:e.agentFields)||[]);if(!i)continue;const o=s.get(i);o?o.push(t):s.set(i,[t])}const a=[],l=new Map,c=new Map;for(const[t,e]of s){const n=this.isCustomAgent((null===(o=null===(i=e[0])||void 0===i?void 0:i.agent)||void 0===o?void 0:o.agentFields)||[]),r=this.resolveAgentDisplayName(t),{warnings:s,warningCount:d}=this.buildAgentWarnings(t,e,l,c);a.push({agentId:t,agentName:r,isCustom:n,warningCount:d,warnings:s,annotations:e})}if(a.sort(((t,e)=>e.warningCount-t.warningCount)),this.agentGroups=a,this.onboardingMode)for(const t of a)this.onboardingOpenedAgentIds.add(t.agentId);const d=a.reduce(((t,e)=>t+e.warningCount),0);this.contentWarningsCount=d,this.hasContentWarnings=d>0,this.spellingSuggestionPagePathMap=l,this.grammarSuggestionPagePathMap=c}catch(t){console.warn("Error in processAgentComments: ",t),vd("Error in processAgentComments: ",t)}},this.extractAgentId=t=>{try{if(!Array.isArray(t)||0===t.length)return null;for(const e of t)if(null==e?void 0:e.startsWith(ke.AGENT))return e.substring(ke.AGENT.length);return null}catch(t){return console.warn("Error in extractAgentId: ",t),null}},this.isCustomAgent=t=>{try{return!!Array.isArray(t)&&t.includes(ke.AGENT_TYPE_CUSTOM)}catch(t){return console.warn("Error in isCustomAgent: ",t),!1}},this.resolveAgentDisplayName=t=>{var e,i;try{return null!==(i=null===(e=this.agentNameMap)||void 0===e?void 0:e.get(t))&&void 0!==i?i:this.getAgentNameFromId(t)}catch(t){return console.warn("Error in resolveAgentDisplayName: ",t),Vt}},this.getAgentNameFromId=t=>{try{return t&&/^[a-z]+(-[a-z]+)*$/.test(t)?t.split("-").map((t=>`${t.charAt(0).toUpperCase()}${t.slice(1)}`)).join(" "):Vt}catch(t){return console.warn("Error in getAgentNameFromId: ",t),Vt}},this.fetchAgentNames=async()=>{var t,e,i;try{this.agentNamesFetched=!0;const{getAgents:o}=await Promise.resolve().then((function(){return Fd})),n=await o(this.apiKey),r=new Map;for(const i of n){const o=null!==(t=null==i?void 0:i.id)&&void 0!==t?t:"",n=null!==(e=null==i?void 0:i.name)&&void 0!==e?e:"";o&&n&&r.set(o,n)}if(this.agentNameMap=r,(null===(i=this.agentGroups)||void 0===i?void 0:i.length)>0){const t=this.agentGroups.map((t=>({...t,agentName:this.resolveAgentDisplayName(t.agentId)})));this.agentGroups=t}}catch(t){this.agentNamesFetched=!1,console.warn("Error in fetchAgentNames: ",t)}},this.sanitiseAgentRunStatusRows=t=>{try{const e=[],i=Array.isArray(t)?t.slice(0,50):[];for(const t of i){const i=null==t?void 0:t.agentId;if("string"!=typeof i||0===i.length)continue;const o=("string"==typeof(null==t?void 0:t.name)&&t.name.length>0?t.name:this.resolveAgentDisplayName(i)).slice(0,80),n="string"==typeof(null==t?void 0:t.status)&&Rt.includes(t.status),r=!0!==(null==t?void 0:t.terminal)&&!n,s=null==t?void 0:t.findings,a="number"==typeof s&&Number.isFinite(s)&&s>=0?Math.floor(s):0;e.push(n?{agentId:i,agentName:o,isRunning:r,findingsCount:a,failed:!0}:{agentId:i,agentName:o,isRunning:r,findingsCount:a})}return e}catch(t){return console.warn("Error in sanitiseAgentRunStatusRows: ",t),vd("Error in sanitiseAgentRunStatusRows: ",t),[]}},this.getPortalOrigins=()=>{try{if(this.portalOrigins)return this.portalOrigins;const t=new Set;for(const e of[je,Ue])try{const{origin:i,hostname:o,protocol:n}=new URL(e);t.add(i),o.endsWith(".firebaseapp.com")?t.add(`${n}//${o.replace(/\.firebaseapp\.com$/,".web.app")}`):o.endsWith(".web.app")&&t.add(`${n}//${o.replace(/\.web\.app$/,".firebaseapp.com")}`)}catch{}return this.portalOrigins=[...t],this.portalOrigins}catch(t){return console.warn("Error in getPortalOrigins: ",t),vd("Error in getPortalOrigins: ",t),[]}},this.isAllowedPortalOrigin=t=>{try{if("string"!=typeof t||0===t.length||"null"===t)return!1;if(this.getPortalOrigins().includes(t))return!0;const{protocol:e,hostname:i}=new URL(t);return!("http:"!==e&&"https:"!==e||"localhost"!==i&&"127.0.0.1"!==i)}catch{return!1}},this.readAncestorOrigins=()=>{var t;try{const e=null===(t=window.location)||void 0===t?void 0:t.ancestorOrigins;return e?Array.from(e):null}catch{return null}},this.readDocumentReferrer=()=>{try{return document.referrer||""}catch{return""}},this.getParentFrameOrigin=()=>{try{if(!window.parent||window.parent===window)return null;const t=this.readAncestorOrigins();if(t)return t[0]||null;const e=this.readDocumentReferrer();return e?new URL(e).origin:null}catch{return null}},this.isFramedByPortal=()=>{try{return this.isAllowedPortalOrigin(this.getParentFrameOrigin())}catch(t){return console.warn("Error in isFramedByPortal: ",t),vd("Error in isFramedByPortal: ",t),!1}},this.canHonourStoredOnboardingFlag=()=>{try{if(!window.parent||window.parent===window)return!1;const t=this.readAncestorOrigins();return!t||this.isAllowedPortalOrigin(t[0])}catch(t){return console.warn("Error in canHonourStoredOnboardingFlag: ",t),vd("Error in canHonourStoredOnboardingFlag: ",t),!1}},this.getPortalTargetOrigin=()=>{try{const t=this.getParentFrameOrigin();return t&&this.isAllowedPortalOrigin(t)?t:"*"}catch{return"*"}},this.startAgentRunStatusListener=()=>{try{if(!this.onboardingMode||!this.isConnected)return void this.stopAgentRunStatusListener();if(this.agentRunStatusListening)return;if(!window.parent||window.parent===window)return void(this.agentRunStatusSettled=!0);if(window.addEventListener("message",this.onAgentRunStatusMessage),this.agentRunStatusListening=!0,this.startOnboardingViewportListener(),window.parent.postMessage({type:Nt},this.getPortalTargetOrigin()),this.agentRunStatusSettled){if(this.agentRunStatuses.some((t=>null==t?void 0:t.isRunning))){const t=this.agentRunStatusLastMessageAt>0?Date.now()-this.agentRunStatusLastMessageAt:0;this.armAgentRunStatusWatchdog(Math.max(0,Dt-t))}}else this.armAgentRunStatusWatchdog(2e4);this.ensureOnboardingFindingsLoaded()}catch(t){console.warn("Error in startAgentRunStatusListener: ",t),vd("Error in startAgentRunStatusListener: ",t)}},this.stopAgentRunStatusListener=()=>{try{window.removeEventListener("message",this.onAgentRunStatusMessage),this.agentRunStatusListening=!1,this.clearAgentRunStatusWatchdog(),this.clearOnboardingFindingsFetch(),this.stopOnboardingViewportListener()}catch(t){console.warn("Error in stopAgentRunStatusListener: ",t),vd("Error in stopAgentRunStatusListener: ",t)}},this.onAgentRunStatusMessage=t=>{try{if(!this.onboardingMode)return;if(!window.parent||window.parent===window||(null==t?void 0:t.source)!==window.parent)return;if(!this.isAllowedPortalOrigin(null==t?void 0:t.origin))return;const e=null==t?void 0:t.data;if((null==e?void 0:e.type)===Ot)return void this.postOnboardingDiagnostics(t.origin);if((null==e?void 0:e.type)!==$t||!Array.isArray(null==e?void 0:e.agents))return;this.agentRunStatuses=this.sanitiseAgentRunStatusRows(e.agents),this.agentRunStatusTimedOut=!1,this.agentRunStatusLastMessageAt=Date.now();const i=!0===(null==e?void 0:e.allTerminal);(this.agentRunStatuses.length>0||i)&&(this.agentRunStatusSettled=!0);this.agentRunStatuses.some((t=>null==t?void 0:t.isRunning))?this.armAgentRunStatusWatchdog(Dt):this.agentRunStatusSettled&&this.clearAgentRunStatusWatchdog(),this.ensureOnboardingFindingsLoaded()}catch(t){console.warn("Error in onAgentRunStatusMessage: ",t),vd("Error in onAgentRunStatusMessage: ",t)}},this.postOnboardingDiagnostics=t=>{var e,i,o,n,r,s;try{if(!this.onboardingMode||!window.parent||window.parent===window||!this.isAllowedPortalOrigin(t))return;const a=(null!==(e=this.lastStreamAnnotations)&&void 0!==e?e:[]).filter((t=>this.isAgentAnnotation(t))).length;window.parent.postMessage({type:Lt,at:(new Date).toISOString(),version:gt,identity:{hasUser:!!this.snippylyUser,isGuest:!!(null===(i=this.snippylyUser)||void 0===i?void 0:i.isGuest),isAnonymous:!!(null===(o=this.snippylyUser)||void 0===o?void 0:o.isAnonymous),hasRole:!!this.snippylyUserRole,loading:this.loading},sdk:{hasCommentElement:!!this.commentElement,hasDocumentId:!!this.documentId,hasLocationPath:!!this.previewLocationPath,sidebarV2:this.sidebarV2Enabled,showAgentCommentsInSidebar:this.showAgentCommentsInSidebar,agentCommentsModeRequested:this.agentCommentsModeRequested,privateCommentsEnabled:this.isPrivateCommentsEnabledOnWorkspace,hasPrivateCommentsAccess:this.hasPrivateCommentsAccess},stream:{emissions:this.streamEmissionCount,lastEmissionAt:this.lastStreamEmissionAt?new Date(this.lastStreamEmissionAt).toISOString():null,lastSize:(null!==(n=this.lastStreamAnnotations)&&void 0!==n?n:[]).length,agentAnnotations:a},fetch:{attempts:this.onboardingFindingsFetchAttempts,inFlight:this.onboardingFindingsFetchInFlight,pending:null!==this.onboardingFindingsFetchTimer,lastCount:this.onboardingLastFetchCount,lastError:this.onboardingLastFetchError,fetchedAt:this.onboardingFetchedAt?new Date(this.onboardingFetchedAt).toISOString():null,unsynced:this.onboardingUnsyncedAnnotationIds.length},groups:(null!==(r=this.agentGroups)&&void 0!==r?r:[]).map((t=>({agentId:null==t?void 0:t.agentId,count:null==t?void 0:t.warningCount}))),statuses:(null!==(s=this.agentRunStatuses)&&void 0!==s?s:[]).map((t=>({agentId:null==t?void 0:t.agentId,isRunning:null==t?void 0:t.isRunning,findingsCount:null==t?void 0:t.findingsCount,failed:!!(null==t?void 0:t.failed),timedOut:!!(null==t?void 0:t.timedOut)}))),missing:this.getAgentIdsMissingFindings(),sidebarOpen:this.showContentWarningSidebar,settled:this.agentRunStatusSettled},t)}catch(t){console.warn("Error in postOnboardingDiagnostics: ",t),vd("Error in postOnboardingDiagnostics: ",t)}},this.isOnboardingAgentResolved=t=>{try{return this.onboardingOpenedAgentIds.has(t)||this.onboardingFetchResolvedAgentIds.has(t)}catch(t){return console.warn("Error in isOnboardingAgentResolved: ",t),!1}},this.getAgentIdsMissingFindings=()=>{var t,e;try{const i=new Set((null!==(t=this.agentGroups)&&void 0!==t?t:[]).map((t=>null==t?void 0:t.agentId)));return(null!==(e=this.agentRunStatuses)&&void 0!==e?e:[]).filter((t=>{var e;return!(null==t?void 0:t.isRunning)&&(null!==(e=null==t?void 0:t.findingsCount)&&void 0!==e?e:0)>0})).map((t=>null==t?void 0:t.agentId)).filter((t=>!!t&&!i.has(t)&&!this.isOnboardingAgentResolved(t)))}catch(t){return console.warn("Error in getAgentIdsMissingFindings: ",t),vd("Error in getAgentIdsMissingFindings: ",t),[]}},this.getFetchableMissingAgentIds=()=>{try{return this.onboardingFindingsFetchAttempts>=30?[]:this.getAgentIdsMissingFindings().filter((t=>{var e;return(null!==(e=this.onboardingFetchAttemptsByAgent.get(t))&&void 0!==e?e:0)<10}))}catch(t){return console.warn("Error in getFetchableMissingAgentIds: ",t),vd("Error in getFetchableMissingAgentIds: ",t),[]}},this.isOnboardingFindingsLoadExhausted=t=>{var e;try{return null===this.onboardingFindingsFetchTimer&&!this.onboardingFindingsFetchInFlight&&((null!==(e=this.onboardingFetchAttemptsByAgent.get(t))&&void 0!==e?e:0)>=10||this.onboardingFindingsFetchAttempts>=30)}catch(t){return console.warn("Error in isOnboardingFindingsLoadExhausted: ",t),!1}},this.getDisplayAgentRunStatuses=()=>{var t,e;try{if(!this.onboardingMode)return this.agentRunStatuses;const i=new Set((null!==(t=this.agentGroups)&&void 0!==t?t:[]).map((t=>null==t?void 0:t.agentId)));return(null!==(e=this.agentRunStatuses)&&void 0!==e?e:[]).map((t=>{var e;return(null==t?void 0:t.isRunning)||0===(null!==(e=null==t?void 0:t.findingsCount)&&void 0!==e?e:0)||i.has(null==t?void 0:t.agentId)?t:this.isOnboardingAgentResolved(t.agentId)?{...t,findingsResolved:!0}:this.isOnboardingFindingsLoadExhausted(t.agentId)?{...t,findingsUnavailable:!0}:t}))}catch(t){return console.warn("Error in getDisplayAgentRunStatuses: ",t),vd("Error in getDisplayAgentRunStatuses: ",t),this.agentRunStatuses}},this.ensureOnboardingFindingsLoaded=()=>{try{if(!this.onboardingMode||!this.agentRunStatusListening)return;if(null!==this.onboardingFindingsFetchTimer||this.onboardingFindingsFetchInFlight)return;if(0===this.getFetchableMissingAgentIds().length)return;this.onboardingFindingsFetchTimer=setTimeout((()=>this.fetchOnboardingFindings()),3e3)}catch(t){console.warn("Error in ensureOnboardingFindingsLoaded: ",t),vd("Error in ensureOnboardingFindingsLoaded: ",t)}},this.clearOnboardingFindingsFetch=()=>{try{null!==this.onboardingFindingsFetchTimer&&(clearTimeout(this.onboardingFindingsFetchTimer),this.onboardingFindingsFetchTimer=null)}catch(t){console.warn("Error in clearOnboardingFindingsFetch: ",t),vd("Error in clearOnboardingFindingsFetch: ",t)}},this.countOnboardingFetchAttempt=t=>{var e;this.onboardingFindingsFetchAttempts+=1;for(const i of t)this.onboardingFetchAttemptsByAgent.set(i,(null!==(e=this.onboardingFetchAttemptsByAgent.get(i))&&void 0!==e?e:0)+1)},this.fetchOnboardingFindings=async()=>{var t;try{if(this.onboardingFindingsFetchTimer=null,!this.onboardingMode)return;const e=this.getFetchableMissingAgentIds();if(0===e.length)return;if(this.countOnboardingFetchAttempt(e),"function"!=typeof(null===(t=this.commentElement)||void 0===t?void 0:t.fetchCommentAnnotations)||!this.documentId)return this.onboardingLastFetchError=Ft.SDK_NOT_READY,this.ensureOnboardingFindingsLoaded(),void this.requestUpdate();this.onboardingFindingsFetchInFlight=!0;const i=await this.commentElement.fetchCommentAnnotations({documentIds:[`${this.documentId}`]});if(this.onboardingFindingsFetchInFlight=!1,!this.onboardingMode)return;if(null===(null==i?void 0:i.data)||void 0===(null==i?void 0:i.data))this.onboardingLastFetchCount=0,this.onboardingLastFetchError=Ft.SDK_RETURNED_NULL;else{const t=this.flattenFetchedAnnotations(i);this.onboardingLastFetchCount=t.length,this.onboardingLastFetchError="",this.applyOnboardingFetchResult(t)}this.ensureOnboardingFindingsLoaded(),this.requestUpdate()}catch(t){this.onboardingFindingsFetchInFlight=!1,this.onboardingLastFetchError=Ft.FETCH_THREW,console.warn("Error in fetchOnboardingFindings: ",t),vd("Error in fetchOnboardingFindings: ",t),this.ensureOnboardingFindingsLoaded(),this.requestUpdate()}},this.applyOnboardingFetchResult=t=>{var e,i,o;try{const n=(Array.isArray(t)?t:[]).filter((t=>{const e=null==t?void 0:t.annotationId;return!!e&&!this.onboardingRemovedAnnotationIds.has(e)&&this.isAgentAnnotation(t)})),r=new Map;for(const t of n){const n=this.extractAgentId((null===(e=null==t?void 0:t.agent)||void 0===e?void 0:e.agentFields)||[]);if(!n)continue;const s=(null===(i=null==t?void 0:t.status)||void 0===i?void 0:i.type)!==xe;r.set(n,null!==(o=r.get(n))&&void 0!==o&&o||s)}for(const[t,e]of r)e?this.onboardingFetchResolvedAgentIds.delete(t):this.onboardingFetchResolvedAgentIds.add(t);this.onboardingFetchedAnnotations=n,this.onboardingFetchedAt=Date.now(),this.processAgentComments(this.mergeOnboardingFetchedAnnotations(this.lastStreamAnnotations))}catch(t){console.warn("Error in applyOnboardingFetchResult: ",t),vd("Error in applyOnboardingFetchResult: ",t)}},this.flattenFetchedAnnotations=t=>{try{const e=null==t?void 0:t.data;if(Array.isArray(e))return e;if(!e||"object"!=typeof e)return[];const i=[];for(const t of Object.values(e))Array.isArray(t)&&i.push(...t);return i}catch(t){return console.warn("Error in flattenFetchedAnnotations: ",t),vd("Error in flattenFetchedAnnotations: ",t),[]}},this.mergeOnboardingFetchedAnnotations=t=>{var e;try{const i=Array.isArray(t)?t:[];if(!this.onboardingMode)return i;if(0===this.onboardingFetchedAnnotations.length)return this.setOnboardingUnsyncedAnnotationIds([]),i;const o=new Set(i.map((t=>null==t?void 0:t.annotationId)));if(this.sidebarV2Enabled&&!this.showAgentCommentsInSidebar){const t=new Map,n=(null!==(e=this.agentGroups)&&void 0!==e?e:[]).flatMap((t=>{var e;return null!==(e=null==t?void 0:t.annotations)&&void 0!==e?e:[]}));for(const e of[...n,...this.onboardingFetchedAnnotations]){const i=null==e?void 0:e.annotationId;!i||o.has(i)||t.has(i)||this.onboardingRemovedAnnotationIds.has(i)||t.set(i,e)}return t.size>0?[...i,...t.values()]:i}return this.onboardingFetchedAnnotations=this.onboardingFetchedAnnotations.filter((t=>{const e=null==t?void 0:t.annotationId;return!!e&&!o.has(e)&&!this.onboardingRemovedAnnotationIds.has(e)})),this.setOnboardingUnsyncedAnnotationIds(this.onboardingFetchedAnnotations.map((t=>t.annotationId))),this.onboardingFetchedAnnotations.length>0?[...i,...this.onboardingFetchedAnnotations]:i}catch(e){return console.warn("Error in mergeOnboardingFetchedAnnotations: ",e),vd("Error in mergeOnboardingFetchedAnnotations: ",e),Array.isArray(t)?t:[]}},this.setOnboardingUnsyncedAnnotationIds=t=>{try{const e=[...t].sort();e.join("\n")!==this.onboardingUnsyncedAnnotationIds.join("\n")&&(this.onboardingUnsyncedAnnotationIds=e)}catch(t){console.warn("Error in setOnboardingUnsyncedAnnotationIds: ",t)}},this.armAgentRunStatusWatchdog=t=>{try{this.clearAgentRunStatusWatchdog(),this.agentRunStatusWatchdogTimer=setTimeout((()=>this.applyAgentRunStatusTimeout()),t)}catch(t){console.warn("Error in armAgentRunStatusWatchdog: ",t),vd("Error in armAgentRunStatusWatchdog: ",t)}},this.clearAgentRunStatusWatchdog=()=>{try{null!==this.agentRunStatusWatchdogTimer&&(clearTimeout(this.agentRunStatusWatchdogTimer),this.agentRunStatusWatchdogTimer=null)}catch(t){console.warn("Error in clearAgentRunStatusWatchdog: ",t),vd("Error in clearAgentRunStatusWatchdog: ",t)}},this.applyAgentRunStatusTimeout=()=>{try{this.agentRunStatusWatchdogTimer=null,this.agentRunStatuses.some((t=>null==t?void 0:t.isRunning))&&(this.agentRunStatuses=this.agentRunStatuses.map((t=>(null==t?void 0:t.isRunning)?{...t,isRunning:!1,timedOut:!0}:t)),this.agentRunStatusTimedOut=!0),this.agentRunStatusSettled=!0}catch(t){console.warn("Error in applyAgentRunStatusTimeout: ",t),vd("Error in applyAgentRunStatusTimeout: ",t)}},this.startOnboardingViewportListener=()=>{try{if(this.onboardingViewportListening)return;window.addEventListener("resize",this.scheduleOnboardingViewportClamp),this.onboardingViewportListening=!0}catch(t){console.warn("Error in startOnboardingViewportListener: ",t),vd("Error in startOnboardingViewportListener: ",t)}},this.stopOnboardingViewportListener=()=>{var t;try{window.removeEventListener("resize",this.scheduleOnboardingViewportClamp),this.onboardingViewportListening=!1,null===(t=this.onboardingPanelResizeObserver)||void 0===t||t.disconnect(),this.onboardingPanelResizeObserver=null,this.onboardingObservedPanel=null,null!==this.onboardingClampFrame&&(cancelAnimationFrame(this.onboardingClampFrame),this.onboardingClampFrame=null)}catch(t){console.warn("Error in stopOnboardingViewportListener: ",t),vd("Error in stopOnboardingViewportListener: ",t)}},this.observeOnboardingPanel=()=>{var t,e,i;try{if(!this.agentRunStatusListening||"undefined"==typeof ResizeObserver)return;const o=null!==(e=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector(".onboarding-container content-warning-sidebar"))&&void 0!==e?e:null;if(o===this.onboardingObservedPanel)return;if(null===(i=this.onboardingPanelResizeObserver)||void 0===i||i.disconnect(),this.onboardingObservedPanel=o,!o)return;this.onboardingPanelResizeObserver||(this.onboardingPanelResizeObserver=new ResizeObserver((()=>this.scheduleOnboardingViewportClamp()))),this.onboardingPanelResizeObserver.observe(o)}catch(t){console.warn("Error in observeOnboardingPanel: ",t),vd("Error in observeOnboardingPanel: ",t)}},this.scheduleOnboardingViewportClamp=()=>{try{if(!this.onboardingMode||null!==this.onboardingClampFrame)return;this.onboardingClampFrame=requestAnimationFrame((()=>{this.onboardingClampFrame=null,this.clampOnboardingPanelToViewport()}))}catch(t){console.warn("Error in scheduleOnboardingViewportClamp: ",t),vd("Error in scheduleOnboardingViewportClamp: ",t)}},this.getOnboardingViewportClampOffset=(t,e,i)=>{let o=0,n=0;return t.right>e-8&&(o=e-8-t.right),t.left+o<8&&(o=8-t.left),t.bottom>i-8&&(n=i-8-t.bottom),t.top+n<8&&(n=8-t.top),{dx:o,dy:n}},this.readTranslate=t=>{var e;try{const i=window.getComputedStyle(t).transform;if(!i||"none"===i)return{x:0,y:0};const o=new(null!==(e=window.DOMMatrixReadOnly)&&void 0!==e?e:window.WebKitCSSMatrix)(i);return{x:Number(o.m41)||0,y:Number(o.m42)||0}}catch{return{x:0,y:0}}},this.clampOnboardingPanelToViewport=t=>{var e;try{const i=null!=t?t:null===(e=this.shadowRoot)||void 0===e?void 0:e.querySelector(".snippyly-plugin-container.onboarding-container");if(!i)return;const o=[i.getBoundingClientRect()],n=i.querySelector("content-warning-sidebar");n&&o.push(n.getBoundingClientRect());const r=o.filter((t=>t.width>0||t.height>0));if(0===r.length)return;const s={left:Math.min(...r.map((t=>t.left))),top:Math.min(...r.map((t=>t.top))),right:Math.max(...r.map((t=>t.right))),bottom:Math.max(...r.map((t=>t.bottom)))},{dx:a,dy:l}=this.getOnboardingViewportClampOffset(s,window.innerWidth,window.innerHeight);if(Math.abs(a)<.5&&Math.abs(l)<.5)return;const{x:c,y:d}=this.readTranslate(i);i.style.transform=`translate(${Math.round(c+a)}px, ${Math.round(d+l)}px)`}catch(t){console.warn("Error in clampOnboardingPanelToViewport: ",t),vd("Error in clampOnboardingPanelToViewport: ",t)}},this.buildAgentWarnings=(t,e,i,o)=>{try{return t===Se.BROKEN_LINKS?this.buildBrokenLinkWarnings(e):t===Se.SPELL_CHECK||t===Se.GRAMMAR_CHECK?this.buildSpellCheckWarnings(e,i,o):this.buildGenericWarnings(e)}catch(t){return console.warn("Error in buildAgentWarnings: ",t),{warnings:[],warningCount:0}}},this.buildBrokenLinkWarnings=t=>{var e,i,o,n,r,s,a,l,c,d,h,u,p;try{const v=new Map;for(const g of t){const t=(null===(e=null==g?void 0:g.pageInfo)||void 0===e?void 0:e.url)||(null===(i=null==g?void 0:g.location)||void 0===i?void 0:i.url)||(null===(o=null==g?void 0:g.agent)||void 0===o?void 0:o.url)||"",f=(null===(n=null==g?void 0:g.agent)||void 0===n?void 0:n.reason)||{},m=f.url||(null===(r=null==g?void 0:g.targetTextRange)||void 0===r?void 0:r.text)||(null===(a=null===(s=null==g?void 0:g.agent)||void 0===s?void 0:s.result)||void 0===a?void 0:a.url)||(null===(c=null===(l=null==g?void 0:g.agent)||void 0===l?void 0:l.result)||void 0===c?void 0:c.link)||t,w=f.issue||f.description||(null===(h=null===(d=null==g?void 0:g.agent)||void 0===d?void 0:d.result)||void 0===h?void 0:h.statusCode)||(null===(p=null===(u=null==g?void 0:g.agent)||void 0===u?void 0:u.result)||void 0===p?void 0:p.status)||"",y=(null==m?void 0:m.toLowerCase())||"";if(v.has(y)){const e=v.get(y);e.occurrences+=1,t&&!e.pageUrls.includes(t)&&e.pageUrls.push(t),e.annotations.push(g)}else v.set(y,{primaryText:m||"",secondaryText:String(w),occurrences:1,pageUrls:t?[t]:[],annotations:[g]})}const g=Array.from(v.values());return{warnings:g,warningCount:g.length}}catch(t){return console.warn("Error in buildBrokenLinkWarnings: ",t),{warnings:[],warningCount:0}}},this.buildSpellCheckWarnings=(t,e,i)=>{var o,n,r,s,a,l,c,d,h,u,p,v,g,f,m,w,y,b,C;try{const x=new Map;for(const E of t){const t=(null===(o=null==E?void 0:E.pageInfo)||void 0===o?void 0:o.url)||(null===(n=null==E?void 0:E.location)||void 0===n?void 0:n.url)||(null===(r=null==E?void 0:E.agent)||void 0===r?void 0:r.url)||"",k=(null===(s=null==E?void 0:E.pageInfo)||void 0===s?void 0:s.path)||(null===(a=null==E?void 0:E.location)||void 0===a?void 0:a.path)||(null===(l=null==E?void 0:E.agent)||void 0===l?void 0:l.path)||"",S=this.normalizePagePath(k),M=null!==(d=null!==(c=null==E?void 0:E.comments)&&void 0!==c?c:null==E?void 0:E.commentData)&&void 0!==d?d:[],T=null!==(p=null===(u=null===(h=null==M?void 0:M[0])||void 0===h?void 0:h.commentText)||void 0===u?void 0:u.trim())&&void 0!==p?p:"",A=(null===(g=null===(v=null==E?void 0:E.agent)||void 0===v?void 0:v.result)||void 0===g?void 0:g.incorrectWord)||(null===(f=null==E?void 0:E.targetElement)||void 0===f?void 0:f.targetText)||T||"",_=(null===(w=null===(m=null==E?void 0:E.agent)||void 0===m?void 0:m.result)||void 0===w?void 0:w.suggestions)||[],I=Array.isArray(_)?_[0]||"":_||"",$=null===(b=null===(y=null==E?void 0:E.agent)||void 0===y?void 0:y.result)||void 0===b?void 0:b.type,N=A||"";A||console.warn("[CWS] Spell check annotation missing incorrectWord. agent.result:",null===(C=null==E?void 0:E.agent)||void 0===C?void 0:C.result,"targetElement:",null==E?void 0:E.targetElement,"comments:",M);const O="grammar"===$?i:e;O.has(N)||O.set(N,new Map);const L=O.get(N),D=L.get(S)||0;if(L.set(S,D+1),x.has(N)){const e=x.get(N);e.occurrences+=1,t&&!e.pageUrls.includes(t)&&e.pageUrls.push(t),e.annotations.push(E)}else x.set(N,{primaryText:A||"",secondaryText:I||"",occurrences:1,pageUrls:t?[t]:[],annotations:[E]})}const E=Array.from(x.values());return{warnings:E,warningCount:E.length}}catch(t){return console.warn("Error in buildSpellCheckWarnings: ",t),{warnings:[],warningCount:0}}},this.splitFindingHeading=t=>{var e;try{if("string"!=typeof t||!t.trim())return null;const i=document.createElement("template");i.innerHTML=t;const o=Array.from(i.content.childNodes).filter((t=>{var e;return!(t.nodeType===Node.TEXT_NODE&&!(null===(e=t.textContent)||void 0===e?void 0:e.trim()))})),n=o[0];if(!n||!["B","STRONG"].includes(n.nodeName))return null;const r=(null===(e=n.textContent)||void 0===e?void 0:e.replace(/\s+/g," ").trim())||"";if(!r)return null;let s="";for(const t of o.slice(1))s+="BR"===t.nodeName?"\n":t.textContent||"";return{title:r,detail:s.split("\n").map((t=>t.replace(/\s+/g," ").trim())).find(Boolean)||""}}catch(t){return console.warn("Error in splitFindingHeading: ",t),null}},this.buildFindingSubItems=t=>{try{return(Array.isArray(null==t?void 0:t.missing)?t.missing:[]).map((t=>{const e="string"==typeof(null==t?void 0:t.text)?t.text.replace(/\s+/g," ").trim():"";if(!e)return null;const i="heading"===(null==t?void 0:t.kind)?"Section":"Link",o="string"==typeof(null==t?void 0:t.href)?t.href.trim().replace(/^https?:\/\//i,"").replace(/^www\./i,"").replace(/\/$/,""):"",n=o.length>40?`${o.slice(0,39)}…`:o;return{label:e,detail:n?`${i} · ${n}`:i}})).filter(Boolean)}catch(t){return console.warn("Error in buildFindingSubItems: ",t),[]}},this.buildGenericWarnings=t=>{var e,i,o,n,r,s,a,l,c,d,h,u,p,v,g,f,m,w,y,b,C,x,E,k;try{const S=new Map;for(const M of t){const t=(null===(e=null==M?void 0:M.pageInfo)||void 0===e?void 0:e.url)||(null===(i=null==M?void 0:M.location)||void 0===i?void 0:i.url)||(null===(o=null==M?void 0:M.agent)||void 0===o?void 0:o.url)||"",T=null!==(r=null!==(n=null==M?void 0:M.comments)&&void 0!==n?n:null==M?void 0:M.commentData)&&void 0!==r?r:[],A=null==T?void 0:T[0],_=null!==(p=null!==(d=null!==(a=null===(s=null==A?void 0:A.commentText)||void 0===s?void 0:s.trim())&&void 0!==a?a:null===(c=null===(l=null==M?void 0:M.agent)||void 0===l?void 0:l.result)||void 0===c?void 0:c.incorrectWord)&&void 0!==d?d:null===(u=null===(h=null==M?void 0:M.targetElement)||void 0===h?void 0:h.targetText)||void 0===u?void 0:u.trim())&&void 0!==p?p:"",I=null!==(b=null!==(m=null===(f=null===(g=null===(v=null==M?void 0:M.agent)||void 0===v?void 0:v.result)||void 0===g?void 0:g.suggestions)||void 0===f?void 0:f[0])&&void 0!==m?m:null===(y=null===(w=null==M?void 0:M.agent)||void 0===w?void 0:w.result)||void 0===y?void 0:y.suggestion)&&void 0!==b?b:"",$=null!==(k=null!==(x=null===(C=null==M?void 0:M.agent)||void 0===C?void 0:C.reason)&&void 0!==x?x:null===(E=null==A?void 0:A.agent)||void 0===E?void 0:E.reason)&&void 0!==k?k:{},N="string"==typeof(null==$?void 0:$.title)?$.title.trim():"",O="string"==typeof(null==$?void 0:$.description)?$.description.trim():"",L=N?null:this.splitFindingHeading(null==A?void 0:A.commentHtml),D=N||(null==L?void 0:L.title)||_,R=I||(N?O:null==L?void 0:L.detail)||"",F=Eh(null==$?void 0:$.severity),P=this.buildFindingSubItems($),V=_||(null==M?void 0:M.annotationId)||(null==M?void 0:M.id)||"";if(S.has(V)){const e=S.get(V);e.occurrences+=1,t&&!e.pageUrls.includes(t)&&e.pageUrls.push(t),e.annotations.push(M),e.severity=kh(e.severity,F)}else S.set(V,{primaryText:D||"No text",secondaryText:R||"",occurrences:1,pageUrls:t?[t]:[],annotations:[M],...F?{severity:F}:{},...P.length>1?{subItems:P}:{}})}const M=Array.from(S.values());return{warnings:M,warningCount:M.length}}catch(t){return console.warn("Error in buildGenericWarnings: ",t),{warnings:[],warningCount:0}}},this.normalizePagePath=t=>{try{return t?(null==t?void 0:t.startsWith("/"))?t.substring(1):t:""}catch(e){return console.warn("Error in normalizePagePath: ",e),t||""}},this.setQueryParamsCommentsInSdk=()=>{var t,e,i,o,n;try{const r="true"===sessionStorage.getItem("debugQueryParamsComments");r&&console.log("setQueryParamsCommentsInSdk commentElement",this.commentElement),this.commentElement&&(r&&console.log("setQueryParamsCommentsInSdk queryParamsComments",this.queryParamsComments),this.queryParamsComments&&(null===(t=this.commentElement)||void 0===t?void 0:t.enableQueryParamsComments)?(r&&console.log("enableQueryParamsComments this.commentElement?.enableQueryParamsComments",null===(e=this.commentElement)||void 0===e?void 0:e.enableQueryParamsComments),null===(i=this.commentElement)||void 0===i||i.enableQueryParamsComments()):!this.queryParamsComments&&(null===(o=this.commentElement)||void 0===o?void 0:o.disableQueryParamsComments)&&(r&&console.log("disableQueryParamsComments"),null===(n=this.commentElement)||void 0===n||n.disableQueryParamsComments()))}catch(t){console.warn("Error in setQueryParamsCommentsInSdk: ",t),vd("Error in setQueryParamsCommentsInSdk: ",t)}},this.checkGlobalUserContact=()=>{try{this.contactElement&&this.contactElement.isUserGlobalContact().subscribe((t=>{this.isUserGlobalContact=t}))}catch(t){console.warn("Error in checkGlobalUserContact: ",t),vd("Error in checkGlobalUserContact: ",t)}},this.applyVeltFeatureGates=()=>{try{const t=(t=>{try{return(null==t?void 0:t.passwordGateActive)||(null==t?void 0:t.planLimitLocked)||(null==t?void 0:t.planExpired)||(null==t?void 0:t.projectDeleted)?[...id]:[]}catch(t){return[]}})({passwordGateActive:this.passwordProtected&&!this.isPasswordValid,planLimitLocked:this.planLimitLocked,planExpired:!0===this.isPlanExpired,projectDeleted:this.projectDeleted});this.resolvedVeltFeatureGates=t,this.pushVeltFeatureGates(t)}catch(t){console.warn("Error in applyVeltFeatureGates: ",t),vd("Error in applyVeltFeatureGates: ",t)}},this.pushVeltFeatureGates=t=>{const e=globalThis.Velt;e&&"function"==typeof e.disableFeatures&&e.disableFeatures(t)},this.replayVeltFeatureGates=()=>{try{this.pushVeltFeatureGates(this.resolvedVeltFeatureGates)}catch(t){console.warn("Error in replayVeltFeatureGates: ",t),vd("Error in replayVeltFeatureGates: ",t)}},this.setProjectConfigVariables=t=>{var e,i,o,n;try{const r="Admin"===this.snippylyUserRole;this.allFeatureDisabled=!r&&(null!==(e=null==t?void 0:t.disabled)&&void 0!==e&&e),this.allFeatureRestricted=null!==(i=null==t?void 0:t.restricted)&&void 0!==i&&i,this.guestMode=null!==(o=null==t?void 0:t.guestMode)&&void 0!==o&&o,this.allowGuestModeSignIn=!!(null===(n=null==t?void 0:t.guestModeConfig)||void 0===n?void 0:n.allowSignIn),(null==t?void 0:t.guestModeConfig)||(this.allowGuestModeSignIn=!0),this.guestMode&&gd(vt.Events.GUEST_MODE_PRESENT),this.passwordProtected=!1,this.queryParamsComments=!!(null==t?void 0:t.queryParamsComments),this.usePageTitleAsLocationName=!!(null==t?void 0:t.usePageTitleAsLocationName),this.applyVeltFeatureGates(),Wc(oe,this.guestMode+"",!0),Wc(de,this.allowGuestModeSignIn+"",!0),Wc(ne,this.passwordProtected+"",!0),Wc(re,this.queryParamsComments+"",!0),Wc(se,this.usePageTitleAsLocationName+"",!0)}catch(t){console.warn("Error in setProjectConfigVariables: ",t),vd("Error in setProjectConfigVariables: ",t)}},this.toggleSnippylyPluginToolbar=()=>{try{this.expanded=!this.expanded,this.expanded?gd(vt.Events.TOOLBAR_EXPANDED):gd(vt.Events.TOOLBAR_COLLAPSED)}catch(t){console.warn("Error in toggleSnippylyPluginToolbar: ",t),vd("Error in toggleSnippylyPluginToolbar: ",t)}},this.enablePrivateCommentModeOnCommentElement=()=>{try{if(!this.commentElement||"function"!=typeof this.commentElement.enablePrivateMode)return;this.commentElement.enablePrivateMode({type:ce})}catch(t){console.warn("Error in enablePrivateCommentModeOnCommentElement: ",t),vd("Error in enablePrivateCommentModeOnCommentElement: ",t)}},this.disablePrivateCommentModeOnCommentElement=()=>{try{if(!this.commentElement||"function"!=typeof this.commentElement.disablePrivateMode)return;this.commentElement.disablePrivateMode()}catch(t){console.warn("Error in disablePrivateCommentModeOnCommentElement: ",t),vd("Error in disablePrivateCommentModeOnCommentElement: ",t)}},this.enableVisibilityOptionsOnCommentElement=()=>{try{if(this.visibilityOptionsEnabled)return;if(!this.commentElement||"function"!=typeof this.commentElement.enableVisibilityOptions)return;this.commentElement.enableVisibilityOptions(),this.visibilityOptionsEnabled=!0,gd(vt.Events.VISIBILITY_OPTIONS_ENABLED)}catch(t){console.warn("Error in enableVisibilityOptionsOnCommentElement: ",t),vd("Error in enableVisibilityOptionsOnCommentElement: ",t)}},this.disableVisibilityOptionsOnCommentElement=()=>{try{if(!this.visibilityOptionsEnabled)return;if(!this.commentElement||"function"!=typeof this.commentElement.disableVisibilityOptions)return void(this.visibilityOptionsEnabled=!1);this.commentElement.disableVisibilityOptions(),this.visibilityOptionsEnabled=!1,gd(vt.Events.VISIBILITY_OPTIONS_DISABLED)}catch(t){console.warn("Error in disableVisibilityOptionsOnCommentElement: ",t),vd("Error in disableVisibilityOptionsOnCommentElement: ",t)}},this.maybeApplyVisibilityOptionsToCommentElement=()=>{"Admin"===this.snippylyUserRole&&this.canShowPrivateCommentToggle?this.enableVisibilityOptionsOnCommentElement():this.disableVisibilityOptionsOnCommentElement()},this.togglePrivateCommentMode=()=>{try{this.commentElement&&(this.privateCommentModeEnabled?(this.disablePrivateCommentModeOnCommentElement(),this.privateCommentModeEnabled=!1,gd(vt.Events.PRIVATE_MODE_DISABLED)):(this.enablePrivateCommentModeOnCommentElement(),this.privateCommentModeEnabled=!0,gd(vt.Events.PRIVATE_MODE_ENABLED)),Wc(le,this.privateCommentModeEnabled.toString()))}catch(t){console.warn("Error in togglePrivateCommentMode: ",t),vd("Error in togglePrivateCommentMode: ",t)}},this.checkPrivateCommentModeFromStorage=()=>{try{!this.allFeatureDisabled&&"Admin"===this.snippylyUserRole&&this.canShowPrivateCommentToggle&&Zc(le)&&(this.privateCommentModeEnabled="true"===Zc(le),this.privateCommentModeEnabled&&this.enablePrivateCommentModeOnCommentElement())}catch(t){console.warn("Error in checkPrivateCommentModeFromStorage: ",t),vd("Error in checkPrivateCommentModeFromStorage: ",t)}},this.loginWithGoogle=()=>{try{if(gd(vt.Events.SIGNIN_CLICKED),this.loading||this.customLoginEnabledLocally)return;const t=this.buildSignInUrlWithParams(this.signInUrl||"");window.open(t,"_self")}catch(t){console.warn("Error in loginWithGoogle: ",t),vd("Error in loginWithGoogle: ",t)}},this.buildSignInUrlWithParams=t=>{try{const e=new URL(t);return this.apiKey&&e.searchParams.set("apiKey",this.apiKey),this.projectId&&e.searchParams.set("projectId",this.projectId),e.toString()}catch(e){return console.warn("Error in buildSignInUrlWithParams: ",e),vd("Error in buildSignInUrlWithParams: ",e),t}},this.getQRCode=async()=>{if(!this.qrCodeLoading)try{this.qrCodeLoading=!0,this.qrCodeError=!1;const t=new URL(window.location.href);null==t||t.searchParams.set("review","true");const e=null==t?void 0:t.toString();if(!e)return void(this.qrCodeError=!0);const i=Jc(e,ze,Be),o=await Od(i);"ok"===o.status?this.qrCode=o.qrcode:this.qrCodeError=!0}catch(t){this.qrCodeError=!0,console.warn("Error in getQRCode: ",t),vd("Error in getQRCode: ",t)}finally{this.qrCodeLoading=!1}},this.retryQRCode=async()=>{try{this.qrCodeError=!1,await this.getQRCode()}catch(t){console.warn("Error in retryQRCode: ",t),vd("Error in retryQRCode: ",t)}},this.toggleQRCodeVisibility=async()=>{try{if(gd(vt.Events.OPEN_MOBILE_CLICKED),this.showQrCode&&this.qrCodeLoading)return;this.showQrCode=!this.showQrCode,this.showQrCode&&!this.qrCode&&await this.getQRCode()}catch(t){console.warn("Error in toggleQRCodeVisibility: ",t),vd("Error in toggleQRCodeVisibility: ",t)}},this.onUserInviteToolClick=()=>{var t;(null===(t=this.snippylyUser)||void 0===t?void 0:t.isGuest)?(this.guestModeSignInModalConfig.title="Sign in to invite others.",this.guestModeSignInModalConfig.description="Invite team members to comment on this project.",this.guestModeSignInModalConfig.showLeaveCommentButton=!1,this.guestModeSignInModalConfig.closeOnClickOutside=!0,this.openGuestModeSignInModal()):this.openInviteModal()},this.openInviteModal=()=>{this.showInviteModal=!0,gd(vt.Events.INVITE_MODAL_OPENED)},this.closeInviteModal=()=>{this.showInviteModal=!1},this.onInviteSuccess=()=>{this.closeInviteModal(),gd(vt.Events.INVITE_SENT)},this.removeSnippyly=async()=>{try{gd(vt.Events.EXIT_REVIEW_MODE_CLICKED),this.exitReviewModeCalled=!0,Kc(Et),Kc(kt),Kc(Bt),Kc(Yt,"sessionStorage"),Kc(Jt,"sessionStorage");const t=new URL(document.location),e=t.searchParams;e.delete(Bt),e.delete(Et),e.delete(Ht),e.delete(kt),this.projectVersionKey&&e.delete(this.projectVersionKey),e.delete(qt),e.delete(Qt),e.delete(Xt),this.projectVersion=void 0,this.projectVersionKey=void 0,delete window.snippylyInitialLoadUrl,window.history.replaceState({},document.title,t.href),window.location.reload()}catch(t){console.warn("Error in removeSnippyly: ",t),vd("Error in removeSnippyly: ",t)}},this.signOutUser=async()=>{try{gd(vt.Events.SIGNOUT_CLICKED),this.subscriptions.forEach((t=>{t&&t.unsubscribe&&(null==t||t.unsubscribe())})),this.contactListSubscription&&(this.contactListSubscription.unsubscribe(),this.contactListSubscription=null),await Velt.signOutUser(),Kc(Gt),Kc(Zt),Kc(ie),Kc(le),this.snippylyUser=void 0,window.open(this.signOutUrl,"_self")}catch(t){console.warn("Error in signOutUser: ",t),vd("Error in signOutUser: ",t)}},this.toggleMenu=(t,e)=>{try{t.stopPropagation(),this.menuOpenedId===e?this.menuOpenedId=void 0:this.menuOpenedId=e}catch(t){console.warn("Error in toggleMenu: ",t),vd("Error in toggleMenu: ",t)}},this.copyLink=()=>{try{navigator.clipboard.writeText(window.location.href),this.copyLinkTooltip="Link copied!",setTimeout((()=>{this.copyLinkTooltip="Copy Link"}),2e3)}catch(t){console.warn("Error in copyLink: ",t),vd("Error in copyLink: ",t)}},this.goToAdminPortal=()=>{try{let t=`${je}`;Velt&&(null===Velt||void 0===Velt?void 0:Velt.getDocumentId)&&this.serverDocumentId&&(t=`${je}/dashboard/project/comment/${this.apiKey}/${this.serverDocumentId}`),gd(vt.Events.VIEW_PROJECT_CLICKED),window.open(t,"_blank")}catch(t){console.warn("Error in goToAdminPortal: ",t),vd("Error in goToAdminPortal: ",t)}},this.openBugReportModal=()=>{try{this.showBugReportModal=!0,gd(vt.Events.REPORT_BUG_CLICKED)}catch(t){console.warn("Error in openBugReportModal: ",t),vd("Error in openBugReportModal: ",t)}},this.closeBugReportModal=()=>{try{this.showBugReportModal=!1}catch(t){console.warn("Error in closeBugReportModal: ",t),vd("Error in closeBugReportModal: ",t)}},this.goToAdminPortalDashboard=()=>{try{let t=`${je}`;Velt&&(null===Velt||void 0===Velt?void 0:Velt.getDocumentId)&&this.serverDocumentId&&(t=`${je}/dashboard`),window.open(t,"_blank")}catch(t){console.warn("Error in goToAdminPortalDashboard: ",t),vd("Error in goToAdminPortalDashboard: ",t)}},this.joinCommunity=()=>{try{window.open("https://join.slack.com/t/superflowusers/shared_invite/zt-1q3jzsddt-NEb~uu9RXscLfxOIDGQXJw","_blank")}catch(t){console.warn("Error in joinCommunity: ",t),vd("Error in joinCommunity: ",t)}},this.onboardingNextClick=()=>{try{this.showOnboardingModal=!1,Wc(Qt,"true");const t=new URL(document.location);t.searchParams.delete(Qt),window.history.replaceState({},document.title,t.href)}catch(t){console.warn("Error in onboardingNextClick: ",t),vd("Error in onboardingNextClick: ",t)}},this.onLiveDemoModalNextClick=()=>{try{this.showLiveDemoModal=!1,Wc(Xt,"true",!1,"sessionStorage");const t=new URL(document.location);t.searchParams.delete(Xt),window.history.replaceState({},document.title,t.href)}catch(t){console.warn("Error in onLiveDemoModalNextClick: ",t),vd("Error in onLiveDemoModalNextClick: ",t)}},this.onFigmaDemoModalNextClick=()=>{try{this.showFigmaDemoModal=!1;const t=new URL(document.location);t.searchParams.delete(te),window.history.replaceState({},document.title,t.href)}catch(t){console.warn("Error in onFigmaDemoModalNextClick: ",t),vd("Error in onFigmaDemoModalNextClick: ",t)}},this.onUpgradePlanClick=()=>{try{window.open(Ue,"_blank")}catch(t){console.warn("Error in onUpgradePlanClick: ",t),vd("Error in onUpgradePlanClick: ",t)}},this.onTourCommentTooltipClick=()=>{try{this.showTourCommentTooltip=!1,Wc(ee,"true"),this.firstCommentNudge&&(this.firstCommentNudge=!1,this.autoCommentModeArmedOnce=!0)}catch(t){console.warn("Error in onTourCommentTooltipClick: ",t),vd("Error in onTourCommentTooltipClick: ",t)}},this.onGuestModeChipSignInButtonClick=()=>{try{gd(vt.Events.GUEST_MODE_SIGN_IN_BUTTON_CLICKED),this.loginWithGoogle()}catch(t){console.warn("Error in onGuestModeChipSignInButtonClick: ",t),vd("Error in onGuestModeChipSignInButtonClick: ",t)}},this.openGuestModeSignInModal=()=>{try{this.showGuestModeSignInModal=!0,gd(vt.Events.GUEST_MODE_SIGN_IN_DIALOG_SHOWN)}catch(t){console.warn("Error in openGuestModeSignInModal: ",t),vd("Error in openGuestModeSignInModal: ",t)}},this.closeGuestModeSignInModal=()=>{try{this.showGuestModeSignInModal=!1,this.guestModeSignInModalConfig=JSON.parse(JSON.stringify(this.defaultGuestModeSignInModalConfig))}catch(t){console.warn("Error in closeGuestModeSignInModal: ",t),vd("Error in closeGuestModeSignInModal: ",t)}},this.onGuestModeSignInModalSignInButtonClick=()=>{try{gd(vt.Events.GUEST_MODE_SIGN_IN_BUTTON_CLICKED),this.loginWithGoogle()}catch(t){console.warn("Error in onGuestModeSignInModalSignInButtonClick: ",t),vd("Error in onGuestModeSignInModalSignInButtonClick: ",t)}},this.openGuestModeNameModel=t=>{try{t&&(t.stopPropagation(),t.preventDefault()),this.skipGuestNameModal||(this.showGuestModeNameModal=!0,gd(vt.Events.GUEST_MODE_NAME_NUDGE_SHOWN))}catch(t){console.warn("Error in openGuestModeNameModel: ",t),vd("Error in openGuestModeNameModel: ",t)}},this.closeGuestModeNameModel=()=>{try{this.showGuestModeNameModal=!1}catch(t){console.warn("Error in closeGuestModeNameModel: ",t),vd("Error in closeGuestModeNameModel: ",t)}},this.onGuestModeNameModalSkipButtonClick=()=>{try{gd(vt.Events.GUEST_MODE_SKIP_BUTTON_CLICKED),this.showGuestModeNameModal=!1}catch(t){console.warn("Error in onGuestModeNameModalSkipButtonClick: ",t),vd("Error in onGuestModeNameModalSkipButtonClick: ",t)}},this.onPasswordProtectedModalCloseButtonClick=()=>{try{gd(vt.Events.PASSWORD_PROTECTED_MODAL_CLOSE_BUTTON_CLICKED),this.showPasswordProtectedModal=!1,this.password="",this.showInvalidPassword=!1}catch(t){console.warn("Error in onPasswordProtectedModalCloseButtonClick: ",t),vd("Error in onPasswordProtectedModalCloseButtonClick: ",t)}},this.onPasswordProtectedModalOpenButtonClick=()=>{try{gd(vt.Events.PASSWORD_PROTECTED_MODAL_OPEN_BUTTON_CLICKED),this.showPasswordProtectedModal=!0}catch(t){console.warn("Error in onPasswordProtectedModalOpenButtonClick: ",t),vd("Error in onPasswordProtectedModalOpenButtonClick: ",t)}},this.showGuestModeSignInBanner=()=>{try{this.guestModeSignInBannerVisible=!0,gd(vt.Events.GUEST_MODE_SIGN_IN_NUDGE_SHOWN)}catch(t){console.warn("Error in showGuestModeSignInBanner: ",t),vd("Error in showGuestModeSignInBanner: ",t)}},this.hideGuestModeSignInBanner=()=>{try{this.guestModeSignInBannerVisible=!1}catch(t){console.warn("Error in hideGuestModeSignInBanner: ",t),vd("Error in hideGuestModeSignInBanner: ",t)}},this.onGuestModeBannerSignInButtonClick=()=>{try{gd(vt.Events.GUEST_MODE_SIGN_IN_CLICKED),this.loginWithGoogle()}catch(t){console.warn("Error in onGuestModeBannerSignInButtonClick: ",t),vd("Error in onGuestModeBannerSignInButtonClick: ",t)}},this.updateGuestUserName=async()=>{var t;try{if(!(null===(t=this.guestUserNameInput)||void 0===t?void 0:t.trim()))return;if(this.guestUserNameUpdateLoading)return;const e=td(!0,this.apiKey);if(e){const t=JSON.parse(JSON.stringify(e));e.name=this.guestUserNameInput,e.photoUrl=null,this.guestUserNameUpdateLoading=!0,(t=>{try{const e=JSON.stringify(t),i=Jc(e,ze,Be);Wc(Kt,i,!0)}catch(t){console.warn("Error in updateGuestUser: ",t),vd("Error in updateGuestUser: ",t)}})(e),await Velt.identify(e),this.snippylyUser=JSON.parse(JSON.stringify(e)),await Sd(this.apiKey,this.projectId||"",t,e),this.showGuestModeNameModal=!1,this.guestUserNameUpdated=!0,this.guestUserNameUpdateLoading=!1,Wc(ue,"true"),gd(vt.Events.GUEST_MODE_NAME_ADDED,{oldName:null==t?void 0:t.name,newName:null==e?void 0:e.name})}this.closeGuestModeNameModel()}catch(t){console.warn("Error in updateGuestUserName: ",t),vd("Error in updateGuestUserName: ",t)}},this.submitPassword=async()=>{var t;try{if(gd(vt.Events.REVIEW_PASSWORD_ADDED),!(null===(t=this.password)||void 0===t?void 0:t.trim()))return;if(this.validatingPasswordLoading)return;this.validatingPasswordLoading=!0,this.isPasswordValid=await bd(this.apiKey,this.projectId,this.password),function(t,e){try{const i="object"==typeof e?JSON.stringify(e):e;localStorage.setItem(t,i)}catch(t){console.warn("Error in setLocalStorage: ",t)}}(ae,this.isPasswordValid),this.isPasswordValid?(this.password="",this.onPasswordProtectedModalCloseButtonClick(),this.showInvalidPassword=!1,this.applyVeltFeatureGates(),gd(vt.Events.REVIEW_PASSWORD_ACCEPTED)):(this.showInvalidPassword=!0,gd(vt.Events.REVIEW_PASSWORD_REJECTED)),this.validatingPasswordLoading=!1}catch(t){console.warn("Error in submitPassword: ",t),vd("Error in submitPassword: ",t)}},this.updateUserName=async()=>{var t;try{if(!(null===(t=this.guestUserNameInput)||void 0===t?void 0:t.trim()))return;if(this.guestUserNameUpdateLoading)return;this.guestUserNameUpdateLoading=!0;const e=JSON.parse(JSON.stringify(this.snippylyUser)),i=JSON.parse(JSON.stringify(this.snippylyUser));i.name=this.guestUserNameInput,await Sd(this.apiKey,this.projectId||"",e,i),await Velt.updateUser(i),this.snippylyUser=JSON.parse(JSON.stringify(i));const o=Qc();o.name=i.name;const n=JSON.stringify(o),r=Jc(n,ze,Be);Wc(Zt,r,!0),this.guestUserNameUpdateLoading=!1,this.guestUserNameInput="",this.closeGuestModeNameModel()}catch(t){console.warn("Error in updateUserName: ",t),vd("Error in updateUserName: ",t)}},this.isAgentAnnotation=t=>{var e;try{const i=null!==this.extractAgentId((null===(e=null==t?void 0:t.agent)||void 0===e?void 0:e.agentFields)||[]),o=(null==t?void 0:t.type)===Ee,n=(null==t?void 0:t.commentType)===Ee;return i||o||n}catch(t){return console.warn("Error in isAgentAnnotation: ",t),!1}},this.getSidebarGroupExpansionMap=()=>{var t,e,i,o,n;try{const r=document.querySelector(Me.VELT_COMMENTS_SIDEBAR_LEGACY),s=null===(n=null===(o=null===(i=null===(e=null===(t=null==r?void 0:r._ngElementStrategy)||void 0===t?void 0:t.componentRef)||void 0===e?void 0:e.instance)||void 0===i?void 0:i.componentConfigSignal)||void 0===o?void 0:o.call(i))||void 0===n?void 0:n.virtualScrollData;if(!Array.isArray(s))return;const a=new Map;return s.forEach((t=>{var e,i;if("group"!==(null==t?void 0:t.type))return;const o=null===(e=null==t?void 0:t.data)||void 0===e?void 0:e.displayName,n=null===(i=null==t?void 0:t.data)||void 0===i?void 0:i.isExpanded;"string"==typeof o&&"boolean"==typeof n&&a.set(o,n)})),a}catch(t){return void console.warn("Error in getSidebarGroupExpansionMap: ",t)}},this.filterAgentCommentsFromSidebar=(t,e)=>{try{if(this.isSettingSidebarData)return;if(!t||!this.commentElement)return;const i=t.commentAnnotations;if(!Array.isArray(i))return;if(this.processAgentComments(this.mergeOnboardingFetchedAnnotations(i)),this.ensureOnboardingFindingsLoaded(),this.sidebarV2Enabled)return;if(this.showAgentCommentsInSidebar)return;const o=Array.isArray(null==t?void 0:t.systemFilteredAnnotations)?t.systemFilteredAnnotations:[],n=new Set(o.map((t=>(null==t?void 0:t.annotationId)||(null==t?void 0:t.id))).filter((t=>Boolean(t)))),r=[];i.forEach((t=>{if(this.isAgentAnnotation(t))return;const e=(null==t?void 0:t.annotationId)||(null==t?void 0:t.id);e&&n.has(e)&&r.push(t)}));const s=new Map;r.forEach((t=>{var e,i,o,n;const r=(null===(e=null==t?void 0:t.pageInfo)||void 0===e?void 0:e.path)||(null===(i=null==t?void 0:t.pageInfo)||void 0===i?void 0:i.url)||(null===(o=null==t?void 0:t.location)||void 0===o?void 0:o.path)||"/";s.has(r)||s.set(r,[]),null===(n=s.get(r))||void 0===n||n.push(t)}));const a=[],l=new URL(window.location.href).pathname,c="/"+this.normalizePagePath(l);s.forEach(((t,i)=>{const o=null==e?void 0:e.get(i);a.push({groupId:i,groupName:i,isExpanded:"boolean"==typeof o?o:i===c,annotations:t})})),this.isSettingSidebarData=!0,this.commentElement.setCommentSidebarData(a,{grouping:!0}),this.isSettingSidebarData=!1}catch(t){this.isSettingSidebarData=!1,console.warn("Error in filterAgentCommentsFromSidebar: ",t),vd("Error in filterAgentCommentsFromSidebar: ",t)}},this.mountVeltCollaborationElements=()=>{if(!document.querySelector(Me.VELT_COMMENTS)){const t=document.createElement(Me.VELT_COMMENTS);t.setAttribute("filter-comments-on-dom","true"),t.setAttribute("shadow-dom","true"),null==t||t.addEventListener("onSignIn",(()=>{this.loginWithGoogle()})),null==t||t.addEventListener("onUpgrade",(()=>{this.onUpgradePlanClick()})),t.addEventListener("onCommentAdd",(()=>{this.addCommentCount++})),t.addEventListener("onCommentUpdate",(t=>{var e,i;(null===(e=this.snippylyUser)||void 0===e?void 0:e.isGuest)&&"newlyAdded"===(null===(i=null==t?void 0:t.detail)||void 0===i?void 0:i.type)&&(this.addCommentCount>=2&&(this.showModalOnceCommentIsModeIsOff=!0),this.addCommentCount>=5&&!this.showModalOnceCommentIsModeIsOff&&(this.showModalOnceCommentIsModeIsOff=!0))})),window.document.body.appendChild(t)}if(!document.querySelector(Me.VELT_CURSOR)){const t=document.createElement(Me.VELT_CURSOR);window.document.body.appendChild(t)}if(!document.querySelector(Me.VELT_HUDDLE)){const t=document.createElement(Me.VELT_HUDDLE);window.document.body.appendChild(t)}if(!document.querySelector(Me.VELT_RECORDER_NOTES)){const t=document.createElement(Me.VELT_RECORDER_NOTES);window.document.body.appendChild(t)}if(!document.querySelector(Me.VELT_RECORDER_CONTROL_PANEL)){const t=document.createElement(Me.VELT_RECORDER_CONTROL_PANEL);window.document.body.appendChild(t)}if(!document.querySelector(Me.VELT_ARROWS)){const t=document.createElement(Me.VELT_ARROWS);window.document.body.appendChild(t)}},this.unmountVeltCollaborationElements=()=>{try{document.querySelectorAll(ru.COLLABORATION_TAGS.join(", ")).forEach((t=>t.remove()))}catch(t){console.warn("Error in unmountVeltCollaborationElements: ",t),vd("Error in unmountVeltCollaborationElements: ",t)}},this.mountCommentSidebar=()=>{const t=this.sidebarV2Enabled,e=t?Me.VELT_COMMENTS_SIDEBAR_V2:Me.VELT_COMMENTS_SIDEBAR_LEGACY,i=t?Me.VELT_COMMENTS_SIDEBAR_LEGACY:Me.VELT_COMMENTS_SIDEBAR_V2;if(document.querySelectorAll(i).forEach((t=>t.remove())),!document.querySelector(e)){const i=document.createElement(e);i.setAttribute("shadow-dom","true"),i.setAttribute(t?Te.URL_NAVIGATION:Te.ENABLE_URL_NAVIGATION,"true"),i.setAttribute(Te.CURRENT_LOCATION_SUFFIX,"true"),e===Me.VELT_COMMENTS_SIDEBAR_LEGACY&&(i.setAttribute(Te.SIDEBAR_BUTTON_COUNT_TYPE,Ae),i.setAttribute(Te.CUSTOM_ACTIONS,"true")),window.document.body.appendChild(i)}},this.setCommentSidebarVisibility=t=>{var e,i,o,n,r,s,a,l;try{if(t===this.showAgentCommentsInSidebar)return;if(this.sidebarV2Enabled)return t?null===(i=null===(e=this.commentElement)||void 0===e?void 0:e.disableFilterCommentsOnDom)||void 0===i||i.call(e):null===(n=null===(o=this.commentElement)||void 0===o?void 0:o.enableFilterCommentsOnDom)||void 0===n||n.call(o),void(this.showAgentCommentsInSidebar=t);const c=document.querySelector(Me.VELT_COMMENTS_SIDEBAR_LEGACY);if(!c)return;t?(c.removeAttribute(Te.SIDEBAR_BUTTON_COUNT_TYPE),c.removeAttribute(Te.CUSTOM_ACTIONS),null===(s=null===(r=this.commentElement)||void 0===r?void 0:r.disableFilterCommentsOnDom)||void 0===s||s.call(r)):(c.setAttribute(Te.SIDEBAR_BUTTON_COUNT_TYPE,Ae),c.setAttribute(Te.CUSTOM_ACTIONS,"true"),null===(l=null===(a=this.commentElement)||void 0===a?void 0:a.enableFilterCommentsOnDom)||void 0===l||l.call(a)),this.showAgentCommentsInSidebar=t}catch(t){console.warn("Error in setCommentSidebarVisibility: ",t),vd("Error in setCommentSidebarVisibility: ",t)}},this.toggleCommentSidebarVisibility=()=>{try{this.setCommentSidebarVisibility(!this.showAgentCommentsInSidebar),this.menuOpenedId=void 0}catch(t){console.warn("Error in toggleCommentSidebarVisibility: ",t),vd("Error in toggleCommentSidebarVisibility: ",t)}},this.applyPageCommentsVisibility=()=>{try{const t=this.commentElement;if(!t)return;this.pageCommentsHidden?"function"==typeof t.hideCommentsOnDom&&t.hideCommentsOnDom():"function"==typeof t.showCommentsOnDom&&t.showCommentsOnDom()}catch(t){console.warn("Error in applyPageCommentsVisibility: ",t),vd("Error in applyPageCommentsVisibility: ",t)}},this.togglePageCommentsVisibility=()=>{try{this.pageCommentsHidden=!this.pageCommentsHidden,this.pageCommentsHidden?Wc(zt,"true",!1,"sessionStorage"):Kc(zt,"sessionStorage"),this.applyPageCommentsVisibility(),this.menuOpenedId=void 0}catch(t){console.warn("Error in togglePageCommentsVisibility: ",t),vd("Error in togglePageCommentsVisibility: ",t)}},this.unhidePageCommentsIfHidden=()=>{try{if(!this.pageCommentsHidden)return;this.pageCommentsHidden=!1,Kc(zt,"sessionStorage"),this.applyPageCommentsVisibility()}catch(t){console.warn("Error in unhidePageCommentsIfHidden: ",t)}},this.toggleSidebarV2=()=>{try{Wc(yt,this.sidebarV2Enabled?"false":"true",!1,"sessionStorage"),window.location.reload()}catch(t){console.warn("Error in toggleSidebarV2: ",t),vd("Error in toggleSidebarV2: ",t)}},this.toggleVeltProxy=()=>{try{if(!this.veltProxyToggleVisible)return;t=!this.veltProxyEnabled,Wc(bt,t?"true":"false"),window.location.reload()}catch(t){console.warn("Error in toggleVeltProxy: ",t),vd("Error in toggleVeltProxy: ",t)}var t},this.isScreenshotDisabledHost=()=>{try{return Ce.includes(window.location.hostname)}catch{return!1}},this.getScreenshotMode=()=>{var t,e,i;return"local"===(null===(i=null===(e=null===(t=this.customerMetadata)||void 0===t?void 0:t.superflow)||void 0===e?void 0:e.advancedFeatures)||void 0===i?void 0:i.screenshotMode)?"local":"basic"},this.logCaptureTrigger=(...t)=>{_h()&&"undefined"!=typeof console&&console.warn("[sf-capture][trigger]",...t)},this.ensureAddCommentAnnotationSubscription=()=>{var t,e,i;this.commentElement&&"function"==typeof this.commentElement.on?this.addCommentAnnotationSubscription&&this.addCommentAnnotationSubscribedEl===this.commentElement?this.logCaptureTrigger("addCommentAnnotation subscription already attached"):(this.addCommentAnnotationSubscription&&(null===(i=(e=this.addCommentAnnotationSubscription).unsubscribe)||void 0===i||i.call(e),this.addCommentAnnotationSubscription=void 0,this.logCaptureTrigger("addCommentAnnotation re-subscribing: comment element changed")),this.addCommentAnnotationSubscription=this.commentElement.on("addCommentAnnotation").subscribe((t=>this.onAddCommentAnnotation(t))),this.addCommentAnnotationSubscribedEl=this.commentElement,this.logCaptureTrigger("addCommentAnnotation subscription attached")):this.logCaptureTrigger("addCommentAnnotation subscription NOT attached: commentElement.on unavailable",{hasCommentElement:!!this.commentElement,hasOn:"function"==typeof(null===(t=this.commentElement)||void 0===t?void 0:t.on)})},this.applyScreenshotSetting=()=>{var t,e,i,o,n,r,s,a,l,c,d,h,u;if(this.commentElement)return this.isScreenshotDisabledHost()?(null===(e=(t=this.commentElement).disableScreenshot)||void 0===e||e.call(t),void(this.nativeScreenshotEnabled&&(this.nativeScreenshotEnabled=!1,this.nativeCapture.dispose()))):void(this.nativeScreenshotEnabled?null===(o=(i=this.commentElement).disableScreenshot)||void 0===o||o.call(i):(null===(s=null===(r=null===(n=this.customerMetadata)||void 0===n?void 0:n.superflow)||void 0===r?void 0:r.advancedFeatures)||void 0===s?void 0:s.takeScreenshotOnComments)?"local"!==this.getScreenshotMode()?null===(u=(h=this.commentElement).enableScreenshot)||void 0===u||u.call(h):null===(d=(c=this.commentElement).disableScreenshot)||void 0===d||d.call(c):null===(l=(a=this.commentElement).disableScreenshot)||void 0===l||l.call(a))},this.canUseNativeScreenshot=()=>{var t,e,i;return!this.isScreenshotDisabledHost()&&(iu()&&"local"===this.getScreenshotMode()&&!!(null===(i=null===(e=null===(t=this.customerMetadata)||void 0===t?void 0:t.superflow)||void 0===e?void 0:e.advancedFeatures)||void 0===i?void 0:i.takeScreenshotOnComments))},this.getNativeScreenshotPermission=()=>{const t=Zc(we,!1,"sessionStorage");return"granted"===t||"denied"===t?t:null},this.setNativeScreenshotPermission=t=>{Wc(we,t,!1,"sessionStorage"),this.nativeScreenshotDenied="denied"===t},this.clearNativeScreenshotPermission=()=>{Kc(we,"sessionStorage"),this.nativeScreenshotDenied=!1},this.promptNativeScreenshotForCommentMode=()=>{this.nativeScreenshotEnabled||this.nativeScreenshotEnabling||!this.canUseNativeScreenshot()||(this.logCaptureTrigger("commentMode enter: requesting screen share"),this.enableNativeScreenshot())},this.toggleNativeScreenshot=async()=>{try{if(!this.canUseNativeScreenshot())return;this.nativeScreenshotEnabled?(this.disableNativeScreenshot(),this.setNativeScreenshotPermission("denied")):(this.clearNativeScreenshotPermission(),await this.enableNativeScreenshot()),this.menuOpenedId=void 0}catch(t){console.warn("Error in toggleNativeScreenshot: ",t),vd("Error in toggleNativeScreenshot: ",t)}},this.enableNativeScreenshot=()=>(this.nativeScreenshotEnabling&&this.nativeScreenshotEnablingPromise||(this.nativeScreenshotEnabling=!0,this.nativeScreenshotEnablingPromise=this.performEnableNativeScreenshot()),this.nativeScreenshotEnablingPromise),this.performEnableNativeScreenshot=async()=>{var t,e;try{if(await this.nativeCapture.init(),!this.nativeCapture.isActive())return this.nativeScreenshotEnabled=!1,void this.nativeCapture.dispose();this.nativeScreenshotEnabled=!0,this.setNativeScreenshotPermission("granted"),null===(e=null===(t=this.commentElement)||void 0===t?void 0:t.disableScreenshot)||void 0===e||e.call(t),this.ensureAddCommentAnnotationSubscription()}catch(t){this.nativeScreenshotEnabled=!1,this.nativeCapture.dispose(),!function(t){var e;const i=t,o=null!==(e=null==i?void 0:i.message)&&void 0!==e?e:"";return!0===(null==i?void 0:i.sfNativeExpected)||"native-share-ended-during-init"===o||"native-not-supported"===o}(t)?console.warn("Native screenshot enable failed/cancelled: ",t):(this.setNativeScreenshotPermission("denied"),_h()&&"undefined"!=typeof console&&console.info("[sf-capture][native] enable skipped (expected):",t))}finally{this.nativeScreenshotEnabling=!1,this.nativeScreenshotEnablingPromise=void 0}},this.disableNativeScreenshot=()=>{try{this.nativeScreenshotEnabled=!1,this.nativeCapture.dispose(),this.restoreSdkScreenshot()}catch(t){console.warn("Error in disableNativeScreenshot: ",t),vd("Error in disableNativeScreenshot: ",t)}},this.handleNativeScreenshotStreamEnded=()=>{try{const t=this.nativeScreenshotEnabled;if(this.nativeScreenshotEnabled=!1,!t)return;this.setNativeScreenshotPermission("denied"),this.restoreSdkScreenshot(),this.requestUpdate()}catch(t){console.warn("Error in handleNativeScreenshotStreamEnded: ",t),vd("Error in handleNativeScreenshotStreamEnded: ",t)}},this.restoreSdkScreenshot=()=>{var t,e,i,o,n;this.isScreenshotDisabledHost()||"basic"===this.getScreenshotMode()&&(null===(i=null===(e=null===(t=this.customerMetadata)||void 0===t?void 0:t.superflow)||void 0===e?void 0:e.advancedFeatures)||void 0===i?void 0:i.takeScreenshotOnComments)&&(null===(n=null===(o=this.commentElement)||void 0===o?void 0:o.enableScreenshot)||void 0===n||n.call(o))},this.onAddCommentAnnotation=async t=>{var e,i,o,n,r,s,a,l,c;try{if(this.logCaptureTrigger("addCommentAnnotation event",{nativeScreenshotEnabled:this.nativeScreenshotEnabled,captureActive:this.nativeCapture.isActive(),dataKeys:t?Object.keys(t):null,commentAnnotationKeys:(null==t?void 0:t.commentAnnotation)?Object.keys(t.commentAnnotation):null}),!this.nativeScreenshotEnabled&&!this.canUseNativeScreenshot())return void this.logCaptureTrigger("skip: native screenshot unavailable");if(!this.nativeScreenshotEnabled){const t=this.nativeScreenshotEnabling&&!!this.nativeScreenshotEnablingPromise;if(!t&&null!==this.getNativeScreenshotPermission())return void this.logCaptureTrigger("skip: native screenshot not enabled (share decision recorded, no prompt in flight)");if(this.logCaptureTrigger(t?"comment add: share prompt already in flight, awaiting its outcome":"comment add: share never requested this session, prompting"),await this.enableNativeScreenshot(),!this.nativeScreenshotEnabled)return void this.logCaptureTrigger("skip: screen share not granted")}const d=null!==(o=null!==(e=null==t?void 0:t.annotationId)&&void 0!==e?e:null===(i=null==t?void 0:t.commentAnnotation)||void 0===i?void 0:i.annotationId)&&void 0!==o?o:null==t?void 0:t.id,h=null!==(l=null!==(a=null!==(r=null===(n=null==t?void 0:t.commentAnnotation)||void 0===n?void 0:n.comments)&&void 0!==r?r:null===(s=null==t?void 0:t.commentAnnotation)||void 0===s?void 0:s.commentData)&&void 0!==a?a:null==t?void 0:t.comments)&&void 0!==l?l:null==t?void 0:t.commentData,u=null===(c=null==h?void 0:h[0])||void 0===c?void 0:c.commentId;if(!d||!u)return void this.logCaptureTrigger("skip: missing ids",{annotationId:d,commentId:u,data:t});this.captureAndAttachScreenshot(d,u)}catch(t){console.warn("Error in onAddCommentAnnotation: ",t),vd("Error in onAddCommentAnnotation: ",t)}},this.captureAndAttachScreenshot=(t,e)=>this.nativeCapture.isActive()?(this.pendingScreenshotCount+=1,this.capturingScreenshot=!0,this.screenshotChain=this.screenshotChain.catch((()=>{})).then((()=>this.runCaptureAndAttach(t,e))).finally((()=>{this.pendingScreenshotCount=Math.max(0,this.pendingScreenshotCount-1),0===this.pendingScreenshotCount&&(this.capturingScreenshot=!1)})),this.screenshotChain):(this.logCaptureTrigger("skip: native capture not active",{annotationId:t,commentId:e}),Promise.resolve()),this.runCaptureAndAttach=async(t,e)=>{var i,o,n,r;try{this.logCaptureTrigger("capture start",{annotationId:t,commentId:e});const s=await this.nativeCapture.capture({focusAnnotationId:t}),a="image/webp"===s.blobType?"webp":"png",l=new File([s.blob],`screenshot-${t}.${a}`,{type:s.blobType}),c=await(null===(o=null===(i=this.commentElement)||void 0===i?void 0:i.addAttachment)||void 0===o?void 0:o.call(i,{annotationId:t,commentId:e,files:[l]}));if(c&&Array.isArray(c)&&c.length>0&&(null===(n=c[0])||void 0===n?void 0:n.valid)){const i=null===(r=c[0])||void 0===r?void 0:r.attachment;await this.commentElement.updateComment({annotationId:t,comment:{commentId:e,attachments:[i]},merge:!0}),this.logCaptureTrigger("capture attached",{annotationId:t,commentId:e})}else console.warn("Invalid screenshot file")}catch(t){console.warn("Native screenshot capture/attach failed: ",t),vd("Native screenshot capture/attach failed: ",t)}},this.setupSidebarAgentCommentFilter=()=>{var t,e,i,o,n,r;try{if(!this.commentElement)return;if("function"==typeof this.commentElement.on&&(this.commentElement.on("commentSidebarDataInit").subscribe((t=>{this.filterAgentCommentsFromSidebar(t)})),this.commentElement.on("commentSidebarDataUpdate").subscribe((t=>{const e=this.getSidebarGroupExpansionMap();this.filterAgentCommentsFromSidebar(t,e)}))),this.setupAgentWarningsHydration(),this.agentCommentsModeRequested)return this.setCommentSidebarVisibility(!0),void(this.showAgentCommentsInSidebar||(null===(e=null===(t=this.commentElement)||void 0===t?void 0:t.disableFilterCommentsOnDom)||void 0===e||e.call(t),this.showAgentCommentsInSidebar=!0));this.sidebarV2Enabled&&(this.showAgentCommentsInSidebar?null===(o=null===(i=this.commentElement)||void 0===i?void 0:i.disableFilterCommentsOnDom)||void 0===o||o.call(i):null===(r=null===(n=this.commentElement)||void 0===n?void 0:n.enableFilterCommentsOnDom)||void 0===r||r.call(n))}catch(t){console.warn("Error in setupSidebarAgentCommentFilter: ",t),vd("Error in setupSidebarAgentCommentFilter: ",t)}},this.setupAgentWarningsHydration=()=>{try{if(!this.commentElement||"function"!=typeof this.commentElement.getAllCommentAnnotations||!this.documentId)return;const t=this.commentElement.getAllCommentAnnotations(this.documentId+"");if(!t||"function"!=typeof t.subscribe)return;const e=t.subscribe((t=>{try{if(this.streamEmissionCount+=1,this.lastStreamEmissionAt=Date.now(),!this.sidebarV2Enabled&&!this.showAgentCommentsInSidebar)return;this.lastStreamAnnotations=Array.isArray(t)?t:[],this.processAgentComments(this.mergeOnboardingFetchedAnnotations(this.lastStreamAnnotations)),this.ensureOnboardingFindingsLoaded()}catch(t){console.warn("Error in agent-warnings hydration subscription: ",t),vd("Error in agent-warnings hydration subscription: ",t)}}));this.subscriptions.push(e)}catch(t){console.warn("Error in setupAgentWarningsHydration: ",t),vd("Error in setupAgentWarningsHydration: ",t)}},this.getContentWarningsDisplayCount=()=>{try{return this.contentWarningsCount>99?"99+":`${this.contentWarningsCount}`}catch(t){return console.warn("Error in getContentWarningsDisplayCount: ",t),"0"}},this.onContentWarningsButtonClick=()=>{try{this.showContentWarningSidebar=!this.showContentWarningSidebar}catch(t){console.warn("Error in onContentWarningsButtonClick: ",t),vd("Error in onContentWarningsButtonClick: ",t)}},this.onContentWarningSidebarClose=()=>{try{this.showContentWarningSidebar=!1}catch(t){console.warn("Error in onContentWarningSidebarClose: ",t)}},this.getOnboardingDismissedProjectIds=()=>{try{const t=Zc(Pt,!1,"sessionStorage");if(!t)return[];try{const e=JSON.parse(t);if(Array.isArray(e))return e.filter((t=>"string"==typeof t&&t.length>0))}catch{}return[t]}catch(t){return console.warn("Error in getOnboardingDismissedProjectIds: ",t),vd("Error in getOnboardingDismissedProjectIds: ",t),[]}},this.setOnboardingDismissedProjectIds=t=>{try{const e=t.slice(-20);if(0===e.length)return void Kc(Pt,"sessionStorage");Wc(Pt,JSON.stringify(e),!1,"sessionStorage")}catch(t){console.warn("Error in setOnboardingDismissedProjectIds: ",t),vd("Error in setOnboardingDismissedProjectIds: ",t)}},this.recordOnboardingSidebarDismissal=()=>{try{if(!this.projectId)return;const t=`${this.projectId}`,e=this.getOnboardingDismissedProjectIds().filter((e=>e!==t));this.setOnboardingDismissedProjectIds([...e,t])}catch(t){console.warn("Error in recordOnboardingSidebarDismissal: ",t),vd("Error in recordOnboardingSidebarDismissal: ",t)}},this.clearOnboardingSidebarDismissal=()=>{try{if(!this.projectId)return;const t=`${this.projectId}`,e=this.getOnboardingDismissedProjectIds();if(!e.includes(t))return;this.setOnboardingDismissedProjectIds(e.filter((e=>e!==t)))}catch(t){console.warn("Error in clearOnboardingSidebarDismissal: ",t),vd("Error in clearOnboardingSidebarDismissal: ",t)}},this.canShowTourCommentTooltip=()=>{try{return!(this.allFeatureDisabled||this.readOnlyMode||!this.showTourCommentTooltip)&&!(this.onboardingMode&&this.showContentWarningSidebar)}catch(t){return console.warn("Error in canShowTourCommentTooltip: ",t),vd("Error in canShowTourCommentTooltip: ",t),!1}},this.autoOpenOnboardingSidebar=()=>{try{if(!this.onboardingMode||this.allFeatureDisabled)return;if(!this.projectId)return;if(this.getOnboardingDismissedProjectIds().includes(`${this.projectId}`))return;this.showContentWarningSidebar=!0}catch(t){console.warn("Error in autoOpenOnboardingSidebar: ",t),vd("Error in autoOpenOnboardingSidebar: ",t)}},this.restoreContentWarningSidebarState=()=>{var t,e;try{if(this.onboardingMode)return this.autoOpenOnboardingSidebar(),void(this.showContentWarningSidebar&&(this.showAgentCommentsInSidebar?null===(e=null===(t=this.commentElement)||void 0===t?void 0:t.disableFilterCommentsOnDom)||void 0===e||e.call(t):this.setCommentSidebarVisibility(!0)));const i="true"===Zc(ge,!1,"sessionStorage"),o=new URL(window.location.href).searchParams.has(Ht);if(!i)return;if(!o)return;if(this.allFeatureDisabled||"Admin"!==this.snippylyUserRole)return;this.showContentWarningSidebar=!0}catch(t){console.warn("Error in restoreContentWarningSidebarState: ",t),vd("Error in restoreContentWarningSidebarState: ",t)}},this.navigateTo=t=>{try{window.location.href=t}catch(t){console.warn("Error in navigateTo: ",t),vd("Error in navigateTo: ",t)}},this.onContentWarningSidebarAddAll=()=>{},this.onContentWarningItemClick=t=>{var e,i,o;try{const n=null===(e=null==t?void 0:t.detail)||void 0===e?void 0:e.annotation;if(!(null==n?void 0:n.annotationId)&&!(null==n?void 0:n.id))return;const r=(null==n?void 0:n.annotationId)||(null==n?void 0:n.id),s=null===(i=null==n?void 0:n.pageInfo)||void 0===i?void 0:i.url;if(s&&!this.isCurrentPageUrl(s)){if(this.showContentWarningSidebar&&Wc(ge,"true",!1,"sessionStorage"),this.isRunningUnderPreviewProxy()){return void(!(null!==nd(s))&&window.parent&&window.parent!==window&&window.parent.postMessage({type:Ut,url:s,annotationId:r},"*"))}const t=new URL(s);return t.searchParams.set(Ht,r),void this.navigateTo(t.toString())}(null===(o=this.commentElement)||void 0===o?void 0:o.selectCommentByAnnotationId)&&this.commentElement.selectCommentByAnnotationId(r),setTimeout((()=>{var t;(null===(t=this.commentElement)||void 0===t?void 0:t.scrollToCommentByAnnotationId)&&this.commentElement.scrollToCommentByAnnotationId(r)}),150)}catch(t){console.warn("Error in onContentWarningItemClick: ",t),vd("Error in onContentWarningItemClick: ",t)}},this.isCurrentPageUrl=t=>{var e;try{const i=null!==(e=nd(t))&&void 0!==e?e:new URL(t).pathname;return i===(this.isRunningUnderPreviewProxy()?this.previewLocationPath||"/":window.location.pathname)}catch{return!1}},this.setupVeltButtonClickListener=()=>{try{if(!(null===Velt||void 0===Velt?void 0:Velt.on))return void console.warn("[CWS Toolbar] Velt.on not available for button click listener");Velt.on("veltButtonClick").subscribe((t=>{var e;try{if(!t)return;const i=null===(e=null==t?void 0:t.buttonContext)||void 0===e?void 0:e.clickedButtonId,o=null==t?void 0:t.commentAnnotation,n=(null==o?void 0:o.annotationId)||(null==o?void 0:o.id),r="accept-suggestion"===i||"reject-suggestion"===i;if(r&&n&&this.processingAnnotationIds.has(n))return;if(r&&this.isRunningUnderPreviewProxy()&&"Admin"!==this.snippylyUserRole)return void console.warn("[CWS Toolbar] Only admins can accept or reject suggestions. Ignoring under the preview proxy:",i);"prev-suggestion"===i?this.navigateSuggestion(o,"prev"):"next-suggestion"===i?this.navigateSuggestion(o,"next"):"accept-suggestion"===i?this.handleAcceptSuggestion(o):"reject-suggestion"===i&&this.handleDeclineSuggestion(o)}catch(t){console.warn("Error in veltButtonClick handler: ",t)}})),this.commentElement.onCommentSelectionChange().subscribe((t=>{this.handleCommentSelection(t)}))}catch(t){console.warn("Error in setupVeltButtonClickListener: ",t),vd("Error in setupVeltButtonClickListener: ",t)}},this.navigateSuggestion=(t,e)=>{var i,o,n,r,s;try{if(!t)return void console.warn("[CWS Toolbar] No annotation provided for navigation");const a=null===(o=null===(i=null==t?void 0:t.agent)||void 0===i?void 0:i.result)||void 0===o?void 0:o.incorrectWord;if(!a)return void console.warn("[CWS Toolbar] No incorrectWord found on annotation");const l=this.findMatchingWarning(a);if(!l)return void console.warn("[CWS Toolbar] No matching warning found for word:",a);const c=null===(n=null==t?void 0:t.pageInfo)||void 0===n?void 0:n.path,d=this.normalizePagePath(c),h=null===(r=null==l?void 0:l.annotations)||void 0===r?void 0:r.filter((t=>{var e;const i=null===(e=null==t?void 0:t.pageInfo)||void 0===e?void 0:e.path;return this.normalizePagePath(i)===d}));if(!(null==h?void 0:h.length)||h.length<=1)return;const u=(null==t?void 0:t.annotationId)||(null==t?void 0:t.id),p=h.findIndex((t=>((null==t?void 0:t.annotationId)||(null==t?void 0:t.id))===u));if(-1===p)return void console.warn("[CWS Toolbar] Current annotation not found in warning group");let v;v="next"===e?(p+1)%h.length:(p-1+h.length)%h.length;const g=h[v],f=(null==g?void 0:g.annotationId)||(null==g?void 0:g.id);f&&((null===(s=this.commentElement)||void 0===s?void 0:s.selectCommentByAnnotationId)&&this.commentElement.selectCommentByAnnotationId(f),setTimeout((()=>{var t;(null===(t=this.commentElement)||void 0===t?void 0:t.scrollToCommentByAnnotationId)&&this.commentElement.scrollToCommentByAnnotationId(f)}),150))}catch(t){console.warn("Error in navigateSuggestion: ",t),vd("Error in navigateSuggestion: ",t)}},this.findMatchingWarning=t=>{var e;try{for(const i of this.agentGroups){const o=null===(e=null==i?void 0:i.warnings)||void 0===e?void 0:e.find((e=>(null==e?void 0:e.primaryText)===t));if(o)return o}return null}catch(t){return console.warn("Error in findMatchingWarning: ",t),null}},this.removeAnnotationFromWarnings=t=>{var e,i,o;try{if(!t)return;const n=e=>{var i,o,n,r;for(const s of e){const e=null===(i=null==s?void 0:s.annotations)||void 0===i?void 0:i.find((e=>((null==e?void 0:e.annotationId)||(null==e?void 0:e.id))===t));if(e){const t="grammar"===(null===(n=null===(o=null==e?void 0:e.agent)||void 0===o?void 0:o.result)||void 0===n?void 0:n.type)?this.grammarSuggestionPagePathMap:this.spellingSuggestionPagePathMap,i=(null==s?void 0:s.primaryText)||"",a=null===(r=null==e?void 0:e.pageInfo)||void 0===r?void 0:r.path,l=this.normalizePagePath(a);if(i&&l&&t.has(i)){const e=t.get(i),o=e.get(l)||0;o>1?e.set(l,o-1):(e.delete(l),0===e.size&&t.delete(i))}return}}};for(const t of this.agentGroups)(null==t?void 0:t.agentId)!==Se.SPELL_CHECK&&(null==t?void 0:t.agentId)!==Se.GRAMMAR_CHECK||n(t.warnings);const r=null!==(o=null===(i=null===(e=this.agentGroups)||void 0===e?void 0:e.map((e=>{var i,o,n,r,s;const a=null!==(n=null===(o=null===(i=null==e?void 0:e.warnings)||void 0===i?void 0:i.map((e=>{var i;const o=null===(i=null==e?void 0:e.annotations)||void 0===i?void 0:i.filter((e=>((null==e?void 0:e.annotationId)||(null==e?void 0:e.id))!==t));return o&&0!==o.length?{...e,annotations:o,occurrences:o.length}:null})))||void 0===o?void 0:o.filter((t=>null!==t)))&&void 0!==n?n:[],l=null!==(s=null===(r=null==e?void 0:e.annotations)||void 0===r?void 0:r.filter((e=>((null==e?void 0:e.annotationId)||(null==e?void 0:e.id))!==t)))&&void 0!==s?s:[];return 0===a.length?null:{...e,warnings:a,warningCount:a.length,annotations:l}})))||void 0===i?void 0:i.filter((t=>null!==t)))&&void 0!==o?o:[];this.agentGroups=r;const s=r.reduce(((t,e)=>t+e.warningCount),0);this.contentWarningsCount=s,this.hasContentWarnings=s>0,this.onboardingFetchedAnnotations=this.onboardingFetchedAnnotations.filter((e=>((null==e?void 0:e.annotationId)||(null==e?void 0:e.id))!==t)),this.onboardingMode&&(this.onboardingRemovedAnnotationIds.add(t),this.setOnboardingUnsyncedAnnotationIds(this.onboardingFetchedAnnotations.map((t=>null==t?void 0:t.annotationId))))}catch(t){console.warn("Error in removeAnnotationFromWarnings: ",t)}},this.setSuggestionButtonsLoading=(t,e,i)=>{try{const o=i||document.querySelector(".velt-comment-dialog.selected");if(!o)return;const n=o.querySelector(".sf-accept-btn"),r=o.querySelector(".sf-reject-btn");if(e){const e="accept"===t?n:r,i="accept"===t?r:n;null==e||e.classList.add("sf-btn-loading"),null==i||i.classList.add("sf-btn-disabled")}else null==n||n.classList.remove("sf-btn-loading","sf-btn-disabled"),null==r||r.classList.remove("sf-btn-loading","sf-btn-disabled")}catch(t){console.warn("Error in setSuggestionButtonsLoading: ",t)}},this.handleAcceptSuggestion=async t=>{var e,i,o;try{const n=(null==t?void 0:t.annotationId)||(null==t?void 0:t.id);if(!n)return void console.warn("[CWS Toolbar] handleAcceptSuggestion: No annotationId found",t);if(this.processingAnnotationIds.has(n))return;const r=(null===(e=this.snippylyUser)||void 0===e?void 0:e.userId)||(null===(i=this.snippylyUser)||void 0===i?void 0:i.uid),s=(null===(o=this.snippylyUser)||void 0===o?void 0:o.email)||"";if(!r)return void console.warn("[CWS Toolbar] handleAcceptSuggestion: No user available");if(!this.documentId)return void console.warn("[CWS Toolbar] handleAcceptSuggestion: No documentId available");this.processingAnnotationIds.add(n);const a=document.querySelector(".velt-comment-dialog.selected");this.setSuggestionButtonsLoading("accept",!0,a);try{await Ld(this.apiKey,this.apiKey,this.documentId+"",n,{userId:r,email:s}),this.removeAnnotationFromWarnings(n)}finally{this.processingAnnotationIds.delete(n),this.setSuggestionButtonsLoading("accept",!1,a)}}catch(t){console.warn("Error in handleAcceptSuggestion: ",t),vd("Error in handleAcceptSuggestion: ",t)}},this.handleDeclineSuggestion=async t=>{var e,i,o;try{const n=(null==t?void 0:t.annotationId)||(null==t?void 0:t.id);if(!n)return void console.warn("[CWS Toolbar] handleDeclineSuggestion: No annotationId found",t);if(this.processingAnnotationIds.has(n))return;if(!this.documentId)return void console.warn("[CWS Toolbar] handleDeclineSuggestion: No documentId available");this.processingAnnotationIds.add(n);const r=document.querySelector(".velt-comment-dialog.selected");this.setSuggestionButtonsLoading("reject",!0,r);const s=(null===(e=this.snippylyUser)||void 0===e?void 0:e.userId)||(null===(i=this.snippylyUser)||void 0===i?void 0:i.uid),a=(null===(o=this.snippylyUser)||void 0===o?void 0:o.email)||"";try{await Dd(this.apiKey,this.apiKey,this.documentId+"",n,s?{userId:s,email:a}:void 0),this.removeAnnotationFromWarnings(n)}finally{this.processingAnnotationIds.delete(n),this.setSuggestionButtonsLoading("reject",!1,r)}}catch(t){console.warn("Error in handleDeclineSuggestion: ",t),vd("Error in handleDeclineSuggestion: ",t)}},this.showFirstCommentNudge=()=>{try{if(!this.autoCommentModeRequested||this.autoCommentModeArmedOnce||this.addCommentMode)return;this.firstCommentNudge=!0,this.showTourCommentTooltip=!0}catch(t){console.warn("Error in showFirstCommentNudge: ",t),vd("Error in showFirstCommentNudge: ",t)}},this.disableCommentMode=()=>{var t;try{(null===(t=this.commentElement)||void 0===t?void 0:t.disableCommentMode)&&this.commentElement.disableCommentMode()}catch(t){console.warn("Error in disableAddCommentMode: ",t),vd("Error in disableAddCommentMode: ",t)}},this.disableCommentModeButton=()=>{try{return this.addCommentMode?L`
5866
5837
  <div class="disable-add-comment-button" @click=${()=>this.disableCommentMode()}>
5867
5838
  <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
5868
5839
  <path fill-rule="evenodd" clip-rule="evenodd" d="M3.52861 3.52858C3.78896 3.26823 4.21107 3.26823 4.47141 3.52858L8.00001 7.05717L11.5286 3.52858C11.789 3.26823 12.2111 3.26823 12.4714 3.52858C12.7318 3.78892 12.7318 4.21103 12.4714 4.47138L8.94282 7.99998L12.4714 11.5286C12.7318 11.7889 12.7318 12.211 12.4714 12.4714C12.2111 12.7317 11.789 12.7317 11.5286 12.4714L8.00001 8.94279L4.47141 12.4714C4.21107 12.7317 3.78896 12.7317 3.52861 12.4714C3.26826 12.211 3.26826 11.7889 3.52861 11.5286L7.0572 7.99998L3.52861 4.47138C3.26826 4.21103 3.26826 3.78892 3.52861 3.52858Z" fill="#FAFBFF"/>
@@ -5903,7 +5874,7 @@ class $c extends ma{}$c.Encryptor=class extends $c{processBlock(t,e){const i=t,o
5903
5874
  @content-warning-sidebar-add-all=${this.onContentWarningSidebarAddAll}
5904
5875
  @content-warning-item-click=${this.onContentWarningItemClick}
5905
5876
  ></content-warning-sidebar>
5906
- `:L``}catch(t){return console.warn("Error in renderContentWarningSidebar: ",t),vd("Error in renderContentWarningSidebar: ",t),L``}},this.getOnboardingTotalFindings=()=>{try{return Sh(this.getDisplayAgentRunStatuses(),this.agentGroups).filter((t=>t.state===oh)).reduce(((t,e)=>t+(e.count||0)),0)}catch(t){return console.warn("Error in getOnboardingTotalFindings: ",t),vd("Error in getOnboardingTotalFindings: ",t),0}},this.isOnboardingRunClean=()=>{try{return 0!==this.agentRunStatuses.length&&Sh(this.getDisplayAgentRunStatuses(),this.agentGroups).every((t=>t.state===nh))}catch(t){return console.warn("Error in isOnboardingRunClean: ",t),vd("Error in isOnboardingRunClean: ",t),!1}},this.getOnboardingFindingsDisplayCount=()=>{try{const t=this.getOnboardingTotalFindings();return t>99?"99+":`${t}`}catch(t){return console.warn("Error in getOnboardingFindingsDisplayCount: ",t),vd("Error in getOnboardingFindingsDisplayCount: ",t),"0"}},this.isOnboardingAgentStatusLoading=()=>{try{return this.onboardingMode&&!this.agentRunStatusSettled}catch(t){return console.warn("Error in isOnboardingAgentStatusLoading: ",t),vd("Error in isOnboardingAgentStatusLoading: ",t),!1}},this.getOnboardingAgentButtonState=()=>{try{return!this.agentRunStatusTimedOut&&this.agentRunStatuses.some((t=>null==t?void 0:t.isRunning))?fe.RUNNING:this.isOnboardingAgentStatusLoading()?fe.LOADING:this.getOnboardingTotalFindings()>0?fe.FINDINGS:this.isOnboardingRunClean()?fe.CLEAN:fe.IDLE}catch(t){return console.warn("Error in getOnboardingAgentButtonState: ",t),vd("Error in getOnboardingAgentButtonState: ",t),fe.IDLE}},this.getOnboardingAgentButtonLabel=()=>{try{const t=this.getOnboardingAgentButtonState();if(t===fe.RUNNING){const t=this.agentRunStatuses.length;return 1===t?Vd(me.RUNNING_SINGLE):`${Vd(me.RUNNING)} ${t} ${Vd(me.QA_AGENTS)}`}return t===fe.LOADING?Vd(me.LOADING):t===fe.FINDINGS?1===this.getOnboardingTotalFindings()?Vd(me.FINDING_SINGLE):`${this.getOnboardingFindingsDisplayCount()} ${Vd(me.FINDINGS)}`:Vd(t===fe.CLEAN?me.NO_ISSUES_FOUND:me.QA_AGENTS)}catch(t){return console.warn("Error in getOnboardingAgentButtonLabel: ",t),vd("Error in getOnboardingAgentButtonLabel: ",t),Vd(me.QA_AGENTS)}},this.renderOnboardingAgentButtonIcon=t=>{try{return t===fe.RUNNING||t===fe.LOADING?L`
5877
+ `:L``}catch(t){return console.warn("Error in renderContentWarningSidebar: ",t),vd("Error in renderContentWarningSidebar: ",t),L``}},this.getOnboardingTotalFindings=()=>{try{return Mh(this.getDisplayAgentRunStatuses(),this.agentGroups).filter((t=>t.state===oh)).reduce(((t,e)=>t+(e.count||0)),0)}catch(t){return console.warn("Error in getOnboardingTotalFindings: ",t),vd("Error in getOnboardingTotalFindings: ",t),0}},this.isOnboardingRunClean=()=>{try{return 0!==this.agentRunStatuses.length&&Mh(this.getDisplayAgentRunStatuses(),this.agentGroups).every((t=>t.state===nh))}catch(t){return console.warn("Error in isOnboardingRunClean: ",t),vd("Error in isOnboardingRunClean: ",t),!1}},this.getOnboardingFindingsDisplayCount=()=>{try{const t=this.getOnboardingTotalFindings();return t>99?"99+":`${t}`}catch(t){return console.warn("Error in getOnboardingFindingsDisplayCount: ",t),vd("Error in getOnboardingFindingsDisplayCount: ",t),"0"}},this.isOnboardingAgentStatusLoading=()=>{try{return this.onboardingMode&&!this.agentRunStatusSettled}catch(t){return console.warn("Error in isOnboardingAgentStatusLoading: ",t),vd("Error in isOnboardingAgentStatusLoading: ",t),!1}},this.getOnboardingAgentButtonState=()=>{try{return!this.agentRunStatusTimedOut&&this.agentRunStatuses.some((t=>null==t?void 0:t.isRunning))?fe.RUNNING:this.isOnboardingAgentStatusLoading()?fe.LOADING:this.getOnboardingTotalFindings()>0?fe.FINDINGS:this.isOnboardingRunClean()?fe.CLEAN:fe.IDLE}catch(t){return console.warn("Error in getOnboardingAgentButtonState: ",t),vd("Error in getOnboardingAgentButtonState: ",t),fe.IDLE}},this.getOnboardingAgentButtonLabel=()=>{try{const t=this.getOnboardingAgentButtonState();if(t===fe.RUNNING){const t=this.agentRunStatuses.length;return 1===t?Vd(me.RUNNING_SINGLE):`${Vd(me.RUNNING)} ${t} ${Vd(me.QA_AGENTS)}`}return t===fe.LOADING?Vd(me.LOADING):t===fe.FINDINGS?1===this.getOnboardingTotalFindings()?Vd(me.FINDING_SINGLE):`${this.getOnboardingFindingsDisplayCount()} ${Vd(me.FINDINGS)}`:Vd(t===fe.CLEAN?me.NO_ISSUES_FOUND:me.QA_AGENTS)}catch(t){return console.warn("Error in getOnboardingAgentButtonLabel: ",t),vd("Error in getOnboardingAgentButtonLabel: ",t),Vd(me.QA_AGENTS)}},this.renderOnboardingAgentButtonIcon=t=>{try{return t===fe.RUNNING||t===fe.LOADING?L`
5907
5878
  <svg class="onboarding-agent-icon onboarding-agent-icon-spinner" width="17" height="17" viewBox="0 0 17 17" fill="none" xmlns="http://www.w3.org/2000/svg">
5908
5879
  <path d="M17 8.5C17 13.1944 13.1944 17 8.5 17C3.80558 17 0 13.1944 0 8.5C0 3.80558 3.80558 3.82234e-06 8.5 3.82234e-06C13.1944 3.82234e-06 17 3.80558 17 8.5ZM2.125 8.5C2.125 12.0208 4.97918 14.875 8.5 14.875C12.0208 14.875 14.875 12.0208 14.875 8.5C14.875 4.97919 12.0208 2.125 8.5 2.125C4.97918 2.125 2.125 4.97919 2.125 8.5Z" fill="#D9D9D9"/>
5909
5880
  <path d="M15.9375 8.5C16.5243 8.5 17.0068 8.02247 16.9337 7.44024C16.7696 6.13462 16.3039 4.87981 15.5675 3.77766C14.6335 2.37984 13.306 1.29037 11.7528 0.647028C10.1996 0.00368291 8.49057 -0.164645 6.84173 0.163329C5.54166 0.421929 4.32507 0.979922 3.28585 1.78712C2.82242 2.14709 2.82596 2.82597 3.24089 3.2409V3.2409C3.65583 3.65583 4.32448 3.64716 4.8025 3.30682C5.53316 2.7866 6.36879 2.42403 7.2563 2.2475C8.49293 2.00152 9.77473 2.12776 10.9396 2.61027C12.1045 3.09278 13.1001 3.90988 13.8006 4.95824C14.3034 5.71064 14.6379 6.55789 14.7867 7.4424C14.884 8.02107 15.3507 8.5 15.9375 8.5V8.5Z" fill="#625DF5"/>
@@ -6931,4 +6902,4 @@ class $c extends ma{}$c.Encryptor=class extends $c{processBlock(t,e){const i=t,o
6931
6902
  @superflow-bug-report-modal-close=${this.closeBugReportModal}
6932
6903
  ></superflow-bug-report-modal>
6933
6904
  `:""}
6934
- `:L``}}nu.PREVIEW_READONLY_CSS="\n velt-comment-dialog-suggestion-actions,\n velt-comment-dialog-suggestion-actions-internal,\n velt-comment-dialog-suggestion-action-accept,\n velt-comment-dialog-suggestion-action-accept-internal,\n velt-comment-dialog-suggestion-action-reject,\n velt-comment-dialog-suggestion-action-reject-internal,\n velt-comment-dialog-legacy-suggestion-action,\n velt-comment-dialog-legacy-suggestion-action-accept,\n velt-comment-dialog-legacy-suggestion-action-reject,\n .velt-suggestion-actions,\n .sf-accept-btn,\n .sf-reject-btn {\n display: none !important;\n }\n ",nu.PREVIEW_READONLY_STYLE_ATTR="data-sf-preview-readonly",nu.COLLABORATION_TAGS=[Me.VELT_COMMENTS,Me.VELT_CURSOR,Me.VELT_HUDDLE,Me.VELT_RECORDER_NOTES,Me.VELT_RECORDER_CONTROL_PANEL,Me.VELT_ARROWS,Me.VELT_COMMENTS_SIDEBAR_LEGACY,Me.VELT_COMMENTS_SIDEBAR_V2],nu.styles=[jd,Ud],ou([nt()],nu.prototype,"loadPlugin",null),ou([nt()],nu.prototype,"comments",void 0),ou([nt()],nu.prototype,"commentElement",void 0),ou([nt()],nu.prototype,"contactElement",void 0),ou([nt()],nu.prototype,"rewriterElement",void 0),ou([nt()],nu.prototype,"presenceElement",void 0),ou([nt()],nu.prototype,"commentSubscription",void 0),ou([nt()],nu.prototype,"selectionElement",void 0),ou([nt()],nu.prototype,"viewsElement",void 0),ou([nt()],nu.prototype,"docElement",void 0),ou([nt()],nu.prototype,"addCommentMode",void 0),ou([nt()],nu.prototype,"showTourCommentTooltip",void 0),ou([nt()],nu.prototype,"firstCommentNudge",void 0),ou([nt()],nu.prototype,"allFeatureDisabled",void 0),ou([nt()],nu.prototype,"planLimitLocked",void 0),ou([nt()],nu.prototype,"projectDeleted",void 0),ou([nt()],nu.prototype,"allFeatureRestricted",void 0),ou([nt()],nu.prototype,"guestMode",void 0),ou([nt()],nu.prototype,"_expanded",void 0),ou([nt()],nu.prototype,"loading",void 0),ou([nt()],nu.prototype,"signInError",void 0),ou([nt()],nu.prototype,"snippylyUser",void 0),ou([nt()],nu.prototype,"snippylyUserRole",void 0),ou([nt()],nu.prototype,"_isPlanExpired",void 0),ou([nt()],nu.prototype,"showOnboardingModal",void 0),ou([nt()],nu.prototype,"embedMode",void 0),ou([nt()],nu.prototype,"readOnlyMode",void 0),ou([nt()],nu.prototype,"onboardingMode",void 0),ou([nt()],nu.prototype,"showLiveDemoModal",void 0),ou([nt()],nu.prototype,"showFigmaDemoModal",void 0),ou([nt()],nu.prototype,"showGuestModeSignInModal",void 0),ou([nt()],nu.prototype,"guestModeSignInModalConfig",void 0),ou([nt()],nu.prototype,"showGuestModeNameModal",void 0),ou([nt()],nu.prototype,"guestModeSignInBannerVisible",void 0),ou([nt()],nu.prototype,"guestUserNameInput",void 0),ou([nt()],nu.prototype,"guestUserModelOpened",void 0),ou([nt()],nu.prototype,"guestUserNameUpdated",void 0),ou([nt()],nu.prototype,"guestUserNameUpdateLoading",void 0),ou([ot()],nu.prototype,"apiKey",null),ou([ot()],nu.prototype,"projectId",null),ou([nt()],nu.prototype,"staging",void 0),ou([ot()],nu.prototype,"projectVersionKey",null),ou([nt()],nu.prototype,"projectVersion",void 0),ou([nt()],nu.prototype,"version",void 0),ou([ot()],nu.prototype,"veltVersion",void 0),ou([ot()],nu.prototype,"autoLocation",null),ou([nt()],nu.prototype,"_menuOpenedId",void 0),ou([nt()],nu.prototype,"copyLinkTooltip",void 0),ou([nt()],nu.prototype,"invalidApiKey",void 0),ou([nt()],nu.prototype,"documentId",void 0),ou([nt()],nu.prototype,"serverDocumentId",void 0),ou([nt()],nu.prototype,"_isUserGlobalContact",void 0),ou([nt()],nu.prototype,"location",void 0),ou([nt()],nu.prototype,"qrCode",void 0),ou([nt()],nu.prototype,"showQrCode",void 0),ou([nt()],nu.prototype,"qrCodeLoading",void 0),ou([nt()],nu.prototype,"qrCodeError",void 0),ou([nt()],nu.prototype,"customLoginEnabledLocally",void 0),ou([ot()],nu.prototype,"customLoginEnabled",void 0),ou([nt()],nu.prototype,"providedUser",void 0),ou([nt()],nu.prototype,"autoTranslation",void 0),ou([nt()],nu.prototype,"addCommentCount",void 0),ou([nt()],nu.prototype,"isSigningInUserAdmin",void 0),ou([nt()],nu.prototype,"_privateCommentModeEnabled",void 0),ou([nt()],nu.prototype,"superflowToolbarMoved",void 0),ou([nt()],nu.prototype,"_customerMetadata",void 0),ou([nt()],nu.prototype,"logoMark",void 0),ou([nt()],nu.prototype,"wordMark",void 0),ou([nt()],nu.prototype,"_darkMode",void 0),ou([nt()],nu.prototype,"projectConfig",void 0),ou([nt()],nu.prototype,"allowGuestModeSignIn",void 0),ou([nt()],nu.prototype,"_queryParamsComments",void 0),ou([nt()],nu.prototype,"_usePageTitleAsLocationName",void 0),ou([nt()],nu.prototype,"toolbarEnabled",void 0),ou([nt()],nu.prototype,"toolbarEnabledApiCalled",void 0),ou([nt()],nu.prototype,"passwordProtected",void 0),ou([nt()],nu.prototype,"isPasswordValid",void 0),ou([nt()],nu.prototype,"password",void 0),ou([nt()],nu.prototype,"validatingPasswordLoading",void 0),ou([nt()],nu.prototype,"showPasswordProtectedModal",void 0),ou([nt()],nu.prototype,"showInvalidPassword",void 0),ou([nt()],nu.prototype,"skipGuestNameModal",void 0),ou([nt()],nu.prototype,"_totalViews",void 0),ou([nt()],nu.prototype,"totalViewsCount",void 0),ou([nt()],nu.prototype,"inviteUrl",void 0),ou([nt()],nu.prototype,"showModalOnceCommentIsModeIsOff",void 0),ou([nt()],nu.prototype,"showInviteModal",void 0),ou([nt()],nu.prototype,"showBugReportModal",void 0),ou([nt()],nu.prototype,"featureAccess",void 0),ou([nt()],nu.prototype,"hasAgentAccess",void 0),ou([nt()],nu.prototype,"hasPrivateCommentsAccess",void 0),ou([nt()],nu.prototype,"isPrivateCommentsEnabledOnWorkspace",void 0),ou([nt()],nu.prototype,"hasContentWarnings",void 0),ou([nt()],nu.prototype,"contentWarningsCount",void 0),ou([nt()],nu.prototype,"showContentWarningSidebar",void 0),ou([nt()],nu.prototype,"showAgentCommentsInSidebar",void 0),ou([nt()],nu.prototype,"pageCommentsHidden",void 0),ou([nt()],nu.prototype,"veltProxyToggleVisible",void 0),ou([nt()],nu.prototype,"nativeScreenshotEnabled",void 0),ou([nt()],nu.prototype,"nativeScreenshotDenied",void 0),ou([nt()],nu.prototype,"capturingScreenshot",void 0),ou([nt()],nu.prototype,"agentGroups",void 0),ou([nt()],nu.prototype,"agentRunStatuses",void 0),ou([nt()],nu.prototype,"agentRunStatusTimedOut",void 0),ou([nt()],nu.prototype,"agentRunStatusSettled",void 0),ou([nt()],nu.prototype,"onboardingUnsyncedAnnotationIds",void 0),ou([nt()],nu.prototype,"spellingSuggestionPagePathMap",void 0),ou([nt()],nu.prototype,"grammarSuggestionPagePathMap",void 0),(t=>{if(customElements.get("superflow-toolbar")||customElements.get("snippyly-plugin"))return;const e={allow:["sdkUrl","windowVariables","snippylyPlugin"],loaders:{windowVariables:()=>{const t=null===window||void 0===window?void 0:window.SUPERFLOW_TOOLBAR_API_KEY;return{valid:!!t,type:"windowVariables",apiKey:t,staging:!!(null===window||void 0===window?void 0:window.SUPERFLOW_TOOLBAR_STAGING),projectVersionKey:null===window||void 0===window?void 0:window.SUPERFLOW_TOOLBAR_PROJECT_VERSION_KEY,projectId:null===window||void 0===window?void 0:window.SUPERFLOW_TOOLBAR_PROJECT_ID,autoLocation:null===window||void 0===window?void 0:window.SUPERFLOW_TOOLBAR_AUTO_LOCATION,veltVersion:null===window||void 0===window?void 0:window.SUPERFLOW_TOOLBAR_VELT_VERSION}},snippylyPlugin:()=>{const t=document.querySelector("snippyly-plugin");if(!t)return;const e=t.getAttribute("apiKey"),i=!!t.getAttribute("staging"),o=t.getAttribute("projectVersionKey"),n=t.getAttribute("projectId"),r=t.getAttribute("autoLocation"),s=t.getAttribute("veltVersion");return null==t||t.remove(),{valid:!!e,type:"snippylyPlugin",apiKey:e,staging:i,projectVersionKey:o,projectId:n,autoLocation:r,veltVersion:s}},sdkUrl:()=>{const t=document.getElementById("superflowToolbarScript");if(!t)return;const e=null==t?void 0:t.src,i=new URL(e).searchParams,o=i.has("apiKey")?i.get("apiKey"):void 0;return{valid:!!o,type:"sdkUrl",apiKey:o,staging:void 0,projectVersionKey:void 0,projectId:i.has("projectId")?i.get("projectId"):void 0,autoLocation:i.has("autoLocation")?i.get("autoLocation"):void 0,veltVersion:i.has("veltVersion")?i.get("veltVersion"):void 0}}},load:()=>{for(let t=0;t<e.allow.length;t++){const i=e.allow[t],o=e.loaders[i]();if(o&&o.valid)return o}}},i=()=>{try{const i=e.load();if(customElements.define("superflow-toolbar",t),i&&i.valid){(()=>{try{document.querySelectorAll("superflow-toolbar").forEach((t=>{t.remove()})),document.querySelectorAll("snippyly-plugin").forEach((t=>{t.remove()}))}catch(t){console.warn("Error in removeSuperflowToolbarTag: ",t)}})();const t={};return t.apiKey=i.apiKey,i.staging&&(t.staging="true"),i.projectVersionKey&&(t.projectVersionKey=i.projectVersionKey),i.projectId&&(t.projectId=i.projectId),(null==i?void 0:i.autoLocation)&&(t.autoLocation=i.autoLocation),(null==i?void 0:i.veltVersion)&&(t.veltVersion=i.veltVersion),void((t={})=>{try{const e=document.createElement("superflow-toolbar");Object.keys(t||{}).forEach((i=>{e.setAttribute(i,t[i])})),document.body.appendChild(e)}catch(t){console.warn("Error in loadSuperflowToolbarTag: ",t)}})(t)}}catch(t){console.warn("Error in initSuperflow: ",t)}};(null===document||void 0===document?void 0:document.body)?i():null===document||void 0===document||document.addEventListener("DOMContentLoaded",(()=>{i()}))})(nu);class ru extends X{}customElements.get("snippyly-plugin")||customElements.define("snippyly-plugin",ru);export{ru as SnippylyPlugin,nu as SuperflowToolbar};
6905
+ `:L``}}ru.PREVIEW_READONLY_CSS="\n velt-comment-dialog-suggestion-actions,\n velt-comment-dialog-suggestion-actions-internal,\n velt-comment-dialog-suggestion-action-accept,\n velt-comment-dialog-suggestion-action-accept-internal,\n velt-comment-dialog-suggestion-action-reject,\n velt-comment-dialog-suggestion-action-reject-internal,\n velt-comment-dialog-legacy-suggestion-action,\n velt-comment-dialog-legacy-suggestion-action-accept,\n velt-comment-dialog-legacy-suggestion-action-reject,\n .velt-suggestion-actions,\n .sf-accept-btn,\n .sf-reject-btn {\n display: none !important;\n }\n ",ru.PREVIEW_READONLY_STYLE_ATTR="data-sf-preview-readonly",ru.COLLABORATION_TAGS=[Me.VELT_COMMENTS,Me.VELT_CURSOR,Me.VELT_HUDDLE,Me.VELT_RECORDER_NOTES,Me.VELT_RECORDER_CONTROL_PANEL,Me.VELT_ARROWS,Me.VELT_COMMENTS_SIDEBAR_LEGACY,Me.VELT_COMMENTS_SIDEBAR_V2],ru.styles=[jd,Ud],nu([nt()],ru.prototype,"loadPlugin",null),nu([nt()],ru.prototype,"comments",void 0),nu([nt()],ru.prototype,"commentElement",void 0),nu([nt()],ru.prototype,"contactElement",void 0),nu([nt()],ru.prototype,"rewriterElement",void 0),nu([nt()],ru.prototype,"presenceElement",void 0),nu([nt()],ru.prototype,"commentSubscription",void 0),nu([nt()],ru.prototype,"selectionElement",void 0),nu([nt()],ru.prototype,"viewsElement",void 0),nu([nt()],ru.prototype,"docElement",void 0),nu([nt()],ru.prototype,"addCommentMode",void 0),nu([nt()],ru.prototype,"showTourCommentTooltip",void 0),nu([nt()],ru.prototype,"firstCommentNudge",void 0),nu([nt()],ru.prototype,"allFeatureDisabled",void 0),nu([nt()],ru.prototype,"planLimitLocked",void 0),nu([nt()],ru.prototype,"projectDeleted",void 0),nu([nt()],ru.prototype,"allFeatureRestricted",void 0),nu([nt()],ru.prototype,"guestMode",void 0),nu([nt()],ru.prototype,"_expanded",void 0),nu([nt()],ru.prototype,"loading",void 0),nu([nt()],ru.prototype,"signInError",void 0),nu([nt()],ru.prototype,"snippylyUser",void 0),nu([nt()],ru.prototype,"snippylyUserRole",void 0),nu([nt()],ru.prototype,"_isPlanExpired",void 0),nu([nt()],ru.prototype,"showOnboardingModal",void 0),nu([nt()],ru.prototype,"embedMode",void 0),nu([nt()],ru.prototype,"readOnlyMode",void 0),nu([nt()],ru.prototype,"onboardingMode",void 0),nu([nt()],ru.prototype,"showLiveDemoModal",void 0),nu([nt()],ru.prototype,"showFigmaDemoModal",void 0),nu([nt()],ru.prototype,"showGuestModeSignInModal",void 0),nu([nt()],ru.prototype,"guestModeSignInModalConfig",void 0),nu([nt()],ru.prototype,"showGuestModeNameModal",void 0),nu([nt()],ru.prototype,"guestModeSignInBannerVisible",void 0),nu([nt()],ru.prototype,"guestUserNameInput",void 0),nu([nt()],ru.prototype,"guestUserModelOpened",void 0),nu([nt()],ru.prototype,"guestUserNameUpdated",void 0),nu([nt()],ru.prototype,"guestUserNameUpdateLoading",void 0),nu([ot()],ru.prototype,"apiKey",null),nu([ot()],ru.prototype,"projectId",null),nu([nt()],ru.prototype,"staging",void 0),nu([ot()],ru.prototype,"projectVersionKey",null),nu([nt()],ru.prototype,"projectVersion",void 0),nu([nt()],ru.prototype,"version",void 0),nu([ot()],ru.prototype,"veltVersion",void 0),nu([ot()],ru.prototype,"autoLocation",null),nu([nt()],ru.prototype,"_menuOpenedId",void 0),nu([nt()],ru.prototype,"copyLinkTooltip",void 0),nu([nt()],ru.prototype,"invalidApiKey",void 0),nu([nt()],ru.prototype,"documentId",void 0),nu([nt()],ru.prototype,"serverDocumentId",void 0),nu([nt()],ru.prototype,"_isUserGlobalContact",void 0),nu([nt()],ru.prototype,"location",void 0),nu([nt()],ru.prototype,"qrCode",void 0),nu([nt()],ru.prototype,"showQrCode",void 0),nu([nt()],ru.prototype,"qrCodeLoading",void 0),nu([nt()],ru.prototype,"qrCodeError",void 0),nu([nt()],ru.prototype,"customLoginEnabledLocally",void 0),nu([ot()],ru.prototype,"customLoginEnabled",void 0),nu([nt()],ru.prototype,"providedUser",void 0),nu([nt()],ru.prototype,"autoTranslation",void 0),nu([nt()],ru.prototype,"addCommentCount",void 0),nu([nt()],ru.prototype,"isSigningInUserAdmin",void 0),nu([nt()],ru.prototype,"_privateCommentModeEnabled",void 0),nu([nt()],ru.prototype,"superflowToolbarMoved",void 0),nu([nt()],ru.prototype,"_customerMetadata",void 0),nu([nt()],ru.prototype,"logoMark",void 0),nu([nt()],ru.prototype,"wordMark",void 0),nu([nt()],ru.prototype,"_darkMode",void 0),nu([nt()],ru.prototype,"projectConfig",void 0),nu([nt()],ru.prototype,"allowGuestModeSignIn",void 0),nu([nt()],ru.prototype,"_queryParamsComments",void 0),nu([nt()],ru.prototype,"_usePageTitleAsLocationName",void 0),nu([nt()],ru.prototype,"toolbarEnabled",void 0),nu([nt()],ru.prototype,"toolbarEnabledApiCalled",void 0),nu([nt()],ru.prototype,"passwordProtected",void 0),nu([nt()],ru.prototype,"isPasswordValid",void 0),nu([nt()],ru.prototype,"password",void 0),nu([nt()],ru.prototype,"validatingPasswordLoading",void 0),nu([nt()],ru.prototype,"showPasswordProtectedModal",void 0),nu([nt()],ru.prototype,"showInvalidPassword",void 0),nu([nt()],ru.prototype,"skipGuestNameModal",void 0),nu([nt()],ru.prototype,"_totalViews",void 0),nu([nt()],ru.prototype,"totalViewsCount",void 0),nu([nt()],ru.prototype,"inviteUrl",void 0),nu([nt()],ru.prototype,"showModalOnceCommentIsModeIsOff",void 0),nu([nt()],ru.prototype,"showInviteModal",void 0),nu([nt()],ru.prototype,"showBugReportModal",void 0),nu([nt()],ru.prototype,"featureAccess",void 0),nu([nt()],ru.prototype,"hasAgentAccess",void 0),nu([nt()],ru.prototype,"hasPrivateCommentsAccess",void 0),nu([nt()],ru.prototype,"isPrivateCommentsEnabledOnWorkspace",void 0),nu([nt()],ru.prototype,"hasContentWarnings",void 0),nu([nt()],ru.prototype,"contentWarningsCount",void 0),nu([nt()],ru.prototype,"showContentWarningSidebar",void 0),nu([nt()],ru.prototype,"showAgentCommentsInSidebar",void 0),nu([nt()],ru.prototype,"pageCommentsHidden",void 0),nu([nt()],ru.prototype,"veltProxyToggleVisible",void 0),nu([nt()],ru.prototype,"nativeScreenshotEnabled",void 0),nu([nt()],ru.prototype,"nativeScreenshotDenied",void 0),nu([nt()],ru.prototype,"capturingScreenshot",void 0),nu([nt()],ru.prototype,"agentGroups",void 0),nu([nt()],ru.prototype,"agentRunStatuses",void 0),nu([nt()],ru.prototype,"agentRunStatusTimedOut",void 0),nu([nt()],ru.prototype,"agentRunStatusSettled",void 0),nu([nt()],ru.prototype,"onboardingUnsyncedAnnotationIds",void 0),nu([nt()],ru.prototype,"spellingSuggestionPagePathMap",void 0),nu([nt()],ru.prototype,"grammarSuggestionPagePathMap",void 0),(t=>{if(customElements.get("superflow-toolbar")||customElements.get("snippyly-plugin"))return;const e={allow:["sdkUrl","windowVariables","snippylyPlugin"],loaders:{windowVariables:()=>{const t=null===window||void 0===window?void 0:window.SUPERFLOW_TOOLBAR_API_KEY;return{valid:!!t,type:"windowVariables",apiKey:t,staging:!!(null===window||void 0===window?void 0:window.SUPERFLOW_TOOLBAR_STAGING),projectVersionKey:null===window||void 0===window?void 0:window.SUPERFLOW_TOOLBAR_PROJECT_VERSION_KEY,projectId:null===window||void 0===window?void 0:window.SUPERFLOW_TOOLBAR_PROJECT_ID,autoLocation:null===window||void 0===window?void 0:window.SUPERFLOW_TOOLBAR_AUTO_LOCATION,veltVersion:null===window||void 0===window?void 0:window.SUPERFLOW_TOOLBAR_VELT_VERSION}},snippylyPlugin:()=>{const t=document.querySelector("snippyly-plugin");if(!t)return;const e=t.getAttribute("apiKey"),i=!!t.getAttribute("staging"),o=t.getAttribute("projectVersionKey"),n=t.getAttribute("projectId"),r=t.getAttribute("autoLocation"),s=t.getAttribute("veltVersion");return null==t||t.remove(),{valid:!!e,type:"snippylyPlugin",apiKey:e,staging:i,projectVersionKey:o,projectId:n,autoLocation:r,veltVersion:s}},sdkUrl:()=>{const t=document.getElementById("superflowToolbarScript");if(!t)return;const e=null==t?void 0:t.src,i=new URL(e).searchParams,o=i.has("apiKey")?i.get("apiKey"):void 0;return{valid:!!o,type:"sdkUrl",apiKey:o,staging:void 0,projectVersionKey:void 0,projectId:i.has("projectId")?i.get("projectId"):void 0,autoLocation:i.has("autoLocation")?i.get("autoLocation"):void 0,veltVersion:i.has("veltVersion")?i.get("veltVersion"):void 0}}},load:()=>{for(let t=0;t<e.allow.length;t++){const i=e.allow[t],o=e.loaders[i]();if(o&&o.valid)return o}}},i=()=>{try{const i=e.load();if(customElements.define("superflow-toolbar",t),i&&i.valid){(()=>{try{document.querySelectorAll("superflow-toolbar").forEach((t=>{t.remove()})),document.querySelectorAll("snippyly-plugin").forEach((t=>{t.remove()}))}catch(t){console.warn("Error in removeSuperflowToolbarTag: ",t)}})();const t={};return t.apiKey=i.apiKey,i.staging&&(t.staging="true"),i.projectVersionKey&&(t.projectVersionKey=i.projectVersionKey),i.projectId&&(t.projectId=i.projectId),(null==i?void 0:i.autoLocation)&&(t.autoLocation=i.autoLocation),(null==i?void 0:i.veltVersion)&&(t.veltVersion=i.veltVersion),void((t={})=>{try{const e=document.createElement("superflow-toolbar");Object.keys(t||{}).forEach((i=>{e.setAttribute(i,t[i])})),document.body.appendChild(e)}catch(t){console.warn("Error in loadSuperflowToolbarTag: ",t)}})(t)}}catch(t){console.warn("Error in initSuperflow: ",t)}};(null===document||void 0===document?void 0:document.body)?i():null===document||void 0===document||document.addEventListener("DOMContentLoaded",(()=>{i()}))})(ru);class su extends X{}customElements.get("snippyly-plugin")||customElements.define("snippyly-plugin",su);export{su as SnippylyPlugin,ru as SuperflowToolbar};