@firebase/util 1.11.0-firebase-studio-sdk-integration.9de25069c → 1.11.0-firebase-studio-sdk-integration.bffdabd70

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.
@@ -712,6 +712,87 @@ function createMockUserToken(token, projectId) {
712
712
  signature
713
713
  ].join('.');
714
714
  }
715
+ const emulatorStatus = {};
716
+ // Checks whether any products are running on an emulator
717
+ function areRunningEmulator() {
718
+ let runningEmulator = false;
719
+ for (const key of Object.keys(emulatorStatus)) {
720
+ if (emulatorStatus[key]) {
721
+ runningEmulator = true;
722
+ }
723
+ }
724
+ return runningEmulator;
725
+ }
726
+ function getOrCreateEl(id) {
727
+ let parentDiv = document.getElementById(id);
728
+ let created = false;
729
+ if (!parentDiv) {
730
+ parentDiv = document.createElement('div');
731
+ parentDiv.setAttribute('id', id);
732
+ created = true;
733
+ }
734
+ return { created, element: parentDiv };
735
+ }
736
+ /**
737
+ * Updates Emulator Banner. Primarily used for Firebase Studio
738
+ * @param name
739
+ * @param isRunningEmulator
740
+ * @public
741
+ */
742
+ function updateEmulatorBanner(name, isRunningEmulator) {
743
+ if (typeof window === 'undefined' ||
744
+ typeof document === 'undefined' ||
745
+ emulatorStatus[name] === isRunningEmulator) {
746
+ return;
747
+ }
748
+ emulatorStatus[name] = isRunningEmulator;
749
+ const bannerId = '__firebase__banner';
750
+ if (!areRunningEmulator()) {
751
+ tearDown();
752
+ return;
753
+ }
754
+ function tearDown() {
755
+ const element = document.getElementById(bannerId);
756
+ if (element) {
757
+ element.remove();
758
+ }
759
+ }
760
+ function setupDom() {
761
+ const banner = getOrCreateEl(bannerId);
762
+ const firebaseText = document.getElementById('__firebase__text') ||
763
+ document.createElement('span');
764
+ if (banner.created) {
765
+ // update styles
766
+ const bannerEl = banner.element;
767
+ bannerEl.style.display = 'flex';
768
+ bannerEl.style.background = '#7faaf0';
769
+ bannerEl.style.position = 'absolute';
770
+ bannerEl.style.bottom = '5px';
771
+ bannerEl.style.left = '5px';
772
+ bannerEl.style.padding = '.5em';
773
+ bannerEl.style.borderRadius = '5px';
774
+ bannerEl.style.alignContent = 'center';
775
+ const closeBtn = document.createElement('span');
776
+ closeBtn.style.cursor = 'pointer';
777
+ closeBtn.style.paddingLeft = '5px';
778
+ closeBtn.innerHTML = ' ×';
779
+ closeBtn.onclick = () => {
780
+ tearDown();
781
+ };
782
+ bannerEl.appendChild(firebaseText);
783
+ bannerEl.appendChild(closeBtn);
784
+ document.body.appendChild(banner.element);
785
+ }
786
+ firebaseText.setAttribute('id', '__firebase__text');
787
+ firebaseText.innerText = 'Running in this workspace';
788
+ }
789
+ if (document.readyState === 'loading') {
790
+ window.addEventListener('DOMContentLoaded', setupDom);
791
+ }
792
+ else {
793
+ setupDom();
794
+ }
795
+ }
715
796
 
716
797
  /**
717
798
  * @license
@@ -2159,5 +2240,5 @@ async function pingServer(endpoint) {
2159
2240
  // Overriding the constant (we should be the only ones doing this)
2160
2241
  CONSTANTS.NODE_CLIENT = true;
2161
2242
 
2162
- export { CONSTANTS, DecodeBase64StringError, Deferred, ErrorFactory, FirebaseError, MAX_VALUE_MILLIS, RANDOM_FACTOR, Sha1, areCookiesEnabled, assert, assertionError, async, base64, base64Decode, base64Encode, base64urlEncodeWithoutPadding, calculateBackoffMillis, contains, createMockUserToken, createSubscribe, decode, deepCopy, deepEqual, deepExtend, errorPrefix, extractQuerystring, getDefaultAppConfig, getDefaultEmulatorHost, getDefaultEmulatorHostnameAndPort, getDefaults, getExperimentalSetting, getGlobal, getModularInstance, getUA, isAdmin, isBrowser, isBrowserExtension, isCloudWorkstation, isCloudflareWorker, isElectron, isEmpty, isIE, isIndexedDBAvailable, isMobileCordova, isNode, isNodeSdk, isReactNative, isSafari, isUWP, isValidFormat, isValidTimestamp, isWebWorker, issuedAtTime, jsonEval, map, ordinal, pingServer, promiseWithTimeout, querystring, querystringDecode, safeGet, stringLength, stringToByteArray, stringify, validateArgCount, validateCallback, validateContextObject, validateIndexedDBOpenable, validateNamespace };
2243
+ export { CONSTANTS, DecodeBase64StringError, Deferred, ErrorFactory, FirebaseError, MAX_VALUE_MILLIS, RANDOM_FACTOR, Sha1, areCookiesEnabled, assert, assertionError, async, base64, base64Decode, base64Encode, base64urlEncodeWithoutPadding, calculateBackoffMillis, contains, createMockUserToken, createSubscribe, decode, deepCopy, deepEqual, deepExtend, errorPrefix, extractQuerystring, getDefaultAppConfig, getDefaultEmulatorHost, getDefaultEmulatorHostnameAndPort, getDefaults, getExperimentalSetting, getGlobal, getModularInstance, getUA, isAdmin, isBrowser, isBrowserExtension, isCloudWorkstation, isCloudflareWorker, isElectron, isEmpty, isIE, isIndexedDBAvailable, isMobileCordova, isNode, isNodeSdk, isReactNative, isSafari, isUWP, isValidFormat, isValidTimestamp, isWebWorker, issuedAtTime, jsonEval, map, ordinal, pingServer, promiseWithTimeout, querystring, querystringDecode, safeGet, stringLength, stringToByteArray, stringify, updateEmulatorBanner, validateArgCount, validateCallback, validateContextObject, validateIndexedDBOpenable, validateNamespace };
2163
2244
  //# sourceMappingURL=index.node.esm.js.map