@snippyly/plugin-staging 1.0.111 → 1.0.112

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/snippyly.js +4 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snippyly/plugin-staging",
3
- "version": "1.0.111",
3
+ "version": "1.0.112",
4
4
  "description": "",
5
5
  "main": "snippyly.js",
6
6
  "scripts": {
package/snippyly.js CHANGED
@@ -390,7 +390,7 @@ class $i{constructor(t,i,e){this.auth=null,this.messaging=null,this.appCheck=nul
390
390
  */
391
391
  class us extends le{}us.Encryptor=class extends us{processBlock(t,i){const e=t,n=this._cipher,{blockSize:s}=n,o=this._iv;let r=this._counter;o&&(this._counter=o.slice(0),r=this._counter,this._iv=void 0),(t=>{const i=t;i[0]=ps(i[0]),0===i[0]&&(i[1]=ps(i[1]))})(r);const l=r.slice(0);n.encryptBlock(l,0);for(let t=0;t<s;t+=1)e[i+t]^=l[t]}},us.Decryptor=us.Encryptor;class fs extends le{}fs.Encryptor=class extends fs{processBlock(t,i){this._cipher.encryptBlock(t,i)}},fs.Decryptor=class extends fs{processBlock(t,i){this._cipher.decryptBlock(t,i)}};class vs extends le{}vs.Encryptor=class extends vs{processBlock(t,i){const e=t,n=this._cipher,{blockSize:s}=n,o=this._iv;let r=this._keystream;o&&(this._keystream=o.slice(0),r=this._keystream,this._iv=void 0),n.encryptBlock(r,0);for(let t=0;t<s;t+=1)e[i+t]^=r[t]}},vs.Decryptor=vs.Encryptor;const ws={pad(t,i){const e=4*i,n=e-t.sigBytes%e;t.concat(ji.random(n-1)).concat(ji.create([n<<24],1))},unpad(t){const i=t,e=255&i.words[i.sigBytes-1>>>2];i.sigBytes-=e}},gs={pad(t,i){const e=t,n=4*i;e.clamp(),e.sigBytes+=n-(t.sigBytes%n||n)},unpad(t){const i=t,e=i.words;for(let t=i.sigBytes-1;t>=0;t-=1)if(e[t>>>2]>>>24-t%4*8&255){i.sigBytes=t+1;break}}},ys={pad(t,i){t.concat(ji.create([2147483648],1)),gs.pad(t,i)},unpad(t){const i=t;gs.unpad(i),i.sigBytes-=1}},ms={stringify:t=>t.ciphertext.toString(Ui),parse(t){const i=Ui.parse(t);return pe.create({ciphertext:i})}};var Cs={lib:{Base:Zi,WordArray:ji,BufferedBlockAlgorithm:Ri,Hasher:zi,Cipher:oe,StreamCipher:re,BlockCipherMode:le,BlockCipher:de,CipherParams:pe,SerializableCipher:fe,PasswordBasedCipher:we},x64:{Word:Ji,WordArray:Ki},enc:{Hex:Ui,Latin1:Oi,Utf8:Ni,Utf16:me,Utf16BE:ye,Utf16LE:Ce,Base64:Wi},algo:{HMAC:Pi,MD5:ie,SHA1:xe,SHA224:De,SHA256:Be,SHA384:Re,SHA512:Ue,SHA3:Qe,RIPEMD160:vn,PBKDF2:yn,EvpKDF:se,AES:_n,DES:Nn,TripleDES:zn,Rabbit:Gn,RabbitLegacy:es,RC4:os,RC4Drop:ls},mode:{CBC:ce,CFB:hs,CTR:ds,CTRGladman:us,ECB:fs,OFB:vs},pad:{Pkcs7:he,AnsiX923:{pad(t,i){const e=t,n=e.sigBytes,s=4*i,o=s-n%s,r=n+o-1;e.clamp(),e.words[r>>>2]|=o<<24-r%4*8,e.sigBytes+=o},unpad(t){const i=t,e=255&i.words[i.sigBytes-1>>>2];i.sigBytes-=e}},Iso10126:ws,Iso97971:ys,NoPadding:{pad(){},unpad(){}},ZeroPadding:gs},format:{OpenSSL:ue,Hex:ms},kdf:{OpenSSL:ve},MD5:ee,HmacMD5:ne,SHA1:Ee,HmacSHA1:Se,SHA224:Ve,HmacSHA224:Te,SHA256:_e,HmacSHA256:Ie,SHA384:ze,HmacSHA384:Pe,SHA512:Oe,HmacSHA512:Ne,SHA3:tn,HmacSHA3:en,RIPEMD160:wn,HmacRIPEMD160:gn,PBKDF2:(t,i,e)=>yn.create(e).compute(t,i),EvpKDF:(t,i,e)=>se.create(e).compute(t,i),AES:In,DES:Rn,TripleDES:Pn,Rabbit:Xn,RabbitLegacy:ns,RC4:rs,RC4Drop:as};const bs=(t,i,e=!1,n="localStorage")=>{try{const s=e?btoa(i):i;"localStorage"===n?localStorage.setItem(t,s):sessionStorage.setItem(t,s)}catch(t){console.warn("Error in setLocalStorage: ",t),Di("Error in setLocalStorage: ",t)}},xs=(t,i=!1,e="localStorage")=>{try{let n=null;return n="localStorage"===e?localStorage.getItem(t):sessionStorage.getItem(t),n&&i?atob(n):n}catch(t){return console.warn("Error in getLocalStorage: ",t),Di("Error in getLocalStorage: ",t),null}},Es=(t,i="localStorage")=>{try{"localStorage"===i?localStorage.removeItem(t):sessionStorage.removeItem(t)}catch(t){console.warn("Error in removeLocalStorageData: ",t),Di("Error in removeLocalStorageData: ",t)}},Ss=(...t)=>{if(t)switch(t.length){case 1:return r`calc(${t[0]}rem * var(--snippyly-base-rem-unit, 1))`;case 2:return r`calc(${t[0]}rem * var(--snippyly-base-rem-unit, 1)) calc(${t[1]}rem * var(--snippyly-base-rem-unit, 1))`;case 3:return r`calc(${t[0]}rem * var(--snippyly-base-rem-unit, 1)) calc(${t[1]}rem * var(--snippyly-base-rem-unit, 1))
392
392
  calc(${t[2]}rem * var(--snippyly-base-rem-unit, 1))`;case 4:return r`calc(${t[0]}rem * var(--snippyly-base-rem-unit, 1)) calc(${t[1]}rem * var(--snippyly-base-rem-unit, 1))
393
- calc(${t[2]}rem * var(--snippyly-base-rem-unit, 1)) calc(${t[3]}rem * var(--snippyly-base-rem-unit, 1))`}return r`0`},ks=t=>{try{return t.replace(/#.*$/,"")}catch(i){return console.warn("Error in removeHashFromUrl: ",i),Di("Error in removeHashFromUrl: ",i),t}},Ms=(t,i,e)=>{try{const n=Cs.enc.Utf8.parse(i),s=Cs.enc.Utf8.parse(e);return Cs.AES.encrypt(Cs.enc.Utf8.parse(t),n,{keySize:32,iv:s,mode:Cs.mode.CBC,padding:Cs.pad.Pkcs7}).toString()}catch(i){return console.warn("Error in encrypt: ",i),Di("Error in encrypt: ",i),t}},$s=(t,i,e)=>{try{const n=Cs.enc.Utf8.parse(i),s=Cs.enc.Utf8.parse(e);return Cs.AES.decrypt(t,n,{keySize:32,iv:s,mode:Cs.mode.CBC,padding:Cs.pad.Pkcs7}).toString(Cs.enc.Utf8)}catch(t){return console.warn("Error in decrypt: ",t),Di("Error in decrypt: ",t),null}},Fs=()=>{try{const t=xs("_sfut",!0);if(t){const i=$s(t,ft,vt);if(i)return JSON.parse(i);console.warn("Error in getUserFromToken: ","Invalid token."),Es("_sfut")}else{const t=xs("snippyly-user",!0);if(t)return Ls(),JSON.parse(t)}return null}catch(t){return console.warn("Error in getUserFromToken: ",t),Di("Error in getUserFromToken: ",t),null}},Ls=()=>{try{const t=xs("snippyly-user",!0);if(t){const i=Ms(t,ft,vt);bs("_sfut",i,!0)}Es("snippyly-user")}catch(t){console.warn("Error in moveSnippylyUserToST: ",t),Di("Error in moveSnippylyUserToST: ",t)}},As=r`
393
+ calc(${t[2]}rem * var(--snippyly-base-rem-unit, 1)) calc(${t[3]}rem * var(--snippyly-base-rem-unit, 1))`}return r`0`},ks=(t,i,e)=>{try{const n=Cs.enc.Utf8.parse(i),s=Cs.enc.Utf8.parse(e);return Cs.AES.encrypt(Cs.enc.Utf8.parse(t),n,{keySize:32,iv:s,mode:Cs.mode.CBC,padding:Cs.pad.Pkcs7}).toString()}catch(i){return console.warn("Error in encrypt: ",i),Di("Error in encrypt: ",i),t}},Ms=(t,i,e)=>{try{const n=Cs.enc.Utf8.parse(i),s=Cs.enc.Utf8.parse(e);return Cs.AES.decrypt(t,n,{keySize:32,iv:s,mode:Cs.mode.CBC,padding:Cs.pad.Pkcs7}).toString(Cs.enc.Utf8)}catch(t){return console.warn("Error in decrypt: ",t),Di("Error in decrypt: ",t),null}},$s=()=>{try{const t=xs("_sfut",!0);if(t){const i=Ms(t,ft,vt);if(i)return JSON.parse(i);console.warn("Error in getUserFromToken: ","Invalid token."),Es("_sfut")}else{const t=xs("snippyly-user",!0);if(t)return Fs(),JSON.parse(t)}return null}catch(t){return console.warn("Error in getUserFromToken: ",t),Di("Error in getUserFromToken: ",t),null}},Fs=()=>{try{const t=xs("snippyly-user",!0);if(t){const i=ks(t,ft,vt);bs("_sfut",i,!0)}Es("snippyly-user")}catch(t){console.warn("Error in moveSnippylyUserToST: ",t),Di("Error in moveSnippylyUserToST: ",t)}},Ls=r`
394
394
 
395
395
  .wrap {
396
396
  padding: 32px;
@@ -676,7 +676,7 @@ class us extends le{}us.Encryptor=class extends us{processBlock(t,i){const e=t,n
676
676
  transform: translate(50%, 41%) rotate(45deg);
677
677
  transform-origin: center;
678
678
  }
679
- `,Hs=r`
679
+ `,As=r`
680
680
  @import url('https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap');
681
681
 
682
682
  * {
@@ -1260,7 +1260,7 @@ class us extends le{}us.Encryptor=class extends us{processBlock(t,i){const e=t,n
1260
1260
  line-height: 1;
1261
1261
  cursor: pointer;
1262
1262
  }
1263
- `;(()=>{try{const t=window.SUPERFLOW_TOOLBAR_API_KEY,i=!!window.SUPERFLOW_TOOLBAR_STAGING,e=window.SUPERFLOW_TOOLBAR_PROJECT_VERSION_KEY,n=window.SUPERFLOW_TOOLBAR_PROJECT_ID;if(t){(()=>{try{document.querySelectorAll("snippyly-plugin").forEach((t=>{t.remove()}))}catch(t){console.warn("Error in removeSuperflowToolbarTag: ",t)}})();const s={};s.apiKey=t,i&&(s.staging="true"),e&&(s.projectVersionKey=e),n&&(s.projectId=n),((t={})=>{try{const i=document.createElement("snippyly-plugin");Object.keys(t||{}).forEach((e=>{i.setAttribute(e,t[e])})),document.body.appendChild(i)}catch(t){console.warn("Error in loadSuperflowToolbarTag: ",t)}})(s)}}catch(t){console.warn("Error in initSuperflow: ",t)}})();var Bs=function(t,i,e,n){for(var s,o=arguments.length,r=o<3?i:null===n?n=Object.getOwnPropertyDescriptor(i,e):n,l=t.length-1;l>=0;l--)(s=t[l])&&(r=(o<3?s(r):o>3?s(i,e,r):s(i,e))||r);return o>3&&r&&Object.defineProperty(i,e,r),r};let _s=class extends Y{constructor(){var e,n,s,o,r;super(),this._loadPlugin=!1,this.comments=[],this.addCommentMode=!1,this._expanded=!0,this.loading=!1,this.isPlanExpired=null,this.showOnboardingModal=!0,this.showLiveDemoModal=!1,this.staging=true,this.copyLinkTooltip="Copy Link",this.invalidApiKey=!1,this.isUserGlobalContact=!1,this.showQrCode=!1,this.exitReviewModeCalled=!1,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),Di("Error in addWindowClickEventListener: ",t)}},this.removeWindowClickEventListener=()=>{try{window.removeEventListener("click",this.windowClickEventListener),this.windowClickEventListener=void 0}catch(t){console.warn("Error in removeWindowClickEventListener: ",t),Di("Error in removeWindowClickEventListener: ",t)}},this.setWindowEventListner=()=>{try{window.addEventListener("locationchange",(()=>{this.checkUrl()}))}catch(t){console.warn("Error in setWindowEventListner: ",t),Di("Error in setWindowEventListner: ",t)}},this.urlChangeListener=()=>{try{const t=history.pushState;history.pushState=function(){const i=t.apply(this,arguments);return window.dispatchEvent(new Event("pushstate")),window.dispatchEvent(new Event("locationchange")),i};const i=history.replaceState;history.replaceState=function(){const t=i.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),Di("Error in urlChangeListener: ",t)}},this.checkUrl=()=>{try{const t=new URL(document.location),i=t.searchParams;if((null==i?void 0:i.has("sprojectInstall"))&&!xs("sprojectInstall")?this.showOnboardingModal=!0:this.showOnboardingModal=!1,null==i?void 0:i.has("sflivedemo"))if(xs("sflivedemo",!1,"sessionStorage")){this.showLiveDemoModal=!1;const t=new URL(document.location);t.searchParams.delete("sflivedemo"),window.history.replaceState({},null===document||void 0===document?void 0:document.title,t.toString())}else this.showLiveDemoModal=!0;else this.showLiveDemoModal=!1;if(i.has("st")||i.has("snippyly_google_token")){if(i.has("st")){const t=decodeURIComponent(i.get("st")),e=$s(t,ft,vt),n=e&&JSON.parse(e);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 i=JSON.stringify(t),e=Ms(i,ft,vt);bs("_sfut",e,!0)}}else if(i.has("snippyly_google_token")){const t=JSON.parse(atob(i.get("snippyly_google_token"))),e={};e.userId=t.uid,e.name=t.displayName,e.email=t.email,e.photoUrl=null==t?void 0:t.photoURL,bs("snippyly-user",JSON.stringify(e),!0)}i.delete("st"),i.delete("snippyly_google_token"),window.history.replaceState({},document.title,t.href)}i.has("review")?(bs("review","true",!1),Es("feedback"),"true"!==i.get("review")&&(i.delete("review"),i.append("review","true"),window.history.replaceState({},document.title,t.href)),this.loadPluginUI()):i.has("feedback")||xs("review",!1)&&(i.append("review","true"),window.history.replaceState({},document.title,t.href),this.loadPluginUI()),i.has("feedback")?(bs("feedback","true",!1),Es("review"),"true"!==i.get("feedback")&&(i.delete("feedback"),i.append("feedback","true"),window.history.replaceState({},document.title,t.href)),this.loadPluginUI()):i.has("review")||xs("feedback",!1)&&(i.append("feedback","true"),window.history.replaceState({},document.title,t.href),this.loadPluginUI()),this.setVersionInUrl()}catch(t){console.warn("Error in checkUrl: ",t),Di("Error in checkUrl: ",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&&bs("projectVersion",this.projectVersion,!1,"sessionStorage")}else{const t=new URL(document.location).searchParams;(t.has("review")||t.has("feedback"))&&t.has("sversion")&&(bs("projectVersionKey","sversion",!1,"sessionStorage"),this.projectVersion=t.get("sversion"),this.projectVersion&&bs("projectVersion",this.projectVersion,!1,"sessionStorage"))}}catch(t){console.warn("Error in detectVersion: ",t),Di("Error in detectVersion: ",t)}},this.setVersionInUrl=()=>{try{const t=this.projectVersionKey||xs("projectVersionKey",!1,"sessionStorage"),i=this.projectVersion||xs("projectVersion",!1,"sessionStorage");if(t&&i){const e=new URL(document.location),n=e.searchParams;n.get(t)||(n.set(t,i),window.history.replaceState({},document.title,e.href))}}catch(t){console.warn("Error in setVersionInUrl: ",t),Di("Error in setVersionInUrl: ",t)}},this.loadPluginUI=()=>{try{if(!this.apiKey)return;if(this.loadPlugin)return this.generateLocation(),void this.setViewMode(this.viewMode);const t=Fs();if(t&&!(null==t?void 0:t.isAnonymous)&&(this.loading=!0),this.loadPlugin=!0,!document.querySelector(lt)){const t=document.createElement(lt);null==t||t.addEventListener("signIn",(()=>{this.loginWithGoogle()})),window.document.body.appendChild(t)}if(!document.querySelector(at)){const t=document.createElement(at);t.setAttribute(ut,"true"),window.document.body.appendChild(t)}if(!document.querySelector(rt)){const t=document.createElement(rt);window.document.body.appendChild(t)}if(!document.querySelector(ct)){const t=document.createElement(ct);window.document.body.appendChild(t)}if(!document.querySelector(ht)){const t=document.createElement(ht);window.document.body.appendChild(t)}if(!document.querySelector(dt)){const t=document.createElement(dt);window.document.body.appendChild(t)}if(!document.querySelector(pt)){const t=document.createElement(pt);window.document.body.appendChild(t)}this.initializeSnippyly()}catch(t){this.loading=!1,console.warn("Error in loadPluginUI: ",t),Di("Error in loadPluginUI: ",t)}},this.initializeSnippyly=async()=>{var e,n,s,o,r,l;try{await(r=this.apiKey,l={options:{staging:this.staging,version:"latest"}},t(void 0,void 0,void 0,(function(){var t,e;return i(this,(function(i){switch(i.label){case 0:return i.trys.push([0,6,,7]),[4,(n=null==l?void 0:l.options,new Promise((function(t,i){var e=document.getElementById("snippylyScript"),s=!1,o="latest";if(n&&(n.staging&&(s=n.staging),n.version&&(o=n.version)),(null==n?void 0:n.version)||(o="1.0.78"),e)t();else{var r=document.createElement("script");r.src="https://cdn.jsdelivr.net/npm/@snippyly/sdk".concat(s?"-staging":"","@").concat(o,"/snippyly.js"),r.id="snippylyScript",r.type="module",document.body.appendChild(r),r.onload=function(){t()},r.onerror=function(){i(new Error("Failed to load Snippyly script"))}}})))];case 1:return i.sent(),t=window.Snippyly,l?[4,t.init(r,l)]:[3,3];case 2:return i.sent(),[3,5];case 3:return[4,t.init(r)];case 4:i.sent(),i.label=5;case 5:return(null==t?void 0:t.st)&&(null==t||t.st("client")),[2,t];case 6:return e=i.sent(),console.error(e),[2,null];case 7:return[2]}var n}))}))),Snippyly&&(null===Snippyly||void 0===Snippyly||Snippyly.sf(!0)),Snippyly&&Ii({sdkVersion:null===Snippyly||void 0===Snippyly?void 0:Snippyly.version,sdkType:"client"}),this.documentId=((t,i=0)=>{try{let e=3735928559^i,n=1103547991^i;for(let i,s=0;s<t.length;s++)i=t.charCodeAt(s),e=Math.imul(e^i,2654435761),n=Math.imul(n^i,1597334677);return e=Math.imul(e^e>>>16,2246822507)^Math.imul(n^n>>>13,3266489909),n=Math.imul(n^n>>>16,2246822507)^Math.imul(e^e>>>13,3266489909),4294967296*(2097151&n)+(e>>>0)}catch(t){return console.warn("Error in cyrb53: ",t),Di("Error in cyrb53: ",t),0}})((t=>{let i;return i=t.includes("http")?new URL(t):new URL("http://"+t),i.hostname.replace("www.","")})(window.location.origin))+"",this.projectId&&(this.documentId=this.projectId+""),await(null===Snippyly||void 0===Snippyly?void 0:Snippyly.setDocumentId(this.documentId+"")),this.generateLocation(),this.setLocation(),this.commentElement=null===Snippyly||void 0===Snippyly?void 0:Snippyly.getCommentElement(),this.contactElement=null===Snippyly||void 0===Snippyly?void 0:Snippyly.getContactElement(),this.rewriterElement=null===Snippyly||void 0===Snippyly?void 0:Snippyly.getRewriterElement(),this.presenceElement=null===Snippyly||void 0===Snippyly?void 0:Snippyly.getPresenceElement(),this.commentElement&&(this.commentElement.enableTextComments(!0),this.commentElement.enableSignInButton(!0),this.commentElement.enableAttachment(!0),this.commentElement.showScreenSizeInfo(!0),this.commentElement.showCommentIndex(!0),this.commentElement.addCommentModeChange&&this.commentElement.addCommentModeChange().subscribe((t=>{this.addCommentMode=t})),(null===(e=this.commentElement)||void 0===e?void 0:e.enableOrphanComments)&&this.commentElement.enableOrphanComments()),this.selectionElement=Snippyly.getSelectionElement(),this.selectionElement&&this.selectionElement.enableLiveSelection(!0),this.rewriterElement&&(null===(n=this.rewriterElement)||void 0===n||n.enableRewriter()),this.presenceElement&&(null===(s=this.presenceElement)||void 0===s?void 0:s.enableFollowAlongMode)&&(null===(o=this.presenceElement)||void 0===o||o.enableFollowAlongMode(!0)),this.identifySnippyly()}catch(t){this.loading=!1,console.warn("Error in initializeSnippyly: ",t),Di("Error in initializeSnippyly: ",t)}},this.generateLocation=()=>{try{const t=new URL(document.location).searchParams,i=new URL(document.location);i.searchParams.delete("review"),i.searchParams.delete("feedback"),i.searchParams.delete("sreviewId"),i.searchParams.delete("scommentId"),i.searchParams.delete("sprojectInstall"),i.searchParams.delete("sflivedemo");const e=t.get("sversion")||this.projectVersion;this.location={url:ks(i.href),version:e}}catch(t){console.warn("Error in generateLocation: ",t),Di("Error in generateLocation: ",t)}},this.setLocation=()=>{try{window.Snippyly&&(null===Snippyly||void 0===Snippyly?void 0:Snippyly.setLocation)&&(null===Snippyly||void 0===Snippyly||Snippyly.setLocation(JSON.parse(JSON.stringify(this.location))))}catch(t){console.warn("Error in setLocation: ",t),Di("Error in setLocation: ",t)}},this.identifySnippyly=async()=>{var t,i;try{this.invalidApiKey=!1;let i={name:"Anonymous User",email:"anonymous@snippyly.com",userId:"anonymous",isAnonymous:!0};const e=Fs();(null==e?void 0:e.email)&&(i=e),i.isAnonymous?delete i.groupId:i.groupId=Snippyly.getDocumentId()+"",(null===(t=null==i?void 0:i.contacts)||void 0===t?void 0:t.length)&&(i.contacts=[]),(null==i?void 0:i.isAnonymous)||(this.loading=!0),await Snippyly.identify(i),(null==i?void 0:i.isAnonymous)||(this.snippylyUser=JSON.parse(JSON.stringify(i))),Snippyly.getUserRole$().subscribe((t=>{var i,e;this.loading=!1,this.snippylyUserRole||"Admin"!==t||this.setViewMode("All"),this.snippylyUserRole=t,this.snippylyUserRole||this.setViewMode(null),"Admin"===this.snippylyUserRole?null===(i=this.commentElement)||void 0===i||i.enablePriority():null===(e=this.commentElement)||void 0===e||e.disablePriority()})),(null===Snippyly||void 0===Snippyly?void 0:Snippyly.isPlanExpired$)&&(null===Snippyly||void 0===Snippyly||Snippyly.isPlanExpired$().subscribe((t=>{this.isPlanExpired=t}),(t=>{this.isPlanExpired=!1,console.warn("Error in isPlanExpired$: ",t),Di("Error in isPlanExpired$: ",t)}))),Ii({clientUserId:null==i?void 0:i.userId}),this.getComments(),this.checkGlobalUserContact()}catch(t){this.loading=!1,this.signInError=!0,t&&"string"==typeof t&&(null===(i=null==t?void 0:t.toLowerCase())||void 0===i?void 0:i.includes("invalid"))&&(this.invalidApiKey=!0),console.warn("Error in identifySnippyly: ",t),Di("Error in identifySnippyly: ",t)}},this.getComments=()=>{try{this.commentElement&&(this.commentSubscription&&this.commentSubscription.unsubscribe(),this.commentSubscription=this.commentElement.getAllCommentAnnotations(this.documentId).subscribe((t=>{this.comments=null==t?void 0:t.filter((t=>["open","inProgress"].includes(null==t?void 0:t.status))),"All"!==this.viewMode&&(this.viewMode?this.comments=this.comments.filter((t=>{var i;return(null===(i=null==t?void 0:t.location)||void 0===i?void 0:i.view)===this.viewMode})):this.comments=this.comments.filter((t=>{var i;return!(null===(i=null==t?void 0:t.location)||void 0===i?void 0:i.view)})))})))}catch(t){console.warn("Error in getComments: ",t),Di("Error in getComments: ",t)}},this.checkGlobalUserContact=()=>{try{this.contactElement&&this.contactElement.isUserGlobalContact().subscribe((t=>{this.isUserGlobalContact=t}))}catch(t){console.warn("Error in checkGlobalUserContact: ",t),Di("Error in checkGlobalUserContact: ",t)}},this.toggleSnippylyPluginToolbar=()=>{try{this.expanded=!this.expanded}catch(t){console.warn("Error in toggleSnippylyPluginToolbar: ",t),Di("Error in toggleSnippylyPluginToolbar: ",t)}},this.loginWithGoogle=()=>{try{if(this.loading)return;window.open(`https://snippyly-self-serve-platform.web.app//signup?redirect_url=${encodeURIComponent(window.location.href)}&source=sf`,"_self")}catch(t){console.warn("Error in loginWithGoogle: ",t),Di("Error in loginWithGoogle: ",t)}},this.getQRCode=async()=>{try{const t=window.location.href;if(t){const i=Ms(t,ft,vt),e=await fetch(`https://us-central1-snipply-sdk-staging.cloudfunctions.net/getQRCode?text=${encodeURIComponent(i)}`),n=await e.json();(null==n?void 0:n.qrcode)&&(this.qrCode=null==n?void 0:n.qrcode)}}catch(t){console.warn("Error in getQRCode: ",t),Di("Error in getQRCode: ",t)}},this.toggleQRCodeVisibility=async()=>{try{this.showQrCode=!this.showQrCode,this.showQrCode&&!this.qrCode&&await this.getQRCode()}catch(t){console.warn("Error in toggleQRCodeVisibility: ",t),Di("Error in toggleQRCodeVisibility: ",t)}},this.removeSnippyly=async()=>{try{this.exitReviewModeCalled=!0,Es("review"),Es("feedback"),Es("sreviewId"),Es("projectVersionKey","sessionStorage"),Es("projectVersion","sessionStorage");const t=new URL(document.location),i=t.searchParams;i.delete("sreviewId"),i.delete("review"),i.delete("feedback"),this.projectVersionKey&&i.delete(this.projectVersionKey),i.delete("sversion"),i.delete("sprojectInstall"),i.delete("sflivedemo"),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),Di("Error in removeSnippyly: ",t)}},this.signOutUser=async()=>{try{await Snippyly.signOutUser(),Es("snippyly-user"),Es("_sfut"),this.snippylyUser=void 0,window.open(`https://snippyly-self-serve-platform.web.app//signout?redirect_url=${encodeURIComponent(window.location.href)}&source=sf`,"_self")}catch(t){console.warn("Error in signOutUser: ",t),Di("Error in signOutUser: ",t)}},this.toggleMenu=(t,i)=>{try{t.stopPropagation(),this.menuOpenedId===i?this.menuOpenedId=void 0:this.menuOpenedId=i}catch(t){console.warn("Error in toggleMenu: ",t),Di("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),Di("Error in copyLink: ",t)}},this.setViewMode=t=>{try{this.viewMode=t,t?this.location.view=t:delete this.location.view,this.setLocation(),this.getComments()}catch(t){console.warn("Error in setViewMode: ",t),Di("Error in setViewMode: ",t)}},this.goToAdminPortal=()=>{try{let t="https://snippyly-self-serve-platform.web.app/";if(Snippyly&&(null===Snippyly||void 0===Snippyly?void 0:Snippyly.getDocumentId)){const i=null===Snippyly||void 0===Snippyly?void 0:Snippyly.getDocumentId();i&&(t=`https://snippyly-self-serve-platform.web.app//dashboard/project/comment/${this.apiKey}/${i}`)}window.open(t,"_blank")}catch(t){console.warn("Error in goToAdminPortal: ",t),Di("Error in goToAdminPortal: ",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),Di("Error in joinCommunity: ",t)}},this.onboardingNextClick=()=>{try{this.showOnboardingModal=!1,bs("sprojectInstall","true");const t=new URL(document.location);t.searchParams.delete("sprojectInstall"),window.history.replaceState({},document.title,t.href)}catch(t){console.warn("Error in onboardingNextClick: ",t),Di("Error in onboardingNextClick: ",t)}},this.onLiveDemoModalNextClick=()=>{try{this.showLiveDemoModal=!1,bs("sflivedemo","true",!1,"sessionStorage");const t=new URL(document.location);t.searchParams.delete("sflivedemo"),window.history.replaceState({},document.title,t.href)}catch(t){console.warn("Error in onLiveDemoModalNextClick: ",t),Di("Error in onLiveDemoModalNextClick: ",t)}},this.onUpgradePlanClick=()=>{try{window.open("https://snippyly-self-serve-platform.web.app/dashboard/billing","_blank")}catch(t){console.warn("Error in onUpgradePlanClick: ",t),Di("Error in onUpgradePlanClick: ",t)}},this.setAttribute("data-snippyly-comment-disabled","true"),this.style.zIndex="2147483577",null===(n=null===(e=null===document||void 0===document?void 0:document.body)||void 0===e?void 0:e.style)||void 0===n||n.setProperty("transform","none","important"),null===(r=null===(o=null===(s=null===document||void 0===document?void 0:document.body)||void 0===s?void 0:s.parentElement)||void 0===o?void 0:o.style)||void 0===r||r.setProperty("transform","none","important");try{this.expanded=!0,this.detectVersion(),this.setWindowEventListner(),this.urlChangeListener(),this.checkUrl(),console.log("*** Staging Mode ON! ***")}catch(t){console.warn("Error in constructor: ",t),Di("Error in constructor: ",t)}}get loadPlugin(){return this._loadPlugin}set loadPlugin(t){this._loadPlugin=t,this.loadPlugin?this.classList.add("visible"):this.classList.remove("visible")}get expanded(){return this._expanded}set expanded(t){this._expanded=t,this.expanded?this.classList.add("expanded"):this.classList.remove("expanded")}get apiKey(){return this._apiKey}set apiKey(t){this._apiKey=t,Ii({apiKey:this.apiKey}),this.checkUrl()}get projectVersionKey(){return this._projectVersionKey}set projectVersionKey(t){try{this._projectVersionKey=t,this.projectVersionKey&&bs("projectVersionKey",this.projectVersionKey,!1,"sessionStorage"),this.exitReviewModeCalled||this.detectVersion()}catch(t){console.warn("Error in set projectVersionKey: ",t),Di("Error in set projectVersionKey: ",t)}}get menuOpenedId(){return this._menuOpenedId}set menuOpenedId(t){this._menuOpenedId=t,this.menuOpenedId?this.addWindowClickEventListener():this.removeWindowClickEventListener()}render(){var t,i,e,n,s,o,r,l,a;return this.loadPlugin?!this.snippylyUser||this.loading||null===this.isPlanExpired?_`
1263
+ `;(()=>{try{const t=window.SUPERFLOW_TOOLBAR_API_KEY,i=!!window.SUPERFLOW_TOOLBAR_STAGING,e=window.SUPERFLOW_TOOLBAR_PROJECT_VERSION_KEY,n=window.SUPERFLOW_TOOLBAR_PROJECT_ID;if(t){(()=>{try{document.querySelectorAll("snippyly-plugin").forEach((t=>{t.remove()}))}catch(t){console.warn("Error in removeSuperflowToolbarTag: ",t)}})();const s={};s.apiKey=t,i&&(s.staging="true"),e&&(s.projectVersionKey=e),n&&(s.projectId=n),((t={})=>{try{const i=document.createElement("snippyly-plugin");Object.keys(t||{}).forEach((e=>{i.setAttribute(e,t[e])})),document.body.appendChild(i)}catch(t){console.warn("Error in loadSuperflowToolbarTag: ",t)}})(s)}}catch(t){console.warn("Error in initSuperflow: ",t)}})();var Hs=function(t,i,e,n){for(var s,o=arguments.length,r=o<3?i:null===n?n=Object.getOwnPropertyDescriptor(i,e):n,l=t.length-1;l>=0;l--)(s=t[l])&&(r=(o<3?s(r):o>3?s(i,e,r):s(i,e))||r);return o>3&&r&&Object.defineProperty(i,e,r),r};let Bs=class extends Y{constructor(){var e,n,s,o,r;super(),this._loadPlugin=!1,this.comments=[],this.addCommentMode=!1,this._expanded=!0,this.loading=!1,this.isPlanExpired=null,this.showOnboardingModal=!0,this.showLiveDemoModal=!1,this.staging=true,this.copyLinkTooltip="Copy Link",this.invalidApiKey=!1,this.isUserGlobalContact=!1,this.showQrCode=!1,this.exitReviewModeCalled=!1,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),Di("Error in addWindowClickEventListener: ",t)}},this.removeWindowClickEventListener=()=>{try{window.removeEventListener("click",this.windowClickEventListener),this.windowClickEventListener=void 0}catch(t){console.warn("Error in removeWindowClickEventListener: ",t),Di("Error in removeWindowClickEventListener: ",t)}},this.setWindowEventListner=()=>{try{window.addEventListener("locationchange",(()=>{this.checkUrl()}))}catch(t){console.warn("Error in setWindowEventListner: ",t),Di("Error in setWindowEventListner: ",t)}},this.urlChangeListener=()=>{try{const t=history.pushState;history.pushState=function(){const i=t.apply(this,arguments);return window.dispatchEvent(new Event("pushstate")),window.dispatchEvent(new Event("locationchange")),i};const i=history.replaceState;history.replaceState=function(){const t=i.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),Di("Error in urlChangeListener: ",t)}},this.checkUrl=()=>{try{const t=new URL(document.location),i=t.searchParams;if((null==i?void 0:i.has("sprojectInstall"))&&!xs("sprojectInstall")?this.showOnboardingModal=!0:this.showOnboardingModal=!1,null==i?void 0:i.has("sflivedemo"))if(xs("sflivedemo",!1,"sessionStorage")){this.showLiveDemoModal=!1;const t=new URL(document.location);t.searchParams.delete("sflivedemo"),window.history.replaceState({},null===document||void 0===document?void 0:document.title,t.toString())}else this.showLiveDemoModal=!0;else this.showLiveDemoModal=!1;if(i.has("st")||i.has("snippyly_google_token")){if(i.has("st")){const t=decodeURIComponent(i.get("st")),e=Ms(t,ft,vt),n=e&&JSON.parse(e);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 i=JSON.stringify(t),e=ks(i,ft,vt);bs("_sfut",e,!0)}}else if(i.has("snippyly_google_token")){const t=JSON.parse(atob(i.get("snippyly_google_token"))),e={};e.userId=t.uid,e.name=t.displayName,e.email=t.email,e.photoUrl=null==t?void 0:t.photoURL,bs("snippyly-user",JSON.stringify(e),!0)}i.delete("st"),i.delete("snippyly_google_token"),window.history.replaceState({},document.title,t.href)}i.has("review")?(bs("review","true",!1),Es("feedback"),"true"!==i.get("review")&&(i.delete("review"),i.append("review","true"),window.history.replaceState({},document.title,t.href)),this.loadPluginUI()):i.has("feedback")||xs("review",!1)&&(i.append("review","true"),window.history.replaceState({},document.title,t.href),this.loadPluginUI()),i.has("feedback")?(bs("feedback","true",!1),Es("review"),"true"!==i.get("feedback")&&(i.delete("feedback"),i.append("feedback","true"),window.history.replaceState({},document.title,t.href)),this.loadPluginUI()):i.has("review")||xs("feedback",!1)&&(i.append("feedback","true"),window.history.replaceState({},document.title,t.href),this.loadPluginUI()),this.setVersionInUrl()}catch(t){console.warn("Error in checkUrl: ",t),Di("Error in checkUrl: ",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&&bs("projectVersion",this.projectVersion,!1,"sessionStorage")}else{const t=new URL(document.location).searchParams;(t.has("review")||t.has("feedback"))&&t.has("sversion")&&(bs("projectVersionKey","sversion",!1,"sessionStorage"),this.projectVersion=t.get("sversion"),this.projectVersion&&bs("projectVersion",this.projectVersion,!1,"sessionStorage"))}}catch(t){console.warn("Error in detectVersion: ",t),Di("Error in detectVersion: ",t)}},this.setVersionInUrl=()=>{try{const t=this.projectVersionKey||xs("projectVersionKey",!1,"sessionStorage"),i=this.projectVersion||xs("projectVersion",!1,"sessionStorage");if(t&&i){const e=new URL(document.location),n=e.searchParams;n.get(t)||(n.set(t,i),window.history.replaceState({},document.title,e.href))}}catch(t){console.warn("Error in setVersionInUrl: ",t),Di("Error in setVersionInUrl: ",t)}},this.loadPluginUI=()=>{try{if(!this.apiKey)return;if(this.loadPlugin)return this.generateLocation(),void this.setViewMode(this.viewMode);const t=$s();if(t&&!(null==t?void 0:t.isAnonymous)&&(this.loading=!0),this.loadPlugin=!0,!document.querySelector(lt)){const t=document.createElement(lt);null==t||t.addEventListener("signIn",(()=>{this.loginWithGoogle()})),window.document.body.appendChild(t)}if(!document.querySelector(at)){const t=document.createElement(at);t.setAttribute(ut,"true"),window.document.body.appendChild(t)}if(!document.querySelector(rt)){const t=document.createElement(rt);window.document.body.appendChild(t)}if(!document.querySelector(ct)){const t=document.createElement(ct);window.document.body.appendChild(t)}if(!document.querySelector(ht)){const t=document.createElement(ht);window.document.body.appendChild(t)}if(!document.querySelector(dt)){const t=document.createElement(dt);window.document.body.appendChild(t)}if(!document.querySelector(pt)){const t=document.createElement(pt);window.document.body.appendChild(t)}this.initializeSnippyly()}catch(t){this.loading=!1,console.warn("Error in loadPluginUI: ",t),Di("Error in loadPluginUI: ",t)}},this.initializeSnippyly=async()=>{var e,n,s,o,r,l;try{await(r=this.apiKey,l={options:{staging:this.staging,version:"latest"}},t(void 0,void 0,void 0,(function(){var t,e;return i(this,(function(i){switch(i.label){case 0:return i.trys.push([0,6,,7]),[4,(n=null==l?void 0:l.options,new Promise((function(t,i){var e=document.getElementById("snippylyScript"),s=!1,o="latest";if(n&&(n.staging&&(s=n.staging),n.version&&(o=n.version)),(null==n?void 0:n.version)||(o="1.0.78"),e)t();else{var r=document.createElement("script");r.src="https://cdn.jsdelivr.net/npm/@snippyly/sdk".concat(s?"-staging":"","@").concat(o,"/snippyly.js"),r.id="snippylyScript",r.type="module",document.body.appendChild(r),r.onload=function(){t()},r.onerror=function(){i(new Error("Failed to load Snippyly script"))}}})))];case 1:return i.sent(),t=window.Snippyly,l?[4,t.init(r,l)]:[3,3];case 2:return i.sent(),[3,5];case 3:return[4,t.init(r)];case 4:i.sent(),i.label=5;case 5:return(null==t?void 0:t.st)&&(null==t||t.st("client")),[2,t];case 6:return e=i.sent(),console.error(e),[2,null];case 7:return[2]}var n}))}))),Snippyly&&(null===Snippyly||void 0===Snippyly||Snippyly.sf(!0)),Snippyly&&Ii({sdkVersion:null===Snippyly||void 0===Snippyly?void 0:Snippyly.version,sdkType:"client"}),this.documentId=((t,i=0)=>{try{let e=3735928559^i,n=1103547991^i;for(let i,s=0;s<t.length;s++)i=t.charCodeAt(s),e=Math.imul(e^i,2654435761),n=Math.imul(n^i,1597334677);return e=Math.imul(e^e>>>16,2246822507)^Math.imul(n^n>>>13,3266489909),n=Math.imul(n^n>>>16,2246822507)^Math.imul(e^e>>>13,3266489909),4294967296*(2097151&n)+(e>>>0)}catch(t){return console.warn("Error in cyrb53: ",t),Di("Error in cyrb53: ",t),0}})((t=>{let i;return i=t.includes("http")?new URL(t):new URL("http://"+t),i.hostname.replace("www.","")})(window.location.origin))+"",this.projectId&&(this.documentId=this.projectId+""),await(null===Snippyly||void 0===Snippyly?void 0:Snippyly.setDocumentId(this.documentId+"")),this.generateLocation(),this.setLocation(),this.commentElement=null===Snippyly||void 0===Snippyly?void 0:Snippyly.getCommentElement(),this.contactElement=null===Snippyly||void 0===Snippyly?void 0:Snippyly.getContactElement(),this.rewriterElement=null===Snippyly||void 0===Snippyly?void 0:Snippyly.getRewriterElement(),this.presenceElement=null===Snippyly||void 0===Snippyly?void 0:Snippyly.getPresenceElement(),this.commentElement&&(this.commentElement.enableTextComments(!0),this.commentElement.enableSignInButton(!0),this.commentElement.enableAttachment(!0),this.commentElement.showScreenSizeInfo(!0),this.commentElement.showCommentIndex(!0),this.commentElement.addCommentModeChange&&this.commentElement.addCommentModeChange().subscribe((t=>{this.addCommentMode=t})),(null===(e=this.commentElement)||void 0===e?void 0:e.enableOrphanComments)&&this.commentElement.enableOrphanComments()),this.selectionElement=Snippyly.getSelectionElement(),this.selectionElement&&this.selectionElement.enableLiveSelection(!0),this.rewriterElement&&(null===(n=this.rewriterElement)||void 0===n||n.enableRewriter()),this.presenceElement&&(null===(s=this.presenceElement)||void 0===s?void 0:s.enableFollowAlongMode)&&(null===(o=this.presenceElement)||void 0===o||o.enableFollowAlongMode(!0)),this.identifySnippyly()}catch(t){this.loading=!1,console.warn("Error in initializeSnippyly: ",t),Di("Error in initializeSnippyly: ",t)}},this.generateLocation=()=>{try{const t=new URL(document.location).searchParams,i=new URL(document.location);i.searchParams.delete("review"),i.searchParams.delete("feedback"),i.searchParams.delete("sreviewId"),i.searchParams.delete("scommentId"),i.searchParams.delete("sprojectInstall"),i.searchParams.delete("sflivedemo");const e=t.get("sversion")||this.projectVersion;let n=(t=>{try{return t.replace(/#.*$/,"")}catch(i){return console.warn("Error in removeHashFromUrl: ",i),Di("Error in removeHashFromUrl: ",i),t}})(i.href);this.projectId&&(n=null==n?void 0:n.replace(window.location.origin,"")),this.location={url:n,version:e}}catch(t){console.warn("Error in generateLocation: ",t),Di("Error in generateLocation: ",t)}},this.setLocation=()=>{try{window.Snippyly&&(null===Snippyly||void 0===Snippyly?void 0:Snippyly.setLocation)&&(null===Snippyly||void 0===Snippyly||Snippyly.setLocation(JSON.parse(JSON.stringify(this.location))))}catch(t){console.warn("Error in setLocation: ",t),Di("Error in setLocation: ",t)}},this.identifySnippyly=async()=>{var t,i;try{this.invalidApiKey=!1;let i={name:"Anonymous User",email:"anonymous@snippyly.com",userId:"anonymous",isAnonymous:!0};const e=$s();(null==e?void 0:e.email)&&(i=e),i.isAnonymous?delete i.groupId:i.groupId=Snippyly.getDocumentId()+"",(null===(t=null==i?void 0:i.contacts)||void 0===t?void 0:t.length)&&(i.contacts=[]),(null==i?void 0:i.isAnonymous)||(this.loading=!0),await Snippyly.identify(i),(null==i?void 0:i.isAnonymous)||(this.snippylyUser=JSON.parse(JSON.stringify(i))),Snippyly.getUserRole$().subscribe((t=>{var i,e;this.loading=!1,this.snippylyUserRole||"Admin"!==t||this.setViewMode("All"),this.snippylyUserRole=t,this.snippylyUserRole||this.setViewMode(null),"Admin"===this.snippylyUserRole?null===(i=this.commentElement)||void 0===i||i.enablePriority():null===(e=this.commentElement)||void 0===e||e.disablePriority()})),(null===Snippyly||void 0===Snippyly?void 0:Snippyly.isPlanExpired$)&&(null===Snippyly||void 0===Snippyly||Snippyly.isPlanExpired$().subscribe((t=>{this.isPlanExpired=t}),(t=>{this.isPlanExpired=!1,console.warn("Error in isPlanExpired$: ",t),Di("Error in isPlanExpired$: ",t)}))),Ii({clientUserId:null==i?void 0:i.userId}),this.getComments(),this.checkGlobalUserContact()}catch(t){this.loading=!1,this.signInError=!0,t&&"string"==typeof t&&(null===(i=null==t?void 0:t.toLowerCase())||void 0===i?void 0:i.includes("invalid"))&&(this.invalidApiKey=!0),console.warn("Error in identifySnippyly: ",t),Di("Error in identifySnippyly: ",t)}},this.getComments=()=>{try{this.commentElement&&(this.commentSubscription&&this.commentSubscription.unsubscribe(),this.commentSubscription=this.commentElement.getAllCommentAnnotations(this.documentId).subscribe((t=>{this.comments=null==t?void 0:t.filter((t=>["open","inProgress"].includes(null==t?void 0:t.status))),"All"!==this.viewMode&&(this.viewMode?this.comments=this.comments.filter((t=>{var i;return(null===(i=null==t?void 0:t.location)||void 0===i?void 0:i.view)===this.viewMode})):this.comments=this.comments.filter((t=>{var i;return!(null===(i=null==t?void 0:t.location)||void 0===i?void 0:i.view)})))})))}catch(t){console.warn("Error in getComments: ",t),Di("Error in getComments: ",t)}},this.checkGlobalUserContact=()=>{try{this.contactElement&&this.contactElement.isUserGlobalContact().subscribe((t=>{this.isUserGlobalContact=t}))}catch(t){console.warn("Error in checkGlobalUserContact: ",t),Di("Error in checkGlobalUserContact: ",t)}},this.toggleSnippylyPluginToolbar=()=>{try{this.expanded=!this.expanded}catch(t){console.warn("Error in toggleSnippylyPluginToolbar: ",t),Di("Error in toggleSnippylyPluginToolbar: ",t)}},this.loginWithGoogle=()=>{try{if(this.loading)return;window.open(`https://snippyly-self-serve-platform.web.app//signup?redirect_url=${encodeURIComponent(window.location.href)}&source=sf`,"_self")}catch(t){console.warn("Error in loginWithGoogle: ",t),Di("Error in loginWithGoogle: ",t)}},this.getQRCode=async()=>{try{const t=window.location.href;if(t){const i=ks(t,ft,vt),e=await fetch(`https://us-central1-snipply-sdk-staging.cloudfunctions.net/getQRCode?text=${encodeURIComponent(i)}`),n=await e.json();(null==n?void 0:n.qrcode)&&(this.qrCode=null==n?void 0:n.qrcode)}}catch(t){console.warn("Error in getQRCode: ",t),Di("Error in getQRCode: ",t)}},this.toggleQRCodeVisibility=async()=>{try{this.showQrCode=!this.showQrCode,this.showQrCode&&!this.qrCode&&await this.getQRCode()}catch(t){console.warn("Error in toggleQRCodeVisibility: ",t),Di("Error in toggleQRCodeVisibility: ",t)}},this.removeSnippyly=async()=>{try{this.exitReviewModeCalled=!0,Es("review"),Es("feedback"),Es("sreviewId"),Es("projectVersionKey","sessionStorage"),Es("projectVersion","sessionStorage");const t=new URL(document.location),i=t.searchParams;i.delete("sreviewId"),i.delete("review"),i.delete("feedback"),this.projectVersionKey&&i.delete(this.projectVersionKey),i.delete("sversion"),i.delete("sprojectInstall"),i.delete("sflivedemo"),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),Di("Error in removeSnippyly: ",t)}},this.signOutUser=async()=>{try{await Snippyly.signOutUser(),Es("snippyly-user"),Es("_sfut"),this.snippylyUser=void 0,window.open(`https://snippyly-self-serve-platform.web.app//signout?redirect_url=${encodeURIComponent(window.location.href)}&source=sf`,"_self")}catch(t){console.warn("Error in signOutUser: ",t),Di("Error in signOutUser: ",t)}},this.toggleMenu=(t,i)=>{try{t.stopPropagation(),this.menuOpenedId===i?this.menuOpenedId=void 0:this.menuOpenedId=i}catch(t){console.warn("Error in toggleMenu: ",t),Di("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),Di("Error in copyLink: ",t)}},this.setViewMode=t=>{try{this.viewMode=t,t?this.location.view=t:delete this.location.view,this.setLocation(),this.getComments()}catch(t){console.warn("Error in setViewMode: ",t),Di("Error in setViewMode: ",t)}},this.goToAdminPortal=()=>{try{let t="https://snippyly-self-serve-platform.web.app/";if(Snippyly&&(null===Snippyly||void 0===Snippyly?void 0:Snippyly.getDocumentId)){const i=null===Snippyly||void 0===Snippyly?void 0:Snippyly.getDocumentId();i&&(t=`https://snippyly-self-serve-platform.web.app//dashboard/project/comment/${this.apiKey}/${i}`)}window.open(t,"_blank")}catch(t){console.warn("Error in goToAdminPortal: ",t),Di("Error in goToAdminPortal: ",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),Di("Error in joinCommunity: ",t)}},this.onboardingNextClick=()=>{try{this.showOnboardingModal=!1,bs("sprojectInstall","true");const t=new URL(document.location);t.searchParams.delete("sprojectInstall"),window.history.replaceState({},document.title,t.href)}catch(t){console.warn("Error in onboardingNextClick: ",t),Di("Error in onboardingNextClick: ",t)}},this.onLiveDemoModalNextClick=()=>{try{this.showLiveDemoModal=!1,bs("sflivedemo","true",!1,"sessionStorage");const t=new URL(document.location);t.searchParams.delete("sflivedemo"),window.history.replaceState({},document.title,t.href)}catch(t){console.warn("Error in onLiveDemoModalNextClick: ",t),Di("Error in onLiveDemoModalNextClick: ",t)}},this.onUpgradePlanClick=()=>{try{window.open("https://snippyly-self-serve-platform.web.app/dashboard/billing","_blank")}catch(t){console.warn("Error in onUpgradePlanClick: ",t),Di("Error in onUpgradePlanClick: ",t)}},this.setAttribute("data-snippyly-comment-disabled","true"),this.style.zIndex="2147483577",null===(n=null===(e=null===document||void 0===document?void 0:document.body)||void 0===e?void 0:e.style)||void 0===n||n.setProperty("transform","none","important"),null===(r=null===(o=null===(s=null===document||void 0===document?void 0:document.body)||void 0===s?void 0:s.parentElement)||void 0===o?void 0:o.style)||void 0===r||r.setProperty("transform","none","important");try{this.expanded=!0,this.detectVersion(),this.setWindowEventListner(),this.urlChangeListener(),this.checkUrl(),console.log("*** Staging Mode ON! ***")}catch(t){console.warn("Error in constructor: ",t),Di("Error in constructor: ",t)}}get loadPlugin(){return this._loadPlugin}set loadPlugin(t){this._loadPlugin=t,this.loadPlugin?this.classList.add("visible"):this.classList.remove("visible")}get expanded(){return this._expanded}set expanded(t){this._expanded=t,this.expanded?this.classList.add("expanded"):this.classList.remove("expanded")}get apiKey(){return this._apiKey}set apiKey(t){this._apiKey=t,Ii({apiKey:this.apiKey}),this.checkUrl()}get projectVersionKey(){return this._projectVersionKey}set projectVersionKey(t){try{this._projectVersionKey=t,this.projectVersionKey&&bs("projectVersionKey",this.projectVersionKey,!1,"sessionStorage"),this.exitReviewModeCalled||this.detectVersion()}catch(t){console.warn("Error in set projectVersionKey: ",t),Di("Error in set projectVersionKey: ",t)}}get menuOpenedId(){return this._menuOpenedId}set menuOpenedId(t){this._menuOpenedId=t,this.menuOpenedId?this.addWindowClickEventListener():this.removeWindowClickEventListener()}render(){var t,i,e,n,s,o,r,l,a;return this.loadPlugin?!this.snippylyUser||this.loading||null===this.isPlanExpired?_`
1264
1264
  <div class="snippyly-plugin-container">
1265
1265
  <div class="toolbar" id="smallToolbar">
1266
1266
  <!-- <div class="toolbar-section">
@@ -1842,4 +1842,4 @@ class us extends le{}us.Encryptor=class extends us{processBlock(t,i){const e=t,n
1842
1842
  </div>
1843
1843
  </div>
1844
1844
  `:_``}
1845
- `:_``}};_s.styles=[As,Hs],Bs([et()],_s.prototype,"loadPlugin",null),Bs([et()],_s.prototype,"comments",void 0),Bs([et()],_s.prototype,"commentElement",void 0),Bs([et()],_s.prototype,"contactElement",void 0),Bs([et()],_s.prototype,"rewriterElement",void 0),Bs([et()],_s.prototype,"presenceElement",void 0),Bs([et()],_s.prototype,"commentSubscription",void 0),Bs([et()],_s.prototype,"selectionElement",void 0),Bs([et()],_s.prototype,"addCommentMode",void 0),Bs([et()],_s.prototype,"_expanded",void 0),Bs([et()],_s.prototype,"loading",void 0),Bs([et()],_s.prototype,"signInError",void 0),Bs([et()],_s.prototype,"snippylyUser",void 0),Bs([et()],_s.prototype,"snippylyUserRole",void 0),Bs([et()],_s.prototype,"isPlanExpired",void 0),Bs([et()],_s.prototype,"showOnboardingModal",void 0),Bs([et()],_s.prototype,"showLiveDemoModal",void 0),Bs([it()],_s.prototype,"apiKey",null),Bs([it()],_s.prototype,"projectId",void 0),Bs([et()],_s.prototype,"staging",void 0),Bs([it()],_s.prototype,"projectVersionKey",null),Bs([et()],_s.prototype,"projectVersion",void 0),Bs([et()],_s.prototype,"_menuOpenedId",void 0),Bs([et()],_s.prototype,"copyLinkTooltip",void 0),Bs([et()],_s.prototype,"invalidApiKey",void 0),Bs([et()],_s.prototype,"documentId",void 0),Bs([et()],_s.prototype,"isUserGlobalContact",void 0),Bs([et()],_s.prototype,"location",void 0),Bs([et()],_s.prototype,"viewMode",void 0),Bs([et()],_s.prototype,"qrCode",void 0),Bs([et()],_s.prototype,"showQrCode",void 0),_s=Bs([(t=>i=>"function"==typeof i?((t,i)=>(window.customElements.define(t,i),i))(t,i):((t,i)=>{const{kind:e,elements:n}=i;return{kind:e,elements:n,finisher(i){window.customElements.define(t,i)}}})(t,i))("snippyly-plugin")],_s);export{_s as SnippylyPlugin};
1845
+ `:_``}};Bs.styles=[Ls,As],Hs([et()],Bs.prototype,"loadPlugin",null),Hs([et()],Bs.prototype,"comments",void 0),Hs([et()],Bs.prototype,"commentElement",void 0),Hs([et()],Bs.prototype,"contactElement",void 0),Hs([et()],Bs.prototype,"rewriterElement",void 0),Hs([et()],Bs.prototype,"presenceElement",void 0),Hs([et()],Bs.prototype,"commentSubscription",void 0),Hs([et()],Bs.prototype,"selectionElement",void 0),Hs([et()],Bs.prototype,"addCommentMode",void 0),Hs([et()],Bs.prototype,"_expanded",void 0),Hs([et()],Bs.prototype,"loading",void 0),Hs([et()],Bs.prototype,"signInError",void 0),Hs([et()],Bs.prototype,"snippylyUser",void 0),Hs([et()],Bs.prototype,"snippylyUserRole",void 0),Hs([et()],Bs.prototype,"isPlanExpired",void 0),Hs([et()],Bs.prototype,"showOnboardingModal",void 0),Hs([et()],Bs.prototype,"showLiveDemoModal",void 0),Hs([it()],Bs.prototype,"apiKey",null),Hs([it()],Bs.prototype,"projectId",void 0),Hs([et()],Bs.prototype,"staging",void 0),Hs([it()],Bs.prototype,"projectVersionKey",null),Hs([et()],Bs.prototype,"projectVersion",void 0),Hs([et()],Bs.prototype,"_menuOpenedId",void 0),Hs([et()],Bs.prototype,"copyLinkTooltip",void 0),Hs([et()],Bs.prototype,"invalidApiKey",void 0),Hs([et()],Bs.prototype,"documentId",void 0),Hs([et()],Bs.prototype,"isUserGlobalContact",void 0),Hs([et()],Bs.prototype,"location",void 0),Hs([et()],Bs.prototype,"viewMode",void 0),Hs([et()],Bs.prototype,"qrCode",void 0),Hs([et()],Bs.prototype,"showQrCode",void 0),Bs=Hs([(t=>i=>"function"==typeof i?((t,i)=>(window.customElements.define(t,i),i))(t,i):((t,i)=>{const{kind:e,elements:n}=i;return{kind:e,elements:n,finisher(i){window.customElements.define(t,i)}}})(t,i))("snippyly-plugin")],Bs);export{Bs as SnippylyPlugin};