@snippyly/plugin-staging 1.0.937 → 1.0.938
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/package.json +1 -1
- package/snippyly.js +8 -8
- package/snippyly.min.js +8 -8
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=D,t.type!==lt)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===D||null==t)return this.ft=void 0,this.it=t;if(t===R)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",REQUEST_MODE_LOADED:"requestModeLoaded",REQUEST_ADDED:"requestAdded",REQUEST_MODE_SIGN_IN_CLICKED:"requestModeSignInClicked",REQUEST_MODE_OPENED:"requestModeOpened"};const gt="1.0.795",ft="6.0.45",mt="6.0.45",wt="Superflow Organization",yt=["v3ogId1G43AFHehEOewv","rNYzMJd13L27xtfipmSK","aU1MxKP0rca2UXwKi8bl"],bt=["ockkGlKLaApkEOBShhbR"],Ct="sfSidebarV2Enabled",xt="sfUseProxy",Et=["v3ogId1G43AFHehEOewv"],kt=[],St="review",Mt="feedback",At="sembed",Tt="scommentmode",$t="sreadonly",It="sagentcomments",_t="spath",Nt="sonboarding",Ot="sagentstatus",Lt="sagentsidebar",Rt="Running checks",Dt="sf-onboarding-agent-status",Ft="sf-onboarding-ready",Pt="sf-onboarding-diagnostics-request",Vt="sf-onboarding-diagnostics",jt=3e5,Ut=["failed","systemError","error"],Bt={SDK_NOT_READY:"sdk-not-ready",SDK_RETURNED_NULL:"sdk-returned-null",FETCH_THREW:"fetch-threw"},zt="sfOnboardingSidebarDismissed",Ht="Unknown Agent",qt=[{hostSuffix:"cloudfunctions.net",pathPrefix:"/previewproxy"},{hostSuffix:"api.velt.dev",pathPrefix:"/previewproxy"}],Gt=["superflow-preview.com","stg.superflow-preview.com"],Wt=/^[a-z2-7]+-[a-z2-7]{16}$/,Zt="sf-preview-navigate",Kt="sfPageCommentsHidden",Yt="sreviewId",Jt="scommentId",Qt="snippyly-user",Xt="st",te="_sfut",ee="_sfuc",ie=6e4,ne="_sfgut",oe="sfGuestMigrationRefused",re="projectVersionKey",se="projectVersion",ae="sversion",le="sprojectInstall",ce="sflivedemo",de="sffigmademo",he="sfTourCommentTooltip",ue="sfUserAdmin",pe="sfGuestMode",ve="sfPasswordProtected",ge="sfQueryParamsComments",fe="sfUsePageTitleAsLocationName",me="sfPasswordIsValid",we="sfPrivateMode",ye="organizationPrivate",be="sfGuestModeAllowSignIn",Ce="sfGuestUserModelOpened",xe="sfGuestUserNameUpdated",Ee="sfGuestUserBannerOpened",ke="sfCustomerMetadata",Se="sfContentWarningSidebarOpen",Me={LOADING:"loading",RUNNING:"running",FINDINGS:"findings",CLEAN:"clean",IDLE:"idle"},Ae={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_FINDINGS_FOUND:"No Findings"},Te="sfNativeScreenshotPermission",$e="sfSamlConfig",Ie=[{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"}],_e=["app.usesuperflow.com","superflow-portal-v2-staging.firebaseapp.com"],Ne="suggestion",Oe={AGENT:"agent:",AGENT_TYPE_CUSTOM:"agentType:custom"},Le={SPELL_CHECK:"spell-check",BROKEN_LINKS:"broken-links",GRAMMAR_CHECK:"grammar-check"},Re={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"},De={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"},Fe="filter",Pe={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'}}}},Ve=[{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.."}],je="bugReport",Ue="create",Be="Sign in to report a bug.",ze="Something went wrong. Please try again.",He={console:100,errors:25,network:25},qe={maxMessageChars:5e3,maxDigestBytes:2048,maxBundleBytes:262144,maxEntryChars:500,maxStackFrames:5,digestListSize:5};const Ge=[{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 n=t.length-1;n>=0;n-=1){let o=Number(t[n]);i&&(o*=2,o>9&&(o-=9)),e+=o,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]"}],We="__SUPERFLOW_LIVE_SIGNIN__",Ze="__sf_signin",Ke="guest";var Ye=Object.freeze({__proto__:null,AGENTS_SIDEBAR_MODE:Lt,AGENT_COMMENTS_MODE:It,AGENT_FIELD_PREFIXES:Oe,AGENT_STATUS_MODE:Ot,AGENT_STATUS_RUNNING_TOOLTIP:Rt,ANNOTATION_STATUS_TERMINAL:"terminal",ANNOTATION_TYPE_SUGGESTION:Ne,ATTRIBUTES:De,AUTO_COMMENT_MODE:Tt,BUG_REPORT_AUTH_REQUIRED_ERROR:Be,BUG_REPORT_EVENT_TYPE:je,BUG_REPORT_SCHEMA_VERSION:1,BUG_REPORT_SUBMIT_FAILED_ERROR:ze,BUG_REPORT_SUB_EVENT_TYPE_CREATE:Ue,COMMENT_PRIVATE_MODE_TYPE_ORGANIZATION:ye,DEFAULT_CUSTOMER_METADATA:Pe,DOCUMENT_TITLE_CHANGE_LISTENER_API_KEYS:yt,DRIVE_HOSTS:Ie,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:At,EXCLUDED_API_KEYS_FROM_CHECK_PRIORITIES:bt,EXCLUDED_API_KEYS_FROM_LATEST_VERSION:["I9R2VqG45F5AgpIicnht"],FEEDBACK_MODE:Mt,FIGMA_DEMO_MODAL:de,GUEST_USERS:Ve,LIVE_DEMO_MODAL:ce,LIVE_PREVIEW_SIGN_IN_GLOBAL:We,LIVE_PREVIEW_SIGN_IN_PARAM:Ze,LIVE_PREVIEW_SIGN_OUT_VALUE:Ke,ONBOARDING_AGENT_BUTTON_LABELS:Ae,ONBOARDING_AGENT_BUTTON_STATE:Me,ONBOARDING_AGENT_STATUS_MESSAGE_TYPE:Dt,ONBOARDING_DIAGNOSTICS_MESSAGE_TYPE:Vt,ONBOARDING_DIAGNOSTICS_REQUEST_MESSAGE_TYPE:Pt,ONBOARDING_FAILED_AGENT_STATUSES:Ut,ONBOARDING_FETCH_ERROR:Bt,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:Nt,ONBOARDING_READY_MESSAGE_TYPE:Ft,ONBOARDING_STATUS_FIRST_MESSAGE_TIMEOUT_MS:2e4,ONBOARDING_STATUS_STALE_MS:jt,ONBOARDING_VIEWPORT_GUTTER_PX:8,PLACEHOLDER_ORGANIZATION_NAME:wt,PREVIEW_LIVE_DOMAINS:Gt,PREVIEW_LIVE_LABEL_PATTERN:Wt,PREVIEW_LOCATION_PATH:_t,PREVIEW_NAVIGATE_MESSAGE_TYPE:Zt,PREVIEW_PROXY_HOSTS:qt,PROJECT_INSTALL:le,PROJECT_VERSION:se,PROJECT_VERSION_DEFAULT_KEY:ae,PROJECT_VERSION_KEY:re,PROXY_DISABLED_DEFAULT_API_KEYS:Et,READ_ONLY_MODE:$t,REVIEW_DOC_ID:Yt,REVIEW_MODE:St,SCREENSHOT_DISABLED_HOSTS:_e,SIDEBAR_BUTTON_COUNT_TYPE_FILTER:Fe,SIDEBAR_V1_DEFAULT_API_KEYS:kt,SNIPPYLY_COMMENT_ID:Jt,SNIPPYLY_TOKEN:Xt,SNIPPYLY_USER:Qt,SUPERFLOW_CONTENT_WARNING_SIDEBAR_OPEN:Se,SUPERFLOW_CUSTOMER_METADATA:ke,SUPERFLOW_DOCUMENT_METADATA:"sfDocumentMetadata",SUPERFLOW_GUEST_MIGRATION_REFUSED:oe,SUPERFLOW_GUEST_MODE:pe,SUPERFLOW_GUEST_MODE_ALLOW_SIGN_IN:be,SUPERFLOW_GUEST_USER_BANNER_OPENED:Ee,SUPERFLOW_GUEST_USER_MODEL_OPENED:Ce,SUPERFLOW_GUEST_USER_NAME_MODEL_OPENED:"sfGuestUserNameModelOpened",SUPERFLOW_GUEST_USER_NAME_UPDATED:xe,SUPERFLOW_GUEST_USER_TOKEN:ne,SUPERFLOW_NATIVE_SCREENSHOT_PERMISSION:Te,SUPERFLOW_ONBOARDING_SIDEBAR_DISMISSED:zt,SUPERFLOW_PAGE_COMMENTS_HIDDEN:Kt,SUPERFLOW_PASSWORD_IS_VALID:me,SUPERFLOW_PASSWORD_PROTECTED:ve,SUPERFLOW_PRIVATE_MODE:we,SUPERFLOW_QUERY_PARAMS_COMMENTS:ge,SUPERFLOW_SAML_CONFIG:$e,SUPERFLOW_SIDEBAR_V2_ENABLED:Ct,SUPERFLOW_USER_ADMIN:ue,SUPERFLOW_USER_CREDENTIAL:ee,SUPERFLOW_USER_CREDENTIAL_EXPIRY_MARGIN_MS:ie,SUPERFLOW_USER_TOKEN:te,SUPERFLOW_USE_PAGE_TITLE_AS_LOCATION_NAME:fe,SUPERFLOW_VERSION:gt,SYSTEM_AGENT_IDS:Le,TAGS:Re,TELEMETRY_BUFFER_CAPS:He,TELEMETRY_REDACTION_RULES:Ge,TELEMETRY_SIZE_LIMITS:qe,TOUR_COMMENT_TOOLTIP:he,UNKNOWN_AGENT_NAME:Ht,VELT_PROXY_FLAG:xt,VELT_SDK_DEVELOP_VERSION:ft,VELT_SDK_PROD_VERSION:mt,VELT_SDK_STAGING_VERSION:"6.0.34"});const Je=!0,Qe="https://superflow-portal-v2-staging.firebaseapp.com/",Xe="https://superflow-portal-v2-staging.firebaseapp.com/settings/billing",ti="9dbcd2509e0fa90a5c81f038ce618e3f",ei="6d24f74f12f6fb84c87efa8f791cfb2e",ii="https://us-central1-snipply-sdk-staging.cloudfunctions.net/sa",ni="https://us-central1-snipply-sdk-staging.cloudfunctions.net/superflowtoolbarhandler",oi=function(t){const e=[];let i=0;for(let n=0;n<t.length;n++){let o=t.charCodeAt(n);o<128?e[i++]=o:o<2048?(e[i++]=o>>6|192,e[i++]=63&o|128):55296==(64512&o)&&n+1<t.length&&56320==(64512&t.charCodeAt(n+1))?(o=65536+((1023&o)<<10)+(1023&t.charCodeAt(++n)),e[i++]=o>>18|240,e[i++]=o>>12&63|128,e[i++]=o>>6&63|128,e[i++]=63&o|128):(e[i++]=o>>12|224,e[i++]=o>>6&63|128,e[i++]=63&o|128)}return e},ri={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_,n=[];for(let e=0;e<t.length;e+=3){const o=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=o>>2,d=(3&o)<<4|s>>4;let h=(15&s)<<2|l>>6,u=63&l;a||(u=64,r||(h=64)),n.push(i[c],i[d],i[h],i[u])}return n.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(oi(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):function(t){const e=[];let i=0,n=0;for(;i<t.length;){const o=t[i++];if(o<128)e[n++]=String.fromCharCode(o);else if(o>191&&o<224){const r=t[i++];e[n++]=String.fromCharCode((31&o)<<6|63&r)}else if(o>239&&o<365){const r=((7&o)<<18|(63&t[i++])<<12|(63&t[i++])<<6|63&t[i++])-65536;e[n++]=String.fromCharCode(55296+(r>>10)),e[n++]=String.fromCharCode(56320+(1023&r))}else{const r=t[i++],s=t[i++];e[n++]=String.fromCharCode((15&o)<<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_,n=[];for(let e=0;e<t.length;){const o=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==o||null==r||null==s||null==a)throw new si;const l=o<<2|r>>4;if(n.push(l),64!==s){const t=r<<4&240|s>>2;if(n.push(t),64!==a){const t=s<<6&192|a;n.push(t)}}}return n},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 si extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const ai=function(t){return function(t){const e=oi(t);return ri.encodeByteArray(e,!0)}(t).replace(/\./g,"")},li=function(t){try{return ri.decodeString(t,!0)}catch(t){console.error("base64Decode failed: ",t)}return null};
|
|
71
|
+
*/class ut extends dt{constructor(t){if(super(t),this.it=D,t.type!==lt)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===D||null==t)return this.ft=void 0,this.it=t;if(t===R)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",REQUEST_MODE_LOADED:"requestModeLoaded",REQUEST_ADDED:"requestAdded",REQUEST_MODE_SIGN_IN_CLICKED:"requestModeSignInClicked",REQUEST_MODE_OPENED:"requestModeOpened"};const gt="1.0.796",ft="6.0.45",mt="6.0.45",wt="Superflow Organization",yt=["v3ogId1G43AFHehEOewv","rNYzMJd13L27xtfipmSK","aU1MxKP0rca2UXwKi8bl"],bt=["ockkGlKLaApkEOBShhbR"],Ct="sfSidebarV2Enabled",xt="sfUseProxy",Et=["v3ogId1G43AFHehEOewv"],kt=[],St="review",Mt="feedback",At="sembed",Tt="scommentmode",$t="sreadonly",It="sagentcomments",_t="spath",Nt="sonboarding",Ot="sagentstatus",Lt="sagentsidebar",Rt="Running checks",Dt="sf-onboarding-agent-status",Ft="sf-onboarding-ready",Pt="sf-onboarding-diagnostics-request",Vt="sf-onboarding-diagnostics",jt=3e5,Ut=["failed","systemError","error"],Bt={SDK_NOT_READY:"sdk-not-ready",SDK_RETURNED_NULL:"sdk-returned-null",FETCH_THREW:"fetch-threw"},zt="sfOnboardingSidebarDismissed",Ht="Unknown Agent",qt=[{hostSuffix:"cloudfunctions.net",pathPrefix:"/previewproxy"},{hostSuffix:"api.velt.dev",pathPrefix:"/previewproxy"}],Gt=["superflow-preview.com","stg.superflow-preview.com"],Wt=/^[a-z2-7]+-[a-z2-7]{16}$/,Zt="sf-preview-navigate",Kt="sfPageCommentsHidden",Yt="sreviewId",Jt="scommentId",Qt="snippyly-user",Xt="st",te="_sfut",ee="_sfuc",ie=6e4,ne="_sfgut",oe="sfGuestMigrationRefused",re="projectVersionKey",se="projectVersion",ae="sversion",le="sprojectInstall",ce="sflivedemo",de="sffigmademo",he="sfTourCommentTooltip",ue="sfUserAdmin",pe="sfGuestMode",ve="sfPasswordProtected",ge="sfQueryParamsComments",fe="sfUsePageTitleAsLocationName",me="sfPasswordIsValid",we="sfPrivateMode",ye="organizationPrivate",be="sfGuestModeAllowSignIn",Ce="sfGuestUserModelOpened",xe="sfGuestUserNameUpdated",Ee="sfGuestUserBannerOpened",ke="sfCustomerMetadata",Se="sfContentWarningSidebarOpen",Me={LOADING:"loading",RUNNING:"running",FINDINGS:"findings",CLEAN:"clean",IDLE:"idle"},Ae={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_FINDINGS_FOUND:"No Findings"},Te="sfNativeScreenshotPermission",$e="sfSamlConfig",Ie=[{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"}],_e=["app.usesuperflow.com","superflow-portal-v2-staging.firebaseapp.com"],Ne="suggestion",Oe={AGENT:"agent:",AGENT_TYPE_CUSTOM:"agentType:custom"},Le={SPELL_CHECK:"spell-check",BROKEN_LINKS:"broken-links",GRAMMAR_CHECK:"grammar-check"},Re={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"},De={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"},Fe="filter",Pe={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'}}}},Ve=[{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.."}],je="bugReport",Ue="create",Be="Sign in to report a bug.",ze="Something went wrong. Please try again.",He={console:100,errors:25,network:25},qe={maxMessageChars:5e3,maxDigestBytes:2048,maxBundleBytes:262144,maxEntryChars:500,maxStackFrames:5,digestListSize:5};const Ge=[{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 n=t.length-1;n>=0;n-=1){let o=Number(t[n]);i&&(o*=2,o>9&&(o-=9)),e+=o,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]"}],We="__SUPERFLOW_LIVE_SIGNIN__",Ze="__sf_signin",Ke="guest";var Ye=Object.freeze({__proto__:null,AGENTS_SIDEBAR_MODE:Lt,AGENT_COMMENTS_MODE:It,AGENT_FIELD_PREFIXES:Oe,AGENT_STATUS_MODE:Ot,AGENT_STATUS_RUNNING_TOOLTIP:Rt,ANNOTATION_STATUS_TERMINAL:"terminal",ANNOTATION_TYPE_SUGGESTION:Ne,ATTRIBUTES:De,AUTO_COMMENT_MODE:Tt,BUG_REPORT_AUTH_REQUIRED_ERROR:Be,BUG_REPORT_EVENT_TYPE:je,BUG_REPORT_SCHEMA_VERSION:1,BUG_REPORT_SUBMIT_FAILED_ERROR:ze,BUG_REPORT_SUB_EVENT_TYPE_CREATE:Ue,COMMENT_PRIVATE_MODE_TYPE_ORGANIZATION:ye,DEFAULT_CUSTOMER_METADATA:Pe,DOCUMENT_TITLE_CHANGE_LISTENER_API_KEYS:yt,DRIVE_HOSTS:Ie,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:At,EXCLUDED_API_KEYS_FROM_CHECK_PRIORITIES:bt,EXCLUDED_API_KEYS_FROM_LATEST_VERSION:["I9R2VqG45F5AgpIicnht"],FEEDBACK_MODE:Mt,FIGMA_DEMO_MODAL:de,GUEST_USERS:Ve,LIVE_DEMO_MODAL:ce,LIVE_PREVIEW_SIGN_IN_GLOBAL:We,LIVE_PREVIEW_SIGN_IN_PARAM:Ze,LIVE_PREVIEW_SIGN_OUT_VALUE:Ke,ONBOARDING_AGENT_BUTTON_LABELS:Ae,ONBOARDING_AGENT_BUTTON_STATE:Me,ONBOARDING_AGENT_STATUS_MESSAGE_TYPE:Dt,ONBOARDING_DIAGNOSTICS_MESSAGE_TYPE:Vt,ONBOARDING_DIAGNOSTICS_REQUEST_MESSAGE_TYPE:Pt,ONBOARDING_FAILED_AGENT_STATUSES:Ut,ONBOARDING_FETCH_ERROR:Bt,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:Nt,ONBOARDING_READY_MESSAGE_TYPE:Ft,ONBOARDING_STATUS_FIRST_MESSAGE_TIMEOUT_MS:2e4,ONBOARDING_STATUS_STALE_MS:jt,ONBOARDING_VIEWPORT_GUTTER_PX:8,PLACEHOLDER_ORGANIZATION_NAME:wt,PREVIEW_LIVE_DOMAINS:Gt,PREVIEW_LIVE_LABEL_PATTERN:Wt,PREVIEW_LOCATION_PATH:_t,PREVIEW_NAVIGATE_MESSAGE_TYPE:Zt,PREVIEW_PROXY_HOSTS:qt,PROJECT_INSTALL:le,PROJECT_VERSION:se,PROJECT_VERSION_DEFAULT_KEY:ae,PROJECT_VERSION_KEY:re,PROXY_DISABLED_DEFAULT_API_KEYS:Et,READ_ONLY_MODE:$t,REVIEW_DOC_ID:Yt,REVIEW_MODE:St,SCREENSHOT_DISABLED_HOSTS:_e,SIDEBAR_BUTTON_COUNT_TYPE_FILTER:Fe,SIDEBAR_V1_DEFAULT_API_KEYS:kt,SNIPPYLY_COMMENT_ID:Jt,SNIPPYLY_TOKEN:Xt,SNIPPYLY_USER:Qt,SUPERFLOW_CONTENT_WARNING_SIDEBAR_OPEN:Se,SUPERFLOW_CUSTOMER_METADATA:ke,SUPERFLOW_DOCUMENT_METADATA:"sfDocumentMetadata",SUPERFLOW_GUEST_MIGRATION_REFUSED:oe,SUPERFLOW_GUEST_MODE:pe,SUPERFLOW_GUEST_MODE_ALLOW_SIGN_IN:be,SUPERFLOW_GUEST_USER_BANNER_OPENED:Ee,SUPERFLOW_GUEST_USER_MODEL_OPENED:Ce,SUPERFLOW_GUEST_USER_NAME_MODEL_OPENED:"sfGuestUserNameModelOpened",SUPERFLOW_GUEST_USER_NAME_UPDATED:xe,SUPERFLOW_GUEST_USER_TOKEN:ne,SUPERFLOW_NATIVE_SCREENSHOT_PERMISSION:Te,SUPERFLOW_ONBOARDING_SIDEBAR_DISMISSED:zt,SUPERFLOW_PAGE_COMMENTS_HIDDEN:Kt,SUPERFLOW_PASSWORD_IS_VALID:me,SUPERFLOW_PASSWORD_PROTECTED:ve,SUPERFLOW_PRIVATE_MODE:we,SUPERFLOW_QUERY_PARAMS_COMMENTS:ge,SUPERFLOW_SAML_CONFIG:$e,SUPERFLOW_SIDEBAR_V2_ENABLED:Ct,SUPERFLOW_USER_ADMIN:ue,SUPERFLOW_USER_CREDENTIAL:ee,SUPERFLOW_USER_CREDENTIAL_EXPIRY_MARGIN_MS:ie,SUPERFLOW_USER_TOKEN:te,SUPERFLOW_USE_PAGE_TITLE_AS_LOCATION_NAME:fe,SUPERFLOW_VERSION:gt,SYSTEM_AGENT_IDS:Le,TAGS:Re,TELEMETRY_BUFFER_CAPS:He,TELEMETRY_REDACTION_RULES:Ge,TELEMETRY_SIZE_LIMITS:qe,TOUR_COMMENT_TOOLTIP:he,UNKNOWN_AGENT_NAME:Ht,VELT_PROXY_FLAG:xt,VELT_SDK_DEVELOP_VERSION:ft,VELT_SDK_PROD_VERSION:mt,VELT_SDK_STAGING_VERSION:"6.0.34"});const Je=!0,Qe="https://superflow-portal-v2-staging.firebaseapp.com/",Xe="https://superflow-portal-v2-staging.firebaseapp.com/settings/billing",ti="9dbcd2509e0fa90a5c81f038ce618e3f",ei="6d24f74f12f6fb84c87efa8f791cfb2e",ii="https://us-central1-snipply-sdk-staging.cloudfunctions.net/sa",ni="https://us-central1-snipply-sdk-staging.cloudfunctions.net/superflowtoolbarhandler",oi=function(t){const e=[];let i=0;for(let n=0;n<t.length;n++){let o=t.charCodeAt(n);o<128?e[i++]=o:o<2048?(e[i++]=o>>6|192,e[i++]=63&o|128):55296==(64512&o)&&n+1<t.length&&56320==(64512&t.charCodeAt(n+1))?(o=65536+((1023&o)<<10)+(1023&t.charCodeAt(++n)),e[i++]=o>>18|240,e[i++]=o>>12&63|128,e[i++]=o>>6&63|128,e[i++]=63&o|128):(e[i++]=o>>12|224,e[i++]=o>>6&63|128,e[i++]=63&o|128)}return e},ri={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_,n=[];for(let e=0;e<t.length;e+=3){const o=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=o>>2,d=(3&o)<<4|s>>4;let h=(15&s)<<2|l>>6,u=63&l;a||(u=64,r||(h=64)),n.push(i[c],i[d],i[h],i[u])}return n.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(oi(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):function(t){const e=[];let i=0,n=0;for(;i<t.length;){const o=t[i++];if(o<128)e[n++]=String.fromCharCode(o);else if(o>191&&o<224){const r=t[i++];e[n++]=String.fromCharCode((31&o)<<6|63&r)}else if(o>239&&o<365){const r=((7&o)<<18|(63&t[i++])<<12|(63&t[i++])<<6|63&t[i++])-65536;e[n++]=String.fromCharCode(55296+(r>>10)),e[n++]=String.fromCharCode(56320+(1023&r))}else{const r=t[i++],s=t[i++];e[n++]=String.fromCharCode((15&o)<<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_,n=[];for(let e=0;e<t.length;){const o=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==o||null==r||null==s||null==a)throw new si;const l=o<<2|r>>4;if(n.push(l),64!==s){const t=r<<4&240|s>>2;if(n.push(t),64!==a){const t=s<<6&192|a;n.push(t)}}}return n},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 si extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const ai=function(t){return function(t){const e=oi(t);return ri.encodeByteArray(e,!0)}(t).replace(/\./g,"")},li=function(t){try{return ri.decodeString(t,!0)}catch(t){console.error("base64Decode failed: ",t)}return null};
|
|
72
72
|
/**
|
|
73
73
|
* @license
|
|
74
74
|
* Copyright 2022 Google LLC
|
|
@@ -6490,7 +6490,7 @@ class zc extends $a{}zc.Encryptor=class extends zc{processBlock(t,e){const i=t,n
|
|
|
6490
6490
|
${this.renderCurrentView()}
|
|
6491
6491
|
${this.theme===Th||this.hasRunStatusList()?L`<div class="cws-sr-only" role="status" aria-live="polite">${this.getRunStatusAnnouncement()}</div>`:D}
|
|
6492
6492
|
</div>
|
|
6493
|
-
`}catch(t){return console.warn("Error in render: ",t),L``}}};Au.styles=[Ah,Mu],fu([nt({type:Array})],Au.prototype,"agentGroups",void 0),fu([nt({type:String})],Au.prototype,"currentPageUrl",void 0),fu([nt({type:String,reflect:!0})],Au.prototype,"theme",void 0),fu([nt({type:Array})],Au.prototype,"agentRunStatuses",void 0),fu([nt({type:Boolean})],Au.prototype,"loading",void 0),fu([nt({type:Array})],Au.prototype,"unsyncedAnnotationIds",void 0),fu([nt({type:Number})],Au.prototype,"lockedIssueCount",void 0),fu([nt({type:String})],Au.prototype,"lockedIssuesUpgradeUrl",void 0),fu([ot()],Au.prototype,"expandedFindingIds",void 0),fu([ot()],Au.prototype,"openAccordions",void 0),fu([ot()],Au.prototype,"currentView",void 0),fu([ot()],Au.prototype,"selectedAgentId",void 0),fu([ot()],Au.prototype,"selectedFindingGroup",void 0),Au=fu([et("content-warning-sidebar")],Au);function Tu(){try{return"undefined"!=typeof localStorage&&"true"===localStorage.getItem("sfScreenShotDebug")}catch{return!1}}function $u(t){return new Promise((e=>{let i=Math.max(1,t);const n=()=>{i-=1,i<=0?e():requestAnimationFrame(n)};requestAnimationFrame(n)}))}function Iu(t,e,i=600){const n=t.requestVideoFrameCallback;return"function"!=typeof n?$u(e+2):new Promise((o=>{let r=Math.max(1,e),s=!1;const a=()=>{s||(s=!0,clearTimeout(l),o())},l=setTimeout(a,Math.max(0,i)),c=()=>{s||(r-=1,r<=0?a():n.call(t,c))};n.call(t,c)}))}function _u(t,e,i,n,o){const r=Math.max(0,Math.round(e)),s=Math.max(0,Math.round(i)),a=Math.max(1,Math.min(Math.round(n),t.width-r)),l=Math.max(1,Math.min(Math.round(o),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 Nu(t,e){const i=Math.max(t.width,t.height);if(i<=e)return{canvas:t,ratio:1};const n=e/i,o=Math.max(1,Math.round(t.width*n)),r=Math.max(1,Math.round(t.height*n)),s=document.createElement("canvas");s.width=o,s.height=r;const a=s.getContext("2d");return a?(a.imageSmoothingEnabled=!0,a.imageSmoothingQuality="high",a.drawImage(t,0,0,o,r),{canvas:s,ratio:n}):{canvas:t,ratio:1}}function Ou(t,e,i){return new Promise((n=>{t.toBlob((t=>n(t)),e,i)}))}async function Lu(t,e=.9){const i=await Ou(t,"image/webp",e);if(i&&"image/webp"===i.type)return{blob:i,type:i.type};const n=await Ou(t,"image/png");if(n)return{blob:n,type:"image/png"};throw new Error("canvas-encode-failed")}const Ru=["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"],Du=["snippyly-text-highlight","snippyly-comment-text-portal","snippyly-comment-text","velt-comment-text-portal","velt-comment-text"],Fu="sf-capture-hide-widgets",Pu="data-sf-capture-keep";let Vu=null,ju=null,Uu=[],Bu=new WeakSet,zu=null;function Hu(...t){Tu()&&"undefined"!=typeof console&&console.log("[sf-capture][exclude]",...t)}const qu=new Set(Ru.map((t=>t.toLowerCase())));function Gu(t){return t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function Wu(t){const e=Gu(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 Zu(t){if(!t)return!1;const e=Gu(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 Ku(t){const e=Array.from(document.querySelectorAll(Wu(t)));for(const t of e){(i=t).setAttribute(Pu,""),i.querySelectorAll("*").forEach((t=>t.setAttribute(Pu,"")));let e=t.parentElement;for(;e;)e.setAttribute(Pu,""),e=e.parentElement}var i;return e}function Yu(t,e){if(!Tu()||!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)]},n=document.getElementById(Fu),o=document.querySelector(Wu(t));if(Hu(`[${e}] hideStyle=${!!n} keptHost=${!!o}`+(o?` keep=${o.hasAttribute(Pu)} display=${getComputedStyle(o).display}`:"")),o){Hu(`[${e}] kept host subtree:`,Array.from(o.querySelectorAll("*")).map((t=>{const e=t.shadowRoot;return{tag:t.tagName.toLowerCase(),keep:t.hasAttribute(Pu),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(Pu),display:getComputedStyle(t).display,rect:i(t)}))).filter((t=>"none"!==t.display));Hu(`[${e}] visible <velt-shadow-dom-internal>: ${r.length}`,r);const s=Gu(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 n=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 n=e.parentElement;return n?n.tagName.toLowerCase():"(detached)"},o=Array.from(document.querySelectorAll(".line")),r=Array.from(document.querySelectorAll(a));Hu(`[${e}] AREA focus: portal kept=${l.hasAttribute(Pu)} display=${getComputedStyle(l).display} rect=${JSON.stringify(i(l))} innerLines=${l.querySelectorAll(".line").length} innerPins=${l.querySelectorAll(a).length}`),Hu(`[${e}] AREA .line owners (total ${o.length}):`,Array.from(new Set(o.map(n)))),Hu(`[${e}] AREA <comment-pin> owners (total ${r.length}):`,r.map((t=>({owner:n(t),keep:t.hasAttribute(Pu),display:getComputedStyle(t).display,painted:t.getClientRects().length>0}))))}}function Ju(){document.querySelectorAll('[style*="cursor"]').forEach((t=>{const e=t.style.getPropertyValue("cursor");if(!e)return;if(Bu.has(t))return void("none"!==e&&t.style.setProperty("cursor","none","important"));if("none"===e)return;const i=t.style.getPropertyPriority("cursor");Uu.push({el:t,value:e,priority:i,isPin:e.includes("url(")&&"important"===i}),Bu.add(t),t.style.setProperty("cursor","none","important")})),Hu(`neutralized inline cursor(s): tracked=${Uu.length}`)}function Qu(t){Xu();let e=!1;if(t){const n=Ku(t);e=n.length>0,function(t,e){if(Tu()){Hu("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));Hu(`candidates <${t}>: ${e.length}`,e.map((t=>({id:t.getAttribute("id"),"data-velt-id":t.getAttribute("data-velt-id")}))))}Hu(`matched kept host(s): ${e.length}`),e.forEach(((t,e)=>{const i=[t.tagName.toLowerCase()];let n=t.parentElement;for(;n;){const t=n.tagName.toLowerCase();i.push(qu.has(t)?`${t}(EXCLUDED-ANCESTOR)`:t),n=n.parentElement}Hu(` match[${e}] chain (self -> root):`,i.join(" > "))})),0===e.length&&Hu("No host matched the annotationId — the marker will be hidden. Compare the annotationId above against the candidate id / data-velt-id values.")}}(t,n),e&&(i=t)&&"undefined"!=typeof MutationObserver&&(ju=i,Vu=new MutationObserver((()=>{ju&&Ku(ju)})),Vu.observe(document.documentElement,{childList:!0,subtree:!0}))}var i;const n=t=>e?`${t}:not([${Pu}])`:t,o=`${Ru.map(n).join(",\n")} { display: none !important; }`,r=`${Du.map(n).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=Fu,s.textContent=`${o}\n${r}\n* { cursor: none !important; }`,document.head.appendChild(s),Ju(),"undefined"!=typeof MutationObserver&&(zu=new MutationObserver((()=>Ju())),zu.observe(document.documentElement,{attributes:!0,subtree:!0,attributeFilter:["style"]})),Hu(`injected hide stylesheet (keptAny=${e}, hide=${Ru.length}, neutralize=${Du.length})`)}function Xu(){var t;null===(t=document.getElementById(Fu))||void 0===t||t.remove(),zu&&(zu.disconnect(),zu=null),Uu.forEach((({el:t,value:e,priority:i,isPin:n})=>{n?t.style.removeProperty("cursor"):t.style.setProperty("cursor",e,i)})),Uu=[],Bu=new WeakSet,Vu&&(Vu.disconnect(),Vu=null),ju=null,document.querySelectorAll(`[${Pu}]`).forEach((t=>t.removeAttribute(Pu)))}function tp(){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 ep(){return!("undefined"==typeof navigator||!navigator.mediaDevices||"function"!=typeof navigator.mediaDevices.getDisplayMedia)&&(tp()||function(){const t=navigator.userAgent;return/Safari/.test(t)&&/Apple/.test(navigator.vendor||"")&&!/Chrome|Chromium|CriOS|Edg\/|FxiOS|Android/.test(t)}())}class ip{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 tp()?"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 n;try{n=await navigator.mediaDevices.getDisplayMedia(i)}catch(t){throw t&&"object"==typeof t&&(t.sfNativeExpected=!0),t}let o=null;try{const i=n.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())),o=document.createElement("video"),o.srcObject=n,o.muted=!0,o.setAttribute("playsinline",""),o.style.cssText="position:fixed;left:-99999px;top:0;width:1px;height:1px;opacity:0;pointer-events:none;",document.body.appendChild(o),await o.play(),"ended"===i.readyState)throw new Error("native-share-ended-during-init");this.stream=n,this.video=o}catch(t){throw n.getTracks().forEach((t=>t.stop())),o&&(o.srcObject=null,o.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;Tu()&&"undefined"!=typeof console&&console.log("[sf-capture][native] capture(): focusAnnotationId =",JSON.stringify(e));const i=performance.now(),n=this.video;return"tab-region"===this.getCapability()?this.captureTabRegion(n,i,e):this.captureScreenCrop(n,i,e)}async captureTabRegion(t,e,i){if("browser"!==this.surface)throw new Error("not-sharing-this-tab");const{canvas:n,page:o,frameW:r,frameH:s}=await this.grabFullFrame(t,i);let a=n;const l=o.viewportW*o.dpr;if(l>0&&r>1.5*l)throw new Error("frame-larger-than-viewport");const c=r/o.viewportW,d=Math.min(r,Math.round(o.viewportW*c)),h=Math.round(o.viewportH*c),u=a.height>h+2||a.width>d+2;u&&(a=_u(a,0,0,d,h)),this.lastDebug={capability:"tab-region",surface:this.surface,cropApplied:!!this.cropEl,frameW:r,frameH:s,viewportW:o.viewportW,viewportH:o.viewportH,dpr:o.dpr,cssToFrame:c,croppedW:a.width,croppedH:a.height,clampedHeight:u},this.logDebug();const p=Nu(a,2560);a=p.canvas;const{blob:v,type:g}=await Lu(a,.9),f=performance.now()-e;return{blob:v,width:a.width,height:a.height,mode:this.name,durationMs:f,page:o,scope:"viewport",blobType:g,markerMapping:{scaleX:c*p.ratio,scaleY:c*p.ratio,originXCss:o.scrollX,originYCss:o.scrollY}}}async captureScreenCrop(t,e,i){const{canvas:n,page:o,frameW:r,frameH:s}=await this.grabFullFrame(t,i),a=this.computeScreenCrop(r,s);let l=_u(n,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:o.viewportW,viewportH:o.viewportH,dpr:o.dpr,cssToFrame:c,croppedW:l.width,croppedH:l.height,clampedHeight:!0,screenCrop:a},this.logDebug();const d=Nu(l,2560);l=d.canvas;const{blob:h,type:u}=await Lu(l,.9),p=performance.now()-e;return{blob:h,width:l.width,height:l.height,mode:this.name,durationMs:p,page:o,scope:"viewport",blobType:u,markerMapping:{scaleX:c*d.ratio,scaleY:c*d.ratio,originXCss:o.scrollX,originYCss:o.scrollY}}}computeScreenCrop(t,e){const i=window.innerWidth,n=window.innerHeight,o=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+o-l;let u=Math.round(d*c),p=Math.round(h*c),v=Math.round(i*c),g=Math.round(n*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:o,surfaceWidthCss:s}}async grabFullFrame(t,e){e&&await function(t,e=1200){return!t||Zu(t)?Promise.resolve(!!t&&Zu(t)):new Promise((i=>{let n=!1;const o=e=>{n||(n=!0,clearTimeout(s),r.disconnect(),Hu(`waitForAnnotationHost(${JSON.stringify(t)}) -> ${e?"found":"timeout"}`),i(e))},r=new MutationObserver((()=>{Zu(t)&&o(!0)}));r.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["id","data-velt-id"]});const s=setTimeout((()=>o(!1)),Math.max(0,e))}))}(e),Qu(e),Yu(e,"post-hide");try{await $u(2),await Iu(t,3),await Iu(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}}(),n=t.videoWidth,o=t.videoHeight;if(!n||!o)throw new Error("capture-no-frame");const r=document.createElement("canvas");r.width=n,r.height=o;const s=r.getContext("2d");if(!s)throw new Error("canvas-2d-unavailable");return Yu(e,"pre-draw"),s.drawImage(t,0,0),{canvas:r,page:i,frameW:n,frameH:o}}finally{Xu()}}logDebug(){Tu()&&"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 n=await e.fromElement(t);await i.cropTo(n)}catch{this.removeCropEl()}}removeCropEl(){var t;null===(t=this.cropEl)||void 0===t||t.remove(),this.cropEl=null}}const np="6.0.44",op="superflow-agents",rp="sidebar-id",sp="scope",ap="group-config",lp="force-close";function cp(t){const e=t=>null==t?void 0:t.map((t=>({path:t.path,values:[...t.values]}))),i={};return t.include&&(i.include=e(t.include)),t.exclude&&(i.exclude=e(t.exclude)),i}const dp={exclude:[{path:"sourceType",values:["agent"]}]},hp={include:[{path:"sourceType",values:["agent"]}],exclude:[{path:"suggestion.status",values:["rejected"]}]};function up(t,e){const i=function(t,e){let i=t;for(const t of e.split(".")){if(null==i)return;i=i[t]}return i}(t,e.path);if(null==i)return!1;return(Array.isArray(i)?i:[i]).some((t=>null!=t&&e.values.includes(t)))}function pp(t){return function(t,e){var i,n;try{if(!t||"object"!=typeof t)return!1;const o=null!==(i=null==e?void 0:e.include)&&void 0!==i?i:[],r=null!==(n=null==e?void 0:e.exclude)&&void 0!==n?n:[];return o.every((e=>up(t,e)))&&!r.some((e=>up(t,e)))}catch(t){return console.warn("Error in isInSidebarScope: ",t),!1}}(t,hp)}function vp(t){const e=/^v?(\d+)\.(\d+)\.(\d+)(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$/.exec(t.trim());return e?{parts:[Number(e[1]),Number(e[2]),Number(e[3])],prerelease:Boolean(e[4])}:null}function gp(t){try{if(!t||!0!==t.sidebarV2||t.onboardingMode||t.agentStatusMode)return!1;const e=void 0===t.minVersion?np:t.minVersion;return function(t,e=np){try{if("string"!=typeof t||"string"!=typeof e)return!1;const i=vp(t),n=vp(e);if(!i||!n)return!1;for(let t=0;t<3;t++)if(i.parts[t]!==n.parts[t])return i.parts[t]>n.parts[t];return!i.prerelease||n.prerelease}catch(t){return console.warn("Error in isScopedSidebarSdkVersion: ",t),!1}}(t.veltVersion,e)}catch(t){return console.warn("Error in isAgentsSidebarModeAchievable: ",t),!1}}const fp="commentClick",mp="commentNavigationButtonClick",wp="sidebarClose";const yp=t=>null===t||"object"!=typeof t||Array.isArray(t)?null:t,bp=t=>"string"==typeof t?t.trim():"",Cp=t=>{try{const e=yp(t),i=yp(null==e?void 0:e.agent);if(i)return i;const n=null==e?void 0:e.comments,o=Array.isArray(n)?yp(n[0]):null;return yp(null==o?void 0:o.agent)}catch{return null}},xp=Object.freeze(["superflow agent"]),Ep=t=>{const e=bp(t);return e&&!xp.includes(e.toLowerCase())?e:""},kp=t=>{var e;try{return Ep(null===(e=Cp(t))||void 0===e?void 0:e.displayName).slice(0,80)}catch{return""}},Sp=t=>{var e;const i=null===(e=yp(t))||void 0===e?void 0:e.createdAt;return"number"==typeof i&&Number.isFinite(i)?i:0},Mp=(t,e)=>{try{return Ep(t)||(t=>{let e="",i=-1/0;for(const n of Array.isArray(t)?t:[]){const t=kp(n);if(!t)continue;const o=Sp(n);(!e||o>i)&&(e=t,i=o)}return e})(e)}catch{return""}},Ap=t=>Cp(t)?"square":"round",Tp="agent",$p=Object.freeze({link:{viewBox:"0 0 18 18",strokeWidth:1.5,paths:["M6.75 11.25L11.25 6.75M8.25 4.50005L8.59725 4.09805C9.3006 3.39479 10.2545 2.99975 11.2491 2.99982C12.2438 2.99989 13.1976 3.39507 13.9009 4.09842C14.6041 4.80178 14.9992 5.75569 14.9991 6.75031C14.999 7.74493 14.6039 8.69879 13.9005 9.40205L13.5 9.75005M9.75011 13.5L9.45236 13.9005C8.74079 14.6041 7.78045 14.9988 6.77973 14.9988C5.77902 14.9988 4.81867 14.6041 4.10711 13.9005C3.75637 13.5537 3.47793 13.1408 3.28789 12.6856C3.09785 12.2304 3 11.7421 3 11.2489C3 10.7556 3.09785 10.2673 3.28789 9.81214C3.47793 9.35698 3.75637 8.94405 4.10711 8.59725L4.50011 8.25"]},spell:{viewBox:"0 0 18 18",strokeWidth:1.5,paths:["M10.5 4.5L15.75 9.75L12.75 12.75M3 14.9999L4.326 13.674M4.37072 13.6291C4.56768 13.8261 4.80153 13.9824 5.0589 14.089C5.31627 14.1956 5.59213 14.2505 5.87072 14.2505C6.14931 14.2505 6.42517 14.1956 6.68254 14.089C6.93991 13.9824 7.17376 13.8261 7.37072 13.6291L15.3102 5.68955C15.4496 5.55026 15.5601 5.38487 15.6355 5.20285C15.711 5.02082 15.7498 4.82571 15.7498 4.62868C15.7498 4.43165 15.711 4.23654 15.6355 4.05451C15.5601 3.87249 15.4496 3.7071 15.3102 3.5678L14.432 2.68955C14.2927 2.5502 14.1273 2.43966 13.9453 2.36424C13.7632 2.28882 13.5681 2.25 13.3711 2.25C13.1741 2.25 12.979 2.28882 12.7969 2.36424C12.6149 2.43966 12.4495 2.5502 12.3102 2.68955L4.37072 10.6291C4.1737 10.826 4.01741 11.0599 3.91078 11.3172C3.80415 11.5746 3.74927 11.8505 3.74927 12.1291C3.74927 12.4076 3.80415 12.6835 3.91078 12.9409C4.01741 13.1982 4.1737 13.4321 4.37072 13.6291Z"]},mobile:{viewBox:"0 0 18 18",strokeWidth:1.5,paths:["M8.25 3H9.75M9 12.75V12.7575M4.5 3.75C4.5 3.35218 4.65804 2.97064 4.93934 2.68934C5.22064 2.40804 5.60218 2.25 6 2.25H12C12.3978 2.25 12.7794 2.40804 13.0607 2.68934C13.342 2.97064 13.5 3.35218 13.5 3.75V14.25C13.5 14.6478 13.342 15.0294 13.0607 15.3107C12.7794 15.592 12.3978 15.75 12 15.75H6C5.60218 15.75 5.22064 15.592 4.93934 15.3107C4.65804 15.0294 4.5 14.6478 4.5 14.25V3.75Z"]},image:{viewBox:"0 0 24 24",strokeWidth:2,paths:["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"]},consistency:{viewBox:"0 0 20 20",strokeWidth:1.66667,paths:["M12.5 3.33333H13.3333C13.5544 3.33333 13.7663 3.42113 13.9226 3.57741C14.0789 3.73369 14.1667 3.94565 14.1667 4.16667V7.08333M16.6667 5C16.8867 5.09333 17.1 5.18083 17.3067 5.2625C17.5101 5.34882 17.6709 5.51241 17.7537 5.71729C17.8366 5.92217 17.8346 6.15155 17.7483 6.355L15.8333 10.8333M3.00335 5.99751L8.95168 3.40668C9.04984 3.36461 9.15542 3.34261 9.26221 3.34199C9.369 3.34137 9.47483 3.36214 9.57346 3.40307C9.6721 3.444 9.76154 3.50426 9.83652 3.58031C9.91149 3.65635 9.97049 3.74664 10.01 3.84584L14.1134 13.7642C14.1986 13.9653 14.2015 14.1919 14.1214 14.3951C14.0413 14.5984 13.8846 14.762 13.685 14.8508L7.73752 17.4417C7.63932 17.4839 7.53366 17.506 7.42678 17.5067C7.3199 17.5073 7.21396 17.4866 7.11523 17.4457C7.0165 17.4047 6.92697 17.3444 6.85193 17.2683C6.7769 17.1922 6.71787 17.1018 6.67835 17.0025L2.57502 7.08334C2.48973 6.88222 2.48683 6.65565 2.56694 6.45241C2.64705 6.24917 2.80377 6.08634 3.00335 5.99751Z"]},"ai-visibility":{viewBox:"0 0 24 24",strokeWidth:2,paths:["M16 18C16.5304 18 17.0391 18.2107 17.4142 18.5858C17.7893 18.9609 18 19.4696 18 20C18 19.4696 18.2107 18.9609 18.5858 18.5858C18.9609 18.2107 19.4696 18 20 18C19.4696 18 18.9609 17.7893 18.5858 17.4142C18.2107 17.0391 18 16.5304 18 16C18 16.5304 17.7893 17.0391 17.4142 17.4142C17.0391 17.7893 16.5304 18 16 18ZM16 6C16.5304 6 17.0391 6.21071 17.4142 6.58579C17.7893 6.96086 18 7.46957 18 8C18 7.46957 18.2107 6.96086 18.5858 6.58579C18.9609 6.21071 19.4696 6 20 6C19.4696 6 18.9609 5.78929 18.5858 5.41421C18.2107 5.03914 18 4.53043 18 4C18 4.53043 17.7893 5.03914 17.4142 5.41421C17.0391 5.78929 16.5304 6 16 6ZM9 18C9 16.4087 9.63214 14.8826 10.7574 13.7574C11.8826 12.6321 13.4087 12 15 12C13.4087 12 11.8826 11.3679 10.7574 10.2426C9.63214 9.11742 9 7.5913 9 6C9 7.5913 8.36786 9.11742 7.24264 10.2426C6.11742 11.3679 4.5913 12 3 12C4.5913 12 6.11742 12.6321 7.24264 13.7574C8.36786 14.8826 9 16.4087 9 18Z"]},accessibility:{viewBox:"0 0 24 24",strokeWidth:2,paths:["M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0","M10 16.5l2 -3l2 3m-2 -3v-2l3 -1m-6 0l3 1","M12 7.5m-.5 0a.5 .5 0 1 0 1 0a.5 .5 0 1 0 -1 0"]},workspace:{viewBox:"0 0 18 18",strokeWidth:1.5,paths:["M2 1H6C6.26522 1 6.51957 1.10536 6.70711 1.29289C6.89464 1.48043 7 1.73478 7 2V8C7 8.26522 6.89464 8.51957 6.70711 8.70711C6.51957 8.89464 6.26522 9 6 9H2C1.73478 9 1.48043 8.89464 1.29289 8.70711C1.10536 8.51957 1 8.26522 1 8V2C1 1.73478 1.10536 1.48043 1.29289 1.29289C1.48043 1.10536 1.73478 1 2 1Z","M2 13H6C6.26522 13 6.51957 13.1054 6.70711 13.2929C6.89464 13.4804 7 13.7348 7 14V16C7 16.2652 6.89464 16.5196 6.70711 16.7071C6.51957 16.8946 6.26522 17 6 17H2C1.73478 17 1.48043 16.8946 1.29289 16.7071C1.10536 16.5196 1 16.2652 1 16V14C1 13.7348 1.10536 13.4804 1.29289 13.2929C1.48043 13.1054 1.73478 13 2 13Z","M12 9H16C16.2652 9 16.5196 9.10536 16.7071 9.29289C16.8946 9.48043 17 9.73478 17 10V16C17 16.2652 16.8946 16.5196 16.7071 16.7071C16.5196 16.8946 16.2652 17 16 17H12C11.7348 17 11.4804 16.8946 11.2929 16.7071C11.1054 16.5196 11 16.2652 11 16V10C11 9.73478 11.1054 9.48043 11.2929 9.29289C11.4804 9.10536 11.7348 9 12 9Z","M12 1H16C16.2652 1 16.5196 1.10536 16.7071 1.29289C16.8946 1.48043 17 1.73478 17 2V4C17 4.26522 16.8946 4.51957 16.7071 4.70711C16.5196 4.89464 16.2652 5 16 5H12C11.7348 5 11.4804 4.89464 11.2929 4.70711C11.1054 4.51957 11 4.26522 11 4V2C11 1.73478 11.1054 1.48043 11.2929 1.29289C11.4804 1.10536 11.7348 1 12 1Z"]},security:{viewBox:"0 0 24 24",strokeWidth:2,paths:["M12 3a12 12 0 0 0 8.5 3a12 12 0 0 1 -8.5 15a12 12 0 0 1 -8.5 -15a12 12 0 0 0 8.5 -3","M9 12l2 2l4 -4"]},uptime:{viewBox:"0 0 24 24",strokeWidth:2,paths:["M3 12h4l3 8l4 -16l3 8h4"]},forms:{viewBox:"0 0 24 24",strokeWidth:2,paths:["M9 5h-2a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-12a2 2 0 0 0 -2 -2h-2","M9 5a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2","M9 12h.01M13 12h2M9 16h.01M13 16h2"]},lighthouse:{viewBox:"0 0 24 24",strokeWidth:2,paths:["M3 12a9 9 0 1 0 18 0a9 9 0 1 0 -18 0","M11 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0","M13.41 10.59l2.59 -2.59","M7 12a5 5 0 0 1 5 -5"]},lorem:{viewBox:"0 0 24 24",strokeWidth:2,paths:["M4 6h16M4 12h10M4 18h14"]},[Tp]:{viewBox:"0 0 16 16",strokeWidth:1.33333,paths:["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"]}});Object.freeze(Object.keys($p));const Ip=t=>{var e;try{const i=bp(null===(e=Cp(t))||void 0===e?void 0:e.icon).toLowerCase();return i&&Object.prototype.hasOwnProperty.call($p,i)?i:Tp}catch{return Tp}},_p=t=>`url("data:image/svg+xml,${encodeURIComponent((t=>{const e=Object.prototype.hasOwnProperty.call($p,t)?$p[t]:$p[Tp],i=e.paths.map((t=>`<path d="${t}"/>`)).join("");return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${e.viewBox}" fill="none" stroke="#FFFFFF" stroke-width="${e.strokeWidth}" stroke-linecap="round" stroke-linejoin="round">${i}</svg>`})(t))}")`,Np="data-sf-agent-pin",Op="comment-pin-container-",Lp=`[id^="${Op}"]`,Rp=Object.freeze(["snippyly-comment-pin-portal","velt-comment-pin-portal","snippyly-area-pin-portal","velt-area-pin-portal"]),Dp=Object.freeze({marker:".velt-comment-pin--marker",avatar:"snippyly-user-avatar",agentIcon:".velt-comment-pin--agent-icon"}),Fp=Object.freeze(Object.values(Dp)),Pp=Dp.marker,Vp=t=>"undefined"!=typeof CSS&&"function"==typeof CSS.escape?CSS.escape(t):t.replace(/[^a-zA-Z0-9_-]/g,(t=>`\\${t}`)),jp=(t,e=[""])=>{const i=e.length>0?e:[""],n=t=>i.map((e=>e?`${e} ${t}`:t)).join(",\n"),o=Pp;return[`${n(o)} { border-radius: 6px !important; background: var(--velt-agent-accent, #4495FF) !important; }`,`${n(`${o} ${Dp.avatar}`)},\n${n(`${o} ${Dp.agentIcon}`)},\n${n(`${o} > svg`)} { display: none !important; }`,`${n(`${o}::before`)} { content: ''; display: block; flex: none; width: 20px; height: 20px; background: ${_p(t)} center / contain no-repeat; }`].join("\n")},Up=(t,e=3,i=8)=>{const n=[],o=(t,r)=>{if(r>e)return;const s=t instanceof Element?[t]:[];t.querySelectorAll("*").forEach((t=>s.push(t)));for(const t of s){if(n.length>=i)return;const e=t.shadowRoot;e&&!n.includes(e)&&(n.push(e),o(e,r+1))}};try{t&&o(t,1)}catch{}return n},Bp=(t,e)=>{try{let i=t.querySelector(`style[${Np}]`);if(!e)return void(null==i||i.remove());i||(i=document.createElement("style"),i.setAttribute(Np,"true"),t.appendChild(i)),i.textContent!==e&&(i.textContent=e)}catch{}},zp=(t,e=document)=>{try{return t?Array.from(e.querySelectorAll(`#${Vp(`${Op}${t}`)}`)):[]}catch{return[]}},Hp=t=>{const e=t;return e&&1===e.nodeType&&"string"==typeof e.id&&e.id.startsWith(Op)?e.id.slice(22):""},qp=Object.freeze(["style","link","script","template"]),Gp=(t,e)=>{const i=e>1?`:scope ${"> * ".repeat(e-1)}*`:"*";for(const e of Array.from(t.querySelectorAll(i)))if(!qp.includes(e.localName))return!0;return!1},Wp=(t,e=Up(t))=>{try{if((t=>{try{return null!==t.querySelector(Pp)}catch{return!1}})(t))return"light";if(e.some((t=>null!==t.querySelector(Dp.marker))))return"shadow";return(e.length>0?e.some((t=>Gp(t,1))):Gp(t,2))?"unrecognised":"pending"}catch{return"pending"}},Zp=t=>{for(const e of Up(t))Bp(e,"")};var Kp=function(t,e,i,n){for(var o,r=arguments.length,s=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n,a=t.length-1;a>=0;a--)(o=t[a])&&(s=(r<3?o(s):r>3?o(e,i,s):o(e,i))||s);return r>3&&s&&Object.defineProperty(e,i,s),s};class Yp 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.agentStatusMode=!1,this.agentsSidebarRequested=!1,this.loadedVeltVersion=void 0,this.scopedSidebarsMinVeltVersion=np,this.agentsSidebarDeepLinkId=null,this.requestModeSwitch=!1,this.requestContextProviderElement=null,this.requestModeLoadedTracked=!1,this.requestToolbarExpanded=!1,this.requestMenuOpen=!1,this.requestMenuListenersAttached=!1,this.requestCommentModePending=null,this.requestNotifyRetryTimer=(t,e)=>{window.setTimeout(t,e)},this.notifyAddedRequest=function(t){const e=new Set,i=(e,n)=>{try{if(!t.isActive())return;t.send(e).then((o=>{var r;"ok"!==o.kind?"error"!==o.kind||"not-found"!==o.code||"first"!==n?"error"===o.kind?t.warn(`${Od} refused (${o.code})`):t.warn(`${Od} could not reach the backend`):t.retryTimer((()=>i(e,"retry")),t.retryDelayMs):o.notified||t.warn(`${Od}: not sent (${null!==(r=o.reason)&&void 0!==r?r:"unknown"})`)})).catch((()=>{t.warn(`${Od} could not reach the backend`)}))}catch(t){console.warn("Error in request notifier attempt: ",t)}};return n=>{try{return!(!n||e.has(n)||!t.isActive()||(e.add(n),i(n,"first"),0))}catch(t){return console.warn("Error in request notifier: ",t),!1}}}({send:t=>hh({apiKey:this.apiKey,documentId:this.projectId||"",annotationId:t,user:Nd(this.snippylyUser)}),isActive:()=>this.isRequestMode()&&!!this.apiKey&&!!this.projectId,retryTimer:(t,e)=>this.requestNotifyRetryTimer(t,e),retryDelayMs:5e3,warn:t=>console.warn(t)}),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=Je,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.agentsSidebarModeLatched=null,this.latchAgentsSidebarMode=()=>{try{null===this.agentsSidebarModeLatched&&(this.agentsSidebarModeLatched=this.resolveAgentsSidebarMode())}catch(t){console.warn("Error in latchAgentsSidebarMode: ",t),this.agentsSidebarModeLatched=!1}},this.resolveAgentsSidebarMode=()=>function(t){try{return!(!t||!0!==t.requested)&&gp(t)}catch(t){return console.warn("Error in isAgentsSidebarModeEnabled: ",t),!1}}({requested:this.agentsSidebarRequested,veltVersion:this.loadedVeltVersion,sidebarV2:this.sidebarV2Enabled,onboardingMode:this.onboardingMode,agentStatusMode:this.agentStatusMode,minVersion:this.scopedSidebarsMinVeltVersion}),this.veltProxyToggleVisible=!1,this.nativeScreenshotEnabled=!1,this.nativeScreenshotDenied=!1,this.capturingScreenshot=!1,this.nativeCapture=new ip,this.screenshotChain=Promise.resolve(),this.pendingScreenshotCount=0,this.nativeScreenshotEnabling=!1,this.addCommentAnnotationSubscribedEl=void 0,this.isSettingSidebarData=!1,this.agentGroups=[],this.lockedAgentIssueCount=0,this.agentCommentLockIdsKey=null,this.agentCommentLockReadAt=0,this.agentCommentLockTimer=null,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.agentPinTargets=new Map,this.agentPinLightDomIds=new Set,this.agentPinPageCss="",this.agentPinDecoratedContainers=new WeakSet,this.agentPinPendingContainers=new Set,this.agentPinDomObserver=null,this.agentPinFrameCancel=null,this.agentPinUnrecognisedContainers=new Set,this.agentPinMarkupRecheckTimer=null,this.agentPinMarkupReported=!1,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),zd("Error in onApiKeyChange: ",t)}},this.checkCustomLoginEnabled=async()=>{var t;try{const e=await eh(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),zd("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!!fd(t)||qt.some((({hostSuffix:t,pathPrefix:n})=>(e===t||e.endsWith(`.${t}`))&&i.startsWith(n)))}catch(t){return console.warn("Error in isRunningUnderPreviewProxy: ",t),!1}},this.isRunningUnderLivePreview=(t=document.location)=>{try{return fd(t)}catch(t){return console.warn("Error in isRunningUnderLivePreview: ",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.identityCameFromToken=!1,this.identityLiveSignIn=null,this.isLiveShareGuest=()=>{var t,e,i;try{const n=null===(t=this.identityLiveSignIn)||void 0===t?void 0:t.user;return!!(null===(e=this.snippylyUser)||void 0===e?void 0:e.isGuest)&&!!(null==n?void 0:n.isGuest)&&n.userId===(null===(i=this.snippylyUser)||void 0===i?void 0:i.userId)}catch(t){return console.warn("Error in isLiveShareGuest: ",t),!1}},this.liveSignInExpiryHandled=!1,this.fallBackToGuestIfLiveSignInExpired=(t,e=Date.now())=>{var i;try{return!(!t||(null===(i=t.user)||void 0===i?void 0:i.isGuest)||t.expiresAt>e+ie)&&(this.liveSignInExpiryHandled||(this.liveSignInExpiryHandled=!0,console.warn("[CWS Toolbar] The live preview sign-in has expired. Continuing as a guest."),this.signInError=!1,setTimeout((()=>this.identifySnippyly()),0)),!0)}catch(t){return console.warn("Error in fallBackToGuestIfLiveSignInExpired: ",t),!1}},this.readLiveSignIn=()=>{try{return this.isRunningUnderLivePreview()?wd():null}catch(t){return console.warn("Error in readLiveSignIn: ",t),null}},this.credentialFor=(t,e)=>{try{return(({cameFromToken:t,user:e,loc:i=window.location,onLivePreview:n,liveSignIn:o})=>{try{if(null!=n?n:fd(i)){const t=void 0===o?wd({loc:i}):o;return!t||!e||e.isGuest||e.isAnonymous||e.userId!==t.user.userId?null:t.token}return!t||!(null==e?void 0:e.userId)||e.isGuest||e.isAnonymous?null:yd({userId:e.userId})}catch(t){return console.warn("Error in credentialForTokenMint: ",t),null}})({cameFromToken:e,user:t,onLivePreview:this.isRunningUnderLivePreview(),liveSignIn:this.readLiveSignIn()})}catch(t){return console.warn("Error in credentialFor: ",t),null}},this.suggestionCredential=()=>{try{return this.credentialFor(this.snippylyUser,this.identityCameFromToken)}catch(t){return console.warn("Error in suggestionCredential: ",t),null}},this.suggestionGuardInstalled=!1,this.suggestionHideStyleObserver=null,this.suggestionHideSweepScheduled=!1,this.suggestionViewerRoleResolved=!1,this.suggestionHideStylesApplied=!1,this.suggestionRoleLookupFailed=!1,this.isSuggestionActionsHiddenForViewer=()=>{try{return this.suggestionRoleLookupFailed||"Admin"!==this.snippylyUserRole}catch(t){return console.warn("Error in isSuggestionActionsHiddenForViewer: ",t),!1}},this.shouldHideSuggestionActionsOnPage=()=>{try{return this.suggestionViewerRoleResolved&&!!window.Velt&&this.isSuggestionActionsHiddenForViewer()}catch(t){return console.warn("Error in shouldHideSuggestionActionsOnPage: ",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.setupSuggestionActionGuard=()=>{try{if(this.suggestionGuardInstalled)return;this.suggestionGuardInstalled=!0,document.addEventListener("click",(t=>{try{if(!this.isSuggestionActionsHiddenForViewer())return;const e="function"==typeof t.composedPath?t.composedPath():[];this.isSuggestionActionEventPath(e)&&(t.stopImmediatePropagation(),t.preventDefault(),console.warn("[CWS Toolbar] Only workspace members can accept or reject suggestions. Click ignored."))}catch(t){console.warn("Error in suggestion-action click guard: ",t)}}),{capture:!0})}catch(t){console.warn("Error in setupSuggestionActionGuard: ",t),zd("Error in setupSuggestionActionGuard: ",t)}},this.applySuggestionActionStyles=()=>{try{if(!this.shouldHideSuggestionActionsOnPage())return void this.removeSuggestionActionStyles();this.suggestionHideStylesApplied=!0,this.sweepSuggestionActionStyles(),this.suggestionHideStyleObserver||(this.suggestionHideStyleObserver=new MutationObserver((()=>{try{if(this.suggestionHideSweepScheduled)return;this.suggestionHideSweepScheduled=!0,requestAnimationFrame((()=>{this.suggestionHideSweepScheduled=!1,this.shouldHideSuggestionActionsOnPage()&&this.sweepSuggestionActionStyles()}))}catch(t){console.warn("Error in suggestion-action style observer: ",t)}})),this.suggestionHideStyleObserver.observe(document.body,{childList:!0,subtree:!0}))}catch(t){console.warn("Error in applySuggestionActionStyles: ",t),zd("Error in applySuggestionActionStyles: ",t)}},this.sweepSuggestionActionStyles=()=>{try{this.injectSuggestionActionStyle(document.head);const t=e=>{e.querySelectorAll("*").forEach((e=>{var i,n;const o=(null===(n=null===(i=e.tagName)||void 0===i?void 0:i.toLowerCase)||void 0===n?void 0:n.call(i))||"";if(!o.startsWith("velt-")&&!o.startsWith("snippyly-"))return;const r=e.shadowRoot;r&&(this.injectSuggestionActionStyle(r),t(r))}))};t(document.body)}catch(t){console.warn("Error in sweepSuggestionActionStyles: ",t)}},this.injectSuggestionActionStyle=t=>{try{if(t.querySelector(`style[${Yp.SUGGESTION_ACTIONS_HIDDEN_STYLE_ATTR}]`))return;const e=document.createElement("style");e.setAttribute(Yp.SUGGESTION_ACTIONS_HIDDEN_STYLE_ATTR,"true"),e.textContent=Yp.SUGGESTION_ACTIONS_HIDDEN_CSS,t.appendChild(e)}catch(t){console.warn("Error in injectSuggestionActionStyle: ",t)}},this.removeSuggestionActionStyles=()=>{try{if(!this.suggestionHideStylesApplied)return;this.suggestionHideStylesApplied=!1,this.suggestionHideStyleObserver&&(this.suggestionHideStyleObserver.disconnect(),this.suggestionHideStyleObserver=null);const t=`style[${Yp.SUGGESTION_ACTIONS_HIDDEN_STYLE_ATTR}]`;document.querySelectorAll(t).forEach((t=>t.remove()));const e=i=>{i.querySelectorAll("*").forEach((i=>{const n=i.shadowRoot;n&&(n.querySelectorAll(t).forEach((t=>t.remove())),e(n))}))};e(document.body)}catch(t){console.warn("Error in removeSuggestionActionStyles: ",t)}},this.isDriveOrPreviewHost=(t=document.location)=>{try{const e=(null==t?void 0:t.hostname)||"",i=(null==t?void 0:t.pathname)||"";return Ie.some((({hostSuffix:t,pathPrefix:n})=>(e===t||e.endsWith(`.${t}`))&&i.startsWith(n)))||this.isRunningUnderPreviewProxy(t)}catch(t){return console.warn("Error in isDriveOrPreviewHost: ",t),!1}},this.loginWithCustomUser=()=>{try{this.customLoginEnabled?(sd(te),bd(),this.loadPlugin&&this.documentId&&this.identifySnippyly()):console.warn("Identify call not allowed.")}catch(t){console.warn("Error in loginWithCustomUser: ",t),zd("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),zd("Error in addWindowClickEventListener: ",t)}},this.removeWindowClickEventListener=()=>{try{window.removeEventListener("click",this.windowClickEventListener),this.windowClickEventListener=void 0}catch(t){console.warn("Error in removeWindowClickEventListener: ",t),zd("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),zd("Error in setWindowEventListner: ",t)}},this.removeWindowLocationChangeListener=()=>{try{window.removeEventListener("locationchange",this.onWindowLocationChange),this.locationChangeListenerAttached=!1}catch(t){console.warn("Error in removeWindowLocationChangeListener: ",t),zd("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),zd("Error in urlChangeListener: ",t)}},this.checkUrl=()=>{try{this.setInviteUrl();const t=new URL(document.location),e=t.searchParams;e.has(Jt)&&(od(St,"true",!1),this.agentsSidebarDeepLinkId=e.get(Jt)||null);let i=!1;for(const t of[At,Tt,$t,It,Nt,Ot,Lt]){if(!e.has(t))continue;const n=!(t===Nt||t===Ot)||this.isFramedByPortal();"true"===e.get(t)&&n?od(t,"true",!1,"sessionStorage"):t===Lt&&"false"===e.get(t)?od(t,"false",!1,"sessionStorage"):sd(t,"sessionStorage"),e.delete(t),i=!0}this.embedMode="true"===rd(At,!1,"sessionStorage"),this.readOnlyMode="true"===rd($t,!1,"sessionStorage"),this.autoCommentModeRequested=!this.readOnlyMode&&"true"===rd(Tt,!1,"sessionStorage"),this.agentCommentsModeRequested="true"===rd(It,!1,"sessionStorage"),this.onboardingMode="true"===rd(Nt,!1,"sessionStorage")&&this.canHonourStoredOnboardingFlag(),this.agentStatusMode="true"===rd(Ot,!1,"sessionStorage")&&this.canHonourStoredOnboardingFlag(),this.agentsSidebarRequested=function(t){try{const i="true"===(e=null==t?void 0:t.sessionFlag)||"false"!==e&&null;return null===i||i}catch(t){return console.warn("Error in resolveAgentsSidebarRequested: ",t),!1}var e}({sessionFlag:rd(Lt,!1,"sessionStorage")}),this.autoOpenOnboardingSidebar();const n=e.get(_t);n&&(od(_t,n,!1,"sessionStorage"),e.delete(_t),i=!0);const o=this.previewLocationPath;if(this.previewLocationPath=this.isRunningUnderLivePreview()?window.location.pathname||"/":rd(_t,!1,"sessionStorage")||"",this.isRunningUnderLivePreview()&&o&&o!==this.previewLocationPath&&this.setPreviewLocationFromPath(),this.pageCommentsHidden="true"===rd(Kt,!1,"sessionStorage"),i&&window.history.replaceState({},document.title,t.href),(null==e?void 0:e.has(le))&&!rd(le)?this.showOnboardingModal=!0:this.showOnboardingModal=!1,null==e?void 0:e.has(ce))if(rd(ce,!1,"sessionStorage")){this.showLiveDemoModal=!1;const t=new URL(document.location);t.searchParams.delete(ce),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(de))if(rd(de,!1)){this.showFigmaDemoModal=!1;const t=new URL(document.location);t.searchParams.delete(de),window.history.replaceState({},null===document||void 0===document?void 0:document.title,t.toString())}else this.showFigmaDemoModal=!0;else this.showFigmaDemoModal=!1;const r=this.isRunningUnderLivePreview();if(e.has(Xt)||e.has("snippyly_google_token")){if(r);else if(e.has(Xt)){const t=decodeURIComponent(e.get(Xt)),i=cd(t,ti,ei),n=i&&JSON.parse(i);if(n){const t={};t.userId=n.uid,t.name=n.displayName,t.email=n.email,t.photoUrl=null==n?void 0:n.photoURL;const e=JSON.stringify(t),i=ld(e,ti,ei);od(te,i,!0),(t=>{try{const e=null==t?void 0:t.cred;"string"==typeof e&&e?od(ee,e,!0):bd()}catch(t){console.warn("Error in storeUserCredentialFromSt: ",t)}})(n),sd(ue)}}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,od(Qt,JSON.stringify(i),!0),bd()}e.delete(Xt),e.delete("snippyly_google_token"),window.history.replaceState({},document.title,t.href)}e.has(St)?(od(St,"true",!1),sd(Mt),e.delete(St),window.history.replaceState({},document.title,t.href),this.loadPluginUI()):e.has(Mt)||rd(St,!1)&&this.loadPluginUI(),e.has(Mt)?(od(Mt,"true",!1),sd(St),e.delete(Mt),window.history.replaceState({},document.title,t.href),this.loadPluginUI()):e.has(St)||rd(Mt,!1)&&this.loadPluginUI(),this.setVersionInUrl(),this.startAgentRunStatusListener()}catch(t){console.warn("Error in checkUrl: ",t),zd("Error in checkUrl: ",t)}},this.setInviteUrl=()=>{try{const t=new URL(document.location);t.searchParams.has(St)||t.searchParams.set(St,"true"),this.inviteUrl=t.toString()}catch(t){console.warn("Error in setInviteUrl: ",t),zd("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&&od(se,this.projectVersion,!1,"sessionStorage")}else{const t=new URL(document.location).searchParams;(t.has(St)||t.has(Mt))&&t.has(ae)&&(od(re,ae,!1,"sessionStorage"),this.projectVersion=t.get(ae),this.projectVersion&&od(se,this.projectVersion,!1,"sessionStorage"))}}catch(t){console.warn("Error in detectVersion: ",t),zd("Error in detectVersion: ",t)}},this.setVersionInUrl=()=>{try{const t=this.projectVersionKey||rd(re,!1,"sessionStorage"),e=this.projectVersion||rd(se,!1,"sessionStorage");if(t&&e){const i=new URL(document.location),n=i.searchParams;n.get(t)||(n.set(t,e),window.history.replaceState({},document.title,i.href))}}catch(t){console.warn("Error in setVersionInUrl: ",t),zd("Error in setVersionInUrl: ",t)}},this.loadPluginUI=async()=>{var t,e,i,n,o,r,s,a,l;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;yt.includes(this.apiKey)&&this.listenToDocumentTitleChange();const c=this.isRunningUnderLivePreview()?null===(t=this.readLiveSignIn())||void 0===t?void 0:t.user:dd();c&&!(null==c?void 0:c.isAnonymous)&&(this.loading=!0);try{this.customerMetadata=await this.getCustomerMetadata()}catch(t){console.warn("Error in getCustomerMetadata: ",t),zd("Error in getCustomerMetadata: ",t)}nd(me)&&(this.isPasswordValid=nd(me));const d=await Zd(this.apiKey,this.projectId);"error"===d.status&&console.warn("getProjectConfig failed for projectId (treating project as valid): ",this.projectId),this.projectDeleted=gd(d,this.isDriveOrPreviewHost(),this.projectIdSupplied),this.applyVeltFeatureGates(),this.projectConfig="ok"===d.status?d.config:null,this.requestModeSwitch=Id(this.projectConfig),this.consumeRequestResumeMarker(),this.guestMode=!!(null===(e=this.projectConfig)||void 0===e?void 0:e.guestMode)||this.guestMode||this.isRunningUnderLivePreview(),this.allowGuestModeSignIn=!!(null===(n=null===(i=this.projectConfig)||void 0===i?void 0:i.guestModeConfig)||void 0===n?void 0:n.allowSignIn),this.queryParamsComments=!!(null===(o=this.projectConfig)||void 0===o?void 0:o.queryParamsComments),this.usePageTitleAsLocationName=!!(null===(r=this.projectConfig)||void 0===r?void 0:r.usePageTitleAsLocationName),(null===(s=this.projectConfig)||void 0===s?void 0:s.guestModeConfig)||(this.allowGuestModeSignIn=!0),this.passwordProtected=!!(null===(l=null===(a=this.projectConfig)||void 0===a?void 0:a.passwordProtected)||void 0===l?void 0:l.enabled),this.applyVeltFeatureGates(),od(pe,this.guestMode+"",!0),od(be,this.allowGuestModeSignIn+"",!0),od(ve,this.passwordProtected+"",!0),od(ge,this.queryParamsComments+"",!0),od(fe,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),zd("Error in loadPluginUI: ",t)}},this.listenToDocumentTitleChange=()=>{try{this.documentTitleChangeInterval||(this.documentTitleChangeInterval=setInterval((()=>{var t,e,i;const n="true"===sessionStorage.getItem("debugDocumentTitleChange");if(n&&(console.log("*** listenToDocumentTitleChange ***"),console.log("usePageTitleAsLocationName: ",this.usePageTitleAsLocationName)),this.usePageTitleAsLocationName){const o=document.title;n&&(console.log("location name: ",null===(t=this.location)||void 0===t?void 0:t.locationName),console.log("title: ",o),console.log("changed: ",(null===(e=this.location)||void 0===e?void 0:e.locationName)!==o)),(null===(i=this.location)||void 0===i?void 0:i.locationName)!==o&&(n&&console.log("%c triggering location update!","color: green; font-weight: bold;"),this.generateLocation(),this.setLocation({forceSetLocation:!0}),this.setPreviewLocationFromPath())}}),2e3))}catch(t){zd("Error in listenToDocumentTitleChange: ",t)}},this.initializeSnippyly=async()=>{var t,e,n,o,r,s,a,l,c,d,h,u,p,v,g,f,m,w,y,b,C,x,E,k,S,M,A;try{let T=this.staging?ft:mt;this.veltVersion&&(T=this.veltVersion);let $=this.staging,I=!1;if((null===sessionStorage||void 0===sessionStorage?void 0:sessionStorage.getItem("velt-version"))&&(T=sessionStorage.getItem("velt-version")),null===sessionStorage||void 0===sessionStorage?void 0:sessionStorage.getItem("velt-env")){"staging"===sessionStorage.getItem("velt-env")&&($=!1,I=!0)}this.apiKey;this.veltProxyToggleVisible=!1;const _=void 0;if(await i(this.apiKey,{options:{develop:$,staging:I,version:T,velt:!0,proxyDomain:"https://cdn.velt.dev"},..._?{proxyConfig:_}:{}}),!window.Velt)return;if(this.setupSuggestionActionGuard(),this.replayVeltFeatureGates(),this.autoTranslation&&(null===Velt||void 0===Velt?void 0:Velt.enableAutoTranslation)&&(null===Velt||void 0===Velt||Velt.enableAutoTranslation()),this.loadedVeltVersion="string"==typeof(null===(t=window.Velt)||void 0===t?void 0:t.version)?window.Velt.version:void 0,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),zd("Error in loadPoppinsFont: ",t)}})()}if(Velt&&(jd({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 t=this.isRunningUnderLivePreview()?null===(e=this.readLiveSignIn())||void 0===e?void 0:e.user:dd(),i="true"===sessionStorage.getItem("debugUserUpdateEvent");this.previousVeltUserId=null!==(n=null==t?void 0:t.userId)&&void 0!==n?n:"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===(o=this.commentElement)||void 0===o?void 0:o.showScreenSizeInfo)&&this.commentElement.showScreenSizeInfo(!0),(null===(r=this.commentElement)||void 0===r?void 0:r.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),od(he,"true")),t&&this.promptNativeScreenshotForCommentMode(),this.addCommentMode||this.showModalOnceCommentIsModeIsOff&&(this.addCommentCount>=2&&!rd(Ce)&&(this.allowGuestModeSignIn?this.openGuestModeSignInModal():this.openGuestModeNameModel(),od(Ce,"true"),this.showModalOnceCommentIsModeIsOff=!1),this.addCommentCount>=5&&!this.showGuestModeSignInModal&&!rd(Ee,!1,"sessionStorage")&&(this.showGuestModeSignInBanner(),od(Ee,"true",!1,"sessionStorage"),this.showModalOnceCommentIsModeIsOff=!1))})),(null===(s=this.commentElement)||void 0===s?void 0:s.enableOrphanComments)&&this.commentElement.enableOrphanComments(),!this.readOnlyMode&&(null===(a=this.commentElement)||void 0===a?void 0:a.enablePersistentCommentMode)&&this.commentElement.enablePersistentCommentMode(),this.readOnlyMode||this.showFirstCommentNudge(),(null===(l=this.commentElement)||void 0===l?void 0:l.enableGhostComments)&&this.commentElement.enableGhostComments();const t=null===window||void 0===window?void 0:window.SUPERFLOW_CUSTOM_STATUSES;t&&"object"==typeof t&&(null===(c=this.commentElement)||void 0===c?void 0:c.setCustomStatus)&&this.commentElement.setCustomStatus(t),(null===(d=this.commentElement)||void 0===d?void 0:d.enableMinimap)&&!this.embedMode&&this.commentElement.enableMinimap(),(null===(h=this.commentElement)||void 0===h?void 0:h.setDStrategy)&&(null===(u=this.commentElement)||void 0===u||u.setDStrategy("dynamicId")),(null===(p=this.commentElement)||void 0===p?void 0:p.enableSidebarButtonOnCommentDialog)&&this.commentElement.enableSidebarButtonOnCommentDialog(),(null===(v=this.commentElement)||void 0===v?void 0:v.enableHotkey)&&this.commentElement.enableHotkey(),(null===(g=this.commentElement)||void 0===g?void 0:g.enableDeviceIndicatorOnCommentPins)&&this.commentElement.enableDeviceIndicatorOnCommentPins(),(null===(f=this.commentElement)||void 0===f?void 0:f.enableLazyLoadResolvedComments)&&this.commentElement.enableLazyLoadResolvedComments(),(null===(m=this.commentElement)||void 0===m?void 0:m.enableDraftConfirmation)&&this.commentElement.enableDraftConfirmation(),this.applyScreenshotSetting(),this.ensureAddCommentAnnotationSubscription(),this.initCommentStatuses(),this.setQueryParamsCommentsInSdk(),this.checkToEnableUpgradeButton(),this.syncRequestMode(),this.setupSidebarAgentCommentFilter(),this.setupVeltButtonClickListener(),this.maybeApplyVisibilityOptionsToCommentElement()}this.applyStorageFeatureAccess(),this.selectionElement=Velt.getSelectionElement(),this.selectionElement&&this.selectionElement.enableLiveSelection(!0),this.rewriterElement&&(null===(w=this.rewriterElement)||void 0===w||w.enableRewriter()),this.presenceElement&&(null===(y=this.presenceElement)||void 0===y?void 0:y.enableFlockMode)&&(null===(b=this.presenceElement)||void 0===b||b.enableFlockMode(!0)),(null===Velt||void 0===Velt?void 0:Velt.getDocElement)&&(this.docElement=Velt.getDocElement()),null===(k=(null===(C=this.docElement)||void 0===C?void 0:C.getDocumentMetadata)?null===(x=this.docElement)||void 0===x?void 0:x.getDocumentMetadata():null===(E=null===Velt||void 0===Velt?void 0:Velt.docService)||void 0===E?void 0:E.getDocumentMetadata$())||void 0===k||k.subscribe((t=>{var e,i;const n=(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):[],o=new URL(document.location).searchParams.get("version");if(o){const t=n.find((t=>t.id===o));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===(S=this.viewsElement)||void 0===S?void 0:S.getUniqueViewsByUser)&&(null===(A=null===(M=this.viewsElement)||void 0===M?void 0:M.getUniqueViewsByUser())||void 0===A||A.subscribe((t=>{this.totalViews=t}))),this.identifySnippyly()}catch(t){this.loading=!1,console.warn("Error in initializeSnippyly: ",t),zd("Error in initializeSnippyly: ",t)}},this.generateDocumentId=()=>{try{this.documentId=Xc(ed(window.location.origin))+"",this.projectId&&(this.documentId=this.projectId+""),this.serverDocumentId=(t=this.documentId+"")?`${Xc(t)}`:void 0}catch(t){console.warn("Error in generateDocumentId: ",t),zd("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+"")),jd({documentId:this.serverDocumentId,clientDocumentId:this.documentId}),this.generateLocation(),this.setLocation(),this.setPreviewLocationFromPath()}catch(t){console.warn("Error in setDocumentAndLocation: ",t),zd("Error in setDocumentAndLocation: ",t)}},this.setPreviewLocationFromPath=()=>{try{if(!(this.agentCommentsModeRequested||this.isRunningUnderLivePreview())||!this.previewLocationPath)return;if(!window.Velt||!(null===Velt||void 0===Velt?void 0:Velt.setLocation))return;const t={url:this.previewLocationPath},e=id(JSON.parse(JSON.stringify(t)));e&&(t.id=`${e}`),this.location=t,null===Velt||void 0===Velt||Velt.setLocation(JSON.parse(JSON.stringify(t))),jd({clientLocation:t}),this.previousLocation=JSON.parse(JSON.stringify(t)),this.onVeltLocationChange()}catch(t){console.warn("Error in setPreviewLocationFromPath: ",t),zd("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),zd("Error in checkToEnableUpgradeButton: ",t)}},this.getCustomerMetadata=async()=>{try{const t=await Jd(this.apiKey);return(t=>{try{const e=t?JSON.stringify(t):"false";od(ke,e)}catch(t){console.warn("Error in setCustomerMetadataToStorage: ",t),zd("Error in setCustomerMetadataToStorage: ",t)}})(t),t}catch(t){console.warn("Error in getCustomerMetadata: ",t),zd("Error in getCustomerMetadata: ",t);const e=(()=>{try{const t=rd(ke);return t?"false"===t?JSON.parse(JSON.stringify(Pe)):JSON.parse(t):null}catch(t){return console.warn("Error in getCustomerMetadataFromStorage: ",t),zd("Error in getCustomerMetadataFromStorage: ",t),null}})();if(e)return e}},this.setCustomStatuses=async()=>{var t;try{const e=await Qd(this.apiKey);if((null==e?void 0:e.success)&&(null==e?void 0:e.data)){const i=Object.values(e.data),n=this.sortCustomStatuses(i);if(n.length>0&&(null===(t=this.commentElement)||void 0===t?void 0:t.setCustomStatus))return void this.commentElement.setCustomStatus(n)}this.hasWindowCustomStatuses()||this.applyDefaultCommentStatuses()}catch(t){console.warn("Error in setCustomStatuses: ",t),zd("Error in setCustomStatuses: ",t)}},this.initCommentStatuses=()=>{var t,e,i;try{(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.hasCustomStatus)?this.setCustomStatuses():this.hasWindowCustomStatuses()||this.applyDefaultCommentStatuses()}catch(t){console.warn("Error in initCommentStatuses: ",t),zd("Error in initCommentStatuses: ",t)}},this.hasWindowCustomStatuses=()=>{try{const t=null===window||void 0===window?void 0:window.SUPERFLOW_CUSTOM_STATUSES;return!!t&&"object"==typeof t}catch{return!1}},this.applyDefaultCommentStatuses=()=>{var t;try{if("function"!=typeof(null===(t=this.commentElement)||void 0===t?void 0:t.setCustomStatus))return;this.commentElement.setCustomStatus(eu.map((t=>({...t}))))}catch(t){console.warn("Error in applyDefaultCommentStatuses: ",t),zd("Error in applyDefaultCommentStatuses: ",t)}},this.applyCheckPriorities=()=>{var t;try{if(bt.includes(this.apiKey))return;if("function"!=typeof(null===(t=this.commentElement)||void 0===t?void 0:t.setCustomPriority))return;this.commentElement.setCustomPriority(Yh.map((t=>({...t}))))}catch(t){console.warn("Error in applyCheckPriorities: ",t),zd("Error in applyCheckPriorities: ",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),zd("Error in sortCustomStatuses: ",e),t}},this.getSamlConfig=async()=>{try{const t=await ih(this.apiKey);return(t=>{try{if(t){const e=JSON.stringify(t);od($e,e,!0)}}catch(t){console.warn("Error in setSamlConfigToStorage: ",t),zd("Error in setSamlConfigToStorage: ",t)}})(t),t}catch(t){console.warn("Error in getSamlConfig: ",t),zd("Error in getSamlConfig: ",t);const e=(()=>{try{const t=rd($e,!0);return t?JSON.parse(t):null}catch(t){return console.warn("Error in getSamlConfigFromStorage: ",t),zd("Error in getSamlConfigFromStorage: ",t),null}})();if(e)return e}},this.setLogos=()=>{var t,e,i,n,o,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===(o=null===(n=null==Ye?void 0:Pe)||void 0===n?void 0:n.customBranding)||void 0===o?void 0:o.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==Ye?void 0:Pe)||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),zd("Error in setLogos: ",t)}},this.getAlertIcon=()=>L`
|
|
6493
|
+
`}catch(t){return console.warn("Error in render: ",t),L``}}};Au.styles=[Ah,Mu],fu([nt({type:Array})],Au.prototype,"agentGroups",void 0),fu([nt({type:String})],Au.prototype,"currentPageUrl",void 0),fu([nt({type:String,reflect:!0})],Au.prototype,"theme",void 0),fu([nt({type:Array})],Au.prototype,"agentRunStatuses",void 0),fu([nt({type:Boolean})],Au.prototype,"loading",void 0),fu([nt({type:Array})],Au.prototype,"unsyncedAnnotationIds",void 0),fu([nt({type:Number})],Au.prototype,"lockedIssueCount",void 0),fu([nt({type:String})],Au.prototype,"lockedIssuesUpgradeUrl",void 0),fu([ot()],Au.prototype,"expandedFindingIds",void 0),fu([ot()],Au.prototype,"openAccordions",void 0),fu([ot()],Au.prototype,"currentView",void 0),fu([ot()],Au.prototype,"selectedAgentId",void 0),fu([ot()],Au.prototype,"selectedFindingGroup",void 0),Au=fu([et("content-warning-sidebar")],Au);function Tu(){try{return"undefined"!=typeof localStorage&&"true"===localStorage.getItem("sfScreenShotDebug")}catch{return!1}}function $u(t){return new Promise((e=>{let i=Math.max(1,t);const n=()=>{i-=1,i<=0?e():requestAnimationFrame(n)};requestAnimationFrame(n)}))}function Iu(t,e,i=600){const n=t.requestVideoFrameCallback;return"function"!=typeof n?$u(e+2):new Promise((o=>{let r=Math.max(1,e),s=!1;const a=()=>{s||(s=!0,clearTimeout(l),o())},l=setTimeout(a,Math.max(0,i)),c=()=>{s||(r-=1,r<=0?a():n.call(t,c))};n.call(t,c)}))}function _u(t,e,i,n,o){const r=Math.max(0,Math.round(e)),s=Math.max(0,Math.round(i)),a=Math.max(1,Math.min(Math.round(n),t.width-r)),l=Math.max(1,Math.min(Math.round(o),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 Nu(t,e){const i=Math.max(t.width,t.height);if(i<=e)return{canvas:t,ratio:1};const n=e/i,o=Math.max(1,Math.round(t.width*n)),r=Math.max(1,Math.round(t.height*n)),s=document.createElement("canvas");s.width=o,s.height=r;const a=s.getContext("2d");return a?(a.imageSmoothingEnabled=!0,a.imageSmoothingQuality="high",a.drawImage(t,0,0,o,r),{canvas:s,ratio:n}):{canvas:t,ratio:1}}function Ou(t,e,i){return new Promise((n=>{t.toBlob((t=>n(t)),e,i)}))}async function Lu(t,e=.9){const i=await Ou(t,"image/webp",e);if(i&&"image/webp"===i.type)return{blob:i,type:i.type};const n=await Ou(t,"image/png");if(n)return{blob:n,type:"image/png"};throw new Error("canvas-encode-failed")}const Ru=["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"],Du=["snippyly-text-highlight","snippyly-comment-text-portal","snippyly-comment-text","velt-comment-text-portal","velt-comment-text"],Fu="sf-capture-hide-widgets",Pu="data-sf-capture-keep";let Vu=null,ju=null,Uu=[],Bu=new WeakSet,zu=null;function Hu(...t){Tu()&&"undefined"!=typeof console&&console.log("[sf-capture][exclude]",...t)}const qu=new Set(Ru.map((t=>t.toLowerCase())));function Gu(t){return t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}function Wu(t){const e=Gu(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 Zu(t){if(!t)return!1;const e=Gu(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 Ku(t){const e=Array.from(document.querySelectorAll(Wu(t)));for(const t of e){(i=t).setAttribute(Pu,""),i.querySelectorAll("*").forEach((t=>t.setAttribute(Pu,"")));let e=t.parentElement;for(;e;)e.setAttribute(Pu,""),e=e.parentElement}var i;return e}function Yu(t,e){if(!Tu()||!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)]},n=document.getElementById(Fu),o=document.querySelector(Wu(t));if(Hu(`[${e}] hideStyle=${!!n} keptHost=${!!o}`+(o?` keep=${o.hasAttribute(Pu)} display=${getComputedStyle(o).display}`:"")),o){Hu(`[${e}] kept host subtree:`,Array.from(o.querySelectorAll("*")).map((t=>{const e=t.shadowRoot;return{tag:t.tagName.toLowerCase(),keep:t.hasAttribute(Pu),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(Pu),display:getComputedStyle(t).display,rect:i(t)}))).filter((t=>"none"!==t.display));Hu(`[${e}] visible <velt-shadow-dom-internal>: ${r.length}`,r);const s=Gu(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 n=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 n=e.parentElement;return n?n.tagName.toLowerCase():"(detached)"},o=Array.from(document.querySelectorAll(".line")),r=Array.from(document.querySelectorAll(a));Hu(`[${e}] AREA focus: portal kept=${l.hasAttribute(Pu)} display=${getComputedStyle(l).display} rect=${JSON.stringify(i(l))} innerLines=${l.querySelectorAll(".line").length} innerPins=${l.querySelectorAll(a).length}`),Hu(`[${e}] AREA .line owners (total ${o.length}):`,Array.from(new Set(o.map(n)))),Hu(`[${e}] AREA <comment-pin> owners (total ${r.length}):`,r.map((t=>({owner:n(t),keep:t.hasAttribute(Pu),display:getComputedStyle(t).display,painted:t.getClientRects().length>0}))))}}function Ju(){document.querySelectorAll('[style*="cursor"]').forEach((t=>{const e=t.style.getPropertyValue("cursor");if(!e)return;if(Bu.has(t))return void("none"!==e&&t.style.setProperty("cursor","none","important"));if("none"===e)return;const i=t.style.getPropertyPriority("cursor");Uu.push({el:t,value:e,priority:i,isPin:e.includes("url(")&&"important"===i}),Bu.add(t),t.style.setProperty("cursor","none","important")})),Hu(`neutralized inline cursor(s): tracked=${Uu.length}`)}function Qu(t){Xu();let e=!1;if(t){const n=Ku(t);e=n.length>0,function(t,e){if(Tu()){Hu("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));Hu(`candidates <${t}>: ${e.length}`,e.map((t=>({id:t.getAttribute("id"),"data-velt-id":t.getAttribute("data-velt-id")}))))}Hu(`matched kept host(s): ${e.length}`),e.forEach(((t,e)=>{const i=[t.tagName.toLowerCase()];let n=t.parentElement;for(;n;){const t=n.tagName.toLowerCase();i.push(qu.has(t)?`${t}(EXCLUDED-ANCESTOR)`:t),n=n.parentElement}Hu(` match[${e}] chain (self -> root):`,i.join(" > "))})),0===e.length&&Hu("No host matched the annotationId — the marker will be hidden. Compare the annotationId above against the candidate id / data-velt-id values.")}}(t,n),e&&(i=t)&&"undefined"!=typeof MutationObserver&&(ju=i,Vu=new MutationObserver((()=>{ju&&Ku(ju)})),Vu.observe(document.documentElement,{childList:!0,subtree:!0}))}var i;const n=t=>e?`${t}:not([${Pu}])`:t,o=`${Ru.map(n).join(",\n")} { display: none !important; }`,r=`${Du.map(n).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=Fu,s.textContent=`${o}\n${r}\n* { cursor: none !important; }`,document.head.appendChild(s),Ju(),"undefined"!=typeof MutationObserver&&(zu=new MutationObserver((()=>Ju())),zu.observe(document.documentElement,{attributes:!0,subtree:!0,attributeFilter:["style"]})),Hu(`injected hide stylesheet (keptAny=${e}, hide=${Ru.length}, neutralize=${Du.length})`)}function Xu(){var t;null===(t=document.getElementById(Fu))||void 0===t||t.remove(),zu&&(zu.disconnect(),zu=null),Uu.forEach((({el:t,value:e,priority:i,isPin:n})=>{n?t.style.removeProperty("cursor"):t.style.setProperty("cursor",e,i)})),Uu=[],Bu=new WeakSet,Vu&&(Vu.disconnect(),Vu=null),ju=null,document.querySelectorAll(`[${Pu}]`).forEach((t=>t.removeAttribute(Pu)))}function tp(){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 ep(){return!("undefined"==typeof navigator||!navigator.mediaDevices||"function"!=typeof navigator.mediaDevices.getDisplayMedia)&&(tp()||function(){const t=navigator.userAgent;return/Safari/.test(t)&&/Apple/.test(navigator.vendor||"")&&!/Chrome|Chromium|CriOS|Edg\/|FxiOS|Android/.test(t)}())}class ip{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 tp()?"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 n;try{n=await navigator.mediaDevices.getDisplayMedia(i)}catch(t){throw t&&"object"==typeof t&&(t.sfNativeExpected=!0),t}let o=null;try{const i=n.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())),o=document.createElement("video"),o.srcObject=n,o.muted=!0,o.setAttribute("playsinline",""),o.style.cssText="position:fixed;left:-99999px;top:0;width:1px;height:1px;opacity:0;pointer-events:none;",document.body.appendChild(o),await o.play(),"ended"===i.readyState)throw new Error("native-share-ended-during-init");this.stream=n,this.video=o}catch(t){throw n.getTracks().forEach((t=>t.stop())),o&&(o.srcObject=null,o.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;Tu()&&"undefined"!=typeof console&&console.log("[sf-capture][native] capture(): focusAnnotationId =",JSON.stringify(e));const i=performance.now(),n=this.video;return"tab-region"===this.getCapability()?this.captureTabRegion(n,i,e):this.captureScreenCrop(n,i,e)}async captureTabRegion(t,e,i){if("browser"!==this.surface)throw new Error("not-sharing-this-tab");const{canvas:n,page:o,frameW:r,frameH:s}=await this.grabFullFrame(t,i);let a=n;const l=o.viewportW*o.dpr;if(l>0&&r>1.5*l)throw new Error("frame-larger-than-viewport");const c=r/o.viewportW,d=Math.min(r,Math.round(o.viewportW*c)),h=Math.round(o.viewportH*c),u=a.height>h+2||a.width>d+2;u&&(a=_u(a,0,0,d,h)),this.lastDebug={capability:"tab-region",surface:this.surface,cropApplied:!!this.cropEl,frameW:r,frameH:s,viewportW:o.viewportW,viewportH:o.viewportH,dpr:o.dpr,cssToFrame:c,croppedW:a.width,croppedH:a.height,clampedHeight:u},this.logDebug();const p=Nu(a,2560);a=p.canvas;const{blob:v,type:g}=await Lu(a,.9),f=performance.now()-e;return{blob:v,width:a.width,height:a.height,mode:this.name,durationMs:f,page:o,scope:"viewport",blobType:g,markerMapping:{scaleX:c*p.ratio,scaleY:c*p.ratio,originXCss:o.scrollX,originYCss:o.scrollY}}}async captureScreenCrop(t,e,i){const{canvas:n,page:o,frameW:r,frameH:s}=await this.grabFullFrame(t,i),a=this.computeScreenCrop(r,s);let l=_u(n,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:o.viewportW,viewportH:o.viewportH,dpr:o.dpr,cssToFrame:c,croppedW:l.width,croppedH:l.height,clampedHeight:!0,screenCrop:a},this.logDebug();const d=Nu(l,2560);l=d.canvas;const{blob:h,type:u}=await Lu(l,.9),p=performance.now()-e;return{blob:h,width:l.width,height:l.height,mode:this.name,durationMs:p,page:o,scope:"viewport",blobType:u,markerMapping:{scaleX:c*d.ratio,scaleY:c*d.ratio,originXCss:o.scrollX,originYCss:o.scrollY}}}computeScreenCrop(t,e){const i=window.innerWidth,n=window.innerHeight,o=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+o-l;let u=Math.round(d*c),p=Math.round(h*c),v=Math.round(i*c),g=Math.round(n*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:o,surfaceWidthCss:s}}async grabFullFrame(t,e){e&&await function(t,e=1200){return!t||Zu(t)?Promise.resolve(!!t&&Zu(t)):new Promise((i=>{let n=!1;const o=e=>{n||(n=!0,clearTimeout(s),r.disconnect(),Hu(`waitForAnnotationHost(${JSON.stringify(t)}) -> ${e?"found":"timeout"}`),i(e))},r=new MutationObserver((()=>{Zu(t)&&o(!0)}));r.observe(document.documentElement,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["id","data-velt-id"]});const s=setTimeout((()=>o(!1)),Math.max(0,e))}))}(e),Qu(e),Yu(e,"post-hide");try{await $u(2),await Iu(t,3),await Iu(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}}(),n=t.videoWidth,o=t.videoHeight;if(!n||!o)throw new Error("capture-no-frame");const r=document.createElement("canvas");r.width=n,r.height=o;const s=r.getContext("2d");if(!s)throw new Error("canvas-2d-unavailable");return Yu(e,"pre-draw"),s.drawImage(t,0,0),{canvas:r,page:i,frameW:n,frameH:o}}finally{Xu()}}logDebug(){Tu()&&"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 n=await e.fromElement(t);await i.cropTo(n)}catch{this.removeCropEl()}}removeCropEl(){var t;null===(t=this.cropEl)||void 0===t||t.remove(),this.cropEl=null}}const np="6.0.44",op="superflow-agents",rp="sidebar-id",sp="scope",ap="group-config",lp="force-close";function cp(t){const e=t=>null==t?void 0:t.map((t=>({path:t.path,values:[...t.values]}))),i={};return t.include&&(i.include=e(t.include)),t.exclude&&(i.exclude=e(t.exclude)),i}const dp={exclude:[{path:"sourceType",values:["agent"]}]},hp={include:[{path:"sourceType",values:["agent"]}],exclude:[{path:"suggestion.status",values:["rejected"]}]};function up(t,e){const i=function(t,e){let i=t;for(const t of e.split(".")){if(null==i)return;i=i[t]}return i}(t,e.path);if(null==i)return!1;return(Array.isArray(i)?i:[i]).some((t=>null!=t&&e.values.includes(t)))}function pp(t){return function(t,e){var i,n;try{if(!t||"object"!=typeof t)return!1;const o=null!==(i=null==e?void 0:e.include)&&void 0!==i?i:[],r=null!==(n=null==e?void 0:e.exclude)&&void 0!==n?n:[];return o.every((e=>up(t,e)))&&!r.some((e=>up(t,e)))}catch(t){return console.warn("Error in isInSidebarScope: ",t),!1}}(t,hp)}function vp(t){const e=/^v?(\d+)\.(\d+)\.(\d+)(-[0-9A-Za-z.-]+)?(\+[0-9A-Za-z.-]+)?$/.exec(t.trim());return e?{parts:[Number(e[1]),Number(e[2]),Number(e[3])],prerelease:Boolean(e[4])}:null}function gp(t){try{if(!t||!0!==t.sidebarV2||t.onboardingMode||t.agentStatusMode)return!1;const e=void 0===t.minVersion?np:t.minVersion;return function(t,e=np){try{if("string"!=typeof t||"string"!=typeof e)return!1;const i=vp(t),n=vp(e);if(!i||!n)return!1;for(let t=0;t<3;t++)if(i.parts[t]!==n.parts[t])return i.parts[t]>n.parts[t];return!i.prerelease||n.prerelease}catch(t){return console.warn("Error in isScopedSidebarSdkVersion: ",t),!1}}(t.veltVersion,e)}catch(t){return console.warn("Error in isAgentsSidebarModeAchievable: ",t),!1}}const fp="commentClick",mp="commentNavigationButtonClick",wp="sidebarClose";const yp=t=>null===t||"object"!=typeof t||Array.isArray(t)?null:t,bp=t=>"string"==typeof t?t.trim():"",Cp=t=>{try{const e=yp(t),i=yp(null==e?void 0:e.agent);if(i)return i;const n=null==e?void 0:e.comments,o=Array.isArray(n)?yp(n[0]):null;return yp(null==o?void 0:o.agent)}catch{return null}},xp=Object.freeze(["superflow agent"]),Ep=t=>{const e=bp(t);return e&&!xp.includes(e.toLowerCase())?e:""},kp=t=>{var e;try{return Ep(null===(e=Cp(t))||void 0===e?void 0:e.displayName).slice(0,80)}catch{return""}},Sp=t=>{var e;const i=null===(e=yp(t))||void 0===e?void 0:e.createdAt;return"number"==typeof i&&Number.isFinite(i)?i:0},Mp=(t,e)=>{try{return Ep(t)||(t=>{let e="",i=-1/0;for(const n of Array.isArray(t)?t:[]){const t=kp(n);if(!t)continue;const o=Sp(n);(!e||o>i)&&(e=t,i=o)}return e})(e)}catch{return""}},Ap=t=>Cp(t)?"square":"round",Tp="agent",$p=Object.freeze({link:{viewBox:"0 0 18 18",strokeWidth:1.5,paths:["M6.75 11.25L11.25 6.75M8.25 4.50005L8.59725 4.09805C9.3006 3.39479 10.2545 2.99975 11.2491 2.99982C12.2438 2.99989 13.1976 3.39507 13.9009 4.09842C14.6041 4.80178 14.9992 5.75569 14.9991 6.75031C14.999 7.74493 14.6039 8.69879 13.9005 9.40205L13.5 9.75005M9.75011 13.5L9.45236 13.9005C8.74079 14.6041 7.78045 14.9988 6.77973 14.9988C5.77902 14.9988 4.81867 14.6041 4.10711 13.9005C3.75637 13.5537 3.47793 13.1408 3.28789 12.6856C3.09785 12.2304 3 11.7421 3 11.2489C3 10.7556 3.09785 10.2673 3.28789 9.81214C3.47793 9.35698 3.75637 8.94405 4.10711 8.59725L4.50011 8.25"]},spell:{viewBox:"0 0 18 18",strokeWidth:1.5,paths:["M10.5 4.5L15.75 9.75L12.75 12.75M3 14.9999L4.326 13.674M4.37072 13.6291C4.56768 13.8261 4.80153 13.9824 5.0589 14.089C5.31627 14.1956 5.59213 14.2505 5.87072 14.2505C6.14931 14.2505 6.42517 14.1956 6.68254 14.089C6.93991 13.9824 7.17376 13.8261 7.37072 13.6291L15.3102 5.68955C15.4496 5.55026 15.5601 5.38487 15.6355 5.20285C15.711 5.02082 15.7498 4.82571 15.7498 4.62868C15.7498 4.43165 15.711 4.23654 15.6355 4.05451C15.5601 3.87249 15.4496 3.7071 15.3102 3.5678L14.432 2.68955C14.2927 2.5502 14.1273 2.43966 13.9453 2.36424C13.7632 2.28882 13.5681 2.25 13.3711 2.25C13.1741 2.25 12.979 2.28882 12.7969 2.36424C12.6149 2.43966 12.4495 2.5502 12.3102 2.68955L4.37072 10.6291C4.1737 10.826 4.01741 11.0599 3.91078 11.3172C3.80415 11.5746 3.74927 11.8505 3.74927 12.1291C3.74927 12.4076 3.80415 12.6835 3.91078 12.9409C4.01741 13.1982 4.1737 13.4321 4.37072 13.6291Z"]},mobile:{viewBox:"0 0 18 18",strokeWidth:1.5,paths:["M8.25 3H9.75M9 12.75V12.7575M4.5 3.75C4.5 3.35218 4.65804 2.97064 4.93934 2.68934C5.22064 2.40804 5.60218 2.25 6 2.25H12C12.3978 2.25 12.7794 2.40804 13.0607 2.68934C13.342 2.97064 13.5 3.35218 13.5 3.75V14.25C13.5 14.6478 13.342 15.0294 13.0607 15.3107C12.7794 15.592 12.3978 15.75 12 15.75H6C5.60218 15.75 5.22064 15.592 4.93934 15.3107C4.65804 15.0294 4.5 14.6478 4.5 14.25V3.75Z"]},image:{viewBox:"0 0 24 24",strokeWidth:2,paths:["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"]},consistency:{viewBox:"0 0 20 20",strokeWidth:1.66667,paths:["M12.5 3.33333H13.3333C13.5544 3.33333 13.7663 3.42113 13.9226 3.57741C14.0789 3.73369 14.1667 3.94565 14.1667 4.16667V7.08333M16.6667 5C16.8867 5.09333 17.1 5.18083 17.3067 5.2625C17.5101 5.34882 17.6709 5.51241 17.7537 5.71729C17.8366 5.92217 17.8346 6.15155 17.7483 6.355L15.8333 10.8333M3.00335 5.99751L8.95168 3.40668C9.04984 3.36461 9.15542 3.34261 9.26221 3.34199C9.369 3.34137 9.47483 3.36214 9.57346 3.40307C9.6721 3.444 9.76154 3.50426 9.83652 3.58031C9.91149 3.65635 9.97049 3.74664 10.01 3.84584L14.1134 13.7642C14.1986 13.9653 14.2015 14.1919 14.1214 14.3951C14.0413 14.5984 13.8846 14.762 13.685 14.8508L7.73752 17.4417C7.63932 17.4839 7.53366 17.506 7.42678 17.5067C7.3199 17.5073 7.21396 17.4866 7.11523 17.4457C7.0165 17.4047 6.92697 17.3444 6.85193 17.2683C6.7769 17.1922 6.71787 17.1018 6.67835 17.0025L2.57502 7.08334C2.48973 6.88222 2.48683 6.65565 2.56694 6.45241C2.64705 6.24917 2.80377 6.08634 3.00335 5.99751Z"]},"ai-visibility":{viewBox:"0 0 24 24",strokeWidth:2,paths:["M16 18C16.5304 18 17.0391 18.2107 17.4142 18.5858C17.7893 18.9609 18 19.4696 18 20C18 19.4696 18.2107 18.9609 18.5858 18.5858C18.9609 18.2107 19.4696 18 20 18C19.4696 18 18.9609 17.7893 18.5858 17.4142C18.2107 17.0391 18 16.5304 18 16C18 16.5304 17.7893 17.0391 17.4142 17.4142C17.0391 17.7893 16.5304 18 16 18ZM16 6C16.5304 6 17.0391 6.21071 17.4142 6.58579C17.7893 6.96086 18 7.46957 18 8C18 7.46957 18.2107 6.96086 18.5858 6.58579C18.9609 6.21071 19.4696 6 20 6C19.4696 6 18.9609 5.78929 18.5858 5.41421C18.2107 5.03914 18 4.53043 18 4C18 4.53043 17.7893 5.03914 17.4142 5.41421C17.0391 5.78929 16.5304 6 16 6ZM9 18C9 16.4087 9.63214 14.8826 10.7574 13.7574C11.8826 12.6321 13.4087 12 15 12C13.4087 12 11.8826 11.3679 10.7574 10.2426C9.63214 9.11742 9 7.5913 9 6C9 7.5913 8.36786 9.11742 7.24264 10.2426C6.11742 11.3679 4.5913 12 3 12C4.5913 12 6.11742 12.6321 7.24264 13.7574C8.36786 14.8826 9 16.4087 9 18Z"]},accessibility:{viewBox:"0 0 24 24",strokeWidth:2,paths:["M3 12a9 9 0 1 0 18 0a9 9 0 0 0 -18 0","M10 16.5l2 -3l2 3m-2 -3v-2l3 -1m-6 0l3 1","M12 7.5m-.5 0a.5 .5 0 1 0 1 0a.5 .5 0 1 0 -1 0"]},workspace:{viewBox:"0 0 18 18",strokeWidth:1.5,paths:["M2 1H6C6.26522 1 6.51957 1.10536 6.70711 1.29289C6.89464 1.48043 7 1.73478 7 2V8C7 8.26522 6.89464 8.51957 6.70711 8.70711C6.51957 8.89464 6.26522 9 6 9H2C1.73478 9 1.48043 8.89464 1.29289 8.70711C1.10536 8.51957 1 8.26522 1 8V2C1 1.73478 1.10536 1.48043 1.29289 1.29289C1.48043 1.10536 1.73478 1 2 1Z","M2 13H6C6.26522 13 6.51957 13.1054 6.70711 13.2929C6.89464 13.4804 7 13.7348 7 14V16C7 16.2652 6.89464 16.5196 6.70711 16.7071C6.51957 16.8946 6.26522 17 6 17H2C1.73478 17 1.48043 16.8946 1.29289 16.7071C1.10536 16.5196 1 16.2652 1 16V14C1 13.7348 1.10536 13.4804 1.29289 13.2929C1.48043 13.1054 1.73478 13 2 13Z","M12 9H16C16.2652 9 16.5196 9.10536 16.7071 9.29289C16.8946 9.48043 17 9.73478 17 10V16C17 16.2652 16.8946 16.5196 16.7071 16.7071C16.5196 16.8946 16.2652 17 16 17H12C11.7348 17 11.4804 16.8946 11.2929 16.7071C11.1054 16.5196 11 16.2652 11 16V10C11 9.73478 11.1054 9.48043 11.2929 9.29289C11.4804 9.10536 11.7348 9 12 9Z","M12 1H16C16.2652 1 16.5196 1.10536 16.7071 1.29289C16.8946 1.48043 17 1.73478 17 2V4C17 4.26522 16.8946 4.51957 16.7071 4.70711C16.5196 4.89464 16.2652 5 16 5H12C11.7348 5 11.4804 4.89464 11.2929 4.70711C11.1054 4.51957 11 4.26522 11 4V2C11 1.73478 11.1054 1.48043 11.2929 1.29289C11.4804 1.10536 11.7348 1 12 1Z"]},security:{viewBox:"0 0 24 24",strokeWidth:2,paths:["M12 3a12 12 0 0 0 8.5 3a12 12 0 0 1 -8.5 15a12 12 0 0 1 -8.5 -15a12 12 0 0 0 8.5 -3","M9 12l2 2l4 -4"]},uptime:{viewBox:"0 0 24 24",strokeWidth:2,paths:["M3 12h4l3 8l4 -16l3 8h4"]},forms:{viewBox:"0 0 24 24",strokeWidth:2,paths:["M9 5h-2a2 2 0 0 0 -2 2v12a2 2 0 0 0 2 2h10a2 2 0 0 0 2 -2v-12a2 2 0 0 0 -2 -2h-2","M9 5a2 2 0 0 1 2 -2h2a2 2 0 0 1 2 2a2 2 0 0 1 -2 2h-2a2 2 0 0 1 -2 -2","M9 12h.01M13 12h2M9 16h.01M13 16h2"]},lighthouse:{viewBox:"0 0 24 24",strokeWidth:2,paths:["M3 12a9 9 0 1 0 18 0a9 9 0 1 0 -18 0","M11 12a1 1 0 1 0 2 0a1 1 0 1 0 -2 0","M13.41 10.59l2.59 -2.59","M7 12a5 5 0 0 1 5 -5"]},lorem:{viewBox:"0 0 24 24",strokeWidth:2,paths:["M4 6h16M4 12h10M4 18h14"]},[Tp]:{viewBox:"0 0 16 16",strokeWidth:1.33333,paths:["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"]}});Object.freeze(Object.keys($p));const Ip=t=>{var e;try{const i=bp(null===(e=Cp(t))||void 0===e?void 0:e.icon).toLowerCase();return i&&Object.prototype.hasOwnProperty.call($p,i)?i:Tp}catch{return Tp}},_p=t=>`url("data:image/svg+xml,${encodeURIComponent((t=>{const e=Object.prototype.hasOwnProperty.call($p,t)?$p[t]:$p[Tp],i=e.paths.map((t=>`<path d="${t}"/>`)).join("");return`<svg xmlns="http://www.w3.org/2000/svg" viewBox="${e.viewBox}" fill="none" stroke="#FFFFFF" stroke-width="${e.strokeWidth}" stroke-linecap="round" stroke-linejoin="round">${i}</svg>`})(t))}")`,Np="data-sf-agent-pin",Op="comment-pin-container-",Lp=`[id^="${Op}"]`,Rp=Object.freeze(["snippyly-comment-pin-portal","velt-comment-pin-portal","snippyly-area-pin-portal","velt-area-pin-portal"]),Dp=Object.freeze({marker:".velt-comment-pin--marker",avatar:"snippyly-user-avatar",agentIcon:".velt-comment-pin--agent-icon"}),Fp=Object.freeze(Object.values(Dp)),Pp=Dp.marker,Vp=t=>"undefined"!=typeof CSS&&"function"==typeof CSS.escape?CSS.escape(t):t.replace(/[^a-zA-Z0-9_-]/g,(t=>`\\${t}`)),jp=(t,e=[""])=>{const i=e.length>0?e:[""],n=t=>i.map((e=>e?`${e} ${t}`:t)).join(",\n"),o=Pp;return[`${n(o)} { border-radius: 6px !important; background: var(--velt-agent-accent, #4495FF) !important; }`,`${n(`${o} ${Dp.avatar}`)},\n${n(`${o} ${Dp.agentIcon}`)},\n${n(`${o} > svg`)} { display: none !important; }`,`${n(`${o}::before`)} { content: ''; display: block; flex: none; width: 20px; height: 20px; background: ${_p(t)} center / contain no-repeat; }`].join("\n")},Up=(t,e=3,i=8)=>{const n=[],o=(t,r)=>{if(r>e)return;const s=t instanceof Element?[t]:[];t.querySelectorAll("*").forEach((t=>s.push(t)));for(const t of s){if(n.length>=i)return;const e=t.shadowRoot;e&&!n.includes(e)&&(n.push(e),o(e,r+1))}};try{t&&o(t,1)}catch{}return n},Bp=(t,e)=>{try{let i=t.querySelector(`style[${Np}]`);if(!e)return void(null==i||i.remove());i||(i=document.createElement("style"),i.setAttribute(Np,"true"),t.appendChild(i)),i.textContent!==e&&(i.textContent=e)}catch{}},zp=(t,e=document)=>{try{return t?Array.from(e.querySelectorAll(`#${Vp(`${Op}${t}`)}`)):[]}catch{return[]}},Hp=t=>{const e=t;return e&&1===e.nodeType&&"string"==typeof e.id&&e.id.startsWith(Op)?e.id.slice(22):""},qp=Object.freeze(["style","link","script","template"]),Gp=(t,e)=>{const i=e>1?`:scope ${"> * ".repeat(e-1)}*`:"*";for(const e of Array.from(t.querySelectorAll(i)))if(!qp.includes(e.localName))return!0;return!1},Wp=(t,e=Up(t))=>{try{if((t=>{try{return null!==t.querySelector(Pp)}catch{return!1}})(t))return"light";if(e.some((t=>null!==t.querySelector(Dp.marker))))return"shadow";return(e.length>0?e.some((t=>Gp(t,1))):Gp(t,2))?"unrecognised":"pending"}catch{return"pending"}},Zp=t=>{for(const e of Up(t))Bp(e,"")};var Kp=function(t,e,i,n){for(var o,r=arguments.length,s=r<3?e:null===n?n=Object.getOwnPropertyDescriptor(e,i):n,a=t.length-1;a>=0;a--)(o=t[a])&&(s=(r<3?o(s):r>3?o(e,i,s):o(e,i))||s);return r>3&&s&&Object.defineProperty(e,i,s),s};class Yp 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.agentStatusMode=!1,this.agentsSidebarRequested=!1,this.loadedVeltVersion=void 0,this.scopedSidebarsMinVeltVersion=np,this.agentsSidebarDeepLinkId=null,this.requestModeSwitch=!1,this.requestContextProviderElement=null,this.requestModeLoadedTracked=!1,this.requestToolbarExpanded=!1,this.requestMenuOpen=!1,this.requestMenuListenersAttached=!1,this.requestCommentModePending=null,this.commentsDisabledSetting="waiting",this.firstConfigCommentsDisabled=null,this.requestNotifyRetryTimer=(t,e)=>{window.setTimeout(t,e)},this.notifyAddedRequest=function(t){const e=new Set,i=(e,n)=>{try{if(!t.isActive())return;t.send(e).then((o=>{var r;"ok"!==o.kind?"error"!==o.kind||"not-found"!==o.code||"first"!==n?"error"===o.kind?t.warn(`${Od} refused (${o.code})`):t.warn(`${Od} could not reach the backend`):t.retryTimer((()=>i(e,"retry")),t.retryDelayMs):o.notified||t.warn(`${Od}: not sent (${null!==(r=o.reason)&&void 0!==r?r:"unknown"})`)})).catch((()=>{t.warn(`${Od} could not reach the backend`)}))}catch(t){console.warn("Error in request notifier attempt: ",t)}};return n=>{try{return!(!n||e.has(n)||!t.isActive()||(e.add(n),i(n,"first"),0))}catch(t){return console.warn("Error in request notifier: ",t),!1}}}({send:t=>hh({apiKey:this.apiKey,documentId:this.projectId||"",annotationId:t,user:Nd(this.snippylyUser)}),isActive:()=>this.isRequestMode()&&!!this.apiKey&&!!this.projectId,retryTimer:(t,e)=>this.requestNotifyRetryTimer(t,e),retryDelayMs:5e3,warn:t=>console.warn(t)}),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=Je,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.agentsSidebarModeLatched=null,this.latchAgentsSidebarMode=()=>{try{null===this.agentsSidebarModeLatched&&(this.agentsSidebarModeLatched=this.resolveAgentsSidebarMode())}catch(t){console.warn("Error in latchAgentsSidebarMode: ",t),this.agentsSidebarModeLatched=!1}},this.resolveAgentsSidebarMode=()=>function(t){try{return!(!t||!0!==t.requested)&&gp(t)}catch(t){return console.warn("Error in isAgentsSidebarModeEnabled: ",t),!1}}({requested:this.agentsSidebarRequested,veltVersion:this.loadedVeltVersion,sidebarV2:this.sidebarV2Enabled,onboardingMode:this.onboardingMode,agentStatusMode:this.agentStatusMode,minVersion:this.scopedSidebarsMinVeltVersion}),this.veltProxyToggleVisible=!1,this.nativeScreenshotEnabled=!1,this.nativeScreenshotDenied=!1,this.capturingScreenshot=!1,this.nativeCapture=new ip,this.screenshotChain=Promise.resolve(),this.pendingScreenshotCount=0,this.nativeScreenshotEnabling=!1,this.addCommentAnnotationSubscribedEl=void 0,this.isSettingSidebarData=!1,this.agentGroups=[],this.lockedAgentIssueCount=0,this.agentCommentLockIdsKey=null,this.agentCommentLockReadAt=0,this.agentCommentLockTimer=null,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.agentPinTargets=new Map,this.agentPinLightDomIds=new Set,this.agentPinPageCss="",this.agentPinDecoratedContainers=new WeakSet,this.agentPinPendingContainers=new Set,this.agentPinDomObserver=null,this.agentPinFrameCancel=null,this.agentPinUnrecognisedContainers=new Set,this.agentPinMarkupRecheckTimer=null,this.agentPinMarkupReported=!1,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),zd("Error in onApiKeyChange: ",t)}},this.checkCustomLoginEnabled=async()=>{var t;try{const e=await eh(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),zd("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!!fd(t)||qt.some((({hostSuffix:t,pathPrefix:n})=>(e===t||e.endsWith(`.${t}`))&&i.startsWith(n)))}catch(t){return console.warn("Error in isRunningUnderPreviewProxy: ",t),!1}},this.isRunningUnderLivePreview=(t=document.location)=>{try{return fd(t)}catch(t){return console.warn("Error in isRunningUnderLivePreview: ",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.identityCameFromToken=!1,this.identityLiveSignIn=null,this.isLiveShareGuest=()=>{var t,e,i;try{const n=null===(t=this.identityLiveSignIn)||void 0===t?void 0:t.user;return!!(null===(e=this.snippylyUser)||void 0===e?void 0:e.isGuest)&&!!(null==n?void 0:n.isGuest)&&n.userId===(null===(i=this.snippylyUser)||void 0===i?void 0:i.userId)}catch(t){return console.warn("Error in isLiveShareGuest: ",t),!1}},this.liveSignInExpiryHandled=!1,this.fallBackToGuestIfLiveSignInExpired=(t,e=Date.now())=>{var i;try{return!(!t||(null===(i=t.user)||void 0===i?void 0:i.isGuest)||t.expiresAt>e+ie)&&(this.liveSignInExpiryHandled||(this.liveSignInExpiryHandled=!0,console.warn("[CWS Toolbar] The live preview sign-in has expired. Continuing as a guest."),this.signInError=!1,setTimeout((()=>this.identifySnippyly()),0)),!0)}catch(t){return console.warn("Error in fallBackToGuestIfLiveSignInExpired: ",t),!1}},this.readLiveSignIn=()=>{try{return this.isRunningUnderLivePreview()?wd():null}catch(t){return console.warn("Error in readLiveSignIn: ",t),null}},this.credentialFor=(t,e)=>{try{return(({cameFromToken:t,user:e,loc:i=window.location,onLivePreview:n,liveSignIn:o})=>{try{if(null!=n?n:fd(i)){const t=void 0===o?wd({loc:i}):o;return!t||!e||e.isGuest||e.isAnonymous||e.userId!==t.user.userId?null:t.token}return!t||!(null==e?void 0:e.userId)||e.isGuest||e.isAnonymous?null:yd({userId:e.userId})}catch(t){return console.warn("Error in credentialForTokenMint: ",t),null}})({cameFromToken:e,user:t,onLivePreview:this.isRunningUnderLivePreview(),liveSignIn:this.readLiveSignIn()})}catch(t){return console.warn("Error in credentialFor: ",t),null}},this.suggestionCredential=()=>{try{return this.credentialFor(this.snippylyUser,this.identityCameFromToken)}catch(t){return console.warn("Error in suggestionCredential: ",t),null}},this.suggestionGuardInstalled=!1,this.suggestionHideStyleObserver=null,this.suggestionHideSweepScheduled=!1,this.suggestionViewerRoleResolved=!1,this.suggestionHideStylesApplied=!1,this.suggestionRoleLookupFailed=!1,this.isSuggestionActionsHiddenForViewer=()=>{try{return this.suggestionRoleLookupFailed||"Admin"!==this.snippylyUserRole}catch(t){return console.warn("Error in isSuggestionActionsHiddenForViewer: ",t),!1}},this.shouldHideSuggestionActionsOnPage=()=>{try{return this.suggestionViewerRoleResolved&&!!window.Velt&&this.isSuggestionActionsHiddenForViewer()}catch(t){return console.warn("Error in shouldHideSuggestionActionsOnPage: ",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.setupSuggestionActionGuard=()=>{try{if(this.suggestionGuardInstalled)return;this.suggestionGuardInstalled=!0,document.addEventListener("click",(t=>{try{if(!this.isSuggestionActionsHiddenForViewer())return;const e="function"==typeof t.composedPath?t.composedPath():[];this.isSuggestionActionEventPath(e)&&(t.stopImmediatePropagation(),t.preventDefault(),console.warn("[CWS Toolbar] Only workspace members can accept or reject suggestions. Click ignored."))}catch(t){console.warn("Error in suggestion-action click guard: ",t)}}),{capture:!0})}catch(t){console.warn("Error in setupSuggestionActionGuard: ",t),zd("Error in setupSuggestionActionGuard: ",t)}},this.applySuggestionActionStyles=()=>{try{if(!this.shouldHideSuggestionActionsOnPage())return void this.removeSuggestionActionStyles();this.suggestionHideStylesApplied=!0,this.sweepSuggestionActionStyles(),this.suggestionHideStyleObserver||(this.suggestionHideStyleObserver=new MutationObserver((()=>{try{if(this.suggestionHideSweepScheduled)return;this.suggestionHideSweepScheduled=!0,requestAnimationFrame((()=>{this.suggestionHideSweepScheduled=!1,this.shouldHideSuggestionActionsOnPage()&&this.sweepSuggestionActionStyles()}))}catch(t){console.warn("Error in suggestion-action style observer: ",t)}})),this.suggestionHideStyleObserver.observe(document.body,{childList:!0,subtree:!0}))}catch(t){console.warn("Error in applySuggestionActionStyles: ",t),zd("Error in applySuggestionActionStyles: ",t)}},this.sweepSuggestionActionStyles=()=>{try{this.injectSuggestionActionStyle(document.head);const t=e=>{e.querySelectorAll("*").forEach((e=>{var i,n;const o=(null===(n=null===(i=e.tagName)||void 0===i?void 0:i.toLowerCase)||void 0===n?void 0:n.call(i))||"";if(!o.startsWith("velt-")&&!o.startsWith("snippyly-"))return;const r=e.shadowRoot;r&&(this.injectSuggestionActionStyle(r),t(r))}))};t(document.body)}catch(t){console.warn("Error in sweepSuggestionActionStyles: ",t)}},this.injectSuggestionActionStyle=t=>{try{if(t.querySelector(`style[${Yp.SUGGESTION_ACTIONS_HIDDEN_STYLE_ATTR}]`))return;const e=document.createElement("style");e.setAttribute(Yp.SUGGESTION_ACTIONS_HIDDEN_STYLE_ATTR,"true"),e.textContent=Yp.SUGGESTION_ACTIONS_HIDDEN_CSS,t.appendChild(e)}catch(t){console.warn("Error in injectSuggestionActionStyle: ",t)}},this.removeSuggestionActionStyles=()=>{try{if(!this.suggestionHideStylesApplied)return;this.suggestionHideStylesApplied=!1,this.suggestionHideStyleObserver&&(this.suggestionHideStyleObserver.disconnect(),this.suggestionHideStyleObserver=null);const t=`style[${Yp.SUGGESTION_ACTIONS_HIDDEN_STYLE_ATTR}]`;document.querySelectorAll(t).forEach((t=>t.remove()));const e=i=>{i.querySelectorAll("*").forEach((i=>{const n=i.shadowRoot;n&&(n.querySelectorAll(t).forEach((t=>t.remove())),e(n))}))};e(document.body)}catch(t){console.warn("Error in removeSuggestionActionStyles: ",t)}},this.isDriveOrPreviewHost=(t=document.location)=>{try{const e=(null==t?void 0:t.hostname)||"",i=(null==t?void 0:t.pathname)||"";return Ie.some((({hostSuffix:t,pathPrefix:n})=>(e===t||e.endsWith(`.${t}`))&&i.startsWith(n)))||this.isRunningUnderPreviewProxy(t)}catch(t){return console.warn("Error in isDriveOrPreviewHost: ",t),!1}},this.loginWithCustomUser=()=>{try{this.customLoginEnabled?(sd(te),bd(),this.loadPlugin&&this.documentId&&this.identifySnippyly()):console.warn("Identify call not allowed.")}catch(t){console.warn("Error in loginWithCustomUser: ",t),zd("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),zd("Error in addWindowClickEventListener: ",t)}},this.removeWindowClickEventListener=()=>{try{window.removeEventListener("click",this.windowClickEventListener),this.windowClickEventListener=void 0}catch(t){console.warn("Error in removeWindowClickEventListener: ",t),zd("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),zd("Error in setWindowEventListner: ",t)}},this.removeWindowLocationChangeListener=()=>{try{window.removeEventListener("locationchange",this.onWindowLocationChange),this.locationChangeListenerAttached=!1}catch(t){console.warn("Error in removeWindowLocationChangeListener: ",t),zd("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),zd("Error in urlChangeListener: ",t)}},this.checkUrl=()=>{try{this.setInviteUrl();const t=new URL(document.location),e=t.searchParams;e.has(Jt)&&(od(St,"true",!1),this.agentsSidebarDeepLinkId=e.get(Jt)||null);let i=!1;for(const t of[At,Tt,$t,It,Nt,Ot,Lt]){if(!e.has(t))continue;const n=!(t===Nt||t===Ot)||this.isFramedByPortal();"true"===e.get(t)&&n?od(t,"true",!1,"sessionStorage"):t===Lt&&"false"===e.get(t)?od(t,"false",!1,"sessionStorage"):sd(t,"sessionStorage"),e.delete(t),i=!0}this.embedMode="true"===rd(At,!1,"sessionStorage"),this.readOnlyMode="true"===rd($t,!1,"sessionStorage"),this.autoCommentModeRequested=!this.readOnlyMode&&"true"===rd(Tt,!1,"sessionStorage"),this.agentCommentsModeRequested="true"===rd(It,!1,"sessionStorage"),this.onboardingMode="true"===rd(Nt,!1,"sessionStorage")&&this.canHonourStoredOnboardingFlag(),this.agentStatusMode="true"===rd(Ot,!1,"sessionStorage")&&this.canHonourStoredOnboardingFlag(),this.agentsSidebarRequested=function(t){try{const i="true"===(e=null==t?void 0:t.sessionFlag)||"false"!==e&&null;return null===i||i}catch(t){return console.warn("Error in resolveAgentsSidebarRequested: ",t),!1}var e}({sessionFlag:rd(Lt,!1,"sessionStorage")}),this.autoOpenOnboardingSidebar();const n=e.get(_t);n&&(od(_t,n,!1,"sessionStorage"),e.delete(_t),i=!0);const o=this.previewLocationPath;if(this.previewLocationPath=this.isRunningUnderLivePreview()?window.location.pathname||"/":rd(_t,!1,"sessionStorage")||"",this.isRunningUnderLivePreview()&&o&&o!==this.previewLocationPath&&this.setPreviewLocationFromPath(),this.pageCommentsHidden="true"===rd(Kt,!1,"sessionStorage"),i&&window.history.replaceState({},document.title,t.href),(null==e?void 0:e.has(le))&&!rd(le)?this.showOnboardingModal=!0:this.showOnboardingModal=!1,null==e?void 0:e.has(ce))if(rd(ce,!1,"sessionStorage")){this.showLiveDemoModal=!1;const t=new URL(document.location);t.searchParams.delete(ce),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(de))if(rd(de,!1)){this.showFigmaDemoModal=!1;const t=new URL(document.location);t.searchParams.delete(de),window.history.replaceState({},null===document||void 0===document?void 0:document.title,t.toString())}else this.showFigmaDemoModal=!0;else this.showFigmaDemoModal=!1;const r=this.isRunningUnderLivePreview();if(e.has(Xt)||e.has("snippyly_google_token")){if(r);else if(e.has(Xt)){const t=decodeURIComponent(e.get(Xt)),i=cd(t,ti,ei),n=i&&JSON.parse(i);if(n){const t={};t.userId=n.uid,t.name=n.displayName,t.email=n.email,t.photoUrl=null==n?void 0:n.photoURL;const e=JSON.stringify(t),i=ld(e,ti,ei);od(te,i,!0),(t=>{try{const e=null==t?void 0:t.cred;"string"==typeof e&&e?od(ee,e,!0):bd()}catch(t){console.warn("Error in storeUserCredentialFromSt: ",t)}})(n),sd(ue)}}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,od(Qt,JSON.stringify(i),!0),bd()}e.delete(Xt),e.delete("snippyly_google_token"),window.history.replaceState({},document.title,t.href)}e.has(St)?(od(St,"true",!1),sd(Mt),e.delete(St),window.history.replaceState({},document.title,t.href),this.loadPluginUI()):e.has(Mt)||rd(St,!1)&&this.loadPluginUI(),e.has(Mt)?(od(Mt,"true",!1),sd(St),e.delete(Mt),window.history.replaceState({},document.title,t.href),this.loadPluginUI()):e.has(St)||rd(Mt,!1)&&this.loadPluginUI(),this.setVersionInUrl(),this.startAgentRunStatusListener()}catch(t){console.warn("Error in checkUrl: ",t),zd("Error in checkUrl: ",t)}},this.setInviteUrl=()=>{try{const t=new URL(document.location);t.searchParams.has(St)||t.searchParams.set(St,"true"),this.inviteUrl=t.toString()}catch(t){console.warn("Error in setInviteUrl: ",t),zd("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&&od(se,this.projectVersion,!1,"sessionStorage")}else{const t=new URL(document.location).searchParams;(t.has(St)||t.has(Mt))&&t.has(ae)&&(od(re,ae,!1,"sessionStorage"),this.projectVersion=t.get(ae),this.projectVersion&&od(se,this.projectVersion,!1,"sessionStorage"))}}catch(t){console.warn("Error in detectVersion: ",t),zd("Error in detectVersion: ",t)}},this.setVersionInUrl=()=>{try{const t=this.projectVersionKey||rd(re,!1,"sessionStorage"),e=this.projectVersion||rd(se,!1,"sessionStorage");if(t&&e){const i=new URL(document.location),n=i.searchParams;n.get(t)||(n.set(t,e),window.history.replaceState({},document.title,i.href))}}catch(t){console.warn("Error in setVersionInUrl: ",t),zd("Error in setVersionInUrl: ",t)}},this.loadPluginUI=async()=>{var t,e,i,n,o,r,s,a,l;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;yt.includes(this.apiKey)&&this.listenToDocumentTitleChange();const c=this.isRunningUnderLivePreview()?null===(t=this.readLiveSignIn())||void 0===t?void 0:t.user:dd();c&&!(null==c?void 0:c.isAnonymous)&&(this.loading=!0);try{this.customerMetadata=await this.getCustomerMetadata()}catch(t){console.warn("Error in getCustomerMetadata: ",t),zd("Error in getCustomerMetadata: ",t)}nd(me)&&(this.isPasswordValid=nd(me));const d=await Zd(this.apiKey,this.projectId);"error"===d.status&&console.warn("getProjectConfig failed for projectId (treating project as valid): ",this.projectId),this.projectDeleted=gd(d,this.isDriveOrPreviewHost(),this.projectIdSupplied),this.applyVeltFeatureGates(),this.projectConfig="ok"===d.status?d.config:null,this.requestModeSwitch=Id(this.projectConfig);const h=function(t){try{const e=t&&"object"==typeof t?t.disabled:void 0;return"boolean"==typeof e?e:null}catch(t){return console.warn("Error in readCommentsDisabledSetting: ",t),null}}(this.projectConfig);null!==h&&"waiting"===this.commentsDisabledSetting&&(this.firstConfigCommentsDisabled=h,this.commentsDisabledSetting="known"),this.consumeRequestResumeMarker(),this.guestMode=!!(null===(e=this.projectConfig)||void 0===e?void 0:e.guestMode)||this.guestMode||this.isRunningUnderLivePreview(),this.allowGuestModeSignIn=!!(null===(n=null===(i=this.projectConfig)||void 0===i?void 0:i.guestModeConfig)||void 0===n?void 0:n.allowSignIn),this.queryParamsComments=!!(null===(o=this.projectConfig)||void 0===o?void 0:o.queryParamsComments),this.usePageTitleAsLocationName=!!(null===(r=this.projectConfig)||void 0===r?void 0:r.usePageTitleAsLocationName),(null===(s=this.projectConfig)||void 0===s?void 0:s.guestModeConfig)||(this.allowGuestModeSignIn=!0),this.passwordProtected=!!(null===(l=null===(a=this.projectConfig)||void 0===a?void 0:a.passwordProtected)||void 0===l?void 0:l.enabled),this.applyVeltFeatureGates(),od(pe,this.guestMode+"",!0),od(be,this.allowGuestModeSignIn+"",!0),od(ve,this.passwordProtected+"",!0),od(ge,this.queryParamsComments+"",!0),od(fe,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),zd("Error in loadPluginUI: ",t)}},this.listenToDocumentTitleChange=()=>{try{this.documentTitleChangeInterval||(this.documentTitleChangeInterval=setInterval((()=>{var t,e,i;const n="true"===sessionStorage.getItem("debugDocumentTitleChange");if(n&&(console.log("*** listenToDocumentTitleChange ***"),console.log("usePageTitleAsLocationName: ",this.usePageTitleAsLocationName)),this.usePageTitleAsLocationName){const o=document.title;n&&(console.log("location name: ",null===(t=this.location)||void 0===t?void 0:t.locationName),console.log("title: ",o),console.log("changed: ",(null===(e=this.location)||void 0===e?void 0:e.locationName)!==o)),(null===(i=this.location)||void 0===i?void 0:i.locationName)!==o&&(n&&console.log("%c triggering location update!","color: green; font-weight: bold;"),this.generateLocation(),this.setLocation({forceSetLocation:!0}),this.setPreviewLocationFromPath())}}),2e3))}catch(t){zd("Error in listenToDocumentTitleChange: ",t)}},this.initializeSnippyly=async()=>{var t,e,n,o,r,s,a,l,c,d,h,u,p,v,g,f,m,w,y,b,C,x,E,k,S,M,A;try{let T=this.staging?ft:mt;this.veltVersion&&(T=this.veltVersion);let $=this.staging,I=!1;if((null===sessionStorage||void 0===sessionStorage?void 0:sessionStorage.getItem("velt-version"))&&(T=sessionStorage.getItem("velt-version")),null===sessionStorage||void 0===sessionStorage?void 0:sessionStorage.getItem("velt-env")){"staging"===sessionStorage.getItem("velt-env")&&($=!1,I=!0)}this.apiKey;this.veltProxyToggleVisible=!1;const _=void 0;if(await i(this.apiKey,{options:{develop:$,staging:I,version:T,velt:!0,proxyDomain:"https://cdn.velt.dev"},..._?{proxyConfig:_}:{}}),!window.Velt)return;if(this.setupSuggestionActionGuard(),this.replayVeltFeatureGates(),this.autoTranslation&&(null===Velt||void 0===Velt?void 0:Velt.enableAutoTranslation)&&(null===Velt||void 0===Velt||Velt.enableAutoTranslation()),this.loadedVeltVersion="string"==typeof(null===(t=window.Velt)||void 0===t?void 0:t.version)?window.Velt.version:void 0,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),zd("Error in loadPoppinsFont: ",t)}})()}if(Velt&&(jd({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 t=this.isRunningUnderLivePreview()?null===(e=this.readLiveSignIn())||void 0===e?void 0:e.user:dd(),i="true"===sessionStorage.getItem("debugUserUpdateEvent");this.previousVeltUserId=null!==(n=null==t?void 0:t.userId)&&void 0!==n?n:"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===(o=this.commentElement)||void 0===o?void 0:o.showScreenSizeInfo)&&this.commentElement.showScreenSizeInfo(!0),(null===(r=this.commentElement)||void 0===r?void 0:r.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),od(he,"true")),t&&this.promptNativeScreenshotForCommentMode(),this.addCommentMode||this.showModalOnceCommentIsModeIsOff&&(this.addCommentCount>=2&&!rd(Ce)&&(this.allowGuestModeSignIn?this.openGuestModeSignInModal():this.openGuestModeNameModel(),od(Ce,"true"),this.showModalOnceCommentIsModeIsOff=!1),this.addCommentCount>=5&&!this.showGuestModeSignInModal&&!rd(Ee,!1,"sessionStorage")&&(this.showGuestModeSignInBanner(),od(Ee,"true",!1,"sessionStorage"),this.showModalOnceCommentIsModeIsOff=!1))})),(null===(s=this.commentElement)||void 0===s?void 0:s.enableOrphanComments)&&this.commentElement.enableOrphanComments(),!this.readOnlyMode&&(null===(a=this.commentElement)||void 0===a?void 0:a.enablePersistentCommentMode)&&this.commentElement.enablePersistentCommentMode(),this.readOnlyMode||this.showFirstCommentNudge(),(null===(l=this.commentElement)||void 0===l?void 0:l.enableGhostComments)&&this.commentElement.enableGhostComments();const t=null===window||void 0===window?void 0:window.SUPERFLOW_CUSTOM_STATUSES;t&&"object"==typeof t&&(null===(c=this.commentElement)||void 0===c?void 0:c.setCustomStatus)&&this.commentElement.setCustomStatus(t),(null===(d=this.commentElement)||void 0===d?void 0:d.enableMinimap)&&!this.embedMode&&this.commentElement.enableMinimap(),(null===(h=this.commentElement)||void 0===h?void 0:h.setDStrategy)&&(null===(u=this.commentElement)||void 0===u||u.setDStrategy("dynamicId")),(null===(p=this.commentElement)||void 0===p?void 0:p.enableSidebarButtonOnCommentDialog)&&this.commentElement.enableSidebarButtonOnCommentDialog(),(null===(v=this.commentElement)||void 0===v?void 0:v.enableHotkey)&&this.commentElement.enableHotkey(),(null===(g=this.commentElement)||void 0===g?void 0:g.enableDeviceIndicatorOnCommentPins)&&this.commentElement.enableDeviceIndicatorOnCommentPins(),(null===(f=this.commentElement)||void 0===f?void 0:f.enableLazyLoadResolvedComments)&&this.commentElement.enableLazyLoadResolvedComments(),(null===(m=this.commentElement)||void 0===m?void 0:m.enableDraftConfirmation)&&this.commentElement.enableDraftConfirmation(),this.applyScreenshotSetting(),this.ensureAddCommentAnnotationSubscription(),this.initCommentStatuses(),this.setQueryParamsCommentsInSdk(),this.checkToEnableUpgradeButton(),this.syncRequestMode(),this.setupSidebarAgentCommentFilter(),this.setupVeltButtonClickListener(),this.maybeApplyVisibilityOptionsToCommentElement()}this.applyStorageFeatureAccess(),this.selectionElement=Velt.getSelectionElement(),this.selectionElement&&this.selectionElement.enableLiveSelection(!0),this.rewriterElement&&(null===(w=this.rewriterElement)||void 0===w||w.enableRewriter()),this.presenceElement&&(null===(y=this.presenceElement)||void 0===y?void 0:y.enableFlockMode)&&(null===(b=this.presenceElement)||void 0===b||b.enableFlockMode(!0)),(null===Velt||void 0===Velt?void 0:Velt.getDocElement)&&(this.docElement=Velt.getDocElement()),null===(k=(null===(C=this.docElement)||void 0===C?void 0:C.getDocumentMetadata)?null===(x=this.docElement)||void 0===x?void 0:x.getDocumentMetadata():null===(E=null===Velt||void 0===Velt?void 0:Velt.docService)||void 0===E?void 0:E.getDocumentMetadata$())||void 0===k||k.subscribe((t=>{var e,i;const n=(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):[],o=new URL(document.location).searchParams.get("version");if(o){const t=n.find((t=>t.id===o));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===(S=this.viewsElement)||void 0===S?void 0:S.getUniqueViewsByUser)&&(null===(A=null===(M=this.viewsElement)||void 0===M?void 0:M.getUniqueViewsByUser())||void 0===A||A.subscribe((t=>{this.totalViews=t}))),this.identifySnippyly()}catch(t){this.loading=!1,console.warn("Error in initializeSnippyly: ",t),zd("Error in initializeSnippyly: ",t)}},this.generateDocumentId=()=>{try{this.documentId=Xc(ed(window.location.origin))+"",this.projectId&&(this.documentId=this.projectId+""),this.serverDocumentId=(t=this.documentId+"")?`${Xc(t)}`:void 0}catch(t){console.warn("Error in generateDocumentId: ",t),zd("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+"")),jd({documentId:this.serverDocumentId,clientDocumentId:this.documentId}),this.generateLocation(),this.setLocation(),this.setPreviewLocationFromPath()}catch(t){console.warn("Error in setDocumentAndLocation: ",t),zd("Error in setDocumentAndLocation: ",t)}},this.setPreviewLocationFromPath=()=>{try{if(!(this.agentCommentsModeRequested||this.isRunningUnderLivePreview())||!this.previewLocationPath)return;if(!window.Velt||!(null===Velt||void 0===Velt?void 0:Velt.setLocation))return;const t={url:this.previewLocationPath},e=id(JSON.parse(JSON.stringify(t)));e&&(t.id=`${e}`),this.location=t,null===Velt||void 0===Velt||Velt.setLocation(JSON.parse(JSON.stringify(t))),jd({clientLocation:t}),this.previousLocation=JSON.parse(JSON.stringify(t)),this.onVeltLocationChange()}catch(t){console.warn("Error in setPreviewLocationFromPath: ",t),zd("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),zd("Error in checkToEnableUpgradeButton: ",t)}},this.getCustomerMetadata=async()=>{try{const t=await Jd(this.apiKey);return(t=>{try{const e=t?JSON.stringify(t):"false";od(ke,e)}catch(t){console.warn("Error in setCustomerMetadataToStorage: ",t),zd("Error in setCustomerMetadataToStorage: ",t)}})(t),t}catch(t){console.warn("Error in getCustomerMetadata: ",t),zd("Error in getCustomerMetadata: ",t);const e=(()=>{try{const t=rd(ke);return t?"false"===t?JSON.parse(JSON.stringify(Pe)):JSON.parse(t):null}catch(t){return console.warn("Error in getCustomerMetadataFromStorage: ",t),zd("Error in getCustomerMetadataFromStorage: ",t),null}})();if(e)return e}},this.setCustomStatuses=async()=>{var t;try{const e=await Qd(this.apiKey);if((null==e?void 0:e.success)&&(null==e?void 0:e.data)){const i=Object.values(e.data),n=this.sortCustomStatuses(i);if(n.length>0&&(null===(t=this.commentElement)||void 0===t?void 0:t.setCustomStatus))return void this.commentElement.setCustomStatus(n)}this.hasWindowCustomStatuses()||this.applyDefaultCommentStatuses()}catch(t){console.warn("Error in setCustomStatuses: ",t),zd("Error in setCustomStatuses: ",t)}},this.initCommentStatuses=()=>{var t,e,i;try{(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.hasCustomStatus)?this.setCustomStatuses():this.hasWindowCustomStatuses()||this.applyDefaultCommentStatuses()}catch(t){console.warn("Error in initCommentStatuses: ",t),zd("Error in initCommentStatuses: ",t)}},this.hasWindowCustomStatuses=()=>{try{const t=null===window||void 0===window?void 0:window.SUPERFLOW_CUSTOM_STATUSES;return!!t&&"object"==typeof t}catch{return!1}},this.applyDefaultCommentStatuses=()=>{var t;try{if("function"!=typeof(null===(t=this.commentElement)||void 0===t?void 0:t.setCustomStatus))return;this.commentElement.setCustomStatus(eu.map((t=>({...t}))))}catch(t){console.warn("Error in applyDefaultCommentStatuses: ",t),zd("Error in applyDefaultCommentStatuses: ",t)}},this.applyCheckPriorities=()=>{var t;try{if(bt.includes(this.apiKey))return;if("function"!=typeof(null===(t=this.commentElement)||void 0===t?void 0:t.setCustomPriority))return;this.commentElement.setCustomPriority(Yh.map((t=>({...t}))))}catch(t){console.warn("Error in applyCheckPriorities: ",t),zd("Error in applyCheckPriorities: ",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),zd("Error in sortCustomStatuses: ",e),t}},this.getSamlConfig=async()=>{try{const t=await ih(this.apiKey);return(t=>{try{if(t){const e=JSON.stringify(t);od($e,e,!0)}}catch(t){console.warn("Error in setSamlConfigToStorage: ",t),zd("Error in setSamlConfigToStorage: ",t)}})(t),t}catch(t){console.warn("Error in getSamlConfig: ",t),zd("Error in getSamlConfig: ",t);const e=(()=>{try{const t=rd($e,!0);return t?JSON.parse(t):null}catch(t){return console.warn("Error in getSamlConfigFromStorage: ",t),zd("Error in getSamlConfigFromStorage: ",t),null}})();if(e)return e}},this.setLogos=()=>{var t,e,i,n,o,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===(o=null===(n=null==Ye?void 0:Pe)||void 0===n?void 0:n.customBranding)||void 0===o?void 0:o.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==Ye?void 0:Pe)||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),zd("Error in setLogos: ",t)}},this.getAlertIcon=()=>L`
|
|
6494
6494
|
<svg class="error-icon" width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
6495
6495
|
<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"/>
|
|
6496
6496
|
</svg>
|
|
@@ -6565,7 +6565,7 @@ class zc extends $a{}zc.Encryptor=class extends zc{processBlock(t,e){const i=t,n
|
|
|
6565
6565
|
<div class="error-message">Comments Disabled</div>
|
|
6566
6566
|
</div>
|
|
6567
6567
|
</div>
|
|
6568
|
-
`:null,this.isRequestMode=()=>{try{return function(t){try{if(!t||!0!==t.requestModeSwitch||_d(t))return!1;const e=t.user;return!(!e||"object"!=typeof e||!0===e.isAnonymous||!0===e.isGuest)&&"string"==typeof t.role&&""!==t.role&&"Admin"!==t.role}catch(t){return console.warn("Error in decideRequestMode: ",t),!1}}({requestModeSwitch:this.requestModeSwitch,user:this.snippylyUser,role:this.snippylyUserRole,embedMode:this.embedMode,readOnlyMode:this.readOnlyMode,onboardingMode:this.onboardingMode,agentStatusMode:this.agentStatusMode,passwordPending:this.passwordProtected&&!this.isPasswordValid})}catch(t){return console.warn("Error in isRequestMode: ",t),!1}},this.isSignedOutRequestMode=()=>{try{return function(t){try{return!(!t||!0!==t.requestModeSwitch||t.loading||_d(t)||t.user&&"object"==typeof t.user)}catch(t){return console.warn("Error in decideSignedOutRequestMode: ",t),!1}}({requestModeSwitch:this.requestModeSwitch,user:this.snippylyUser,loading:!!this.loading,embedMode:this.embedMode,readOnlyMode:this.readOnlyMode,onboardingMode:this.onboardingMode,agentStatusMode:this.agentStatusMode,passwordPending:this.passwordProtected&&!this.isPasswordValid})}catch(t){return console.warn("Error in isSignedOutRequestMode: ",t),!1}},this.canShowRequestTools=()=>{try{return this.isToolbarStateResolved()&&this.canShowCollaborationTools()}catch(t){return console.warn("Error in canShowRequestTools: ",t),!1}},this.onRequestSignInClick=t=>{try{try{Hd(vt.Events.REQUEST_MODE_SIGN_IN_CLICKED,t?{projectId:this.projectId,source:t}:{projectId:this.projectId})}catch(t){console.warn("Error tracking requestModeSignInClicked: ",t)}this.loginWithGoogle()}catch(t){console.warn("Error in onRequestSignInClick: ",t),zd("Error in onRequestSignInClick: ",t)}},this.onRequestBadgeClick=()=>{try{if(this.isSignedOutRequestMode()&&this.requestMenuItems(!1).signIn)return this.storeRequestResumeMarker(),void this.onRequestSignInClick("badge");this.openRequestToolbar()}catch(t){console.warn("Error in onRequestBadgeClick: ",t),zd("Error in onRequestBadgeClick: ",t)}},this.openRequestToolbar=()=>{try{this.requestToolbarExpanded=!0,this.isRequestStateLoading()?this.requestCommentModePending="click":(this.requestCommentModePending=null,this.canEnterRequestCommentMode()&&this.enterRequestCommentMode());try{Hd(vt.Events.REQUEST_MODE_OPENED,{projectId:this.projectId})}catch(t){console.warn("Error tracking requestModeOpened: ",t)}this.focusRequestControl('[data-testid="sf-request-collapse"]')}catch(t){console.warn("Error in openRequestToolbar: ",t),zd("Error in openRequestToolbar: ",t)}},this.isRequestStateLoading=()=>{try{return!!this.snippylyUser&&"object"==typeof this.snippylyUser&&!this.isToolbarStateResolved()}catch(t){return console.warn("Error in isRequestStateLoading: ",t),!1}},this.canEnterRequestCommentMode=()=>{var t;try{return this.canShowRequestTools()&&!this.readOnlyMode&&"function"==typeof(null===(t=this.commentElement)||void 0===t?void 0:t.enableCommentMode)}catch(t){return console.warn("Error in canEnterRequestCommentMode: ",t),!1}},this.enterRequestCommentMode=()=>{try{this.commentElement.enableCommentMode()}catch(t){console.warn("Error enabling comment mode from the request badge: ",t)}},this.resolvePendingRequestOpen=()=>{try{const t=this.requestCommentModePending;if(!t||!this.isToolbarStateResolved())return;if(this.requestCommentModePending=null,!this.isRequestMode())return;if("resume"===t)return void(this.requestToolbarExpanded||this.openRequestToolbar());this.requestToolbarExpanded&&this.canEnterRequestCommentMode()&&this.enterRequestCommentMode()}catch(t){console.warn("Error in resolvePendingRequestOpen: ",t),zd("Error in resolvePendingRequestOpen: ",t)}},this.requestMenuItems=t=>function(t){try{return!t||t.customLogin?{signIn:!1,signOut:!1}:t.signedIn?{signIn:!1,signOut:!0}:{signIn:!t.invalidApiKey,signOut:!1}}catch(t){return console.warn("Error in decideRequestMenu: ",t),{signIn:!1,signOut:!1}}}({signedIn:t,customLogin:!!this.customLoginEnabledLocally,invalidApiKey:!!this.invalidApiKey}),this.storeRequestResumeMarker=()=>{try{window.sessionStorage.setItem($d,(t={apiKey:this.apiKey,projectId:this.projectId,now:Date.now()},JSON.stringify({v:1,apiKey:t.apiKey||"",projectId:t.projectId||"",expiresAt:t.now+6e5})))}catch(t){console.warn("Error storing the request-mode resume marker: ",t)}var t},this.consumeRequestResumeMarker=()=>{try{let t=null;try{t=window.sessionStorage.getItem($d),null!==t&&window.sessionStorage.removeItem($d)}catch(t){return}if(null===t||!this.requestModeSwitch)return;(function(t,e){try{if("string"!=typeof t||!t)return!1;const i=JSON.parse(t);return!!i&&1===i.v&&!!e.apiKey&&i.apiKey===e.apiKey&&!!e.projectId&&i.projectId===e.projectId&&"number"==typeof i.expiresAt&&i.expiresAt>e.now}catch(t){return!1}})(t,{apiKey:this.apiKey,projectId:this.projectId,now:Date.now()})&&(this.requestCommentModePending="resume",this.resolvePendingRequestOpen())}catch(t){console.warn("Error in consumeRequestResumeMarker: ",t)}},this.onRequestCollapseClick=()=>{try{this.closeRequestMenu(),this.requestToolbarExpanded=!1,this.requestCommentModePending=null,this.focusRequestControl('[data-testid="sf-request-badge"]')}catch(t){console.warn("Error in onRequestCollapseClick: ",t),zd("Error in onRequestCollapseClick: ",t)}},this.focusRequestControl=t=>{try{this.updateComplete.then((()=>{var e,i,n,o;try{null===(o=null===(n=null===(i=null===(e=this.renderRoot)||void 0===e?void 0:e.querySelector)||void 0===i?void 0:i.call(e,t))||void 0===n?void 0:n.focus)||void 0===o||o.call(n)}catch(t){console.warn("Error focusing the request toolbar: ",t)}})).catch((t=>console.warn("Error waiting to focus the request toolbar: ",t)))}catch(t){console.warn("Error in focusRequestControl: ",t)}},this.onRequestMenuButtonClick=()=>{try{if(this.requestMenuOpen)return void this.closeRequestMenu();this.requestMenuOpen=!0,this.attachRequestMenuListeners()}catch(t){console.warn("Error in onRequestMenuButtonClick: ",t),zd("Error in onRequestMenuButtonClick: ",t)}},this.closeRequestMenu=()=>{try{this.requestMenuOpen=!1,this.detachRequestMenuListeners()}catch(t){console.warn("Error in closeRequestMenu: ",t)}},this.onRequestMenuSignOutClick=()=>{try{this.closeRequestMenu(),this.signOutUser()}catch(t){console.warn("Error in onRequestMenuSignOutClick: ",t),zd("Error in onRequestMenuSignOutClick: ",t)}},this.onRequestMenuSignInClick=()=>{try{this.closeRequestMenu(),this.onRequestSignInClick()}catch(t){console.warn("Error in onRequestMenuSignInClick: ",t),zd("Error in onRequestMenuSignInClick: ",t)}},this.attachRequestMenuListeners=()=>{try{if(this.requestMenuListenersAttached)return;this.requestMenuListenersAttached=!0,document.addEventListener("pointerdown",this.onRequestMenuOutsidePointer,!0),document.addEventListener("keydown",this.onRequestMenuKeydown,!0)}catch(t){console.warn("Error in attachRequestMenuListeners: ",t)}},this.detachRequestMenuListeners=()=>{try{if(!this.requestMenuListenersAttached)return;this.requestMenuListenersAttached=!1,document.removeEventListener("pointerdown",this.onRequestMenuOutsidePointer,!0),document.removeEventListener("keydown",this.onRequestMenuKeydown,!0)}catch(t){console.warn("Error in detachRequestMenuListeners: ",t)}},this.onRequestMenuOutsidePointer=t=>{try{const e="function"==typeof t.composedPath?t.composedPath():[];e.some((t=>{const e=t;return!!(null==e?void 0:e.getAttribute)&&"true"===e.getAttribute("data-request-menu-area")}))||this.closeRequestMenu()}catch(t){console.warn("Error in onRequestMenuOutsidePointer: ",t)}},this.onRequestMenuKeydown=t=>{try{if("Escape"!==t.key||!this.requestMenuOpen)return;this.closeRequestMenu(),this.focusRequestControl('[data-testid="sf-request-menu-button"]')}catch(t){console.warn("Error in onRequestMenuKeydown: ",t)}},this.syncRequestMode=()=>{try{if(!this.commentElement||!this.isRequestMode())return;this.applyRequestModeToCommentElement(),this.ensureAddCommentAnnotationSubscription(),this.requestModeLoadedTracked||(this.requestModeLoadedTracked=!0,Hd(vt.Events.REQUEST_MODE_LOADED,{projectId:this.projectId}))}catch(t){console.warn("Error in syncRequestMode: ",t),zd("Error in syncRequestMode: ",t)}},this.applyRequestModeToCommentElement=()=>{try{const t=this.commentElement;if(!t||t===this.requestContextProviderElement||"function"!=typeof t.setContextProvider)return;this.requestContextProviderElement=t,t.setContextProvider((()=>this.isRequestMode()?function(t){let e="string"==typeof t?t:"";try{const t=new URL(e);t.searchParams.delete("sf_review"),e=t.toString()}catch(t){}return{sf:{type:"request",visibility:"client",pageUrl:e}}}(window.location.href):void 0))}catch(t){console.warn("Error in applyRequestModeToCommentElement: ",t),zd("Error in applyRequestModeToCommentElement: ",t)}},this.onRequestModeAnnotationSaved=t=>{try{if(!this.isRequestMode())return;const{annotationId:e,stamp:i}=function(t){try{const e=t&&"object"==typeof t?t:{},i=e.commentAnnotation&&"object"==typeof e.commentAnnotation?e.commentAnnotation:null,n="string"==typeof e.annotationId&&e.annotationId?e.annotationId:null==i?void 0:i.annotationId,o="string"==typeof n&&n?n:null,r=null==i?void 0:i.context;if(null==r)return{annotationId:o,stamp:"missing"};const s="object"==typeof r?r.sf:void 0;return{annotationId:o,stamp:"request"===(s&&"object"==typeof s?s.type:void 0)?"request":"other"}}catch(t){return console.warn("Error in readSavedAnnotation: ",t),{annotationId:null,stamp:"other"}}}(t),n=!!this.commentElement&&this.requestContextProviderElement===this.commentElement;if(!e||!("request"===i||"missing"===i&&n))return;if(!this.notifyAddedRequest(e))return;try{Hd(vt.Events.REQUEST_ADDED,{projectId:this.projectId})}catch(t){console.warn("Error tracking requestAdded: ",t)}}catch(t){console.warn("Error in onRequestModeAnnotationSaved: ",t)}},this.identifySnippyly=async()=>{var t,e,i,n;let o="",r="",s=!1;try{this.invalidApiKey=!1;let n={name:"Default User",email:"default@usesuperflow.com",userId:"default",isAnonymous:!0,organizationId:this.apiKey};const a=this.isRunningUnderLivePreview(),l=a?this.readLiveSignIn():null;let c;c=a?l?{...l.user}:null:this.customLoginEnabled&&this.providedUser?this.providedUser:dd(),ia("[Superflow][identify] resolved user (pre-iam)",{source:a?l?"liveSignIn":"liveGuest":this.customLoginEnabled&&this.providedUser?"providedUser":"token",email:null==c?void 0:c.email,userId:null==c?void 0:c.userId,name:null==c?void 0:c.name,isAnonymous:null==c?void 0:c.isAnonymous});const d=await this.getSamlConfig(),h=new URL(document.location);if(h.searchParams.has(Xt)&&h.searchParams.delete(Xt),d&&(this.signInUrl=`${Qe}saml/${d.slug}/login?redirect_url=${encodeURIComponent(null==h?void 0:h.toString())}&source=sf`,window.Superflow.signInUrl=this.signInUrl),((null==c?void 0:c.email)||a&&(null==c?void 0:c.userId))&&(n=c),n.isAnonymous)delete n.groupId;else{const t=Velt.getDocumentId()||this.serverDocumentId;t&&(n.groupId=t+"")}if(this.customLoginEnabledLocally||(null===(t=null==n?void 0:n.contacts)||void 0===t?void 0:t.length)&&(n.contacts=[]),o=null==n?void 0:n.email,r=null==n?void 0:n.userId,(null==n?void 0:n.isAnonymous)&&this.projectId&&(this.guestMode||a)){const t=ud(!0,this.apiKey);t&&(n=JSON.parse(JSON.stringify(t)))}(null==n?void 0:n.isAnonymous)||(this.loading=!0);const u={};(null==n?void 0:n.groupId)&&(u.groupId=null==n?void 0:n.groupId),n.organizationId=this.apiKey;const p=await Wd(this.apiKey,this.projectId||"",null==n?void 0:n.email,null==n?void 0:n.userId),v=null==p?void 0:p.isAdmin;this.snippylyUserRole=v?"Admin":"Commenter",this.suggestionRoleLookupFailed="boolean"!=typeof v,this.suggestionViewerRoleResolved=!0,s=!0,this.applySuggestionActionStyles(),ia("[Superflow][identify] iamResponse",p,{isAdminUser:v,snippylyUserRole:this.snippylyUserRole,email:null==n?void 0:n.email,userId:null==n?void 0:n.userId});const g=!(a||this.customLoginEnabled&&this.providedUser);this.identityCameFromToken=g,this.identityLiveSignIn=l;const f=((t,e)=>!(!e||(null==t?void 0:t.isAnonymous)||(null==t?void 0:t.isGuest)||!(null==t?void 0:t.userId)))(n,g),m=f&&((t,e)=>{try{if(!t||!e)return!1;const i=!!e.name&&e.name!==t.name,n=!!e.photoUrl&&e.photoUrl!==t.photoUrl;return ia("[Superflow][identity] hasProfileChanged",{nameChanged:i,photoChanged:n,localName:t.name,savedName:e.name,localPhotoUrl:t.photoUrl,savedPhotoUrl:e.photoUrl}),i||n}catch(t){return console.warn("Error in hasProfileChanged: ",t),zd("Error in hasProfileChanged: ",t),!1}})(n,p);if(ia("[Superflow][identify] enrichment gate",{cameFromToken:g,willEnrichIdentity:f,profileChanged:m,forceReset:m,isAnonymous:null==n?void 0:n.isAnonymous,isGuest:null==n?void 0:n.isGuest,userId:null==n?void 0:n.userId,nameBefore:null==n?void 0:n.name}),f&&(n=((t,e)=>t&&e?{...t,name:e.name||t.name,photoUrl:e.photoUrl||t.photoUrl}:t)(n,p),ia("[Superflow][identify] enriched user",{nameAfter:null==n?void 0:n.name,photoUrl:null==n?void 0:n.photoUrl})),v&&(u.isAdmin=v,v&&this.allFeatureDisabled&&(this.allFeatureDisabled=!1)),this.restoreContentWarningSidebarState(),!this.projectDeleted&&(null==n?void 0:n.userId)&&!(null==n?void 0:n.isGuest)&&!(null==n?void 0:n.isAnonymous)&&this.documentId)try{await rh(this.apiKey,this.documentId,n.userId,n.name,n.email,this.credentialFor(n,g))}catch(t){zd("checkDocumentUserAndCreateError",t)}ia("[Superflow][identify] setVeltAuthProvider options",{forceReset:m,profileChanged:m,userName:null==n?void 0:n.name,userId:null==n?void 0:n.userId});const[w]=await Promise.all([Velt.setVeltAuthProvider({user:n,options:{throwError:!0,forceReset:m},retryConfig:{retryCount:3,retryDelay:1e3},generateToken:async()=>{if(this.fallBackToGuestIfLiveSignInExpired(l))return null;const t=this.credentialFor(n,g),e=await Xd(this.apiKey,null==n?void 0:n.userId,u,t);return this.applyServerAdminDecision(null==e?void 0:e.isAdmin),null==e?void 0:e.token},onError:t=>{console.log("Error signing to velt - ",t),this.fallBackToGuestIfLiveSignInExpired(l)||(this.invalidApiKey=!0)}}),this.fetchAndApplyFeatureAccess()]);if(this.hasAgentAccess&&this.insertShadowDOM(),this.invalidApiKey)throw"Invalid Api Key - Domain Not Whitelisted";f&&((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=ld(JSON.stringify(e),ti,ei);od(te,i,!0)}catch(t){console.warn("Error in saveUserToken: ",t),zd("Error in saveUserToken: ",t)}})(n),ia("[Superflow][identify] token rewritten post-signin, re-read",{persistedName:null===(e=dd())||void 0===e?void 0:e.name})),ia("[Superflow][identify] velt auth response",{name:null==w?void 0:w.name,email:null==w?void 0:w.email,userId:null==w?void 0:w.userId,userSnippylyId:null==w?void 0:w.userSnippylyId,tokenUserProperties:u}),Ud(JSON.parse(JSON.stringify(w||{}))),(null==n?void 0:n.isAnonymous)||(this.snippylyUser=JSON.parse(JSON.stringify(n)),ia("[Superflow][identify] this.snippylyUser (rendered) name",null===(i=this.snippylyUser)||void 0===i?void 0:i.name)),this.syncRequestMode();const y=JSON.parse(JSON.stringify(w||{}));if((null==y?void 0:y.userSnippylyId)&&!(null==y?void 0:y.isGuest)&&this.checkToMigrateGuestUser(y,this.credentialFor(y,g)),Velt.getUserRole$().subscribe((t=>{var e;t&&(this.loading=!1,null===(e=this.commentElement)||void 0===e||e.enablePriority(),this.applyCheckPriorities())})),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),zd("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),zd("Error in getDocumentMetadata: ",t)})))}))}jd({clientUserId:null==n?void 0:n.userId});try{Bd(n)}catch(t){console.warn("Error in trackIdentifyEvent: ",t)}this.getComments(),this.checkGlobalUserContact(),this.showFirstCommentNudge(),setTimeout((()=>{rd(he)||this.autoCommentModeArmedOnce||(this.showTourCommentTooltip=!0)}),2e3)}catch(t){if(this.loading=!1,this.signInError=!0,s||this.resolveSuggestionRoleAsLookupFailed(),t&&"string"==typeof t&&(null===(n=null==t?void 0:t.toLowerCase())||void 0===n?void 0:n.includes("invalid"))){this.invalidApiKey=!0,Hd(vt.Events.DOMAIN_NOT_WHITELISTED),this.projectId&&Gd(this.apiKey,this.projectId);if(new URL(document.location).searchParams.has(le))this.isSigningInUserAdmin=!0;else if(rd(ue))this.isSigningInUserAdmin="true"===rd(ue,!0);else{const t=await Wd(this.apiKey,this.projectId||"",o,r);this.isSigningInUserAdmin=!!(null==t?void 0:t.isAdmin),od(ue,this.isSigningInUserAdmin+"",!0)}}console.warn("Error in identifySnippyly: ",t),zd("Error in identifySnippyly: ",t)}},this.handleDocumentMetadataUpdate=async t=>{try{if(!t)return;const e=await Zd(this.apiKey,null==t?void 0:t.clientDocumentId);gd(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),zd("Error in handleDocumentMetadataUpdate: ",t)}},this.lockForDeletedProject=()=>{this.projectDeleted=!0,this.applyVeltFeatureGates(),this.unmountVeltCollaborationElements()},this.fetchAndApplyFeatureAccess=async()=>{var t,e;try{const i=await ah(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 n=null===(t=this.featureAccess)||void 0===t?void 0:t[sh.Agents];this.hasAgentAccess=!0===(null==n?void 0:n.hasAccess);const o=null===(e=this.featureAccess)||void 0===e?void 0:e[sh.WorkspacePrivateComments];this.hasPrivateCommentsAccess=!0===(null==o?void 0:o.hasAccess),this.isPrivateCommentsEnabledOnWorkspace=!0===(null==o?void 0:o.isPrivateCommentsEnabled),!this.canShowPrivateCommentToggle&&this.privateCommentModeEnabled&&(this.disablePrivateCommentModeOnCommentElement(),this.privateCommentModeEnabled=!1,od(we,"false")),this.maybeApplyVisibilityOptionsToCommentElement()}catch(t){console.warn("Error in fetchAndApplyFeatureAccess: ",t),zd("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(`${Re.VELT_COMMENTS_SIDEBAR_LEGACY}, ${Re.VELT_COMMENTS_SIDEBAR_V2}`);e&&e.setAttribute("shadow-dom","true")}catch(t){console.warn("Error in insertShadowDOM: ",t),zd("Error in insertShadowDOM: ",t)}},this.applyStorageFeatureAccess=()=>{try{if(!this.featureAccess||!this.commentElement)return;const t=this.featureAccess[sh.Storage];(null==t?void 0:t.hasUsageExhausted)&&(this.commentElement.disableAttachments(),this.commentElement.setRecordings("none"))}catch(t){zd("Error in applyStorageFeatureAccess: ",t)}},this.checkToMigrateGuestUser=async(t,e)=>{try{const i=ud(!1,this.apiKey);if(i){const n=`${oe}:${i.userId}:${null==t?void 0:t.userId}`,o=rd(n,!1,"sessionStorage");if("with-credential"===o||"without-credential"===o&&!e)return;const r=await th(this.apiKey,this.projectId||"",i,t,!0,e);if(!1===(null==r?void 0:r.success))return console.warn("[CWS Toolbar] Guest migration refused; keeping the guest user:",null==r?void 0:r.reason),void od(n,e?"with-credential":"without-credential",!1,"sessionStorage");sd(n,"sessionStorage"),sd(ne)}}catch(t){console.warn("Error in checkToMigrationGuestUser: ",t),zd("Error in checkToMigrationGuestUser: ",t)}},this.getComments=()=>{try{this.commentElement&&this.commentSubscription&&this.commentSubscription.unsubscribe()}catch(t){console.warn("Error in getComments: ",t),zd("Error in getComments: ",t)}},this.handleCommentSelection=t=>{var e,i,n,o,r,s,a,l,c,d,h;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 u=null==t?void 0:t.annotation;if(!u||!this.isAgentAnnotation(u))return void(null===(i=null===Velt||void 0===Velt?void 0:Velt.setUiState)||void 0===i||i.call(Velt,{showButtons:!1}));const p=this.resolveFullAnnotation(u);if(su(p))return void(null===(n=null===Velt||void 0===Velt?void 0:Velt.setUiState)||void 0===n||n.call(Velt,{showButtons:au(p).length>1,warningType:"site"}));const v=null===(r=null===(o=null==u?void 0:u.agent)||void 0===o?void 0:o.result)||void 0===r?void 0:r.incorrectWord,g=(null===(s=null==u?void 0:u.pageInfo)||void 0===s?void 0:s.path)||(null===(a=null==u?void 0:u.location)||void 0===a?void 0:a.path)||(null===(l=null==u?void 0:u.agent)||void 0===l?void 0:l.path);if(!v||!g)return void(null===(c=null===Velt||void 0===Velt?void 0:Velt.setUiState)||void 0===c||c.call(Velt,{showButtons:!1}));const f=this.normalizePagePath(g),m=v,w=null===(h=null===(d=null==u?void 0:u.agent)||void 0===d?void 0:d.result)||void 0===h?void 0:h.type;let y,b="";"grammar"===w?(y=this.grammarSuggestionPagePathMap,b="grammar"):(y=this.spellingSuggestionPagePathMap,b="spelling");const C=null==y?void 0:y.get(m);((null==C?void 0:C.get(f))||0)<=1?Velt.setUiState({showButtons:!1,warningType:b}):Velt.setUiState({showButtons:!0,warningType:b})}catch(t){console.warn("Error in handleCommentSelection: ",t),zd("Error in handleCommentSelection: ",t)}},this.processAgentComments=t=>{var e,i,n;try{const o=Array.isArray(t)?t:[];this.trackAgentPins(o),o.length&&!this.agentNamesFetched&&this.apiKey&&this.fetchAgentNames();const r=o.filter((t=>this.isAgentAnnotation(t)&&!iu(t)));if(this.sidebarV2Enabled&&!this.showAgentCommentsInSidebar&&0===r.length&&this.agentGroups.length>0){const t=new Set(this.agentGroups.flatMap((t=>{var e;return null!==(e=null==t?void 0:t.annotations)&&void 0!==e?e:[]})).map(Wh));for(const e of o){const i=Wh(e);i&&t.has(i)&&iu(e)&&this.removeAnnotationFromWarnings(i)}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 n=s.get(i);n?n.push(t):s.set(i,[t])}const a=[],l=new Map,c=new Map;for(const[t,e]of s){const o=this.isCustomAgent((null===(n=null===(i=e[0])||void 0===i?void 0:i.agent)||void 0===n?void 0:n.agentFields)||[]),r=this.resolveAgentGroupName(t,e),{warnings:s,warningCount:d}=this.buildAgentWarnings(t,e,l,c);a.push({agentId:t,agentName:r,isCustom:o,warningCount:d,warnings:s,annotations:e})}if(a.sort(((t,e)=>e.warningCount-t.warningCount)),this.agentGroups=a,this.isAgentRunStatusFeedEnabled())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),zd("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(Oe.AGENT))return e.substring(Oe.AGENT.length);return null}catch(t){return console.warn("Error in extractAgentId: ",t),null}},this.isCustomAgent=t=>{try{return!!Array.isArray(t)&&t.includes(Oe.AGENT_TYPE_CUSTOM)}catch(t){return console.warn("Error in isCustomAgent: ",t),!1}},this.resolveAgentGroupName=(t,e)=>{var i;try{return Mp(null===(i=this.agentNameMap)||void 0===i?void 0:i.get(t),e)||this.getAgentNameFromId(t)}catch(e){return console.warn("Error in resolveAgentGroupName: ",e),zd("Error in resolveAgentGroupName: ",e),this.getAgentNameFromId(t)}},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),Ht}},this.getAgentNameFromId=t=>{try{return t&&/^[a-z]+(-[a-z]+)*$/.test(t)?t.split("-").map((t=>`${t.charAt(0).toUpperCase()}${t.slice(1)}`)).join(" "):Ht}catch(t){return console.warn("Error in getAgentNameFromId: ",t),Ht}},this.fetchAgentNames=async()=>{var t,e,i;try{this.agentNamesFetched=!0;const{getAgents:n}=await Promise.resolve().then((function(){return ph})),o=await n(this.apiKey),r=new Map;for(const i of o){const n=null!==(t=null==i?void 0:i.id)&&void 0!==t?t:"",o=null!==(e=null==i?void 0:i.name)&&void 0!==e?e:"";n&&o&&r.set(n,o)}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.resolveAgentGroupName(t.agentId,t.annotations)})));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 n=("string"==typeof(null==t?void 0:t.name)&&t.name.length>0?t.name:this.resolveAgentDisplayName(i)).slice(0,80),o="string"==typeof(null==t?void 0:t.status)&&Ut.includes(t.status),r=!0!==(null==t?void 0:t.terminal)&&!o,s=null==t?void 0:t.findings,a="number"==typeof s&&Number.isFinite(s)&&s>=0?Math.floor(s):0;e.push(o?{agentId:i,agentName:n,isRunning:r,findingsCount:a,failed:!0}:{agentId:i,agentName:n,isRunning:r,findingsCount:a})}return e}catch(t){return console.warn("Error in sanitiseAgentRunStatusRows: ",t),zd("Error in sanitiseAgentRunStatusRows: ",t),[]}},this.getPortalOrigins=()=>{try{if(this.portalOrigins)return this.portalOrigins;const t=new Set;for(const e of[Qe,Xe])try{const{origin:i,hostname:n,protocol:o}=new URL(e);t.add(i),n.endsWith(".firebaseapp.com")?t.add(`${o}//${n.replace(/\.firebaseapp\.com$/,".web.app")}`):n.endsWith(".web.app")&&t.add(`${o}//${n.replace(/\.web\.app$/,".firebaseapp.com")}`)}catch{}return this.portalOrigins=[...t],this.portalOrigins}catch(t){return console.warn("Error in getPortalOrigins: ",t),zd("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),zd("Error in isFramedByPortal: ",t),!1}},this.isAgentRunStatusFeedEnabled=()=>this.onboardingMode||this.agentStatusMode,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),zd("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.isAgentRunStatusFeedEnabled()||!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.onboardingMode&&this.startOnboardingViewportListener(),window.parent.postMessage({type:Ft},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,jt-t))}}else this.armAgentRunStatusWatchdog(2e4);this.ensureOnboardingFindingsLoaded()}catch(t){console.warn("Error in startAgentRunStatusListener: ",t),zd("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),zd("Error in stopAgentRunStatusListener: ",t)}},this.onAgentRunStatusMessage=t=>{try{if(!this.isAgentRunStatusFeedEnabled())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)===Pt)return void this.postOnboardingDiagnostics(t.origin);if((null==e?void 0:e.type)!==Dt||!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(jt):this.agentRunStatusSettled&&this.clearAgentRunStatusWatchdog(),this.ensureOnboardingFindingsLoaded()}catch(t){console.warn("Error in onAgentRunStatusMessage: ",t),zd("Error in onAgentRunStatusMessage: ",t)}},this.postOnboardingDiagnostics=t=>{var e,i,n,o,r,s;try{if(!this.isAgentRunStatusFeedEnabled()||!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:Vt,at:(new Date).toISOString(),version:gt,identity:{hasUser:!!this.snippylyUser,isGuest:!!(null===(i=this.snippylyUser)||void 0===i?void 0:i.isGuest),isAnonymous:!!(null===(n=this.snippylyUser)||void 0===n?void 0:n.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!==(o=this.lastStreamAnnotations)&&void 0!==o?o:[]).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),zd("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),zd("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),zd("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.isAgentRunStatusFeedEnabled())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),zd("Error in getDisplayAgentRunStatuses: ",t),this.agentRunStatuses}},this.ensureOnboardingFindingsLoaded=()=>{try{if(!this.isAgentRunStatusFeedEnabled()||!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),zd("Error in ensureOnboardingFindingsLoaded: ",t)}},this.clearOnboardingFindingsFetch=()=>{try{null!==this.onboardingFindingsFetchTimer&&(clearTimeout(this.onboardingFindingsFetchTimer),this.onboardingFindingsFetchTimer=null)}catch(t){console.warn("Error in clearOnboardingFindingsFetch: ",t),zd("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.isAgentRunStatusFeedEnabled())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=Bt.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.isAgentRunStatusFeedEnabled())return;if(null===(null==i?void 0:i.data)||void 0===(null==i?void 0:i.data))this.onboardingLastFetchCount=0,this.onboardingLastFetchError=Bt.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=Bt.FETCH_THREW,console.warn("Error in fetchOnboardingFindings: ",t),zd("Error in fetchOnboardingFindings: ",t),this.ensureOnboardingFindingsLoaded(),this.requestUpdate()}},this.applyOnboardingFetchResult=t=>{var e,i;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)})),o=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 r=!iu(t);o.set(n,null!==(i=o.get(n))&&void 0!==i&&i||r)}for(const[t,e]of o)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),zd("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),zd("Error in flattenFetchedAnnotations: ",t),[]}},this.mergeOnboardingFetchedAnnotations=t=>{var e;try{const i=Array.isArray(t)?t:[];if(!this.isAgentRunStatusFeedEnabled())return i;if(0===this.onboardingFetchedAnnotations.length)return this.setOnboardingUnsyncedAnnotationIds([]),i;const n=new Set(i.map((t=>null==t?void 0:t.annotationId)));if(this.sidebarV2Enabled&&!this.showAgentCommentsInSidebar){const t=new Map,o=(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[...o,...this.onboardingFetchedAnnotations]){const i=null==e?void 0:e.annotationId;!i||n.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&&!n.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),zd("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),zd("Error in armAgentRunStatusWatchdog: ",t)}},this.clearAgentRunStatusWatchdog=()=>{try{null!==this.agentRunStatusWatchdogTimer&&(clearTimeout(this.agentRunStatusWatchdogTimer),this.agentRunStatusWatchdogTimer=null)}catch(t){console.warn("Error in clearAgentRunStatusWatchdog: ",t),zd("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),zd("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),zd("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),zd("Error in stopOnboardingViewportListener: ",t)}},this.observeOnboardingPanel=()=>{var t,e,i;try{if(!this.agentRunStatusListening||"undefined"==typeof ResizeObserver)return;const n=null!==(e=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector(".onboarding-container content-warning-sidebar"))&&void 0!==e?e:null;if(n===this.onboardingObservedPanel)return;if(null===(i=this.onboardingPanelResizeObserver)||void 0===i||i.disconnect(),this.onboardingObservedPanel=n,!n)return;this.onboardingPanelResizeObserver||(this.onboardingPanelResizeObserver=new ResizeObserver((()=>this.scheduleOnboardingViewportClamp()))),this.onboardingPanelResizeObserver.observe(n)}catch(t){console.warn("Error in observeOnboardingPanel: ",t),zd("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),zd("Error in scheduleOnboardingViewportClamp: ",t)}},this.getOnboardingViewportClampOffset=(t,e,i)=>{let n=0,o=0;return t.right>e-8&&(n=e-8-t.right),t.left+n<8&&(n=8-t.left),t.bottom>i-8&&(o=i-8-t.bottom),t.top+o<8&&(o=8-t.top),{dx:n,dy:o}},this.readTranslate=t=>{var e;try{const i=window.getComputedStyle(t).transform;if(!i||"none"===i)return{x:0,y:0};const n=new(null!==(e=window.DOMMatrixReadOnly)&&void 0!==e?e:window.WebKitCSSMatrix)(i);return{x:Number(n.m41)||0,y:Number(n.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 n=[i.getBoundingClientRect()],o=i.querySelector("content-warning-sidebar");o&&n.push(o.getBoundingClientRect());const r=n.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),zd("Error in clampOnboardingPanelToViewport: ",t)}},this.buildAgentWarnings=(t,e,i,n)=>{try{return t===Le.BROKEN_LINKS?this.buildBrokenLinkWarnings(e):t===Le.SPELL_CHECK||t===Le.GRAMMAR_CHECK?this.buildSpellCheckWarnings(e,i,n):this.buildGenericWarnings(e)}catch(t){return console.warn("Error in buildAgentWarnings: ",t),{warnings:[],warningCount:0}}},this.buildBrokenLinkWarnings=t=>{var e,i,n,o,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===(n=null==g?void 0:g.agent)||void 0===n?void 0:n.url)||"",f=(null===(o=null==g?void 0:g.agent)||void 0===o?void 0:o.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())||"",b=ru(g)?lu(g):void 0;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),b&&(e.severity=Eu(e.severity,b))}else v.set(y,{primaryText:m||"",secondaryText:String(w),occurrences:1,pageUrls:t?[t]:[],annotations:[g],...b?{severity:b}:{}})}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 n,o,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===(n=null==E?void 0:E.pageInfo)||void 0===n?void 0:n.url)||(null===(o=null==E?void 0:E.location)||void 0===o?void 0:o.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:[],A=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:"",T=(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)||A||"",$=(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=T||"";T||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),R=L.get(S)||0;L.set(S,R+1);const D=ru(E)?lu(E):void 0;if(x.has(N)){const e=x.get(N);e.occurrences+=1,t&&!e.pageUrls.includes(t)&&e.pageUrls.push(t),e.annotations.push(E),D&&(e.severity=Eu(e.severity,D))}else x.set(N,{primaryText:T||"",secondaryText:I||"",occurrences:1,pageUrls:t?[t]:[],annotations:[E],...D?{severity:D}:{}})}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 n=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()))})),o=n[0];if(!o||!["B","STRONG"].includes(o.nodeName))return null;const r=(null===(e=o.textContent)||void 0===e?void 0:e.replace(/\s+/g," ").trim())||"";if(!r)return null;let s="";for(const t of n.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",n="string"==typeof(null==t?void 0:t.href)?t.href.trim().replace(/^https?:\/\//i,"").replace(/^www\./i,"").replace(/\/$/,""):"",o=n.length>40?`${n.slice(0,39)}…`:n;return{label:e,detail:o?`${i} · ${o}`:i}})).filter(Boolean)}catch(t){return console.warn("Error in buildFindingSubItems: ",t),[]}},this.buildGenericWarnings=t=>{var e,i,n,o,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===(n=null==M?void 0:M.agent)||void 0===n?void 0:n.url)||"",A=null!==(r=null!==(o=null==M?void 0:M.comments)&&void 0!==o?o:null==M?void 0:M.commentData)&&void 0!==r?r:[],T=null==A?void 0:A[0],$=null!==(p=null!==(d=null!==(a=null===(s=null==T?void 0:T.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==T?void 0:T.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==T?void 0:T.commentHtml),R=N||(null==L?void 0:L.title)||$,D=I||(N?O:null==L?void 0:L.detail)||"",F=this.resolveWarningSeverity(M,_),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=Eu(e.severity,F)}else S.set(V,{primaryText:R||"No text",secondaryText:D||"",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.resolveWarningSeverity=(t,e)=>{try{return ru(t)?lu(t):(t=>{if("string"!=typeof t)return;const e=t.trim().toLowerCase();return Uh.includes(e)?e:void 0})(null==e?void 0:e.severity)}catch(t){return console.warn("Error in resolveWarningSeverity: ",t),void zd("Error in resolveWarningSeverity: ",t)}},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,n,o;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===(n=this.commentElement)||void 0===n?void 0:n.disableQueryParamsComments)&&(r&&console.log("disableQueryParamsComments"),null===(o=this.commentElement)||void 0===o||o.disableQueryParamsComments()))}catch(t){console.warn("Error in setQueryParamsCommentsInSdk: ",t),zd("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),zd("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)?[...vd]:[]}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),zd("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),zd("Error in replayVeltFeatureGates: ",t)}},this.setProjectConfigVariables=t=>{var e,i,n,o;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!==(n=null==t?void 0:t.guestMode)&&void 0!==n&&n||this.isRunningUnderLivePreview(),this.allowGuestModeSignIn=!!(null===(o=null==t?void 0:t.guestModeConfig)||void 0===o?void 0:o.allowSignIn),(null==t?void 0:t.guestModeConfig)||(this.allowGuestModeSignIn=!0),this.guestMode&&Hd(vt.Events.GUEST_MODE_PRESENT),this.passwordProtected=!1,this.queryParamsComments=!!(null==t?void 0:t.queryParamsComments),this.usePageTitleAsLocationName=!!(null==t?void 0:t.usePageTitleAsLocationName),function(t){try{return!!t&&"object"==typeof t&&"boolean"==typeof t.requestMode}catch(t){return console.warn("Error in hasRequestModeField: ",t),!1}}(t)&&(this.requestModeSwitch=Id(t),this.syncRequestMode()),this.applyVeltFeatureGates(),od(pe,this.guestMode+"",!0),od(be,this.allowGuestModeSignIn+"",!0),od(ve,this.passwordProtected+"",!0),od(ge,this.queryParamsComments+"",!0),od(fe,this.usePageTitleAsLocationName+"",!0)}catch(t){console.warn("Error in setProjectConfigVariables: ",t),zd("Error in setProjectConfigVariables: ",t)}},this.toggleSnippylyPluginToolbar=()=>{try{this.expanded=!this.expanded,this.expanded?Hd(vt.Events.TOOLBAR_EXPANDED):Hd(vt.Events.TOOLBAR_COLLAPSED)}catch(t){console.warn("Error in toggleSnippylyPluginToolbar: ",t),zd("Error in toggleSnippylyPluginToolbar: ",t)}},this.enablePrivateCommentModeOnCommentElement=()=>{try{if(!this.commentElement||"function"!=typeof this.commentElement.enablePrivateMode)return;this.commentElement.enablePrivateMode({type:ye})}catch(t){console.warn("Error in enablePrivateCommentModeOnCommentElement: ",t),zd("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),zd("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,Hd(vt.Events.VISIBILITY_OPTIONS_ENABLED)}catch(t){console.warn("Error in enableVisibilityOptionsOnCommentElement: ",t),zd("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,Hd(vt.Events.VISIBILITY_OPTIONS_DISABLED)}catch(t){console.warn("Error in disableVisibilityOptionsOnCommentElement: ",t),zd("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,Hd(vt.Events.PRIVATE_MODE_DISABLED)):(this.enablePrivateCommentModeOnCommentElement(),this.privateCommentModeEnabled=!0,Hd(vt.Events.PRIVATE_MODE_ENABLED)),od(we,this.privateCommentModeEnabled.toString()))}catch(t){console.warn("Error in togglePrivateCommentMode: ",t),zd("Error in togglePrivateCommentMode: ",t)}},this.checkPrivateCommentModeFromStorage=()=>{try{!this.allFeatureDisabled&&"Admin"===this.snippylyUserRole&&this.canShowPrivateCommentToggle&&rd(we)&&(this.privateCommentModeEnabled="true"===rd(we),this.privateCommentModeEnabled&&this.enablePrivateCommentModeOnCommentElement())}catch(t){console.warn("Error in checkPrivateCommentModeFromStorage: ",t),zd("Error in checkPrivateCommentModeFromStorage: ",t)}},this.loginWithGoogle=()=>{try{if(Hd(vt.Events.SIGNIN_CLICKED),this.loading||this.customLoginEnabledLocally)return;const t=this.buildSignInUrlWithParams(this.signInUrl||""),e=this.signInWindowTarget();"_blank"===e?window.open(t,"_blank","noopener,noreferrer"):window.open(t,e)}catch(t){console.warn("Error in loginWithGoogle: ",t),zd("Error in loginWithGoogle: ",t)}},this.signInWindowTarget=()=>{try{return this.isRunningUnderPreviewProxy()&&this.isInFrame()?"_blank":"_self"}catch(t){return console.warn("Error in signInWindowTarget: ",t),"_self"}},this.isInFrame=()=>{try{return window.top!==window.self}catch(t){return console.warn("Error in isInFrame: ",t),!0}},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),zd("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=ld(e,ti,ei),n=await lh(i);"ok"===n.status?this.qrCode=n.qrcode:this.qrCodeError=!0}catch(t){this.qrCodeError=!0,console.warn("Error in getQRCode: ",t),zd("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),zd("Error in retryQRCode: ",t)}},this.toggleQRCodeVisibility=async()=>{try{if(Hd(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),zd("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,Hd(vt.Events.INVITE_MODAL_OPENED)},this.closeInviteModal=()=>{this.showInviteModal=!1},this.onInviteSuccess=()=>{this.closeInviteModal(),Hd(vt.Events.INVITE_SENT)},this.removeSnippyly=async()=>{try{Hd(vt.Events.EXIT_REVIEW_MODE_CLICKED),this.exitReviewModeCalled=!0,sd(St),sd(Mt),sd(Yt),sd(re,"sessionStorage"),sd(se,"sessionStorage");const t=new URL(document.location),e=t.searchParams;e.delete(Yt),e.delete(St),e.delete(Jt),e.delete(Mt),this.projectVersionKey&&e.delete(this.projectVersionKey),e.delete(ae),e.delete(le),e.delete(ce),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),zd("Error in removeSnippyly: ",t)}},this.signOutUser=async()=>{try{Hd(vt.Events.SIGNOUT_CLICKED),this.subscriptions.forEach((t=>{t&&t.unsubscribe&&(null==t||t.unsubscribe())})),this.contactListSubscription&&(this.contactListSubscription.unsubscribe(),this.contactListSubscription=null),this.teardownAgentsSidebarBusSubscriptions(),await Velt.signOutUser(),sd(Qt),sd(te),bd(),sd(ue),sd(we),this.snippylyUser=void 0,window.open(this.signOutUrl,"_self")}catch(t){console.warn("Error in signOutUser: ",t),zd("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),zd("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),zd("Error in copyLink: ",t)}},this.goToAdminPortal=()=>{try{let t=`${Qe}`;Velt&&(null===Velt||void 0===Velt?void 0:Velt.getDocumentId)&&this.serverDocumentId&&(t=`${Qe}/dashboard/project/comment/${this.apiKey}/${this.serverDocumentId}`),Hd(vt.Events.VIEW_PROJECT_CLICKED),window.open(t,"_blank")}catch(t){console.warn("Error in goToAdminPortal: ",t),zd("Error in goToAdminPortal: ",t)}},this.openBugReportModal=()=>{try{this.showBugReportModal=!0,Hd(vt.Events.REPORT_BUG_CLICKED)}catch(t){console.warn("Error in openBugReportModal: ",t),zd("Error in openBugReportModal: ",t)}},this.closeBugReportModal=()=>{try{this.showBugReportModal=!1}catch(t){console.warn("Error in closeBugReportModal: ",t),zd("Error in closeBugReportModal: ",t)}},this.goToAdminPortalDashboard=()=>{try{let t=`${Qe}`;Velt&&(null===Velt||void 0===Velt?void 0:Velt.getDocumentId)&&this.serverDocumentId&&(t=`${Qe}/dashboard`),window.open(t,"_blank")}catch(t){console.warn("Error in goToAdminPortalDashboard: ",t),zd("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),zd("Error in joinCommunity: ",t)}},this.onboardingNextClick=()=>{try{this.showOnboardingModal=!1,od(le,"true");const t=new URL(document.location);t.searchParams.delete(le),window.history.replaceState({},document.title,t.href)}catch(t){console.warn("Error in onboardingNextClick: ",t),zd("Error in onboardingNextClick: ",t)}},this.onLiveDemoModalNextClick=()=>{try{this.showLiveDemoModal=!1,od(ce,"true",!1,"sessionStorage");const t=new URL(document.location);t.searchParams.delete(ce),window.history.replaceState({},document.title,t.href)}catch(t){console.warn("Error in onLiveDemoModalNextClick: ",t),zd("Error in onLiveDemoModalNextClick: ",t)}},this.onFigmaDemoModalNextClick=()=>{try{this.showFigmaDemoModal=!1;const t=new URL(document.location);t.searchParams.delete(de),window.history.replaceState({},document.title,t.href)}catch(t){console.warn("Error in onFigmaDemoModalNextClick: ",t),zd("Error in onFigmaDemoModalNextClick: ",t)}},this.onUpgradePlanClick=()=>{try{window.open(Xe,"_blank")}catch(t){console.warn("Error in onUpgradePlanClick: ",t),zd("Error in onUpgradePlanClick: ",t)}},this.onTourCommentTooltipClick=()=>{try{this.showTourCommentTooltip=!1,od(he,"true"),this.firstCommentNudge&&(this.firstCommentNudge=!1,this.autoCommentModeArmedOnce=!0)}catch(t){console.warn("Error in onTourCommentTooltipClick: ",t),zd("Error in onTourCommentTooltipClick: ",t)}},this.onGuestModeChipSignInButtonClick=()=>{try{Hd(vt.Events.GUEST_MODE_SIGN_IN_BUTTON_CLICKED),this.loginWithGoogle()}catch(t){console.warn("Error in onGuestModeChipSignInButtonClick: ",t),zd("Error in onGuestModeChipSignInButtonClick: ",t)}},this.openGuestModeSignInModal=()=>{try{this.showGuestModeSignInModal=!0,Hd(vt.Events.GUEST_MODE_SIGN_IN_DIALOG_SHOWN)}catch(t){console.warn("Error in openGuestModeSignInModal: ",t),zd("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),zd("Error in closeGuestModeSignInModal: ",t)}},this.onGuestModeSignInModalSignInButtonClick=()=>{try{Hd(vt.Events.GUEST_MODE_SIGN_IN_BUTTON_CLICKED),this.loginWithGoogle()}catch(t){console.warn("Error in onGuestModeSignInModalSignInButtonClick: ",t),zd("Error in onGuestModeSignInModalSignInButtonClick: ",t)}},this.openGuestModeNameModel=t=>{try{t&&(t.stopPropagation(),t.preventDefault()),this.skipGuestNameModal||(this.showGuestModeNameModal=!0,Hd(vt.Events.GUEST_MODE_NAME_NUDGE_SHOWN))}catch(t){console.warn("Error in openGuestModeNameModel: ",t),zd("Error in openGuestModeNameModel: ",t)}},this.closeGuestModeNameModel=()=>{try{this.showGuestModeNameModal=!1}catch(t){console.warn("Error in closeGuestModeNameModel: ",t),zd("Error in closeGuestModeNameModel: ",t)}},this.onGuestModeNameModalSkipButtonClick=()=>{try{Hd(vt.Events.GUEST_MODE_SKIP_BUTTON_CLICKED),this.showGuestModeNameModal=!1}catch(t){console.warn("Error in onGuestModeNameModalSkipButtonClick: ",t),zd("Error in onGuestModeNameModalSkipButtonClick: ",t)}},this.onPasswordProtectedModalCloseButtonClick=()=>{try{Hd(vt.Events.PASSWORD_PROTECTED_MODAL_CLOSE_BUTTON_CLICKED),this.showPasswordProtectedModal=!1,this.password="",this.showInvalidPassword=!1}catch(t){console.warn("Error in onPasswordProtectedModalCloseButtonClick: ",t),zd("Error in onPasswordProtectedModalCloseButtonClick: ",t)}},this.onPasswordProtectedModalOpenButtonClick=()=>{try{Hd(vt.Events.PASSWORD_PROTECTED_MODAL_OPEN_BUTTON_CLICKED),this.showPasswordProtectedModal=!0}catch(t){console.warn("Error in onPasswordProtectedModalOpenButtonClick: ",t),zd("Error in onPasswordProtectedModalOpenButtonClick: ",t)}},this.showGuestModeSignInBanner=()=>{try{this.guestModeSignInBannerVisible=!0,Hd(vt.Events.GUEST_MODE_SIGN_IN_NUDGE_SHOWN)}catch(t){console.warn("Error in showGuestModeSignInBanner: ",t),zd("Error in showGuestModeSignInBanner: ",t)}},this.hideGuestModeSignInBanner=()=>{try{this.guestModeSignInBannerVisible=!1}catch(t){console.warn("Error in hideGuestModeSignInBanner: ",t),zd("Error in hideGuestModeSignInBanner: ",t)}},this.onGuestModeBannerSignInButtonClick=()=>{try{Hd(vt.Events.GUEST_MODE_SIGN_IN_CLICKED),this.loginWithGoogle()}catch(t){console.warn("Error in onGuestModeBannerSignInButtonClick: ",t),zd("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=ud(!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=ld(e,ti,ei);od(ne,i,!0)}catch(t){console.warn("Error in updateGuestUser: ",t),zd("Error in updateGuestUser: ",t)}})(e),await Velt.identify(e),this.snippylyUser=JSON.parse(JSON.stringify(e)),await th(this.apiKey,this.projectId||"",t,e),this.showGuestModeNameModal=!1,this.guestUserNameUpdated=!0,this.guestUserNameUpdateLoading=!1,od(xe,"true"),Hd(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),zd("Error in updateGuestUserName: ",t)}},this.submitPassword=async()=>{var t;try{if(Hd(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 Kd(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)}}(me,this.isPasswordValid),this.isPasswordValid?(this.password="",this.onPasswordProtectedModalCloseButtonClick(),this.showInvalidPassword=!1,this.applyVeltFeatureGates(),Hd(vt.Events.REVIEW_PASSWORD_ACCEPTED)):(this.showInvalidPassword=!0,Hd(vt.Events.REVIEW_PASSWORD_REJECTED)),this.validatingPasswordLoading=!1}catch(t){console.warn("Error in submitPassword: ",t),zd("Error in submitPassword: ",t)}},this.updateUserName=async()=>{var t,e;try{if(!(null===(t=this.guestUserNameInput)||void 0===t?void 0:t.trim()))return;if(this.guestUserNameUpdateLoading)return;this.guestUserNameUpdateLoading=!0;const i=JSON.parse(JSON.stringify(this.snippylyUser)),n=JSON.parse(JSON.stringify(this.snippylyUser));n.name=this.guestUserNameInput;const o=this.readLiveSignIn(),r=o&&(null===(e=o.user)||void 0===e?void 0:e.userId)===(null==i?void 0:i.userId)?o.token:null,s=this.isLiveShareGuest()?r:this.credentialFor(i,this.identityCameFromToken),a=await th(this.apiKey,this.projectId||"",i,n,!1,s);if(!1===(null==a?void 0:a.success))return console.warn("[CWS Toolbar] Name change refused; keeping the old name:",null==a?void 0:a.reason),this.guestUserNameUpdateLoading=!1,this.guestUserNameInput="",void this.closeGuestModeNameModel();await Velt.updateUser(n),this.snippylyUser=JSON.parse(JSON.stringify(n));const l=this.identityCameFromToken?dd():null;if(l){l.name=n.name;const t=JSON.stringify(l),e=ld(t,ti,ei);od(te,e,!0)}n.isGuest&&(this.guestUserNameUpdated=!0,od(xe,"true")),this.guestUserNameUpdateLoading=!1,this.guestUserNameInput="",this.closeGuestModeNameModel()}catch(t){console.warn("Error in updateUserName: ",t),zd("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)||[]),n=(null==t?void 0:t.type)===Ne,o=(null==t?void 0:t.commentType)===Ne;return i||n||o}catch(t){return console.warn("Error in isAgentAnnotation: ",t),!1}},this.getSidebarGroupExpansionMap=()=>{var t,e,i,n,o;try{const r=document.querySelector(Re.VELT_COMMENTS_SIDEBAR_LEGACY),s=null===(o=null===(n=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===n?void 0:n.call(i))||void 0===o?void 0:o.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 n=null===(e=null==t?void 0:t.data)||void 0===e?void 0:e.displayName,o=null===(i=null==t?void 0:t.data)||void 0===i?void 0:i.isExpanded;"string"==typeof n&&"boolean"==typeof o&&a.set(n,o)})),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 n=Array.isArray(null==t?void 0:t.systemFilteredAnnotations)?t.systemFilteredAnnotations:[],o=new Set(n.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&&o.has(e)&&r.push(t)}));const s=new Map;r.forEach((t=>{var e,i,n,o;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===(n=null==t?void 0:t.location)||void 0===n?void 0:n.path)||"/";s.has(r)||s.set(r,[]),null===(o=s.get(r))||void 0===o||o.push(t)}));const a=[],l=new URL(window.location.href).pathname,c="/"+this.normalizePagePath(l);s.forEach(((t,i)=>{const n=null==e?void 0:e.get(i);a.push({groupId:i,groupName:i,isExpanded:"boolean"==typeof n?n: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),zd("Error in filterAgentCommentsFromSidebar: ",t)}},this.mountVeltCollaborationElements=()=>{if(!document.querySelector(Re.VELT_COMMENTS)){const t=document.createElement(Re.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(Re.VELT_CURSOR)){const t=document.createElement(Re.VELT_CURSOR);window.document.body.appendChild(t)}if(!document.querySelector(Re.VELT_HUDDLE)){const t=document.createElement(Re.VELT_HUDDLE);window.document.body.appendChild(t)}if(!document.querySelector(Re.VELT_RECORDER_NOTES)){const t=document.createElement(Re.VELT_RECORDER_NOTES);window.document.body.appendChild(t)}if(!document.querySelector(Re.VELT_RECORDER_CONTROL_PANEL)){const t=document.createElement(Re.VELT_RECORDER_CONTROL_PANEL);window.document.body.appendChild(t)}if(!document.querySelector(Re.VELT_ARROWS)){const t=document.createElement(Re.VELT_ARROWS);window.document.body.appendChild(t)}},this.unmountVeltCollaborationElements=()=>{try{document.querySelectorAll(Yp.COLLABORATION_TAGS.join(", ")).forEach((t=>t.remove()))}catch(t){console.warn("Error in unmountVeltCollaborationElements: ",t),zd("Error in unmountVeltCollaborationElements: ",t)}},this.mountCommentSidebar=()=>{if(this.latchAgentsSidebarMode(),this.agentsSidebarMode)return void this.mountScopedCommentSidebars();const t=this.sidebarV2Enabled,e=t?Re.VELT_COMMENTS_SIDEBAR_V2:Re.VELT_COMMENTS_SIDEBAR_LEGACY,i=t?Re.VELT_COMMENTS_SIDEBAR_LEGACY:Re.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?De.URL_NAVIGATION:De.ENABLE_URL_NAVIGATION,"true"),i.setAttribute(De.CURRENT_LOCATION_SUFFIX,"true"),e===Re.VELT_COMMENTS_SIDEBAR_LEGACY&&(i.setAttribute(De.SIDEBAR_BUTTON_COUNT_TYPE,Fe),i.setAttribute(De.CUSTOM_ACTIONS,"true")),window.document.body.appendChild(i)}},this.mountScopedCommentSidebars=()=>{try{const t=Re.VELT_COMMENTS_SIDEBAR_V2;document.querySelectorAll(Re.VELT_COMMENTS_SIDEBAR_LEGACY).forEach((t=>t.remove()));const e=rp;if(!document.querySelector(`${t}:not([${e}])`)){const e=document.createElement(t);e.setAttribute("shadow-dom","true"),e.setAttribute(De.URL_NAVIGATION,"true"),e.setAttribute(De.CURRENT_LOCATION_SUFFIX,"true"),e.setAttribute(sp,JSON.stringify(cp(dp))),window.document.body.appendChild(e)}if(!document.querySelector(`${t}[${e}="${op}"]`)){const i=document.createElement(t);i.setAttribute(e,op),i.setAttribute("shadow-dom","true"),i.setAttribute(De.CURRENT_LOCATION_SUFFIX,"true"),i.setAttribute(lp,"false"),i.setAttribute(sp,JSON.stringify(cp(hp))),i.setAttribute(ap,JSON.stringify({enable:!0,groupBy:"checkInfo.ruleKey"})),window.document.body.appendChild(i)}}catch(t){console.warn("Error in mountScopedCommentSidebars: ",t),zd("Error in mountScopedCommentSidebars: ",t)}},this.agentsSidebarBusSubscriptions=[],this.lastAgentsSidebarClick=null,this.agentsSidebarBusElement=void 0,this.syncAgentsSidebarBusSubscriptions=()=>{try{const t=this.commentElement,e=this.agentsSidebarMode&&!!t&&"function"==typeof t.on;if(e&&this.agentsSidebarBusElement===t)return;if(this.teardownAgentsSidebarBusSubscriptions(),!e)return;this.agentsSidebarBusElement=t;const i=t.on(fp);i&&"function"==typeof i.subscribe&&this.agentsSidebarBusSubscriptions.push(i.subscribe(this.onAgentsSidebarCommentClick));const n=t.on(mp);n&&"function"==typeof n.subscribe&&this.agentsSidebarBusSubscriptions.push(n.subscribe(this.onAgentsSidebarCommentClick));const o=t.on(wp);o&&"function"==typeof o.subscribe&&this.agentsSidebarBusSubscriptions.push(o.subscribe(this.onAgentsSidebarClose))}catch(t){console.warn("Error in syncAgentsSidebarBusSubscriptions: ",t),zd("Error in syncAgentsSidebarBusSubscriptions: ",t)}},this.teardownAgentsSidebarBusSubscriptions=()=>{try{this.agentsSidebarBusSubscriptions.forEach((t=>{var e;return null===(e=null==t?void 0:t.unsubscribe)||void 0===e?void 0:e.call(t)})),this.agentsSidebarBusSubscriptions=[],this.agentsSidebarBusElement=void 0}catch(t){console.warn("Error in teardownAgentsSidebarBusSubscriptions: ",t)}},this.onAgentsSidebarCommentClick=t=>{try{if(!this.agentsSidebarMode)return;const e=function(t){try{const e=null==t?void 0:t.annotation;if(!e||!e.annotationId&&!e.id)return null;const i=null==t?void 0:t.sidebarId;return i===op||null==i&&pp(e)?e:null}catch(t){return console.warn("Error in readAgentsSidebarClickAnnotation: ",t),null}}(t);if(!e)return;const i=String(e.annotationId||e.id),n=Date.now(),o=this.lastAgentsSidebarClick;if(o&&o.annotationId===i&&n-o.at<1e3)return;this.lastAgentsSidebarClick={annotationId:i,at:n},this.onContentWarningItemClick({detail:{annotation:e}})}catch(t){console.warn("Error in onAgentsSidebarCommentClick: ",t),zd("Error in onAgentsSidebarCommentClick: ",t)}},this.onAgentsSidebarClose=t=>{try{if(!this.agentsSidebarMode||!function(t){try{return(null==t?void 0:t.sidebarId)===op}catch(t){return console.warn("Error in isAgentsSidebarCloseEvent: ",t),!1}}(t))return;this.showContentWarningSidebar&&(this.showContentWarningSidebar=!1)}catch(t){console.warn("Error in onAgentsSidebarClose: ",t)}},this.agentsSidebarOpenApplied=!1,this.syncAgentsSidebarOpenState=()=>{var t,e,i,n,o;try{if(!this.agentsSidebarMode)return;const r=this.commentElement;if(!r)return;const s=this.showContentWarningSidebar&&this.canShowContentWarningSidebar(),a=s?this.getAgentsSidebarDeepLinkFocusId():null;if(s===this.agentsSidebarOpenApplied&&!a)return;if(this.agentsSidebarOpenApplied=s,s){null===(t=r.closeCommentSidebar)||void 0===t||t.call(r),null===(e=r.disableSidebarUrlNavigation)||void 0===e||e.call(r);const n=a;a&&(this.agentsSidebarDeepLinkId=null),null===(i=r.openCommentSidebar)||void 0===i||i.call(r,n?{sidebarId:op,annotationId:n}:{sidebarId:op})}else null===(n=r.closeCommentSidebar)||void 0===n||n.call(r,{sidebarId:op}),null===(o=r.enableSidebarUrlNavigation)||void 0===o||o.call(r)}catch(t){console.warn("Error in syncAgentsSidebarOpenState: ",t),zd("Error in syncAgentsSidebarOpenState: ",t)}},this.onCommentsSidebarButtonClick=()=>{try{if(!this.agentsSidebarMode||!this.showContentWarningSidebar)return;this.showContentWarningSidebar=!1}catch(t){console.warn("Error in onCommentsSidebarButtonClick: ",t)}},this.getAgentsSidebarDeepLinkFocusId=()=>{var t,e;try{const i=this.agentsSidebarDeepLinkId;if(!i)return null;const n=[...(null!==(t=this.agentGroups)&&void 0!==t?t:[]).flatMap((t=>{var e;return null!==(e=null==t?void 0:t.annotations)&&void 0!==e?e:[]})),...null!==(e=this.lastStreamAnnotations)&&void 0!==e?e:[]],o=n.find((t=>Wh(t)===i));return o&&pp(o)?i:null}catch(t){return console.warn("Error in getAgentsSidebarDeepLinkFocusId: ",t),null}},this.maybeOpenAgentsSidebarForDeepLink=()=>{try{if(!this.agentsSidebarMode||!this.canShowContentWarningSidebar())return;if(!this.getAgentsSidebarDeepLinkFocusId())return;if(this.showContentWarningSidebar)return void this.syncAgentsSidebarOpenState();this.showContentWarningSidebar=!0}catch(t){console.warn("Error in maybeOpenAgentsSidebarForDeepLink: ",t),zd("Error in maybeOpenAgentsSidebarForDeepLink: ",t)}},this.setCommentSidebarVisibility=t=>{var e,i,n,o,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===(o=null===(n=this.commentElement)||void 0===n?void 0:n.enableFilterCommentsOnDom)||void 0===o||o.call(n),void(this.showAgentCommentsInSidebar=t);const c=document.querySelector(Re.VELT_COMMENTS_SIDEBAR_LEGACY);if(!c)return;t?(c.removeAttribute(De.SIDEBAR_BUTTON_COUNT_TYPE),c.removeAttribute(De.CUSTOM_ACTIONS),null===(s=null===(r=this.commentElement)||void 0===r?void 0:r.disableFilterCommentsOnDom)||void 0===s||s.call(r)):(c.setAttribute(De.SIDEBAR_BUTTON_COUNT_TYPE,Fe),c.setAttribute(De.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),zd("Error in setCommentSidebarVisibility: ",t)}},this.toggleCommentSidebarVisibility=()=>{try{this.setCommentSidebarVisibility(!this.showAgentCommentsInSidebar),this.menuOpenedId=void 0}catch(t){console.warn("Error in toggleCommentSidebarVisibility: ",t),zd("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),zd("Error in applyPageCommentsVisibility: ",t)}},this.togglePageCommentsVisibility=()=>{try{this.pageCommentsHidden=!this.pageCommentsHidden,this.pageCommentsHidden?od(Kt,"true",!1,"sessionStorage"):sd(Kt,"sessionStorage"),this.applyPageCommentsVisibility(),this.menuOpenedId=void 0}catch(t){console.warn("Error in togglePageCommentsVisibility: ",t),zd("Error in togglePageCommentsVisibility: ",t)}},this.unhidePageCommentsIfHidden=()=>{try{if(!this.pageCommentsHidden)return;this.pageCommentsHidden=!1,sd(Kt,"sessionStorage"),this.applyPageCommentsVisibility()}catch(t){console.warn("Error in unhidePageCommentsIfHidden: ",t)}},this.toggleSidebarV2=()=>{try{od(Ct,this.sidebarV2Enabled?"false":"true",!1,"sessionStorage"),window.location.reload()}catch(t){console.warn("Error in toggleSidebarV2: ",t),zd("Error in toggleSidebarV2: ",t)}},this.toggleVeltProxy=()=>{try{if(!this.veltProxyToggleVisible)return;t=!this.veltProxyEnabled,od(xt,t?"true":"false"),window.location.reload()}catch(t){console.warn("Error in toggleVeltProxy: ",t),zd("Error in toggleVeltProxy: ",t)}var t},this.isScreenshotDisabledHost=()=>{try{return _e.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)=>{Tu()&&"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.onRequestModeAnnotationSaved(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,n,o,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===(n=(i=this.commentElement).disableScreenshot)||void 0===n||n.call(i):(null===(s=null===(r=null===(o=this.customerMetadata)||void 0===o?void 0:o.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()&&(ep()&&"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=rd(Te,!1,"sessionStorage");return"granted"===t||"denied"===t?t:null},this.setNativeScreenshotPermission=t=>{od(Te,t,!1,"sessionStorage"),this.nativeScreenshotDenied="denied"===t},this.clearNativeScreenshotPermission=()=>{sd(Te,"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),zd("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,n=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"===n||"native-not-supported"===n}(t)?console.warn("Native screenshot enable failed/cancelled: ",t):(this.setNativeScreenshotPermission("denied"),Tu()&&"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),zd("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),zd("Error in handleNativeScreenshotStreamEnded: ",t)}},this.restoreSdkScreenshot=()=>{var t,e,i,n,o;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===(o=null===(n=this.commentElement)||void 0===n?void 0:n.enableScreenshot)||void 0===o||o.call(n))},this.onAddCommentAnnotation=async t=>{var e,i,n,o,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!==(n=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!==n?n:null==t?void 0:t.id,h=null!==(l=null!==(a=null!==(r=null===(o=null==t?void 0:t.commentAnnotation)||void 0===o?void 0:o.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),zd("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,n,o,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===(n=null===(i=this.commentElement)||void 0===i?void 0:i.addAttachment)||void 0===n?void 0:n.call(i,{annotationId:t,commentId:e,files:[l]}));if(c&&Array.isArray(c)&&c.length>0&&(null===(o=c[0])||void 0===o?void 0:o.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),zd("Native screenshot capture/attach failed: ",t)}},this.setupSidebarAgentCommentFilter=()=>{var t,e,i,n,o,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.syncAgentsSidebarBusSubscriptions(),this.syncAgentsSidebarOpenState(),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===(n=null===(i=this.commentElement)||void 0===i?void 0:i.disableFilterCommentsOnDom)||void 0===n||n.call(i):null===(r=null===(o=this.commentElement)||void 0===o?void 0:o.enableFilterCommentsOnDom)||void 0===r||r.call(o))}catch(t){console.warn("Error in setupSidebarAgentCommentFilter: ",t),zd("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),zd("Error in agent-warnings hydration subscription: ",t)}}));this.subscriptions.push(e)}catch(t){console.warn("Error in setupAgentWarningsHydration: ",t),zd("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),zd("Error in onContentWarningsButtonClick: ",t)}},this.onContentWarningSidebarClose=()=>{try{this.showContentWarningSidebar=!1}catch(t){console.warn("Error in onContentWarningSidebarClose: ",t)}},this.getOnboardingDismissedProjectIds=()=>{try{const t=rd(zt,!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),zd("Error in getOnboardingDismissedProjectIds: ",t),[]}},this.setOnboardingDismissedProjectIds=t=>{try{const e=t.slice(-20);if(0===e.length)return void sd(zt,"sessionStorage");od(zt,JSON.stringify(e),!1,"sessionStorage")}catch(t){console.warn("Error in setOnboardingDismissedProjectIds: ",t),zd("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),zd("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),zd("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),zd("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),zd("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"===rd(Se,!1,"sessionStorage"),n=new URL(window.location.href).searchParams.has(Jt);if(!i)return;if(!n)return;if(this.allFeatureDisabled||"Admin"!==this.snippylyUserRole)return;this.showContentWarningSidebar=!0}catch(t){console.warn("Error in restoreContentWarningSidebarState: ",t),zd("Error in restoreContentWarningSidebarState: ",t)}},this.navigateTo=t=>{try{window.location.href=t}catch(t){console.warn("Error in navigateTo: ",t),zd("Error in navigateTo: ",t)}},this.onContentWarningSidebarAddAll=()=>{},this.onContentWarningItemClick=t=>{var e,i;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 o=(null==n?void 0:n.annotationId)||(null==n?void 0:n.id),r=null===(i=null==n?void 0:n.pageInfo)||void 0===i?void 0:i.url;if(su(n))return void this.selectAnnotationOnPage(o);if(r&&!this.isCurrentPageUrl(r)){if(this.showContentWarningSidebar&&od(Se,"true",!1,"sessionStorage"),this.isRunningUnderLivePreview()){const t=new URL(r),e=fd(t)?null:md(r),i=null!=e?e:t.pathname,n=null===e?t.search:"",s=this.buildLivePreviewNavigationUrl(`${i}${n}`,o);return void(s&&this.navigateTo(s))}if(this.isRunningUnderPreviewProxy()){return void(!(null!==md(r))&&window.parent&&window.parent!==window&&window.parent.postMessage({type:Zt,url:r,annotationId:o},"*"))}const t=new URL(r);return t.searchParams.set(Jt,o),void this.navigateTo(t.toString())}this.selectAnnotationOnPage(o)}catch(t){console.warn("Error in onContentWarningItemClick: ",t),zd("Error in onContentWarningItemClick: ",t)}},this.buildLivePreviewNavigationUrl=(t,e)=>{try{const i=new URL(t,window.location.origin);return i.origin!==window.location.origin?(console.warn("[CWS Toolbar] Refusing a live preview navigation off this origin:",t),null):(i.searchParams.delete(Ze),i.searchParams.set(Jt,e),i.toString())}catch(t){return console.warn("Error in buildLivePreviewNavigationUrl: ",t),null}},this.selectAnnotationOnPage=t=>{var e;try{(null===(e=this.commentElement)||void 0===e?void 0:e.selectCommentByAnnotationId)&&this.commentElement.selectCommentByAnnotationId(t),setTimeout((()=>{var e;(null===(e=this.commentElement)||void 0===e?void 0:e.scrollToCommentByAnnotationId)&&this.commentElement.scrollToCommentByAnnotationId(t)}),150)}catch(t){console.warn("Error in selectAnnotationOnPage: ",t),zd("Error in selectAnnotationOnPage: ",t)}},this.onContentWarningItemNext=t=>{var e;try{const i=null===(e=null==t?void 0:t.detail)||void 0===e?void 0:e.annotation;if(!i)return;this.navigateToCheckPage(this.resolveFullAnnotation(i),"next")}catch(t){console.warn("Error in onContentWarningItemNext: ",t),zd("Error in onContentWarningItemNext: ",t)}},this.getCurrentCheckPageKey=()=>{var t;try{if(this.isRunningUnderPreviewProxy())return this.previewLocationPath||"/";if(this.autoLocation&&"string"==typeof(null===(t=this.location)||void 0===t?void 0:t.url)&&this.location.url)return this.location.url;const e=new URL(window.location.href);for(const t of[St,Mt,Yt,Jt,le,ce])e.searchParams.delete(t);return`${e.pathname}${this.queryParamsComments?e.search:""}`}catch(t){return console.warn("Error in getCurrentCheckPageKey: ",t),zd("Error in getCurrentCheckPageKey: ",t),window.location.pathname}},this.navigateToCheckPage=(t,e="next")=>{try{const i=au(t);if(i.length<2)return!1;const n=du(i,this.getCurrentCheckPageKey(),e);return!!n&&this.navigateToCheckPageKey(t,n)}catch(t){return console.warn("Error in navigateToCheckPage: ",t),zd("Error in navigateToCheckPage: ",t),!1}},this.navigateToCheckPageKey=(t,e)=>{var i;try{const n=(null==t?void 0:t.annotationId)||(null==t?void 0:t.id);if(!n||!e)return!1;if(this.showContentWarningSidebar&&od(Se,"true",!1,"sessionStorage"),this.isRunningUnderLivePreview()){const t=this.buildLivePreviewNavigationUrl(e,n);return!!t&&(this.navigateTo(t),!0)}if(this.isRunningUnderPreviewProxy()){const o=null===(i=null==t?void 0:t.pageInfo)||void 0===i?void 0:i.url;if("string"!=typeof o||!o||null!==md(o))return!1;if(!window.parent||window.parent===window)return!1;const r=new URL(e,new URL(o).origin);return window.parent.postMessage({type:Zt,url:r.toString(),annotationId:n},"*"),!0}const o=new URL(e,window.location.origin);return o.searchParams.set(Jt,n),this.navigateTo(o.toString()),!0}catch(t){return console.warn("Error in navigateToCheckPageKey: ",t),zd("Error in navigateToCheckPageKey: ",t),!1}},this.resolveFullAnnotation=t=>{var e;try{if(!t||Kh(t))return t;const i=(null==t?void 0:t.annotationId)||(null==t?void 0:t.id);if(!i)return t;const n=t=>((null==t?void 0:t.annotationId)||(null==t?void 0:t.id))===i,o=this.lastStreamAnnotations.find(n);if(Kh(o))return o;for(const t of this.agentGroups){const i=null===(e=null==t?void 0:t.annotations)||void 0===e?void 0:e.find(n);if(Kh(i))return i}return t}catch(e){return console.warn("Error in resolveFullAnnotation: ",e),zd("Error in resolveFullAnnotation: ",e),t}},this.isCurrentPageUrl=t=>{var e;try{const i=null!==(e=md(t))&&void 0!==e?e:new URL(t).pathname;let n=window.location.pathname;return!this.isRunningUnderLivePreview()&&this.isRunningUnderPreviewProxy()&&(n=this.previewLocationPath||"/"),i===n}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,n=null==t?void 0:t.commentAnnotation,o=(null==n?void 0:n.annotationId)||(null==n?void 0:n.id),r="accept-suggestion"===i||"reject-suggestion"===i;if(r&&o&&this.processingAnnotationIds.has(o))return;if(r&&this.isSuggestionActionsHiddenForViewer())return void console.warn("[CWS Toolbar] Only workspace members can accept or reject suggestions. Ignoring:",i);if("prev-suggestion"===i||"next-suggestion"===i){const t="next-suggestion"===i?"next":"prev",e=this.resolveFullAnnotation(n);su(e)&&au(e).length>1?this.navigateToCheckPage(e,t):this.navigateSuggestion(n,t)}else"accept-suggestion"===i&&this.handleAcceptSuggestion(n)}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),zd("Error in setupVeltButtonClickListener: ",t)}},this.navigateSuggestion=(t,e)=>{var i,n,o,r,s;try{if(!t)return void console.warn("[CWS Toolbar] No annotation provided for navigation");const a=null===(n=null===(i=null==t?void 0:t.agent)||void 0===i?void 0:i.result)||void 0===n?void 0:n.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===(o=null==t?void 0:t.pageInfo)||void 0===o?void 0:o.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),zd("Error in navigateSuggestion: ",t)}},this.findMatchingWarning=t=>{var e;try{for(const i of this.agentGroups){const n=null===(e=null==i?void 0:i.warnings)||void 0===e?void 0:e.find((e=>(null==e?void 0:e.primaryText)===t));if(n)return n}return null}catch(t){return console.warn("Error in findMatchingWarning: ",t),null}},this.removeAnnotationFromWarnings=t=>{var e,i,n;try{if(!t)return;const o=e=>{var i,n,o,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===(o=null===(n=null==e?void 0:e.agent)||void 0===n?void 0:n.result)||void 0===o?void 0:o.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),n=e.get(l)||0;n>1?e.set(l,n-1):(e.delete(l),0===e.size&&t.delete(i))}return}}};for(const t of this.agentGroups)(null==t?void 0:t.agentId)!==Le.SPELL_CHECK&&(null==t?void 0:t.agentId)!==Le.GRAMMAR_CHECK||o(t.warnings);const r=null!==(n=null===(i=null===(e=this.agentGroups)||void 0===e?void 0:e.map((e=>{var i,n,o,r,s;const a=null!==(o=null===(n=null===(i=null==e?void 0:e.warnings)||void 0===i?void 0:i.map((e=>{var i;const n=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 n&&0!==n.length?{...e,annotations:n,occurrences:n.length}:null})))||void 0===n?void 0:n.filter((t=>null!==t)))&&void 0!==o?o:[],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!==n?n:[];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.isAgentRunStatusFeedEnabled()&&(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 n=i||document.querySelector(".velt-comment-dialog.selected");if(!n)return;const o=n.querySelector(".sf-accept-btn"),r=n.querySelector(".sf-reject-btn");if(e){const e="accept"===t?o:r,i="accept"===t?r:o;null==e||e.classList.add("sf-btn-loading"),null==i||i.classList.add("sf-btn-disabled")}else null==o||o.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,n;try{const o=(null==t?void 0:t.annotationId)||(null==t?void 0:t.id);if(!o)return void console.warn("[CWS Toolbar] handleAcceptSuggestion: No annotationId found",t);if(this.processingAnnotationIds.has(o))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===(n=this.snippylyUser)||void 0===n?void 0:n.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(o);const a=document.querySelector(".velt-comment-dialog.selected");this.setSuggestionButtonsLoading("accept",!0,a);try{await dh(this.apiKey,this.apiKey,this.documentId+"",o,{userId:r,email:s},this.suggestionCredential()),this.removeAnnotationFromWarnings(o)}finally{this.processingAnnotationIds.delete(o),this.setSuggestionButtonsLoading("accept",!1,a)}}catch(t){console.warn("Error in handleAcceptSuggestion: ",t),zd("Error in handleAcceptSuggestion: ",t)}},this.trackAgentPins=t=>{try{const e=this.agentPinTargets;if(this.agentPinTargets=new Map((t=>{const e=[],i=new Set;for(const n of Array.isArray(t)?t:[]){if("square"!==Ap(n))continue;const t=Wh(n);t&&!i.has(t)&&(i.add(t),e.push({id:t,icon:Ip(n)}))}return e})(t).map((t=>[t.id,t]))),!this.isConnected)return;for(const t of e.keys())if(!this.agentPinTargets.has(t))for(const e of zp(t))Zp(e),this.agentPinDecoratedContainers.delete(e);this.decorateAgentPins(),this.syncAgentPinDomObserver()}catch(t){console.warn("Error in trackAgentPins: ",t),zd("Error in trackAgentPins: ",t)}},this.resyncAgentPins=()=>{try{if(!this.isConnected||0===this.agentPinTargets.size)return;this.decorateAgentPins(),this.syncAgentPinDomObserver()}catch(t){console.warn("Error in resyncAgentPins: ",t),zd("Error in resyncAgentPins: ",t)}},this.decorateAgentPins=()=>{try{if(!this.isConnected)return;const t=new Set,e=new Map;for(const i of this.agentPinTargets.values())for(const n of zp(i.id))"light"===this.decorateAgentPinContainer(n,i,e)&&t.add(i.id);this.agentPinLightDomIds=t,this.writeAgentPinPageCss()}catch(t){console.warn("Error in decorateAgentPins: ",t),zd("Error in decorateAgentPins: ",t)}},this.decorateAgentPinContainer=(t,e,i)=>{let n=i.get(e.icon);void 0===n&&(n=jp(e.icon),i.set(e.icon,n));const o=Up(t);for(const t of o)Bp(t,n);this.agentPinDecoratedContainers.add(t);const r=Wp(t,o);return"unrecognised"===r&&this.noteUnrecognisedAgentPin(t),r},this.noteUnrecognisedAgentPin=t=>{try{if(this.agentPinMarkupReported)return;this.agentPinUnrecognisedContainers.add(t),null===this.agentPinMarkupRecheckTimer&&(this.agentPinMarkupRecheckTimer=setTimeout((()=>this.checkUnrecognisedAgentPins()),Yp.AGENT_PIN_MARKUP_RECHECK_MS))}catch(t){console.warn("Error in noteUnrecognisedAgentPin: ",t)}},this.checkUnrecognisedAgentPins=()=>{try{null!==this.agentPinMarkupRecheckTimer&&(clearTimeout(this.agentPinMarkupRecheckTimer),this.agentPinMarkupRecheckTimer=null);const t=Array.from(this.agentPinUnrecognisedContainers);if(this.agentPinUnrecognisedContainers.clear(),this.agentPinMarkupReported||!this.isConnected)return;for(const e of t){const t=Hp(e);if(!e.isConnected||!this.agentPinTargets.has(t)||"unrecognised"!==Wp(e))continue;this.agentPinMarkupReported=!0;const i=Fp.join(" ");return console.warn(`[Superflow] Agent pin not squared: the SDK rendered pin ${t} with none of the SDK pin internals (${i}). Update SDK_PIN_INTERNALS for this SDK version.`),void zd("Agent pin SDK markup not recognised","SDK pin internals changed",{annotationId:t,selectors:i})}}catch(t){console.warn("Error in checkUnrecognisedAgentPins: ",t)}},this.decoratePendingAgentPins=()=>{try{const t=Array.from(this.agentPinPendingContainers);if(this.agentPinPendingContainers.clear(),!this.isConnected)return;const e=new Map;let i=!1;for(const n of t){if(!n.isConnected||this.agentPinDecoratedContainers.has(n))continue;const t=this.agentPinTargets.get(Hp(n));t&&("light"!==this.decorateAgentPinContainer(n,t,e)||this.agentPinLightDomIds.has(t.id)||(this.agentPinLightDomIds.add(t.id),i=!0))}i&&this.writeAgentPinPageCss()}catch(t){console.warn("Error in decoratePendingAgentPins: ",t),zd("Error in decoratePendingAgentPins: ",t)}},this.writeAgentPinPageCss=()=>{const t=[];for(const e of this.agentPinLightDomIds){const i=this.agentPinTargets.get(e);i&&t.push(i)}const e=(t=>{var e;const i=new Map;for(const n of Array.isArray(t)?t:[]){if(!(null==n?void 0:n.id))continue;const t=null!==(e=i.get(n.icon))&&void 0!==e?e:[];t.push(`#${Op}${Vp(n.id)}`),i.set(n.icon,t)}return Array.from(i.entries()).map((([t,e])=>jp(t,e))).join("\n")})(t);e!==this.agentPinPageCss&&(this.agentPinPageCss=e,document.head&&Bp(document.head,e))},this.scheduleAgentPinDecorate=()=>{try{if(!this.isConnected||0===this.agentPinTargets.size||null!==this.agentPinFrameCancel)return;const t=()=>{this.agentPinFrameCancel=null,this.decoratePendingAgentPins()};if("function"==typeof requestAnimationFrame){const e=requestAnimationFrame(t);this.agentPinFrameCancel=()=>cancelAnimationFrame(e)}else{const e=setTimeout(t,16);this.agentPinFrameCancel=()=>clearTimeout(e)}}catch(t){console.warn("Error in scheduleAgentPinDecorate: ",t),zd("Error in scheduleAgentPinDecorate: ",t)}},this.onAgentPinMutations=t=>{try{if(0===this.agentPinTargets.size)return;const{added:e,changed:i}=(t=>{const e=new Set,i=new Set;try{for(const n of Array.isArray(t)?t:[]){const t=null==n?void 0:n.addedNodes;if(!t||0===t.length)continue;let o=!1;for(let i=0;i<t.length;i+=1){const n=t[i];if(1!==n.nodeType)continue;o=!0;const r=n;Hp(r)?e.add(r):Rp.includes(r.localName)&&r.querySelectorAll(Lp).forEach((t=>e.add(t)))}const r=n.target;if(!o||!r||1!==r.nodeType)continue;const s=r.closest(Lp);s&&i.add(s)}}catch{}return{added:Array.from(e),changed:Array.from(i)}})(t);let n=!1;for(const t of i)this.agentPinTargets.has(Hp(t))&&(this.agentPinDecoratedContainers.delete(t),this.agentPinPendingContainers.add(t),n=!0);for(const t of e)!this.agentPinDecoratedContainers.has(t)&&this.agentPinTargets.has(Hp(t))&&(this.agentPinPendingContainers.add(t),n=!0);n&&this.scheduleAgentPinDecorate()}catch(t){console.warn("Error in onAgentPinMutations: ",t),zd("Error in onAgentPinMutations: ",t)}},this.syncAgentPinDomObserver=()=>{var t;try{if(!this.isConnected||0===this.agentPinTargets.size)return null===(t=this.agentPinDomObserver)||void 0===t||t.disconnect(),void(this.agentPinDomObserver=null);if(this.agentPinDomObserver||"undefined"==typeof MutationObserver||!document.body)return;this.agentPinDomObserver=new MutationObserver((t=>this.onAgentPinMutations(t))),this.agentPinDomObserver.observe(document.body,{childList:!0,subtree:!0})}catch(t){console.warn("Error in syncAgentPinDomObserver: ",t),zd("Error in syncAgentPinDomObserver: ",t)}},this.teardownAgentPins=()=>{var t,e;try{null===(t=this.agentPinDomObserver)||void 0===t||t.disconnect(),this.agentPinDomObserver=null,null===(e=this.agentPinFrameCancel)||void 0===e||e.call(this),this.agentPinFrameCancel=null,this.agentPinPendingContainers.clear(),null!==this.agentPinMarkupRecheckTimer&&(clearTimeout(this.agentPinMarkupRecheckTimer),this.agentPinMarkupRecheckTimer=null),this.agentPinUnrecognisedContainers.clear(),this.agentPinLightDomIds=new Set,this.agentPinPageCss="",document.head&&Bp(document.head,"");for(const t of this.agentPinTargets.values())for(const e of zp(t.id))Zp(e);this.agentPinDecoratedContainers=new WeakSet}catch(t){console.warn("Error in teardownAgentPins: ",t),zd("Error in teardownAgentPins: ",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),zd("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),zd("Error in disableAddCommentMode: ",t)}},this.disableCommentModeButton=()=>{try{return this.addCommentMode?L`
|
|
6568
|
+
`:null,this.isRequestMode=()=>{try{return function(t){try{if(!t||!0!==t.requestModeSwitch||_d(t))return!1;const e=t.user;return!(!e||"object"!=typeof e||!0===e.isAnonymous||!0===e.isGuest)&&"string"==typeof t.role&&""!==t.role&&"Admin"!==t.role}catch(t){return console.warn("Error in decideRequestMode: ",t),!1}}({requestModeSwitch:this.requestModeSwitch,user:this.snippylyUser,role:this.snippylyUserRole,embedMode:this.embedMode,readOnlyMode:this.readOnlyMode,onboardingMode:this.onboardingMode,agentStatusMode:this.agentStatusMode,passwordPending:this.passwordProtected&&!this.isPasswordValid})}catch(t){return console.warn("Error in isRequestMode: ",t),!1}},this.isSignedOutRequestMode=()=>{try{return function(t){try{return!(!t||!0!==t.requestModeSwitch||t.loading||_d(t)||t.user&&"object"==typeof t.user)}catch(t){return console.warn("Error in decideSignedOutRequestMode: ",t),!1}}({requestModeSwitch:this.requestModeSwitch,user:this.snippylyUser,loading:!!this.loading,embedMode:this.embedMode,readOnlyMode:this.readOnlyMode,onboardingMode:this.onboardingMode,agentStatusMode:this.agentStatusMode,passwordPending:this.passwordProtected&&!this.isPasswordValid})}catch(t){return console.warn("Error in isSignedOutRequestMode: ",t),!1}},this.canShowRequestTools=()=>{try{return this.isToolbarStateResolved()&&this.canShowCollaborationTools()}catch(t){return console.warn("Error in canShowRequestTools: ",t),!1}},this.onRequestSignInClick=t=>{try{try{Hd(vt.Events.REQUEST_MODE_SIGN_IN_CLICKED,t?{projectId:this.projectId,source:t}:{projectId:this.projectId})}catch(t){console.warn("Error tracking requestModeSignInClicked: ",t)}this.loginWithGoogle()}catch(t){console.warn("Error in onRequestSignInClick: ",t),zd("Error in onRequestSignInClick: ",t)}},this.onRequestBadgeClick=()=>{try{if(this.isSignedOutRequestMode()&&this.requestMenuItems(!1).signIn)return this.storeRequestResumeMarker(),void this.onRequestSignInClick("badge");this.openRequestToolbar()}catch(t){console.warn("Error in onRequestBadgeClick: ",t),zd("Error in onRequestBadgeClick: ",t)}},this.openRequestToolbar=(t=!0)=>{try{this.requestToolbarExpanded=!0,this.isRequestStateLoading()?this.requestCommentModePending="click":(this.requestCommentModePending=null,t&&this.canEnterRequestCommentMode()&&this.enterRequestCommentMode());try{Hd(vt.Events.REQUEST_MODE_OPENED,{projectId:this.projectId})}catch(t){console.warn("Error tracking requestModeOpened: ",t)}this.focusRequestControl('[data-testid="sf-request-collapse"]')}catch(t){console.warn("Error in openRequestToolbar: ",t),zd("Error in openRequestToolbar: ",t)}},this.isRequestStateLoading=()=>{try{return!(!this.snippylyUser||"object"!=typeof this.snippylyUser||this.isToolbarStateResolved()&&"waiting"!==this.commentsDisabledSetting)}catch(t){return console.warn("Error in isRequestStateLoading: ",t),!1}},this.canEnterRequestCommentMode=()=>{var t;try{return this.canShowRequestTools()&&!this.readOnlyMode&&"function"==typeof(null===(t=this.commentElement)||void 0===t?void 0:t.enableCommentMode)}catch(t){return console.warn("Error in canEnterRequestCommentMode: ",t),!1}},this.enterRequestCommentMode=()=>{try{this.commentElement.enableCommentMode()}catch(t){console.warn("Error enabling comment mode from the request badge: ",t)}},this.resolvePendingRequestOpen=()=>{try{const t=this.requestCommentModePending;if(!t||!this.isToolbarStateResolved()||"waiting"===this.commentsDisabledSetting)return;if(this.requestCommentModePending=null,!this.isRequestMode())return;this.applyFirstConfigCommentsDisabled();const e="known"===this.commentsDisabledSetting;if("resume"===t)return void(this.requestToolbarExpanded||this.openRequestToolbar(e));e&&this.requestToolbarExpanded&&this.canEnterRequestCommentMode()&&this.enterRequestCommentMode()}catch(t){console.warn("Error in resolvePendingRequestOpen: ",t),zd("Error in resolvePendingRequestOpen: ",t)}},this.requestMenuItems=t=>function(t){try{return!t||t.customLogin?{signIn:!1,signOut:!1}:t.signedIn?{signIn:!1,signOut:!0}:{signIn:!t.invalidApiKey,signOut:!1}}catch(t){return console.warn("Error in decideRequestMenu: ",t),{signIn:!1,signOut:!1}}}({signedIn:t,customLogin:!!this.customLoginEnabledLocally,invalidApiKey:!!this.invalidApiKey}),this.storeRequestResumeMarker=()=>{try{window.sessionStorage.setItem($d,(t={apiKey:this.apiKey,projectId:this.projectId,now:Date.now()},JSON.stringify({v:1,apiKey:t.apiKey||"",projectId:t.projectId||"",expiresAt:t.now+6e5})))}catch(t){console.warn("Error storing the request-mode resume marker: ",t)}var t},this.consumeRequestResumeMarker=()=>{try{let t=null;try{t=window.sessionStorage.getItem($d),null!==t&&window.sessionStorage.removeItem($d)}catch(t){return}if(null===t||!this.requestModeSwitch)return;(function(t,e){try{if("string"!=typeof t||!t)return!1;const i=JSON.parse(t);return!!i&&1===i.v&&!!e.apiKey&&i.apiKey===e.apiKey&&!!e.projectId&&i.projectId===e.projectId&&"number"==typeof i.expiresAt&&i.expiresAt>e.now}catch(t){return!1}})(t,{apiKey:this.apiKey,projectId:this.projectId,now:Date.now()})&&(this.requestCommentModePending="resume",this.resolvePendingRequestOpen())}catch(t){console.warn("Error in consumeRequestResumeMarker: ",t)}},this.onRequestCollapseClick=()=>{try{this.closeRequestMenu(),this.requestToolbarExpanded=!1,this.requestCommentModePending=null,this.focusRequestControl('[data-testid="sf-request-badge"]')}catch(t){console.warn("Error in onRequestCollapseClick: ",t),zd("Error in onRequestCollapseClick: ",t)}},this.focusRequestControl=t=>{try{this.updateComplete.then((()=>{var e,i,n,o;try{null===(o=null===(n=null===(i=null===(e=this.renderRoot)||void 0===e?void 0:e.querySelector)||void 0===i?void 0:i.call(e,t))||void 0===n?void 0:n.focus)||void 0===o||o.call(n)}catch(t){console.warn("Error focusing the request toolbar: ",t)}})).catch((t=>console.warn("Error waiting to focus the request toolbar: ",t)))}catch(t){console.warn("Error in focusRequestControl: ",t)}},this.onRequestMenuButtonClick=()=>{try{if(this.requestMenuOpen)return void this.closeRequestMenu();this.requestMenuOpen=!0,this.attachRequestMenuListeners()}catch(t){console.warn("Error in onRequestMenuButtonClick: ",t),zd("Error in onRequestMenuButtonClick: ",t)}},this.closeRequestMenu=()=>{try{this.requestMenuOpen=!1,this.detachRequestMenuListeners()}catch(t){console.warn("Error in closeRequestMenu: ",t)}},this.onRequestMenuSignOutClick=()=>{try{this.closeRequestMenu(),this.signOutUser()}catch(t){console.warn("Error in onRequestMenuSignOutClick: ",t),zd("Error in onRequestMenuSignOutClick: ",t)}},this.onRequestMenuSignInClick=()=>{try{this.closeRequestMenu(),this.onRequestSignInClick()}catch(t){console.warn("Error in onRequestMenuSignInClick: ",t),zd("Error in onRequestMenuSignInClick: ",t)}},this.attachRequestMenuListeners=()=>{try{if(this.requestMenuListenersAttached)return;this.requestMenuListenersAttached=!0,document.addEventListener("pointerdown",this.onRequestMenuOutsidePointer,!0),document.addEventListener("keydown",this.onRequestMenuKeydown,!0)}catch(t){console.warn("Error in attachRequestMenuListeners: ",t)}},this.detachRequestMenuListeners=()=>{try{if(!this.requestMenuListenersAttached)return;this.requestMenuListenersAttached=!1,document.removeEventListener("pointerdown",this.onRequestMenuOutsidePointer,!0),document.removeEventListener("keydown",this.onRequestMenuKeydown,!0)}catch(t){console.warn("Error in detachRequestMenuListeners: ",t)}},this.onRequestMenuOutsidePointer=t=>{try{const e="function"==typeof t.composedPath?t.composedPath():[];e.some((t=>{const e=t;return!!(null==e?void 0:e.getAttribute)&&"true"===e.getAttribute("data-request-menu-area")}))||this.closeRequestMenu()}catch(t){console.warn("Error in onRequestMenuOutsidePointer: ",t)}},this.onRequestMenuKeydown=t=>{try{if("Escape"!==t.key||!this.requestMenuOpen)return;this.closeRequestMenu(),this.focusRequestControl('[data-testid="sf-request-menu-button"]')}catch(t){console.warn("Error in onRequestMenuKeydown: ",t)}},this.syncRequestMode=()=>{try{if(!this.isRequestMode())return;if(this.applyFirstConfigCommentsDisabled(),!this.commentElement)return;this.applyRequestModeToCommentElement(),this.ensureAddCommentAnnotationSubscription(),this.requestModeLoadedTracked||(this.requestModeLoadedTracked=!0,Hd(vt.Events.REQUEST_MODE_LOADED,{projectId:this.projectId}))}catch(t){console.warn("Error in syncRequestMode: ",t),zd("Error in syncRequestMode: ",t)}},this.applyFirstConfigCommentsDisabled=()=>{try{!0===this.firstConfigCommentsDisabled&&!this.allFeatureDisabled&&this.isRequestMode()&&(this.allFeatureDisabled=!0)}catch(t){console.warn("Error in applyFirstConfigCommentsDisabled: ",t)}},this.applyRequestModeToCommentElement=()=>{try{const t=this.commentElement;if(!t||t===this.requestContextProviderElement||"function"!=typeof t.setContextProvider)return;this.requestContextProviderElement=t,t.setContextProvider((()=>this.isRequestMode()?function(t){let e="string"==typeof t?t:"";try{const t=new URL(e);t.searchParams.delete("sf_review"),e=t.toString()}catch(t){}return{sf:{type:"request",visibility:"client",pageUrl:e}}}(window.location.href):void 0))}catch(t){console.warn("Error in applyRequestModeToCommentElement: ",t),zd("Error in applyRequestModeToCommentElement: ",t)}},this.onRequestModeAnnotationSaved=t=>{try{if(!this.isRequestMode())return;const{annotationId:e,stamp:i}=function(t){try{const e=t&&"object"==typeof t?t:{},i=e.commentAnnotation&&"object"==typeof e.commentAnnotation?e.commentAnnotation:null,n="string"==typeof e.annotationId&&e.annotationId?e.annotationId:null==i?void 0:i.annotationId,o="string"==typeof n&&n?n:null,r=null==i?void 0:i.context;if(null==r)return{annotationId:o,stamp:"missing"};const s="object"==typeof r?r.sf:void 0;return{annotationId:o,stamp:"request"===(s&&"object"==typeof s?s.type:void 0)?"request":"other"}}catch(t){return console.warn("Error in readSavedAnnotation: ",t),{annotationId:null,stamp:"other"}}}(t),n=!!this.commentElement&&this.requestContextProviderElement===this.commentElement;if(!e||!("request"===i||"missing"===i&&n))return;if(!this.notifyAddedRequest(e))return;try{Hd(vt.Events.REQUEST_ADDED,{projectId:this.projectId})}catch(t){console.warn("Error tracking requestAdded: ",t)}}catch(t){console.warn("Error in onRequestModeAnnotationSaved: ",t)}},this.identifySnippyly=async()=>{var t,e,i,n;let o="",r="",s=!1;try{this.invalidApiKey=!1;let n={name:"Default User",email:"default@usesuperflow.com",userId:"default",isAnonymous:!0,organizationId:this.apiKey};const a=this.isRunningUnderLivePreview(),l=a?this.readLiveSignIn():null;let c;c=a?l?{...l.user}:null:this.customLoginEnabled&&this.providedUser?this.providedUser:dd(),ia("[Superflow][identify] resolved user (pre-iam)",{source:a?l?"liveSignIn":"liveGuest":this.customLoginEnabled&&this.providedUser?"providedUser":"token",email:null==c?void 0:c.email,userId:null==c?void 0:c.userId,name:null==c?void 0:c.name,isAnonymous:null==c?void 0:c.isAnonymous});const d=await this.getSamlConfig(),h=new URL(document.location);if(h.searchParams.has(Xt)&&h.searchParams.delete(Xt),d&&(this.signInUrl=`${Qe}saml/${d.slug}/login?redirect_url=${encodeURIComponent(null==h?void 0:h.toString())}&source=sf`,window.Superflow.signInUrl=this.signInUrl),((null==c?void 0:c.email)||a&&(null==c?void 0:c.userId))&&(n=c),n.isAnonymous)delete n.groupId;else{const t=Velt.getDocumentId()||this.serverDocumentId;t&&(n.groupId=t+"")}if(this.customLoginEnabledLocally||(null===(t=null==n?void 0:n.contacts)||void 0===t?void 0:t.length)&&(n.contacts=[]),o=null==n?void 0:n.email,r=null==n?void 0:n.userId,(null==n?void 0:n.isAnonymous)&&this.projectId&&(this.guestMode||a)){const t=ud(!0,this.apiKey);t&&(n=JSON.parse(JSON.stringify(t)))}(null==n?void 0:n.isAnonymous)||(this.loading=!0);const u={};(null==n?void 0:n.groupId)&&(u.groupId=null==n?void 0:n.groupId),n.organizationId=this.apiKey;const p=await Wd(this.apiKey,this.projectId||"",null==n?void 0:n.email,null==n?void 0:n.userId),v=null==p?void 0:p.isAdmin;this.snippylyUserRole=v?"Admin":"Commenter",this.suggestionRoleLookupFailed="boolean"!=typeof v,this.suggestionViewerRoleResolved=!0,s=!0,this.applySuggestionActionStyles(),ia("[Superflow][identify] iamResponse",p,{isAdminUser:v,snippylyUserRole:this.snippylyUserRole,email:null==n?void 0:n.email,userId:null==n?void 0:n.userId});const g=!(a||this.customLoginEnabled&&this.providedUser);this.identityCameFromToken=g,this.identityLiveSignIn=l;const f=((t,e)=>!(!e||(null==t?void 0:t.isAnonymous)||(null==t?void 0:t.isGuest)||!(null==t?void 0:t.userId)))(n,g),m=f&&((t,e)=>{try{if(!t||!e)return!1;const i=!!e.name&&e.name!==t.name,n=!!e.photoUrl&&e.photoUrl!==t.photoUrl;return ia("[Superflow][identity] hasProfileChanged",{nameChanged:i,photoChanged:n,localName:t.name,savedName:e.name,localPhotoUrl:t.photoUrl,savedPhotoUrl:e.photoUrl}),i||n}catch(t){return console.warn("Error in hasProfileChanged: ",t),zd("Error in hasProfileChanged: ",t),!1}})(n,p);if(ia("[Superflow][identify] enrichment gate",{cameFromToken:g,willEnrichIdentity:f,profileChanged:m,forceReset:m,isAnonymous:null==n?void 0:n.isAnonymous,isGuest:null==n?void 0:n.isGuest,userId:null==n?void 0:n.userId,nameBefore:null==n?void 0:n.name}),f&&(n=((t,e)=>t&&e?{...t,name:e.name||t.name,photoUrl:e.photoUrl||t.photoUrl}:t)(n,p),ia("[Superflow][identify] enriched user",{nameAfter:null==n?void 0:n.name,photoUrl:null==n?void 0:n.photoUrl})),v&&(u.isAdmin=v,v&&this.allFeatureDisabled&&(this.allFeatureDisabled=!1)),this.restoreContentWarningSidebarState(),!this.projectDeleted&&(null==n?void 0:n.userId)&&!(null==n?void 0:n.isGuest)&&!(null==n?void 0:n.isAnonymous)&&this.documentId)try{await rh(this.apiKey,this.documentId,n.userId,n.name,n.email,this.credentialFor(n,g))}catch(t){zd("checkDocumentUserAndCreateError",t)}ia("[Superflow][identify] setVeltAuthProvider options",{forceReset:m,profileChanged:m,userName:null==n?void 0:n.name,userId:null==n?void 0:n.userId});const[w]=await Promise.all([Velt.setVeltAuthProvider({user:n,options:{throwError:!0,forceReset:m},retryConfig:{retryCount:3,retryDelay:1e3},generateToken:async()=>{if(this.fallBackToGuestIfLiveSignInExpired(l))return null;const t=this.credentialFor(n,g),e=await Xd(this.apiKey,null==n?void 0:n.userId,u,t);return this.applyServerAdminDecision(null==e?void 0:e.isAdmin),null==e?void 0:e.token},onError:t=>{console.log("Error signing to velt - ",t),this.fallBackToGuestIfLiveSignInExpired(l)||(this.invalidApiKey=!0)}}),this.fetchAndApplyFeatureAccess()]);if(this.hasAgentAccess&&this.insertShadowDOM(),this.invalidApiKey)throw"Invalid Api Key - Domain Not Whitelisted";f&&((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=ld(JSON.stringify(e),ti,ei);od(te,i,!0)}catch(t){console.warn("Error in saveUserToken: ",t),zd("Error in saveUserToken: ",t)}})(n),ia("[Superflow][identify] token rewritten post-signin, re-read",{persistedName:null===(e=dd())||void 0===e?void 0:e.name})),ia("[Superflow][identify] velt auth response",{name:null==w?void 0:w.name,email:null==w?void 0:w.email,userId:null==w?void 0:w.userId,userSnippylyId:null==w?void 0:w.userSnippylyId,tokenUserProperties:u}),Ud(JSON.parse(JSON.stringify(w||{}))),(null==n?void 0:n.isAnonymous)||(this.snippylyUser=JSON.parse(JSON.stringify(n)),ia("[Superflow][identify] this.snippylyUser (rendered) name",null===(i=this.snippylyUser)||void 0===i?void 0:i.name)),this.syncRequestMode();const y=JSON.parse(JSON.stringify(w||{}));if((null==y?void 0:y.userSnippylyId)&&!(null==y?void 0:y.isGuest)&&this.checkToMigrateGuestUser(y,this.credentialFor(y,g)),Velt.getUserRole$().subscribe((t=>{var e;t&&(this.loading=!1,null===(e=this.commentElement)||void 0===e||e.enablePriority(),this.applyCheckPriorities())})),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),zd("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),zd("Error in getDocumentMetadata: ",t)})))}))}jd({clientUserId:null==n?void 0:n.userId});try{Bd(n)}catch(t){console.warn("Error in trackIdentifyEvent: ",t)}this.getComments(),this.checkGlobalUserContact(),this.showFirstCommentNudge(),setTimeout((()=>{rd(he)||this.autoCommentModeArmedOnce||(this.showTourCommentTooltip=!0)}),2e3)}catch(t){if(this.loading=!1,this.signInError=!0,s||this.resolveSuggestionRoleAsLookupFailed(),t&&"string"==typeof t&&(null===(n=null==t?void 0:t.toLowerCase())||void 0===n?void 0:n.includes("invalid"))){this.invalidApiKey=!0,Hd(vt.Events.DOMAIN_NOT_WHITELISTED),this.projectId&&Gd(this.apiKey,this.projectId);if(new URL(document.location).searchParams.has(le))this.isSigningInUserAdmin=!0;else if(rd(ue))this.isSigningInUserAdmin="true"===rd(ue,!0);else{const t=await Wd(this.apiKey,this.projectId||"",o,r);this.isSigningInUserAdmin=!!(null==t?void 0:t.isAdmin),od(ue,this.isSigningInUserAdmin+"",!0)}}console.warn("Error in identifySnippyly: ",t),zd("Error in identifySnippyly: ",t)}},this.handleDocumentMetadataUpdate=async t=>{try{if(!t)return;const e=await Zd(this.apiKey,null==t?void 0:t.clientDocumentId);gd(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),zd("Error in handleDocumentMetadataUpdate: ",t)}},this.lockForDeletedProject=()=>{this.projectDeleted=!0,this.applyVeltFeatureGates(),this.unmountVeltCollaborationElements()},this.fetchAndApplyFeatureAccess=async()=>{var t,e;try{const i=await ah(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 n=null===(t=this.featureAccess)||void 0===t?void 0:t[sh.Agents];this.hasAgentAccess=!0===(null==n?void 0:n.hasAccess);const o=null===(e=this.featureAccess)||void 0===e?void 0:e[sh.WorkspacePrivateComments];this.hasPrivateCommentsAccess=!0===(null==o?void 0:o.hasAccess),this.isPrivateCommentsEnabledOnWorkspace=!0===(null==o?void 0:o.isPrivateCommentsEnabled),!this.canShowPrivateCommentToggle&&this.privateCommentModeEnabled&&(this.disablePrivateCommentModeOnCommentElement(),this.privateCommentModeEnabled=!1,od(we,"false")),this.maybeApplyVisibilityOptionsToCommentElement()}catch(t){console.warn("Error in fetchAndApplyFeatureAccess: ",t),zd("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(`${Re.VELT_COMMENTS_SIDEBAR_LEGACY}, ${Re.VELT_COMMENTS_SIDEBAR_V2}`);e&&e.setAttribute("shadow-dom","true")}catch(t){console.warn("Error in insertShadowDOM: ",t),zd("Error in insertShadowDOM: ",t)}},this.applyStorageFeatureAccess=()=>{try{if(!this.featureAccess||!this.commentElement)return;const t=this.featureAccess[sh.Storage];(null==t?void 0:t.hasUsageExhausted)&&(this.commentElement.disableAttachments(),this.commentElement.setRecordings("none"))}catch(t){zd("Error in applyStorageFeatureAccess: ",t)}},this.checkToMigrateGuestUser=async(t,e)=>{try{const i=ud(!1,this.apiKey);if(i){const n=`${oe}:${i.userId}:${null==t?void 0:t.userId}`,o=rd(n,!1,"sessionStorage");if("with-credential"===o||"without-credential"===o&&!e)return;const r=await th(this.apiKey,this.projectId||"",i,t,!0,e);if(!1===(null==r?void 0:r.success))return console.warn("[CWS Toolbar] Guest migration refused; keeping the guest user:",null==r?void 0:r.reason),void od(n,e?"with-credential":"without-credential",!1,"sessionStorage");sd(n,"sessionStorage"),sd(ne)}}catch(t){console.warn("Error in checkToMigrationGuestUser: ",t),zd("Error in checkToMigrationGuestUser: ",t)}},this.getComments=()=>{try{this.commentElement&&this.commentSubscription&&this.commentSubscription.unsubscribe()}catch(t){console.warn("Error in getComments: ",t),zd("Error in getComments: ",t)}},this.handleCommentSelection=t=>{var e,i,n,o,r,s,a,l,c,d,h;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 u=null==t?void 0:t.annotation;if(!u||!this.isAgentAnnotation(u))return void(null===(i=null===Velt||void 0===Velt?void 0:Velt.setUiState)||void 0===i||i.call(Velt,{showButtons:!1}));const p=this.resolveFullAnnotation(u);if(su(p))return void(null===(n=null===Velt||void 0===Velt?void 0:Velt.setUiState)||void 0===n||n.call(Velt,{showButtons:au(p).length>1,warningType:"site"}));const v=null===(r=null===(o=null==u?void 0:u.agent)||void 0===o?void 0:o.result)||void 0===r?void 0:r.incorrectWord,g=(null===(s=null==u?void 0:u.pageInfo)||void 0===s?void 0:s.path)||(null===(a=null==u?void 0:u.location)||void 0===a?void 0:a.path)||(null===(l=null==u?void 0:u.agent)||void 0===l?void 0:l.path);if(!v||!g)return void(null===(c=null===Velt||void 0===Velt?void 0:Velt.setUiState)||void 0===c||c.call(Velt,{showButtons:!1}));const f=this.normalizePagePath(g),m=v,w=null===(h=null===(d=null==u?void 0:u.agent)||void 0===d?void 0:d.result)||void 0===h?void 0:h.type;let y,b="";"grammar"===w?(y=this.grammarSuggestionPagePathMap,b="grammar"):(y=this.spellingSuggestionPagePathMap,b="spelling");const C=null==y?void 0:y.get(m);((null==C?void 0:C.get(f))||0)<=1?Velt.setUiState({showButtons:!1,warningType:b}):Velt.setUiState({showButtons:!0,warningType:b})}catch(t){console.warn("Error in handleCommentSelection: ",t),zd("Error in handleCommentSelection: ",t)}},this.processAgentComments=t=>{var e,i,n;try{const o=Array.isArray(t)?t:[];this.trackAgentPins(o),o.length&&!this.agentNamesFetched&&this.apiKey&&this.fetchAgentNames();const r=o.filter((t=>this.isAgentAnnotation(t)&&!iu(t)));if(this.sidebarV2Enabled&&!this.showAgentCommentsInSidebar&&0===r.length&&this.agentGroups.length>0){const t=new Set(this.agentGroups.flatMap((t=>{var e;return null!==(e=null==t?void 0:t.annotations)&&void 0!==e?e:[]})).map(Wh));for(const e of o){const i=Wh(e);i&&t.has(i)&&iu(e)&&this.removeAnnotationFromWarnings(i)}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 n=s.get(i);n?n.push(t):s.set(i,[t])}const a=[],l=new Map,c=new Map;for(const[t,e]of s){const o=this.isCustomAgent((null===(n=null===(i=e[0])||void 0===i?void 0:i.agent)||void 0===n?void 0:n.agentFields)||[]),r=this.resolveAgentGroupName(t,e),{warnings:s,warningCount:d}=this.buildAgentWarnings(t,e,l,c);a.push({agentId:t,agentName:r,isCustom:o,warningCount:d,warnings:s,annotations:e})}if(a.sort(((t,e)=>e.warningCount-t.warningCount)),this.agentGroups=a,this.isAgentRunStatusFeedEnabled())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),zd("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(Oe.AGENT))return e.substring(Oe.AGENT.length);return null}catch(t){return console.warn("Error in extractAgentId: ",t),null}},this.isCustomAgent=t=>{try{return!!Array.isArray(t)&&t.includes(Oe.AGENT_TYPE_CUSTOM)}catch(t){return console.warn("Error in isCustomAgent: ",t),!1}},this.resolveAgentGroupName=(t,e)=>{var i;try{return Mp(null===(i=this.agentNameMap)||void 0===i?void 0:i.get(t),e)||this.getAgentNameFromId(t)}catch(e){return console.warn("Error in resolveAgentGroupName: ",e),zd("Error in resolveAgentGroupName: ",e),this.getAgentNameFromId(t)}},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),Ht}},this.getAgentNameFromId=t=>{try{return t&&/^[a-z]+(-[a-z]+)*$/.test(t)?t.split("-").map((t=>`${t.charAt(0).toUpperCase()}${t.slice(1)}`)).join(" "):Ht}catch(t){return console.warn("Error in getAgentNameFromId: ",t),Ht}},this.fetchAgentNames=async()=>{var t,e,i;try{this.agentNamesFetched=!0;const{getAgents:n}=await Promise.resolve().then((function(){return ph})),o=await n(this.apiKey),r=new Map;for(const i of o){const n=null!==(t=null==i?void 0:i.id)&&void 0!==t?t:"",o=null!==(e=null==i?void 0:i.name)&&void 0!==e?e:"";n&&o&&r.set(n,o)}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.resolveAgentGroupName(t.agentId,t.annotations)})));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 n=("string"==typeof(null==t?void 0:t.name)&&t.name.length>0?t.name:this.resolveAgentDisplayName(i)).slice(0,80),o="string"==typeof(null==t?void 0:t.status)&&Ut.includes(t.status),r=!0!==(null==t?void 0:t.terminal)&&!o,s=null==t?void 0:t.findings,a="number"==typeof s&&Number.isFinite(s)&&s>=0?Math.floor(s):0;e.push(o?{agentId:i,agentName:n,isRunning:r,findingsCount:a,failed:!0}:{agentId:i,agentName:n,isRunning:r,findingsCount:a})}return e}catch(t){return console.warn("Error in sanitiseAgentRunStatusRows: ",t),zd("Error in sanitiseAgentRunStatusRows: ",t),[]}},this.getPortalOrigins=()=>{try{if(this.portalOrigins)return this.portalOrigins;const t=new Set;for(const e of[Qe,Xe])try{const{origin:i,hostname:n,protocol:o}=new URL(e);t.add(i),n.endsWith(".firebaseapp.com")?t.add(`${o}//${n.replace(/\.firebaseapp\.com$/,".web.app")}`):n.endsWith(".web.app")&&t.add(`${o}//${n.replace(/\.web\.app$/,".firebaseapp.com")}`)}catch{}return this.portalOrigins=[...t],this.portalOrigins}catch(t){return console.warn("Error in getPortalOrigins: ",t),zd("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),zd("Error in isFramedByPortal: ",t),!1}},this.isAgentRunStatusFeedEnabled=()=>this.onboardingMode||this.agentStatusMode,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),zd("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.isAgentRunStatusFeedEnabled()||!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.onboardingMode&&this.startOnboardingViewportListener(),window.parent.postMessage({type:Ft},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,jt-t))}}else this.armAgentRunStatusWatchdog(2e4);this.ensureOnboardingFindingsLoaded()}catch(t){console.warn("Error in startAgentRunStatusListener: ",t),zd("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),zd("Error in stopAgentRunStatusListener: ",t)}},this.onAgentRunStatusMessage=t=>{try{if(!this.isAgentRunStatusFeedEnabled())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)===Pt)return void this.postOnboardingDiagnostics(t.origin);if((null==e?void 0:e.type)!==Dt||!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(jt):this.agentRunStatusSettled&&this.clearAgentRunStatusWatchdog(),this.ensureOnboardingFindingsLoaded()}catch(t){console.warn("Error in onAgentRunStatusMessage: ",t),zd("Error in onAgentRunStatusMessage: ",t)}},this.postOnboardingDiagnostics=t=>{var e,i,n,o,r,s;try{if(!this.isAgentRunStatusFeedEnabled()||!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:Vt,at:(new Date).toISOString(),version:gt,identity:{hasUser:!!this.snippylyUser,isGuest:!!(null===(i=this.snippylyUser)||void 0===i?void 0:i.isGuest),isAnonymous:!!(null===(n=this.snippylyUser)||void 0===n?void 0:n.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!==(o=this.lastStreamAnnotations)&&void 0!==o?o:[]).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),zd("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),zd("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),zd("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.isAgentRunStatusFeedEnabled())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),zd("Error in getDisplayAgentRunStatuses: ",t),this.agentRunStatuses}},this.ensureOnboardingFindingsLoaded=()=>{try{if(!this.isAgentRunStatusFeedEnabled()||!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),zd("Error in ensureOnboardingFindingsLoaded: ",t)}},this.clearOnboardingFindingsFetch=()=>{try{null!==this.onboardingFindingsFetchTimer&&(clearTimeout(this.onboardingFindingsFetchTimer),this.onboardingFindingsFetchTimer=null)}catch(t){console.warn("Error in clearOnboardingFindingsFetch: ",t),zd("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.isAgentRunStatusFeedEnabled())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=Bt.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.isAgentRunStatusFeedEnabled())return;if(null===(null==i?void 0:i.data)||void 0===(null==i?void 0:i.data))this.onboardingLastFetchCount=0,this.onboardingLastFetchError=Bt.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=Bt.FETCH_THREW,console.warn("Error in fetchOnboardingFindings: ",t),zd("Error in fetchOnboardingFindings: ",t),this.ensureOnboardingFindingsLoaded(),this.requestUpdate()}},this.applyOnboardingFetchResult=t=>{var e,i;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)})),o=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 r=!iu(t);o.set(n,null!==(i=o.get(n))&&void 0!==i&&i||r)}for(const[t,e]of o)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),zd("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),zd("Error in flattenFetchedAnnotations: ",t),[]}},this.mergeOnboardingFetchedAnnotations=t=>{var e;try{const i=Array.isArray(t)?t:[];if(!this.isAgentRunStatusFeedEnabled())return i;if(0===this.onboardingFetchedAnnotations.length)return this.setOnboardingUnsyncedAnnotationIds([]),i;const n=new Set(i.map((t=>null==t?void 0:t.annotationId)));if(this.sidebarV2Enabled&&!this.showAgentCommentsInSidebar){const t=new Map,o=(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[...o,...this.onboardingFetchedAnnotations]){const i=null==e?void 0:e.annotationId;!i||n.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&&!n.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),zd("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),zd("Error in armAgentRunStatusWatchdog: ",t)}},this.clearAgentRunStatusWatchdog=()=>{try{null!==this.agentRunStatusWatchdogTimer&&(clearTimeout(this.agentRunStatusWatchdogTimer),this.agentRunStatusWatchdogTimer=null)}catch(t){console.warn("Error in clearAgentRunStatusWatchdog: ",t),zd("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),zd("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),zd("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),zd("Error in stopOnboardingViewportListener: ",t)}},this.observeOnboardingPanel=()=>{var t,e,i;try{if(!this.agentRunStatusListening||"undefined"==typeof ResizeObserver)return;const n=null!==(e=null===(t=this.shadowRoot)||void 0===t?void 0:t.querySelector(".onboarding-container content-warning-sidebar"))&&void 0!==e?e:null;if(n===this.onboardingObservedPanel)return;if(null===(i=this.onboardingPanelResizeObserver)||void 0===i||i.disconnect(),this.onboardingObservedPanel=n,!n)return;this.onboardingPanelResizeObserver||(this.onboardingPanelResizeObserver=new ResizeObserver((()=>this.scheduleOnboardingViewportClamp()))),this.onboardingPanelResizeObserver.observe(n)}catch(t){console.warn("Error in observeOnboardingPanel: ",t),zd("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),zd("Error in scheduleOnboardingViewportClamp: ",t)}},this.getOnboardingViewportClampOffset=(t,e,i)=>{let n=0,o=0;return t.right>e-8&&(n=e-8-t.right),t.left+n<8&&(n=8-t.left),t.bottom>i-8&&(o=i-8-t.bottom),t.top+o<8&&(o=8-t.top),{dx:n,dy:o}},this.readTranslate=t=>{var e;try{const i=window.getComputedStyle(t).transform;if(!i||"none"===i)return{x:0,y:0};const n=new(null!==(e=window.DOMMatrixReadOnly)&&void 0!==e?e:window.WebKitCSSMatrix)(i);return{x:Number(n.m41)||0,y:Number(n.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 n=[i.getBoundingClientRect()],o=i.querySelector("content-warning-sidebar");o&&n.push(o.getBoundingClientRect());const r=n.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),zd("Error in clampOnboardingPanelToViewport: ",t)}},this.buildAgentWarnings=(t,e,i,n)=>{try{return t===Le.BROKEN_LINKS?this.buildBrokenLinkWarnings(e):t===Le.SPELL_CHECK||t===Le.GRAMMAR_CHECK?this.buildSpellCheckWarnings(e,i,n):this.buildGenericWarnings(e)}catch(t){return console.warn("Error in buildAgentWarnings: ",t),{warnings:[],warningCount:0}}},this.buildBrokenLinkWarnings=t=>{var e,i,n,o,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===(n=null==g?void 0:g.agent)||void 0===n?void 0:n.url)||"",f=(null===(o=null==g?void 0:g.agent)||void 0===o?void 0:o.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())||"",b=ru(g)?lu(g):void 0;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),b&&(e.severity=Eu(e.severity,b))}else v.set(y,{primaryText:m||"",secondaryText:String(w),occurrences:1,pageUrls:t?[t]:[],annotations:[g],...b?{severity:b}:{}})}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 n,o,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===(n=null==E?void 0:E.pageInfo)||void 0===n?void 0:n.url)||(null===(o=null==E?void 0:E.location)||void 0===o?void 0:o.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:[],A=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:"",T=(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)||A||"",$=(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=T||"";T||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),R=L.get(S)||0;L.set(S,R+1);const D=ru(E)?lu(E):void 0;if(x.has(N)){const e=x.get(N);e.occurrences+=1,t&&!e.pageUrls.includes(t)&&e.pageUrls.push(t),e.annotations.push(E),D&&(e.severity=Eu(e.severity,D))}else x.set(N,{primaryText:T||"",secondaryText:I||"",occurrences:1,pageUrls:t?[t]:[],annotations:[E],...D?{severity:D}:{}})}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 n=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()))})),o=n[0];if(!o||!["B","STRONG"].includes(o.nodeName))return null;const r=(null===(e=o.textContent)||void 0===e?void 0:e.replace(/\s+/g," ").trim())||"";if(!r)return null;let s="";for(const t of n.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",n="string"==typeof(null==t?void 0:t.href)?t.href.trim().replace(/^https?:\/\//i,"").replace(/^www\./i,"").replace(/\/$/,""):"",o=n.length>40?`${n.slice(0,39)}…`:n;return{label:e,detail:o?`${i} · ${o}`:i}})).filter(Boolean)}catch(t){return console.warn("Error in buildFindingSubItems: ",t),[]}},this.buildGenericWarnings=t=>{var e,i,n,o,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===(n=null==M?void 0:M.agent)||void 0===n?void 0:n.url)||"",A=null!==(r=null!==(o=null==M?void 0:M.comments)&&void 0!==o?o:null==M?void 0:M.commentData)&&void 0!==r?r:[],T=null==A?void 0:A[0],$=null!==(p=null!==(d=null!==(a=null===(s=null==T?void 0:T.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==T?void 0:T.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==T?void 0:T.commentHtml),R=N||(null==L?void 0:L.title)||$,D=I||(N?O:null==L?void 0:L.detail)||"",F=this.resolveWarningSeverity(M,_),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=Eu(e.severity,F)}else S.set(V,{primaryText:R||"No text",secondaryText:D||"",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.resolveWarningSeverity=(t,e)=>{try{return ru(t)?lu(t):(t=>{if("string"!=typeof t)return;const e=t.trim().toLowerCase();return Uh.includes(e)?e:void 0})(null==e?void 0:e.severity)}catch(t){return console.warn("Error in resolveWarningSeverity: ",t),void zd("Error in resolveWarningSeverity: ",t)}},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,n,o;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===(n=this.commentElement)||void 0===n?void 0:n.disableQueryParamsComments)&&(r&&console.log("disableQueryParamsComments"),null===(o=this.commentElement)||void 0===o||o.disableQueryParamsComments()))}catch(t){console.warn("Error in setQueryParamsCommentsInSdk: ",t),zd("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),zd("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)?[...vd]:[]}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),zd("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),zd("Error in replayVeltFeatureGates: ",t)}},this.setProjectConfigVariables=t=>{var e,i,n,o;try{const r="Admin"===this.snippylyUserRole;this.allFeatureDisabled=!r&&(null!==(e=null==t?void 0:t.disabled)&&void 0!==e&&e),t&&"object"==typeof t?(this.firstConfigCommentsDisabled=null,this.commentsDisabledSetting="known"):("waiting"===this.commentsDisabledSetting&&(this.commentsDisabledSetting="unread"),this.applyFirstConfigCommentsDisabled()),this.allFeatureRestricted=null!==(i=null==t?void 0:t.restricted)&&void 0!==i&&i,this.guestMode=null!==(n=null==t?void 0:t.guestMode)&&void 0!==n&&n||this.isRunningUnderLivePreview(),this.allowGuestModeSignIn=!!(null===(o=null==t?void 0:t.guestModeConfig)||void 0===o?void 0:o.allowSignIn),(null==t?void 0:t.guestModeConfig)||(this.allowGuestModeSignIn=!0),this.guestMode&&Hd(vt.Events.GUEST_MODE_PRESENT),this.passwordProtected=!1,this.queryParamsComments=!!(null==t?void 0:t.queryParamsComments),this.usePageTitleAsLocationName=!!(null==t?void 0:t.usePageTitleAsLocationName),function(t){try{return!!t&&"object"==typeof t&&"boolean"==typeof t.requestMode}catch(t){return console.warn("Error in hasRequestModeField: ",t),!1}}(t)&&(this.requestModeSwitch=Id(t),this.syncRequestMode()),this.applyVeltFeatureGates(),od(pe,this.guestMode+"",!0),od(be,this.allowGuestModeSignIn+"",!0),od(ve,this.passwordProtected+"",!0),od(ge,this.queryParamsComments+"",!0),od(fe,this.usePageTitleAsLocationName+"",!0)}catch(t){console.warn("Error in setProjectConfigVariables: ",t),zd("Error in setProjectConfigVariables: ",t)}},this.toggleSnippylyPluginToolbar=()=>{try{this.expanded=!this.expanded,this.expanded?Hd(vt.Events.TOOLBAR_EXPANDED):Hd(vt.Events.TOOLBAR_COLLAPSED)}catch(t){console.warn("Error in toggleSnippylyPluginToolbar: ",t),zd("Error in toggleSnippylyPluginToolbar: ",t)}},this.enablePrivateCommentModeOnCommentElement=()=>{try{if(!this.commentElement||"function"!=typeof this.commentElement.enablePrivateMode)return;this.commentElement.enablePrivateMode({type:ye})}catch(t){console.warn("Error in enablePrivateCommentModeOnCommentElement: ",t),zd("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),zd("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,Hd(vt.Events.VISIBILITY_OPTIONS_ENABLED)}catch(t){console.warn("Error in enableVisibilityOptionsOnCommentElement: ",t),zd("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,Hd(vt.Events.VISIBILITY_OPTIONS_DISABLED)}catch(t){console.warn("Error in disableVisibilityOptionsOnCommentElement: ",t),zd("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,Hd(vt.Events.PRIVATE_MODE_DISABLED)):(this.enablePrivateCommentModeOnCommentElement(),this.privateCommentModeEnabled=!0,Hd(vt.Events.PRIVATE_MODE_ENABLED)),od(we,this.privateCommentModeEnabled.toString()))}catch(t){console.warn("Error in togglePrivateCommentMode: ",t),zd("Error in togglePrivateCommentMode: ",t)}},this.checkPrivateCommentModeFromStorage=()=>{try{!this.allFeatureDisabled&&"Admin"===this.snippylyUserRole&&this.canShowPrivateCommentToggle&&rd(we)&&(this.privateCommentModeEnabled="true"===rd(we),this.privateCommentModeEnabled&&this.enablePrivateCommentModeOnCommentElement())}catch(t){console.warn("Error in checkPrivateCommentModeFromStorage: ",t),zd("Error in checkPrivateCommentModeFromStorage: ",t)}},this.loginWithGoogle=()=>{try{if(Hd(vt.Events.SIGNIN_CLICKED),this.loading||this.customLoginEnabledLocally)return;const t=this.buildSignInUrlWithParams(this.signInUrl||""),e=this.signInWindowTarget();"_blank"===e?window.open(t,"_blank","noopener,noreferrer"):window.open(t,e)}catch(t){console.warn("Error in loginWithGoogle: ",t),zd("Error in loginWithGoogle: ",t)}},this.signInWindowTarget=()=>{try{return this.isRunningUnderPreviewProxy()&&this.isInFrame()?"_blank":"_self"}catch(t){return console.warn("Error in signInWindowTarget: ",t),"_self"}},this.isInFrame=()=>{try{return window.top!==window.self}catch(t){return console.warn("Error in isInFrame: ",t),!0}},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),zd("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=ld(e,ti,ei),n=await lh(i);"ok"===n.status?this.qrCode=n.qrcode:this.qrCodeError=!0}catch(t){this.qrCodeError=!0,console.warn("Error in getQRCode: ",t),zd("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),zd("Error in retryQRCode: ",t)}},this.toggleQRCodeVisibility=async()=>{try{if(Hd(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),zd("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,Hd(vt.Events.INVITE_MODAL_OPENED)},this.closeInviteModal=()=>{this.showInviteModal=!1},this.onInviteSuccess=()=>{this.closeInviteModal(),Hd(vt.Events.INVITE_SENT)},this.removeSnippyly=async()=>{try{Hd(vt.Events.EXIT_REVIEW_MODE_CLICKED),this.exitReviewModeCalled=!0,sd(St),sd(Mt),sd(Yt),sd(re,"sessionStorage"),sd(se,"sessionStorage");const t=new URL(document.location),e=t.searchParams;e.delete(Yt),e.delete(St),e.delete(Jt),e.delete(Mt),this.projectVersionKey&&e.delete(this.projectVersionKey),e.delete(ae),e.delete(le),e.delete(ce),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),zd("Error in removeSnippyly: ",t)}},this.signOutUser=async()=>{try{Hd(vt.Events.SIGNOUT_CLICKED),this.subscriptions.forEach((t=>{t&&t.unsubscribe&&(null==t||t.unsubscribe())})),this.contactListSubscription&&(this.contactListSubscription.unsubscribe(),this.contactListSubscription=null),this.teardownAgentsSidebarBusSubscriptions(),await Velt.signOutUser(),sd(Qt),sd(te),bd(),sd(ue),sd(we),this.snippylyUser=void 0,window.open(this.signOutUrl,"_self")}catch(t){console.warn("Error in signOutUser: ",t),zd("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),zd("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),zd("Error in copyLink: ",t)}},this.goToAdminPortal=()=>{try{let t=`${Qe}`;Velt&&(null===Velt||void 0===Velt?void 0:Velt.getDocumentId)&&this.serverDocumentId&&(t=`${Qe}/dashboard/project/comment/${this.apiKey}/${this.serverDocumentId}`),Hd(vt.Events.VIEW_PROJECT_CLICKED),window.open(t,"_blank")}catch(t){console.warn("Error in goToAdminPortal: ",t),zd("Error in goToAdminPortal: ",t)}},this.openBugReportModal=()=>{try{this.showBugReportModal=!0,Hd(vt.Events.REPORT_BUG_CLICKED)}catch(t){console.warn("Error in openBugReportModal: ",t),zd("Error in openBugReportModal: ",t)}},this.closeBugReportModal=()=>{try{this.showBugReportModal=!1}catch(t){console.warn("Error in closeBugReportModal: ",t),zd("Error in closeBugReportModal: ",t)}},this.goToAdminPortalDashboard=()=>{try{let t=`${Qe}`;Velt&&(null===Velt||void 0===Velt?void 0:Velt.getDocumentId)&&this.serverDocumentId&&(t=`${Qe}/dashboard`),window.open(t,"_blank")}catch(t){console.warn("Error in goToAdminPortalDashboard: ",t),zd("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),zd("Error in joinCommunity: ",t)}},this.onboardingNextClick=()=>{try{this.showOnboardingModal=!1,od(le,"true");const t=new URL(document.location);t.searchParams.delete(le),window.history.replaceState({},document.title,t.href)}catch(t){console.warn("Error in onboardingNextClick: ",t),zd("Error in onboardingNextClick: ",t)}},this.onLiveDemoModalNextClick=()=>{try{this.showLiveDemoModal=!1,od(ce,"true",!1,"sessionStorage");const t=new URL(document.location);t.searchParams.delete(ce),window.history.replaceState({},document.title,t.href)}catch(t){console.warn("Error in onLiveDemoModalNextClick: ",t),zd("Error in onLiveDemoModalNextClick: ",t)}},this.onFigmaDemoModalNextClick=()=>{try{this.showFigmaDemoModal=!1;const t=new URL(document.location);t.searchParams.delete(de),window.history.replaceState({},document.title,t.href)}catch(t){console.warn("Error in onFigmaDemoModalNextClick: ",t),zd("Error in onFigmaDemoModalNextClick: ",t)}},this.onUpgradePlanClick=()=>{try{window.open(Xe,"_blank")}catch(t){console.warn("Error in onUpgradePlanClick: ",t),zd("Error in onUpgradePlanClick: ",t)}},this.onTourCommentTooltipClick=()=>{try{this.showTourCommentTooltip=!1,od(he,"true"),this.firstCommentNudge&&(this.firstCommentNudge=!1,this.autoCommentModeArmedOnce=!0)}catch(t){console.warn("Error in onTourCommentTooltipClick: ",t),zd("Error in onTourCommentTooltipClick: ",t)}},this.onGuestModeChipSignInButtonClick=()=>{try{Hd(vt.Events.GUEST_MODE_SIGN_IN_BUTTON_CLICKED),this.loginWithGoogle()}catch(t){console.warn("Error in onGuestModeChipSignInButtonClick: ",t),zd("Error in onGuestModeChipSignInButtonClick: ",t)}},this.openGuestModeSignInModal=()=>{try{this.showGuestModeSignInModal=!0,Hd(vt.Events.GUEST_MODE_SIGN_IN_DIALOG_SHOWN)}catch(t){console.warn("Error in openGuestModeSignInModal: ",t),zd("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),zd("Error in closeGuestModeSignInModal: ",t)}},this.onGuestModeSignInModalSignInButtonClick=()=>{try{Hd(vt.Events.GUEST_MODE_SIGN_IN_BUTTON_CLICKED),this.loginWithGoogle()}catch(t){console.warn("Error in onGuestModeSignInModalSignInButtonClick: ",t),zd("Error in onGuestModeSignInModalSignInButtonClick: ",t)}},this.openGuestModeNameModel=t=>{try{t&&(t.stopPropagation(),t.preventDefault()),this.skipGuestNameModal||(this.showGuestModeNameModal=!0,Hd(vt.Events.GUEST_MODE_NAME_NUDGE_SHOWN))}catch(t){console.warn("Error in openGuestModeNameModel: ",t),zd("Error in openGuestModeNameModel: ",t)}},this.closeGuestModeNameModel=()=>{try{this.showGuestModeNameModal=!1}catch(t){console.warn("Error in closeGuestModeNameModel: ",t),zd("Error in closeGuestModeNameModel: ",t)}},this.onGuestModeNameModalSkipButtonClick=()=>{try{Hd(vt.Events.GUEST_MODE_SKIP_BUTTON_CLICKED),this.showGuestModeNameModal=!1}catch(t){console.warn("Error in onGuestModeNameModalSkipButtonClick: ",t),zd("Error in onGuestModeNameModalSkipButtonClick: ",t)}},this.onPasswordProtectedModalCloseButtonClick=()=>{try{Hd(vt.Events.PASSWORD_PROTECTED_MODAL_CLOSE_BUTTON_CLICKED),this.showPasswordProtectedModal=!1,this.password="",this.showInvalidPassword=!1}catch(t){console.warn("Error in onPasswordProtectedModalCloseButtonClick: ",t),zd("Error in onPasswordProtectedModalCloseButtonClick: ",t)}},this.onPasswordProtectedModalOpenButtonClick=()=>{try{Hd(vt.Events.PASSWORD_PROTECTED_MODAL_OPEN_BUTTON_CLICKED),this.showPasswordProtectedModal=!0}catch(t){console.warn("Error in onPasswordProtectedModalOpenButtonClick: ",t),zd("Error in onPasswordProtectedModalOpenButtonClick: ",t)}},this.showGuestModeSignInBanner=()=>{try{this.guestModeSignInBannerVisible=!0,Hd(vt.Events.GUEST_MODE_SIGN_IN_NUDGE_SHOWN)}catch(t){console.warn("Error in showGuestModeSignInBanner: ",t),zd("Error in showGuestModeSignInBanner: ",t)}},this.hideGuestModeSignInBanner=()=>{try{this.guestModeSignInBannerVisible=!1}catch(t){console.warn("Error in hideGuestModeSignInBanner: ",t),zd("Error in hideGuestModeSignInBanner: ",t)}},this.onGuestModeBannerSignInButtonClick=()=>{try{Hd(vt.Events.GUEST_MODE_SIGN_IN_CLICKED),this.loginWithGoogle()}catch(t){console.warn("Error in onGuestModeBannerSignInButtonClick: ",t),zd("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=ud(!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=ld(e,ti,ei);od(ne,i,!0)}catch(t){console.warn("Error in updateGuestUser: ",t),zd("Error in updateGuestUser: ",t)}})(e),await Velt.identify(e),this.snippylyUser=JSON.parse(JSON.stringify(e)),await th(this.apiKey,this.projectId||"",t,e),this.showGuestModeNameModal=!1,this.guestUserNameUpdated=!0,this.guestUserNameUpdateLoading=!1,od(xe,"true"),Hd(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),zd("Error in updateGuestUserName: ",t)}},this.submitPassword=async()=>{var t;try{if(Hd(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 Kd(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)}}(me,this.isPasswordValid),this.isPasswordValid?(this.password="",this.onPasswordProtectedModalCloseButtonClick(),this.showInvalidPassword=!1,this.applyVeltFeatureGates(),Hd(vt.Events.REVIEW_PASSWORD_ACCEPTED)):(this.showInvalidPassword=!0,Hd(vt.Events.REVIEW_PASSWORD_REJECTED)),this.validatingPasswordLoading=!1}catch(t){console.warn("Error in submitPassword: ",t),zd("Error in submitPassword: ",t)}},this.updateUserName=async()=>{var t,e;try{if(!(null===(t=this.guestUserNameInput)||void 0===t?void 0:t.trim()))return;if(this.guestUserNameUpdateLoading)return;this.guestUserNameUpdateLoading=!0;const i=JSON.parse(JSON.stringify(this.snippylyUser)),n=JSON.parse(JSON.stringify(this.snippylyUser));n.name=this.guestUserNameInput;const o=this.readLiveSignIn(),r=o&&(null===(e=o.user)||void 0===e?void 0:e.userId)===(null==i?void 0:i.userId)?o.token:null,s=this.isLiveShareGuest()?r:this.credentialFor(i,this.identityCameFromToken),a=await th(this.apiKey,this.projectId||"",i,n,!1,s);if(!1===(null==a?void 0:a.success))return console.warn("[CWS Toolbar] Name change refused; keeping the old name:",null==a?void 0:a.reason),this.guestUserNameUpdateLoading=!1,this.guestUserNameInput="",void this.closeGuestModeNameModel();await Velt.updateUser(n),this.snippylyUser=JSON.parse(JSON.stringify(n));const l=this.identityCameFromToken?dd():null;if(l){l.name=n.name;const t=JSON.stringify(l),e=ld(t,ti,ei);od(te,e,!0)}n.isGuest&&(this.guestUserNameUpdated=!0,od(xe,"true")),this.guestUserNameUpdateLoading=!1,this.guestUserNameInput="",this.closeGuestModeNameModel()}catch(t){console.warn("Error in updateUserName: ",t),zd("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)||[]),n=(null==t?void 0:t.type)===Ne,o=(null==t?void 0:t.commentType)===Ne;return i||n||o}catch(t){return console.warn("Error in isAgentAnnotation: ",t),!1}},this.getSidebarGroupExpansionMap=()=>{var t,e,i,n,o;try{const r=document.querySelector(Re.VELT_COMMENTS_SIDEBAR_LEGACY),s=null===(o=null===(n=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===n?void 0:n.call(i))||void 0===o?void 0:o.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 n=null===(e=null==t?void 0:t.data)||void 0===e?void 0:e.displayName,o=null===(i=null==t?void 0:t.data)||void 0===i?void 0:i.isExpanded;"string"==typeof n&&"boolean"==typeof o&&a.set(n,o)})),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 n=Array.isArray(null==t?void 0:t.systemFilteredAnnotations)?t.systemFilteredAnnotations:[],o=new Set(n.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&&o.has(e)&&r.push(t)}));const s=new Map;r.forEach((t=>{var e,i,n,o;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===(n=null==t?void 0:t.location)||void 0===n?void 0:n.path)||"/";s.has(r)||s.set(r,[]),null===(o=s.get(r))||void 0===o||o.push(t)}));const a=[],l=new URL(window.location.href).pathname,c="/"+this.normalizePagePath(l);s.forEach(((t,i)=>{const n=null==e?void 0:e.get(i);a.push({groupId:i,groupName:i,isExpanded:"boolean"==typeof n?n: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),zd("Error in filterAgentCommentsFromSidebar: ",t)}},this.mountVeltCollaborationElements=()=>{if(!document.querySelector(Re.VELT_COMMENTS)){const t=document.createElement(Re.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(Re.VELT_CURSOR)){const t=document.createElement(Re.VELT_CURSOR);window.document.body.appendChild(t)}if(!document.querySelector(Re.VELT_HUDDLE)){const t=document.createElement(Re.VELT_HUDDLE);window.document.body.appendChild(t)}if(!document.querySelector(Re.VELT_RECORDER_NOTES)){const t=document.createElement(Re.VELT_RECORDER_NOTES);window.document.body.appendChild(t)}if(!document.querySelector(Re.VELT_RECORDER_CONTROL_PANEL)){const t=document.createElement(Re.VELT_RECORDER_CONTROL_PANEL);window.document.body.appendChild(t)}if(!document.querySelector(Re.VELT_ARROWS)){const t=document.createElement(Re.VELT_ARROWS);window.document.body.appendChild(t)}},this.unmountVeltCollaborationElements=()=>{try{document.querySelectorAll(Yp.COLLABORATION_TAGS.join(", ")).forEach((t=>t.remove()))}catch(t){console.warn("Error in unmountVeltCollaborationElements: ",t),zd("Error in unmountVeltCollaborationElements: ",t)}},this.mountCommentSidebar=()=>{if(this.latchAgentsSidebarMode(),this.agentsSidebarMode)return void this.mountScopedCommentSidebars();const t=this.sidebarV2Enabled,e=t?Re.VELT_COMMENTS_SIDEBAR_V2:Re.VELT_COMMENTS_SIDEBAR_LEGACY,i=t?Re.VELT_COMMENTS_SIDEBAR_LEGACY:Re.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?De.URL_NAVIGATION:De.ENABLE_URL_NAVIGATION,"true"),i.setAttribute(De.CURRENT_LOCATION_SUFFIX,"true"),e===Re.VELT_COMMENTS_SIDEBAR_LEGACY&&(i.setAttribute(De.SIDEBAR_BUTTON_COUNT_TYPE,Fe),i.setAttribute(De.CUSTOM_ACTIONS,"true")),window.document.body.appendChild(i)}},this.mountScopedCommentSidebars=()=>{try{const t=Re.VELT_COMMENTS_SIDEBAR_V2;document.querySelectorAll(Re.VELT_COMMENTS_SIDEBAR_LEGACY).forEach((t=>t.remove()));const e=rp;if(!document.querySelector(`${t}:not([${e}])`)){const e=document.createElement(t);e.setAttribute("shadow-dom","true"),e.setAttribute(De.URL_NAVIGATION,"true"),e.setAttribute(De.CURRENT_LOCATION_SUFFIX,"true"),e.setAttribute(sp,JSON.stringify(cp(dp))),window.document.body.appendChild(e)}if(!document.querySelector(`${t}[${e}="${op}"]`)){const i=document.createElement(t);i.setAttribute(e,op),i.setAttribute("shadow-dom","true"),i.setAttribute(De.CURRENT_LOCATION_SUFFIX,"true"),i.setAttribute(lp,"false"),i.setAttribute(sp,JSON.stringify(cp(hp))),i.setAttribute(ap,JSON.stringify({enable:!0,groupBy:"checkInfo.ruleKey"})),window.document.body.appendChild(i)}}catch(t){console.warn("Error in mountScopedCommentSidebars: ",t),zd("Error in mountScopedCommentSidebars: ",t)}},this.agentsSidebarBusSubscriptions=[],this.lastAgentsSidebarClick=null,this.agentsSidebarBusElement=void 0,this.syncAgentsSidebarBusSubscriptions=()=>{try{const t=this.commentElement,e=this.agentsSidebarMode&&!!t&&"function"==typeof t.on;if(e&&this.agentsSidebarBusElement===t)return;if(this.teardownAgentsSidebarBusSubscriptions(),!e)return;this.agentsSidebarBusElement=t;const i=t.on(fp);i&&"function"==typeof i.subscribe&&this.agentsSidebarBusSubscriptions.push(i.subscribe(this.onAgentsSidebarCommentClick));const n=t.on(mp);n&&"function"==typeof n.subscribe&&this.agentsSidebarBusSubscriptions.push(n.subscribe(this.onAgentsSidebarCommentClick));const o=t.on(wp);o&&"function"==typeof o.subscribe&&this.agentsSidebarBusSubscriptions.push(o.subscribe(this.onAgentsSidebarClose))}catch(t){console.warn("Error in syncAgentsSidebarBusSubscriptions: ",t),zd("Error in syncAgentsSidebarBusSubscriptions: ",t)}},this.teardownAgentsSidebarBusSubscriptions=()=>{try{this.agentsSidebarBusSubscriptions.forEach((t=>{var e;return null===(e=null==t?void 0:t.unsubscribe)||void 0===e?void 0:e.call(t)})),this.agentsSidebarBusSubscriptions=[],this.agentsSidebarBusElement=void 0}catch(t){console.warn("Error in teardownAgentsSidebarBusSubscriptions: ",t)}},this.onAgentsSidebarCommentClick=t=>{try{if(!this.agentsSidebarMode)return;const e=function(t){try{const e=null==t?void 0:t.annotation;if(!e||!e.annotationId&&!e.id)return null;const i=null==t?void 0:t.sidebarId;return i===op||null==i&&pp(e)?e:null}catch(t){return console.warn("Error in readAgentsSidebarClickAnnotation: ",t),null}}(t);if(!e)return;const i=String(e.annotationId||e.id),n=Date.now(),o=this.lastAgentsSidebarClick;if(o&&o.annotationId===i&&n-o.at<1e3)return;this.lastAgentsSidebarClick={annotationId:i,at:n},this.onContentWarningItemClick({detail:{annotation:e}})}catch(t){console.warn("Error in onAgentsSidebarCommentClick: ",t),zd("Error in onAgentsSidebarCommentClick: ",t)}},this.onAgentsSidebarClose=t=>{try{if(!this.agentsSidebarMode||!function(t){try{return(null==t?void 0:t.sidebarId)===op}catch(t){return console.warn("Error in isAgentsSidebarCloseEvent: ",t),!1}}(t))return;this.showContentWarningSidebar&&(this.showContentWarningSidebar=!1)}catch(t){console.warn("Error in onAgentsSidebarClose: ",t)}},this.agentsSidebarOpenApplied=!1,this.syncAgentsSidebarOpenState=()=>{var t,e,i,n,o;try{if(!this.agentsSidebarMode)return;const r=this.commentElement;if(!r)return;const s=this.showContentWarningSidebar&&this.canShowContentWarningSidebar(),a=s?this.getAgentsSidebarDeepLinkFocusId():null;if(s===this.agentsSidebarOpenApplied&&!a)return;if(this.agentsSidebarOpenApplied=s,s){null===(t=r.closeCommentSidebar)||void 0===t||t.call(r),null===(e=r.disableSidebarUrlNavigation)||void 0===e||e.call(r);const n=a;a&&(this.agentsSidebarDeepLinkId=null),null===(i=r.openCommentSidebar)||void 0===i||i.call(r,n?{sidebarId:op,annotationId:n}:{sidebarId:op})}else null===(n=r.closeCommentSidebar)||void 0===n||n.call(r,{sidebarId:op}),null===(o=r.enableSidebarUrlNavigation)||void 0===o||o.call(r)}catch(t){console.warn("Error in syncAgentsSidebarOpenState: ",t),zd("Error in syncAgentsSidebarOpenState: ",t)}},this.onCommentsSidebarButtonClick=()=>{try{if(!this.agentsSidebarMode||!this.showContentWarningSidebar)return;this.showContentWarningSidebar=!1}catch(t){console.warn("Error in onCommentsSidebarButtonClick: ",t)}},this.getAgentsSidebarDeepLinkFocusId=()=>{var t,e;try{const i=this.agentsSidebarDeepLinkId;if(!i)return null;const n=[...(null!==(t=this.agentGroups)&&void 0!==t?t:[]).flatMap((t=>{var e;return null!==(e=null==t?void 0:t.annotations)&&void 0!==e?e:[]})),...null!==(e=this.lastStreamAnnotations)&&void 0!==e?e:[]],o=n.find((t=>Wh(t)===i));return o&&pp(o)?i:null}catch(t){return console.warn("Error in getAgentsSidebarDeepLinkFocusId: ",t),null}},this.maybeOpenAgentsSidebarForDeepLink=()=>{try{if(!this.agentsSidebarMode||!this.canShowContentWarningSidebar())return;if(!this.getAgentsSidebarDeepLinkFocusId())return;if(this.showContentWarningSidebar)return void this.syncAgentsSidebarOpenState();this.showContentWarningSidebar=!0}catch(t){console.warn("Error in maybeOpenAgentsSidebarForDeepLink: ",t),zd("Error in maybeOpenAgentsSidebarForDeepLink: ",t)}},this.setCommentSidebarVisibility=t=>{var e,i,n,o,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===(o=null===(n=this.commentElement)||void 0===n?void 0:n.enableFilterCommentsOnDom)||void 0===o||o.call(n),void(this.showAgentCommentsInSidebar=t);const c=document.querySelector(Re.VELT_COMMENTS_SIDEBAR_LEGACY);if(!c)return;t?(c.removeAttribute(De.SIDEBAR_BUTTON_COUNT_TYPE),c.removeAttribute(De.CUSTOM_ACTIONS),null===(s=null===(r=this.commentElement)||void 0===r?void 0:r.disableFilterCommentsOnDom)||void 0===s||s.call(r)):(c.setAttribute(De.SIDEBAR_BUTTON_COUNT_TYPE,Fe),c.setAttribute(De.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),zd("Error in setCommentSidebarVisibility: ",t)}},this.toggleCommentSidebarVisibility=()=>{try{this.setCommentSidebarVisibility(!this.showAgentCommentsInSidebar),this.menuOpenedId=void 0}catch(t){console.warn("Error in toggleCommentSidebarVisibility: ",t),zd("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),zd("Error in applyPageCommentsVisibility: ",t)}},this.togglePageCommentsVisibility=()=>{try{this.pageCommentsHidden=!this.pageCommentsHidden,this.pageCommentsHidden?od(Kt,"true",!1,"sessionStorage"):sd(Kt,"sessionStorage"),this.applyPageCommentsVisibility(),this.menuOpenedId=void 0}catch(t){console.warn("Error in togglePageCommentsVisibility: ",t),zd("Error in togglePageCommentsVisibility: ",t)}},this.unhidePageCommentsIfHidden=()=>{try{if(!this.pageCommentsHidden)return;this.pageCommentsHidden=!1,sd(Kt,"sessionStorage"),this.applyPageCommentsVisibility()}catch(t){console.warn("Error in unhidePageCommentsIfHidden: ",t)}},this.toggleSidebarV2=()=>{try{od(Ct,this.sidebarV2Enabled?"false":"true",!1,"sessionStorage"),window.location.reload()}catch(t){console.warn("Error in toggleSidebarV2: ",t),zd("Error in toggleSidebarV2: ",t)}},this.toggleVeltProxy=()=>{try{if(!this.veltProxyToggleVisible)return;t=!this.veltProxyEnabled,od(xt,t?"true":"false"),window.location.reload()}catch(t){console.warn("Error in toggleVeltProxy: ",t),zd("Error in toggleVeltProxy: ",t)}var t},this.isScreenshotDisabledHost=()=>{try{return _e.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)=>{Tu()&&"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.onRequestModeAnnotationSaved(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,n,o,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===(n=(i=this.commentElement).disableScreenshot)||void 0===n||n.call(i):(null===(s=null===(r=null===(o=this.customerMetadata)||void 0===o?void 0:o.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()&&(ep()&&"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=rd(Te,!1,"sessionStorage");return"granted"===t||"denied"===t?t:null},this.setNativeScreenshotPermission=t=>{od(Te,t,!1,"sessionStorage"),this.nativeScreenshotDenied="denied"===t},this.clearNativeScreenshotPermission=()=>{sd(Te,"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),zd("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,n=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"===n||"native-not-supported"===n}(t)?console.warn("Native screenshot enable failed/cancelled: ",t):(this.setNativeScreenshotPermission("denied"),Tu()&&"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),zd("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),zd("Error in handleNativeScreenshotStreamEnded: ",t)}},this.restoreSdkScreenshot=()=>{var t,e,i,n,o;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===(o=null===(n=this.commentElement)||void 0===n?void 0:n.enableScreenshot)||void 0===o||o.call(n))},this.onAddCommentAnnotation=async t=>{var e,i,n,o,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!==(n=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!==n?n:null==t?void 0:t.id,h=null!==(l=null!==(a=null!==(r=null===(o=null==t?void 0:t.commentAnnotation)||void 0===o?void 0:o.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),zd("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,n,o,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===(n=null===(i=this.commentElement)||void 0===i?void 0:i.addAttachment)||void 0===n?void 0:n.call(i,{annotationId:t,commentId:e,files:[l]}));if(c&&Array.isArray(c)&&c.length>0&&(null===(o=c[0])||void 0===o?void 0:o.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),zd("Native screenshot capture/attach failed: ",t)}},this.setupSidebarAgentCommentFilter=()=>{var t,e,i,n,o,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.syncAgentsSidebarBusSubscriptions(),this.syncAgentsSidebarOpenState(),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===(n=null===(i=this.commentElement)||void 0===i?void 0:i.disableFilterCommentsOnDom)||void 0===n||n.call(i):null===(r=null===(o=this.commentElement)||void 0===o?void 0:o.enableFilterCommentsOnDom)||void 0===r||r.call(o))}catch(t){console.warn("Error in setupSidebarAgentCommentFilter: ",t),zd("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),zd("Error in agent-warnings hydration subscription: ",t)}}));this.subscriptions.push(e)}catch(t){console.warn("Error in setupAgentWarningsHydration: ",t),zd("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),zd("Error in onContentWarningsButtonClick: ",t)}},this.onContentWarningSidebarClose=()=>{try{this.showContentWarningSidebar=!1}catch(t){console.warn("Error in onContentWarningSidebarClose: ",t)}},this.getOnboardingDismissedProjectIds=()=>{try{const t=rd(zt,!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),zd("Error in getOnboardingDismissedProjectIds: ",t),[]}},this.setOnboardingDismissedProjectIds=t=>{try{const e=t.slice(-20);if(0===e.length)return void sd(zt,"sessionStorage");od(zt,JSON.stringify(e),!1,"sessionStorage")}catch(t){console.warn("Error in setOnboardingDismissedProjectIds: ",t),zd("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),zd("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),zd("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),zd("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),zd("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"===rd(Se,!1,"sessionStorage"),n=new URL(window.location.href).searchParams.has(Jt);if(!i)return;if(!n)return;if(this.allFeatureDisabled||"Admin"!==this.snippylyUserRole)return;this.showContentWarningSidebar=!0}catch(t){console.warn("Error in restoreContentWarningSidebarState: ",t),zd("Error in restoreContentWarningSidebarState: ",t)}},this.navigateTo=t=>{try{window.location.href=t}catch(t){console.warn("Error in navigateTo: ",t),zd("Error in navigateTo: ",t)}},this.onContentWarningSidebarAddAll=()=>{},this.onContentWarningItemClick=t=>{var e,i;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 o=(null==n?void 0:n.annotationId)||(null==n?void 0:n.id),r=null===(i=null==n?void 0:n.pageInfo)||void 0===i?void 0:i.url;if(su(n))return void this.selectAnnotationOnPage(o);if(r&&!this.isCurrentPageUrl(r)){if(this.showContentWarningSidebar&&od(Se,"true",!1,"sessionStorage"),this.isRunningUnderLivePreview()){const t=new URL(r),e=fd(t)?null:md(r),i=null!=e?e:t.pathname,n=null===e?t.search:"",s=this.buildLivePreviewNavigationUrl(`${i}${n}`,o);return void(s&&this.navigateTo(s))}if(this.isRunningUnderPreviewProxy()){return void(!(null!==md(r))&&window.parent&&window.parent!==window&&window.parent.postMessage({type:Zt,url:r,annotationId:o},"*"))}const t=new URL(r);return t.searchParams.set(Jt,o),void this.navigateTo(t.toString())}this.selectAnnotationOnPage(o)}catch(t){console.warn("Error in onContentWarningItemClick: ",t),zd("Error in onContentWarningItemClick: ",t)}},this.buildLivePreviewNavigationUrl=(t,e)=>{try{const i=new URL(t,window.location.origin);return i.origin!==window.location.origin?(console.warn("[CWS Toolbar] Refusing a live preview navigation off this origin:",t),null):(i.searchParams.delete(Ze),i.searchParams.set(Jt,e),i.toString())}catch(t){return console.warn("Error in buildLivePreviewNavigationUrl: ",t),null}},this.selectAnnotationOnPage=t=>{var e;try{(null===(e=this.commentElement)||void 0===e?void 0:e.selectCommentByAnnotationId)&&this.commentElement.selectCommentByAnnotationId(t),setTimeout((()=>{var e;(null===(e=this.commentElement)||void 0===e?void 0:e.scrollToCommentByAnnotationId)&&this.commentElement.scrollToCommentByAnnotationId(t)}),150)}catch(t){console.warn("Error in selectAnnotationOnPage: ",t),zd("Error in selectAnnotationOnPage: ",t)}},this.onContentWarningItemNext=t=>{var e;try{const i=null===(e=null==t?void 0:t.detail)||void 0===e?void 0:e.annotation;if(!i)return;this.navigateToCheckPage(this.resolveFullAnnotation(i),"next")}catch(t){console.warn("Error in onContentWarningItemNext: ",t),zd("Error in onContentWarningItemNext: ",t)}},this.getCurrentCheckPageKey=()=>{var t;try{if(this.isRunningUnderPreviewProxy())return this.previewLocationPath||"/";if(this.autoLocation&&"string"==typeof(null===(t=this.location)||void 0===t?void 0:t.url)&&this.location.url)return this.location.url;const e=new URL(window.location.href);for(const t of[St,Mt,Yt,Jt,le,ce])e.searchParams.delete(t);return`${e.pathname}${this.queryParamsComments?e.search:""}`}catch(t){return console.warn("Error in getCurrentCheckPageKey: ",t),zd("Error in getCurrentCheckPageKey: ",t),window.location.pathname}},this.navigateToCheckPage=(t,e="next")=>{try{const i=au(t);if(i.length<2)return!1;const n=du(i,this.getCurrentCheckPageKey(),e);return!!n&&this.navigateToCheckPageKey(t,n)}catch(t){return console.warn("Error in navigateToCheckPage: ",t),zd("Error in navigateToCheckPage: ",t),!1}},this.navigateToCheckPageKey=(t,e)=>{var i;try{const n=(null==t?void 0:t.annotationId)||(null==t?void 0:t.id);if(!n||!e)return!1;if(this.showContentWarningSidebar&&od(Se,"true",!1,"sessionStorage"),this.isRunningUnderLivePreview()){const t=this.buildLivePreviewNavigationUrl(e,n);return!!t&&(this.navigateTo(t),!0)}if(this.isRunningUnderPreviewProxy()){const o=null===(i=null==t?void 0:t.pageInfo)||void 0===i?void 0:i.url;if("string"!=typeof o||!o||null!==md(o))return!1;if(!window.parent||window.parent===window)return!1;const r=new URL(e,new URL(o).origin);return window.parent.postMessage({type:Zt,url:r.toString(),annotationId:n},"*"),!0}const o=new URL(e,window.location.origin);return o.searchParams.set(Jt,n),this.navigateTo(o.toString()),!0}catch(t){return console.warn("Error in navigateToCheckPageKey: ",t),zd("Error in navigateToCheckPageKey: ",t),!1}},this.resolveFullAnnotation=t=>{var e;try{if(!t||Kh(t))return t;const i=(null==t?void 0:t.annotationId)||(null==t?void 0:t.id);if(!i)return t;const n=t=>((null==t?void 0:t.annotationId)||(null==t?void 0:t.id))===i,o=this.lastStreamAnnotations.find(n);if(Kh(o))return o;for(const t of this.agentGroups){const i=null===(e=null==t?void 0:t.annotations)||void 0===e?void 0:e.find(n);if(Kh(i))return i}return t}catch(e){return console.warn("Error in resolveFullAnnotation: ",e),zd("Error in resolveFullAnnotation: ",e),t}},this.isCurrentPageUrl=t=>{var e;try{const i=null!==(e=md(t))&&void 0!==e?e:new URL(t).pathname;let n=window.location.pathname;return!this.isRunningUnderLivePreview()&&this.isRunningUnderPreviewProxy()&&(n=this.previewLocationPath||"/"),i===n}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,n=null==t?void 0:t.commentAnnotation,o=(null==n?void 0:n.annotationId)||(null==n?void 0:n.id),r="accept-suggestion"===i||"reject-suggestion"===i;if(r&&o&&this.processingAnnotationIds.has(o))return;if(r&&this.isSuggestionActionsHiddenForViewer())return void console.warn("[CWS Toolbar] Only workspace members can accept or reject suggestions. Ignoring:",i);if("prev-suggestion"===i||"next-suggestion"===i){const t="next-suggestion"===i?"next":"prev",e=this.resolveFullAnnotation(n);su(e)&&au(e).length>1?this.navigateToCheckPage(e,t):this.navigateSuggestion(n,t)}else"accept-suggestion"===i&&this.handleAcceptSuggestion(n)}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),zd("Error in setupVeltButtonClickListener: ",t)}},this.navigateSuggestion=(t,e)=>{var i,n,o,r,s;try{if(!t)return void console.warn("[CWS Toolbar] No annotation provided for navigation");const a=null===(n=null===(i=null==t?void 0:t.agent)||void 0===i?void 0:i.result)||void 0===n?void 0:n.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===(o=null==t?void 0:t.pageInfo)||void 0===o?void 0:o.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),zd("Error in navigateSuggestion: ",t)}},this.findMatchingWarning=t=>{var e;try{for(const i of this.agentGroups){const n=null===(e=null==i?void 0:i.warnings)||void 0===e?void 0:e.find((e=>(null==e?void 0:e.primaryText)===t));if(n)return n}return null}catch(t){return console.warn("Error in findMatchingWarning: ",t),null}},this.removeAnnotationFromWarnings=t=>{var e,i,n;try{if(!t)return;const o=e=>{var i,n,o,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===(o=null===(n=null==e?void 0:e.agent)||void 0===n?void 0:n.result)||void 0===o?void 0:o.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),n=e.get(l)||0;n>1?e.set(l,n-1):(e.delete(l),0===e.size&&t.delete(i))}return}}};for(const t of this.agentGroups)(null==t?void 0:t.agentId)!==Le.SPELL_CHECK&&(null==t?void 0:t.agentId)!==Le.GRAMMAR_CHECK||o(t.warnings);const r=null!==(n=null===(i=null===(e=this.agentGroups)||void 0===e?void 0:e.map((e=>{var i,n,o,r,s;const a=null!==(o=null===(n=null===(i=null==e?void 0:e.warnings)||void 0===i?void 0:i.map((e=>{var i;const n=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 n&&0!==n.length?{...e,annotations:n,occurrences:n.length}:null})))||void 0===n?void 0:n.filter((t=>null!==t)))&&void 0!==o?o:[],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!==n?n:[];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.isAgentRunStatusFeedEnabled()&&(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 n=i||document.querySelector(".velt-comment-dialog.selected");if(!n)return;const o=n.querySelector(".sf-accept-btn"),r=n.querySelector(".sf-reject-btn");if(e){const e="accept"===t?o:r,i="accept"===t?r:o;null==e||e.classList.add("sf-btn-loading"),null==i||i.classList.add("sf-btn-disabled")}else null==o||o.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,n;try{const o=(null==t?void 0:t.annotationId)||(null==t?void 0:t.id);if(!o)return void console.warn("[CWS Toolbar] handleAcceptSuggestion: No annotationId found",t);if(this.processingAnnotationIds.has(o))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===(n=this.snippylyUser)||void 0===n?void 0:n.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(o);const a=document.querySelector(".velt-comment-dialog.selected");this.setSuggestionButtonsLoading("accept",!0,a);try{await dh(this.apiKey,this.apiKey,this.documentId+"",o,{userId:r,email:s},this.suggestionCredential()),this.removeAnnotationFromWarnings(o)}finally{this.processingAnnotationIds.delete(o),this.setSuggestionButtonsLoading("accept",!1,a)}}catch(t){console.warn("Error in handleAcceptSuggestion: ",t),zd("Error in handleAcceptSuggestion: ",t)}},this.trackAgentPins=t=>{try{const e=this.agentPinTargets;if(this.agentPinTargets=new Map((t=>{const e=[],i=new Set;for(const n of Array.isArray(t)?t:[]){if("square"!==Ap(n))continue;const t=Wh(n);t&&!i.has(t)&&(i.add(t),e.push({id:t,icon:Ip(n)}))}return e})(t).map((t=>[t.id,t]))),!this.isConnected)return;for(const t of e.keys())if(!this.agentPinTargets.has(t))for(const e of zp(t))Zp(e),this.agentPinDecoratedContainers.delete(e);this.decorateAgentPins(),this.syncAgentPinDomObserver()}catch(t){console.warn("Error in trackAgentPins: ",t),zd("Error in trackAgentPins: ",t)}},this.resyncAgentPins=()=>{try{if(!this.isConnected||0===this.agentPinTargets.size)return;this.decorateAgentPins(),this.syncAgentPinDomObserver()}catch(t){console.warn("Error in resyncAgentPins: ",t),zd("Error in resyncAgentPins: ",t)}},this.decorateAgentPins=()=>{try{if(!this.isConnected)return;const t=new Set,e=new Map;for(const i of this.agentPinTargets.values())for(const n of zp(i.id))"light"===this.decorateAgentPinContainer(n,i,e)&&t.add(i.id);this.agentPinLightDomIds=t,this.writeAgentPinPageCss()}catch(t){console.warn("Error in decorateAgentPins: ",t),zd("Error in decorateAgentPins: ",t)}},this.decorateAgentPinContainer=(t,e,i)=>{let n=i.get(e.icon);void 0===n&&(n=jp(e.icon),i.set(e.icon,n));const o=Up(t);for(const t of o)Bp(t,n);this.agentPinDecoratedContainers.add(t);const r=Wp(t,o);return"unrecognised"===r&&this.noteUnrecognisedAgentPin(t),r},this.noteUnrecognisedAgentPin=t=>{try{if(this.agentPinMarkupReported)return;this.agentPinUnrecognisedContainers.add(t),null===this.agentPinMarkupRecheckTimer&&(this.agentPinMarkupRecheckTimer=setTimeout((()=>this.checkUnrecognisedAgentPins()),Yp.AGENT_PIN_MARKUP_RECHECK_MS))}catch(t){console.warn("Error in noteUnrecognisedAgentPin: ",t)}},this.checkUnrecognisedAgentPins=()=>{try{null!==this.agentPinMarkupRecheckTimer&&(clearTimeout(this.agentPinMarkupRecheckTimer),this.agentPinMarkupRecheckTimer=null);const t=Array.from(this.agentPinUnrecognisedContainers);if(this.agentPinUnrecognisedContainers.clear(),this.agentPinMarkupReported||!this.isConnected)return;for(const e of t){const t=Hp(e);if(!e.isConnected||!this.agentPinTargets.has(t)||"unrecognised"!==Wp(e))continue;this.agentPinMarkupReported=!0;const i=Fp.join(" ");return console.warn(`[Superflow] Agent pin not squared: the SDK rendered pin ${t} with none of the SDK pin internals (${i}). Update SDK_PIN_INTERNALS for this SDK version.`),void zd("Agent pin SDK markup not recognised","SDK pin internals changed",{annotationId:t,selectors:i})}}catch(t){console.warn("Error in checkUnrecognisedAgentPins: ",t)}},this.decoratePendingAgentPins=()=>{try{const t=Array.from(this.agentPinPendingContainers);if(this.agentPinPendingContainers.clear(),!this.isConnected)return;const e=new Map;let i=!1;for(const n of t){if(!n.isConnected||this.agentPinDecoratedContainers.has(n))continue;const t=this.agentPinTargets.get(Hp(n));t&&("light"!==this.decorateAgentPinContainer(n,t,e)||this.agentPinLightDomIds.has(t.id)||(this.agentPinLightDomIds.add(t.id),i=!0))}i&&this.writeAgentPinPageCss()}catch(t){console.warn("Error in decoratePendingAgentPins: ",t),zd("Error in decoratePendingAgentPins: ",t)}},this.writeAgentPinPageCss=()=>{const t=[];for(const e of this.agentPinLightDomIds){const i=this.agentPinTargets.get(e);i&&t.push(i)}const e=(t=>{var e;const i=new Map;for(const n of Array.isArray(t)?t:[]){if(!(null==n?void 0:n.id))continue;const t=null!==(e=i.get(n.icon))&&void 0!==e?e:[];t.push(`#${Op}${Vp(n.id)}`),i.set(n.icon,t)}return Array.from(i.entries()).map((([t,e])=>jp(t,e))).join("\n")})(t);e!==this.agentPinPageCss&&(this.agentPinPageCss=e,document.head&&Bp(document.head,e))},this.scheduleAgentPinDecorate=()=>{try{if(!this.isConnected||0===this.agentPinTargets.size||null!==this.agentPinFrameCancel)return;const t=()=>{this.agentPinFrameCancel=null,this.decoratePendingAgentPins()};if("function"==typeof requestAnimationFrame){const e=requestAnimationFrame(t);this.agentPinFrameCancel=()=>cancelAnimationFrame(e)}else{const e=setTimeout(t,16);this.agentPinFrameCancel=()=>clearTimeout(e)}}catch(t){console.warn("Error in scheduleAgentPinDecorate: ",t),zd("Error in scheduleAgentPinDecorate: ",t)}},this.onAgentPinMutations=t=>{try{if(0===this.agentPinTargets.size)return;const{added:e,changed:i}=(t=>{const e=new Set,i=new Set;try{for(const n of Array.isArray(t)?t:[]){const t=null==n?void 0:n.addedNodes;if(!t||0===t.length)continue;let o=!1;for(let i=0;i<t.length;i+=1){const n=t[i];if(1!==n.nodeType)continue;o=!0;const r=n;Hp(r)?e.add(r):Rp.includes(r.localName)&&r.querySelectorAll(Lp).forEach((t=>e.add(t)))}const r=n.target;if(!o||!r||1!==r.nodeType)continue;const s=r.closest(Lp);s&&i.add(s)}}catch{}return{added:Array.from(e),changed:Array.from(i)}})(t);let n=!1;for(const t of i)this.agentPinTargets.has(Hp(t))&&(this.agentPinDecoratedContainers.delete(t),this.agentPinPendingContainers.add(t),n=!0);for(const t of e)!this.agentPinDecoratedContainers.has(t)&&this.agentPinTargets.has(Hp(t))&&(this.agentPinPendingContainers.add(t),n=!0);n&&this.scheduleAgentPinDecorate()}catch(t){console.warn("Error in onAgentPinMutations: ",t),zd("Error in onAgentPinMutations: ",t)}},this.syncAgentPinDomObserver=()=>{var t;try{if(!this.isConnected||0===this.agentPinTargets.size)return null===(t=this.agentPinDomObserver)||void 0===t||t.disconnect(),void(this.agentPinDomObserver=null);if(this.agentPinDomObserver||"undefined"==typeof MutationObserver||!document.body)return;this.agentPinDomObserver=new MutationObserver((t=>this.onAgentPinMutations(t))),this.agentPinDomObserver.observe(document.body,{childList:!0,subtree:!0})}catch(t){console.warn("Error in syncAgentPinDomObserver: ",t),zd("Error in syncAgentPinDomObserver: ",t)}},this.teardownAgentPins=()=>{var t,e;try{null===(t=this.agentPinDomObserver)||void 0===t||t.disconnect(),this.agentPinDomObserver=null,null===(e=this.agentPinFrameCancel)||void 0===e||e.call(this),this.agentPinFrameCancel=null,this.agentPinPendingContainers.clear(),null!==this.agentPinMarkupRecheckTimer&&(clearTimeout(this.agentPinMarkupRecheckTimer),this.agentPinMarkupRecheckTimer=null),this.agentPinUnrecognisedContainers.clear(),this.agentPinLightDomIds=new Set,this.agentPinPageCss="",document.head&&Bp(document.head,"");for(const t of this.agentPinTargets.values())for(const e of zp(t.id))Zp(e);this.agentPinDecoratedContainers=new WeakSet}catch(t){console.warn("Error in teardownAgentPins: ",t),zd("Error in teardownAgentPins: ",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),zd("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),zd("Error in disableAddCommentMode: ",t)}},this.disableCommentModeButton=()=>{try{return this.addCommentMode?L`
|
|
6569
6569
|
<div class="disable-add-comment-button" @click=${()=>this.disableCommentMode()}>
|
|
6570
6570
|
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
6571
6571
|
<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"/>
|
|
@@ -6692,7 +6692,10 @@ class zc extends $a{}zc.Encryptor=class extends zc{processBlock(t,e){const i=t,n
|
|
|
6692
6692
|
@click=${()=>this.onRequestCollapseClick()}>
|
|
6693
6693
|
<span class="toolbar-logo">${this.getLogoMark(!0)}</span>
|
|
6694
6694
|
</button>
|
|
6695
|
-
${
|
|
6695
|
+
${this.isRequestStateLoading()?L`
|
|
6696
|
+
<span class="request-loading" role="status" aria-label=${gh(Td)}
|
|
6697
|
+
data-testid="sf-request-loading"></span>
|
|
6698
|
+
`:i?L`
|
|
6696
6699
|
${this.renderCommentTool()}
|
|
6697
6700
|
<div class="tooltip request-requests" data-testid="sf-request-requests">
|
|
6698
6701
|
<div class="tooltiptext">${o}</div>
|
|
@@ -6703,9 +6706,6 @@ class zc extends $a{}zc.Encryptor=class extends zc{processBlock(t,e){const i=t,n
|
|
|
6703
6706
|
${this.renderToolsBlockedNotices()}
|
|
6704
6707
|
${this.renderCommentsDisabledNotice()}
|
|
6705
6708
|
</div>
|
|
6706
|
-
`:this.isRequestStateLoading()?L`
|
|
6707
|
-
<span class="request-loading" role="status" aria-label=${gh(Td)}
|
|
6708
|
-
data-testid="sf-request-loading"></span>
|
|
6709
6709
|
`:null}
|
|
6710
6710
|
${this.renderRequestMenu(e)}
|
|
6711
6711
|
</div>
|
|
@@ -7643,4 +7643,4 @@ class zc extends $a{}zc.Encryptor=class extends zc{processBlock(t,e){const i=t,n
|
|
|
7643
7643
|
</div>
|
|
7644
7644
|
</div>
|
|
7645
7645
|
`:L``}
|
|
7646
|
-
`:L``}}Yp.SUGGESTION_ACTIONS_HIDDEN_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 ",Yp.SUGGESTION_ACTIONS_HIDDEN_STYLE_ATTR="data-sf-suggestion-actions-hidden",Yp.COLLABORATION_TAGS=[Re.VELT_COMMENTS,Re.VELT_CURSOR,Re.VELT_HUDDLE,Re.VELT_RECORDER_NOTES,Re.VELT_RECORDER_CONTROL_PANEL,Re.VELT_ARROWS,Re.VELT_COMMENTS_SIDEBAR_LEGACY,Re.VELT_COMMENTS_SIDEBAR_V2],Yp.AGENT_PIN_MARKUP_RECHECK_MS=2e3,Yp.styles=[fh,mh],Kp([ot()],Yp.prototype,"loadPlugin",null),Kp([ot()],Yp.prototype,"comments",void 0),Kp([ot()],Yp.prototype,"commentElement",void 0),Kp([ot()],Yp.prototype,"contactElement",void 0),Kp([ot()],Yp.prototype,"rewriterElement",void 0),Kp([ot()],Yp.prototype,"presenceElement",void 0),Kp([ot()],Yp.prototype,"commentSubscription",void 0),Kp([ot()],Yp.prototype,"selectionElement",void 0),Kp([ot()],Yp.prototype,"viewsElement",void 0),Kp([ot()],Yp.prototype,"docElement",void 0),Kp([ot()],Yp.prototype,"addCommentMode",void 0),Kp([ot()],Yp.prototype,"showTourCommentTooltip",void 0),Kp([ot()],Yp.prototype,"firstCommentNudge",void 0),Kp([ot()],Yp.prototype,"allFeatureDisabled",void 0),Kp([ot()],Yp.prototype,"planLimitLocked",void 0),Kp([ot()],Yp.prototype,"projectDeleted",void 0),Kp([ot()],Yp.prototype,"allFeatureRestricted",void 0),Kp([ot()],Yp.prototype,"guestMode",void 0),Kp([ot()],Yp.prototype,"_expanded",void 0),Kp([ot()],Yp.prototype,"loading",void 0),Kp([ot()],Yp.prototype,"signInError",void 0),Kp([ot()],Yp.prototype,"snippylyUser",void 0),Kp([ot()],Yp.prototype,"snippylyUserRole",void 0),Kp([ot()],Yp.prototype,"_isPlanExpired",void 0),Kp([ot()],Yp.prototype,"showOnboardingModal",void 0),Kp([ot()],Yp.prototype,"embedMode",void 0),Kp([ot()],Yp.prototype,"readOnlyMode",void 0),Kp([ot()],Yp.prototype,"onboardingMode",void 0),Kp([ot()],Yp.prototype,"agentStatusMode",void 0),Kp([ot()],Yp.prototype,"agentsSidebarRequested",void 0),Kp([ot()],Yp.prototype,"loadedVeltVersion",void 0),Kp([ot()],Yp.prototype,"requestModeSwitch",void 0),Kp([ot()],Yp.prototype,"requestToolbarExpanded",void 0),Kp([ot()],Yp.prototype,"requestMenuOpen",void 0),Kp([ot()],Yp.prototype,"showLiveDemoModal",void 0),Kp([ot()],Yp.prototype,"showFigmaDemoModal",void 0),Kp([ot()],Yp.prototype,"showGuestModeSignInModal",void 0),Kp([ot()],Yp.prototype,"guestModeSignInModalConfig",void 0),Kp([ot()],Yp.prototype,"showGuestModeNameModal",void 0),Kp([ot()],Yp.prototype,"guestModeSignInBannerVisible",void 0),Kp([ot()],Yp.prototype,"guestUserNameInput",void 0),Kp([ot()],Yp.prototype,"guestUserModelOpened",void 0),Kp([ot()],Yp.prototype,"guestUserNameUpdated",void 0),Kp([ot()],Yp.prototype,"guestUserNameUpdateLoading",void 0),Kp([nt()],Yp.prototype,"apiKey",null),Kp([nt()],Yp.prototype,"projectId",null),Kp([ot()],Yp.prototype,"staging",void 0),Kp([nt()],Yp.prototype,"projectVersionKey",null),Kp([ot()],Yp.prototype,"projectVersion",void 0),Kp([ot()],Yp.prototype,"version",void 0),Kp([nt()],Yp.prototype,"veltVersion",void 0),Kp([nt()],Yp.prototype,"autoLocation",null),Kp([ot()],Yp.prototype,"_menuOpenedId",void 0),Kp([ot()],Yp.prototype,"copyLinkTooltip",void 0),Kp([ot()],Yp.prototype,"invalidApiKey",void 0),Kp([ot()],Yp.prototype,"documentId",void 0),Kp([ot()],Yp.prototype,"serverDocumentId",void 0),Kp([ot()],Yp.prototype,"_isUserGlobalContact",void 0),Kp([ot()],Yp.prototype,"location",void 0),Kp([ot()],Yp.prototype,"qrCode",void 0),Kp([ot()],Yp.prototype,"showQrCode",void 0),Kp([ot()],Yp.prototype,"qrCodeLoading",void 0),Kp([ot()],Yp.prototype,"qrCodeError",void 0),Kp([ot()],Yp.prototype,"customLoginEnabledLocally",void 0),Kp([nt()],Yp.prototype,"customLoginEnabled",void 0),Kp([ot()],Yp.prototype,"providedUser",void 0),Kp([ot()],Yp.prototype,"autoTranslation",void 0),Kp([ot()],Yp.prototype,"addCommentCount",void 0),Kp([ot()],Yp.prototype,"isSigningInUserAdmin",void 0),Kp([ot()],Yp.prototype,"_privateCommentModeEnabled",void 0),Kp([ot()],Yp.prototype,"superflowToolbarMoved",void 0),Kp([ot()],Yp.prototype,"_customerMetadata",void 0),Kp([ot()],Yp.prototype,"logoMark",void 0),Kp([ot()],Yp.prototype,"wordMark",void 0),Kp([ot()],Yp.prototype,"_darkMode",void 0),Kp([ot()],Yp.prototype,"projectConfig",void 0),Kp([ot()],Yp.prototype,"allowGuestModeSignIn",void 0),Kp([ot()],Yp.prototype,"_queryParamsComments",void 0),Kp([ot()],Yp.prototype,"_usePageTitleAsLocationName",void 0),Kp([ot()],Yp.prototype,"toolbarEnabled",void 0),Kp([ot()],Yp.prototype,"toolbarEnabledApiCalled",void 0),Kp([ot()],Yp.prototype,"passwordProtected",void 0),Kp([ot()],Yp.prototype,"isPasswordValid",void 0),Kp([ot()],Yp.prototype,"password",void 0),Kp([ot()],Yp.prototype,"validatingPasswordLoading",void 0),Kp([ot()],Yp.prototype,"showPasswordProtectedModal",void 0),Kp([ot()],Yp.prototype,"showInvalidPassword",void 0),Kp([ot()],Yp.prototype,"skipGuestNameModal",void 0),Kp([ot()],Yp.prototype,"_totalViews",void 0),Kp([ot()],Yp.prototype,"totalViewsCount",void 0),Kp([ot()],Yp.prototype,"inviteUrl",void 0),Kp([ot()],Yp.prototype,"showModalOnceCommentIsModeIsOff",void 0),Kp([ot()],Yp.prototype,"showInviteModal",void 0),Kp([ot()],Yp.prototype,"showBugReportModal",void 0),Kp([ot()],Yp.prototype,"featureAccess",void 0),Kp([ot()],Yp.prototype,"hasAgentAccess",void 0),Kp([ot()],Yp.prototype,"hasPrivateCommentsAccess",void 0),Kp([ot()],Yp.prototype,"isPrivateCommentsEnabledOnWorkspace",void 0),Kp([ot()],Yp.prototype,"hasContentWarnings",void 0),Kp([ot()],Yp.prototype,"contentWarningsCount",void 0),Kp([ot()],Yp.prototype,"showContentWarningSidebar",void 0),Kp([ot()],Yp.prototype,"showAgentCommentsInSidebar",void 0),Kp([ot()],Yp.prototype,"pageCommentsHidden",void 0),Kp([ot()],Yp.prototype,"agentsSidebarModeLatched",void 0),Kp([ot()],Yp.prototype,"veltProxyToggleVisible",void 0),Kp([ot()],Yp.prototype,"nativeScreenshotEnabled",void 0),Kp([ot()],Yp.prototype,"nativeScreenshotDenied",void 0),Kp([ot()],Yp.prototype,"capturingScreenshot",void 0),Kp([ot()],Yp.prototype,"agentGroups",void 0),Kp([ot()],Yp.prototype,"lockedAgentIssueCount",void 0),Kp([ot()],Yp.prototype,"agentRunStatuses",void 0),Kp([ot()],Yp.prototype,"agentRunStatusTimedOut",void 0),Kp([ot()],Yp.prototype,"agentRunStatusSettled",void 0),Kp([ot()],Yp.prototype,"onboardingUnsyncedAnnotationIds",void 0),Kp([ot()],Yp.prototype,"spellingSuggestionPagePathMap",void 0),Kp([ot()],Yp.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"),n=t.getAttribute("projectVersionKey"),o=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:n,projectId:o,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,n=i.has("apiKey")?i.get("apiKey"):void 0;return{valid:!!n,type:"sdkUrl",apiKey:n,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],n=e.loaders[i]();if(n&&n.valid)return n}}},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()}))})(Yp);class Jp extends X{}customElements.get("snippyly-plugin")||customElements.define("snippyly-plugin",Jp);export{Jp as SnippylyPlugin,Yp as SuperflowToolbar};
|
|
7646
|
+
`:L``}}Yp.SUGGESTION_ACTIONS_HIDDEN_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 ",Yp.SUGGESTION_ACTIONS_HIDDEN_STYLE_ATTR="data-sf-suggestion-actions-hidden",Yp.COLLABORATION_TAGS=[Re.VELT_COMMENTS,Re.VELT_CURSOR,Re.VELT_HUDDLE,Re.VELT_RECORDER_NOTES,Re.VELT_RECORDER_CONTROL_PANEL,Re.VELT_ARROWS,Re.VELT_COMMENTS_SIDEBAR_LEGACY,Re.VELT_COMMENTS_SIDEBAR_V2],Yp.AGENT_PIN_MARKUP_RECHECK_MS=2e3,Yp.styles=[fh,mh],Kp([ot()],Yp.prototype,"loadPlugin",null),Kp([ot()],Yp.prototype,"comments",void 0),Kp([ot()],Yp.prototype,"commentElement",void 0),Kp([ot()],Yp.prototype,"contactElement",void 0),Kp([ot()],Yp.prototype,"rewriterElement",void 0),Kp([ot()],Yp.prototype,"presenceElement",void 0),Kp([ot()],Yp.prototype,"commentSubscription",void 0),Kp([ot()],Yp.prototype,"selectionElement",void 0),Kp([ot()],Yp.prototype,"viewsElement",void 0),Kp([ot()],Yp.prototype,"docElement",void 0),Kp([ot()],Yp.prototype,"addCommentMode",void 0),Kp([ot()],Yp.prototype,"showTourCommentTooltip",void 0),Kp([ot()],Yp.prototype,"firstCommentNudge",void 0),Kp([ot()],Yp.prototype,"allFeatureDisabled",void 0),Kp([ot()],Yp.prototype,"planLimitLocked",void 0),Kp([ot()],Yp.prototype,"projectDeleted",void 0),Kp([ot()],Yp.prototype,"allFeatureRestricted",void 0),Kp([ot()],Yp.prototype,"guestMode",void 0),Kp([ot()],Yp.prototype,"_expanded",void 0),Kp([ot()],Yp.prototype,"loading",void 0),Kp([ot()],Yp.prototype,"signInError",void 0),Kp([ot()],Yp.prototype,"snippylyUser",void 0),Kp([ot()],Yp.prototype,"snippylyUserRole",void 0),Kp([ot()],Yp.prototype,"_isPlanExpired",void 0),Kp([ot()],Yp.prototype,"showOnboardingModal",void 0),Kp([ot()],Yp.prototype,"embedMode",void 0),Kp([ot()],Yp.prototype,"readOnlyMode",void 0),Kp([ot()],Yp.prototype,"onboardingMode",void 0),Kp([ot()],Yp.prototype,"agentStatusMode",void 0),Kp([ot()],Yp.prototype,"agentsSidebarRequested",void 0),Kp([ot()],Yp.prototype,"loadedVeltVersion",void 0),Kp([ot()],Yp.prototype,"requestModeSwitch",void 0),Kp([ot()],Yp.prototype,"requestToolbarExpanded",void 0),Kp([ot()],Yp.prototype,"requestMenuOpen",void 0),Kp([ot()],Yp.prototype,"commentsDisabledSetting",void 0),Kp([ot()],Yp.prototype,"showLiveDemoModal",void 0),Kp([ot()],Yp.prototype,"showFigmaDemoModal",void 0),Kp([ot()],Yp.prototype,"showGuestModeSignInModal",void 0),Kp([ot()],Yp.prototype,"guestModeSignInModalConfig",void 0),Kp([ot()],Yp.prototype,"showGuestModeNameModal",void 0),Kp([ot()],Yp.prototype,"guestModeSignInBannerVisible",void 0),Kp([ot()],Yp.prototype,"guestUserNameInput",void 0),Kp([ot()],Yp.prototype,"guestUserModelOpened",void 0),Kp([ot()],Yp.prototype,"guestUserNameUpdated",void 0),Kp([ot()],Yp.prototype,"guestUserNameUpdateLoading",void 0),Kp([nt()],Yp.prototype,"apiKey",null),Kp([nt()],Yp.prototype,"projectId",null),Kp([ot()],Yp.prototype,"staging",void 0),Kp([nt()],Yp.prototype,"projectVersionKey",null),Kp([ot()],Yp.prototype,"projectVersion",void 0),Kp([ot()],Yp.prototype,"version",void 0),Kp([nt()],Yp.prototype,"veltVersion",void 0),Kp([nt()],Yp.prototype,"autoLocation",null),Kp([ot()],Yp.prototype,"_menuOpenedId",void 0),Kp([ot()],Yp.prototype,"copyLinkTooltip",void 0),Kp([ot()],Yp.prototype,"invalidApiKey",void 0),Kp([ot()],Yp.prototype,"documentId",void 0),Kp([ot()],Yp.prototype,"serverDocumentId",void 0),Kp([ot()],Yp.prototype,"_isUserGlobalContact",void 0),Kp([ot()],Yp.prototype,"location",void 0),Kp([ot()],Yp.prototype,"qrCode",void 0),Kp([ot()],Yp.prototype,"showQrCode",void 0),Kp([ot()],Yp.prototype,"qrCodeLoading",void 0),Kp([ot()],Yp.prototype,"qrCodeError",void 0),Kp([ot()],Yp.prototype,"customLoginEnabledLocally",void 0),Kp([nt()],Yp.prototype,"customLoginEnabled",void 0),Kp([ot()],Yp.prototype,"providedUser",void 0),Kp([ot()],Yp.prototype,"autoTranslation",void 0),Kp([ot()],Yp.prototype,"addCommentCount",void 0),Kp([ot()],Yp.prototype,"isSigningInUserAdmin",void 0),Kp([ot()],Yp.prototype,"_privateCommentModeEnabled",void 0),Kp([ot()],Yp.prototype,"superflowToolbarMoved",void 0),Kp([ot()],Yp.prototype,"_customerMetadata",void 0),Kp([ot()],Yp.prototype,"logoMark",void 0),Kp([ot()],Yp.prototype,"wordMark",void 0),Kp([ot()],Yp.prototype,"_darkMode",void 0),Kp([ot()],Yp.prototype,"projectConfig",void 0),Kp([ot()],Yp.prototype,"allowGuestModeSignIn",void 0),Kp([ot()],Yp.prototype,"_queryParamsComments",void 0),Kp([ot()],Yp.prototype,"_usePageTitleAsLocationName",void 0),Kp([ot()],Yp.prototype,"toolbarEnabled",void 0),Kp([ot()],Yp.prototype,"toolbarEnabledApiCalled",void 0),Kp([ot()],Yp.prototype,"passwordProtected",void 0),Kp([ot()],Yp.prototype,"isPasswordValid",void 0),Kp([ot()],Yp.prototype,"password",void 0),Kp([ot()],Yp.prototype,"validatingPasswordLoading",void 0),Kp([ot()],Yp.prototype,"showPasswordProtectedModal",void 0),Kp([ot()],Yp.prototype,"showInvalidPassword",void 0),Kp([ot()],Yp.prototype,"skipGuestNameModal",void 0),Kp([ot()],Yp.prototype,"_totalViews",void 0),Kp([ot()],Yp.prototype,"totalViewsCount",void 0),Kp([ot()],Yp.prototype,"inviteUrl",void 0),Kp([ot()],Yp.prototype,"showModalOnceCommentIsModeIsOff",void 0),Kp([ot()],Yp.prototype,"showInviteModal",void 0),Kp([ot()],Yp.prototype,"showBugReportModal",void 0),Kp([ot()],Yp.prototype,"featureAccess",void 0),Kp([ot()],Yp.prototype,"hasAgentAccess",void 0),Kp([ot()],Yp.prototype,"hasPrivateCommentsAccess",void 0),Kp([ot()],Yp.prototype,"isPrivateCommentsEnabledOnWorkspace",void 0),Kp([ot()],Yp.prototype,"hasContentWarnings",void 0),Kp([ot()],Yp.prototype,"contentWarningsCount",void 0),Kp([ot()],Yp.prototype,"showContentWarningSidebar",void 0),Kp([ot()],Yp.prototype,"showAgentCommentsInSidebar",void 0),Kp([ot()],Yp.prototype,"pageCommentsHidden",void 0),Kp([ot()],Yp.prototype,"agentsSidebarModeLatched",void 0),Kp([ot()],Yp.prototype,"veltProxyToggleVisible",void 0),Kp([ot()],Yp.prototype,"nativeScreenshotEnabled",void 0),Kp([ot()],Yp.prototype,"nativeScreenshotDenied",void 0),Kp([ot()],Yp.prototype,"capturingScreenshot",void 0),Kp([ot()],Yp.prototype,"agentGroups",void 0),Kp([ot()],Yp.prototype,"lockedAgentIssueCount",void 0),Kp([ot()],Yp.prototype,"agentRunStatuses",void 0),Kp([ot()],Yp.prototype,"agentRunStatusTimedOut",void 0),Kp([ot()],Yp.prototype,"agentRunStatusSettled",void 0),Kp([ot()],Yp.prototype,"onboardingUnsyncedAnnotationIds",void 0),Kp([ot()],Yp.prototype,"spellingSuggestionPagePathMap",void 0),Kp([ot()],Yp.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"),n=t.getAttribute("projectVersionKey"),o=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:n,projectId:o,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,n=i.has("apiKey")?i.get("apiKey"):void 0;return{valid:!!n,type:"sdkUrl",apiKey:n,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],n=e.loaders[i]();if(n&&n.valid)return n}}},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()}))})(Yp);class Jp extends X{}customElements.get("snippyly-plugin")||customElements.define("snippyly-plugin",Jp);export{Jp as SnippylyPlugin,Yp as SuperflowToolbar};
|