{"version":3,"sources":["node_modules/@angular/cdk/fesm2022/clipboard.mjs"],"sourcesContent":["import { DOCUMENT } from '@angular/common';\nimport * as i0 from '@angular/core';\nimport { inject, Injectable, InjectionToken, NgZone, EventEmitter, Directive, Input, Output, NgModule } from '@angular/core';\n\n/**\n * A pending copy-to-clipboard operation.\n *\n * The implementation of copying text to the clipboard modifies the DOM and\n * forces a re-layout. This re-layout can take too long if the string is large,\n * causing the execCommand('copy') to happen too long after the user clicked.\n * This results in the browser refusing to copy. This object lets the\n * re-layout happen in a separate tick from copying by providing a copy function\n * that can be called later.\n *\n * Destroy must be called when no longer in use, regardless of whether `copy` is\n * called.\n */\nclass PendingCopy {\n  _document;\n  _textarea;\n  constructor(text, _document) {\n    this._document = _document;\n    const textarea = this._textarea = this._document.createElement('textarea');\n    const styles = textarea.style;\n    // Hide the element for display and accessibility. Set a fixed position so the page layout\n    // isn't affected. We use `fixed` with `top: 0`, because focus is moved into the textarea\n    // for a split second and if it's off-screen, some browsers will attempt to scroll it into view.\n    styles.position = 'fixed';\n    styles.top = styles.opacity = '0';\n    styles.left = '-999em';\n    textarea.setAttribute('aria-hidden', 'true');\n    textarea.value = text;\n    // Making the textarea `readonly` prevents the screen from jumping on iOS Safari (see #25169).\n    textarea.readOnly = true;\n    // The element needs to be inserted into the fullscreen container, if the page\n    // is in fullscreen mode, otherwise the browser won't execute the copy command.\n    (this._document.fullscreenElement || this._document.body).appendChild(textarea);\n  }\n  /** Finishes copying the text. */\n  copy() {\n    const textarea = this._textarea;\n    let successful = false;\n    try {\n      // Older browsers could throw if copy is not supported.\n      if (textarea) {\n        const currentFocus = this._document.activeElement;\n        textarea.select();\n        textarea.setSelectionRange(0, textarea.value.length);\n        successful = this._document.execCommand('copy');\n        if (currentFocus) {\n          currentFocus.focus();\n        }\n      }\n    } catch {\n      // Discard error.\n      // Initial setting of {@code successful} will represent failure here.\n    }\n    return successful;\n  }\n  /** Cleans up DOM changes used to perform the copy operation. */\n  destroy() {\n    const textarea = this._textarea;\n    if (textarea) {\n      textarea.remove();\n      this._textarea = undefined;\n    }\n  }\n}\n\n/**\n * A service for copying text to the clipboard.\n */\nlet Clipboard = /*#__PURE__*/(() => {\n  class Clipboard {\n    _document = inject(DOCUMENT);\n    constructor() {}\n    /**\n     * Copies the provided text into the user's clipboard.\n     *\n     * @param text The string to copy.\n     * @returns Whether the operation was successful.\n     */\n    copy(text) {\n      const pendingCopy = this.beginCopy(text);\n      const successful = pendingCopy.copy();\n      pendingCopy.destroy();\n      return successful;\n    }\n    /**\n     * Prepares a string to be copied later. This is useful for large strings\n     * which take too long to successfully render and be copied in the same tick.\n     *\n     * The caller must call `destroy` on the returned `PendingCopy`.\n     *\n     * @param text The string to copy.\n     * @returns the pending copy operation.\n     */\n    beginCopy(text) {\n      return new PendingCopy(text, this._document);\n    }\n    static ɵfac = function Clipboard_Factory(__ngFactoryType__) {\n      return new (__ngFactoryType__ || Clipboard)();\n    };\n    static ɵprov = /* @__PURE__ */i0.ɵɵdefineInjectable({\n      token: Clipboard,\n      factory: Clipboard.ɵfac,\n      providedIn: 'root'\n    });\n  }\n  return Clipboard;\n})();\n/*#__PURE__*/(() => {\n  (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/** Injection token that can be used to provide the default options to `CdkCopyToClipboard`. */\nconst CDK_COPY_TO_CLIPBOARD_CONFIG = /*#__PURE__*/new InjectionToken('CDK_COPY_TO_CLIPBOARD_CONFIG');\n/**\n * Provides behavior for a button that when clicked copies content into user's\n * clipboard.\n */\nlet CdkCopyToClipboard = /*#__PURE__*/(() => {\n  class CdkCopyToClipboard {\n    _clipboard = inject(Clipboard);\n    _ngZone = inject(NgZone);\n    /** Content to be copied. */\n    text = '';\n    /**\n     * How many times to attempt to copy the text. This may be necessary for longer text, because\n     * the browser needs time to fill an intermediate textarea element and copy the content.\n     */\n    attempts = 1;\n    /**\n     * Emits when some text is copied to the clipboard. The\n     * emitted value indicates whether copying was successful.\n     */\n    copied = new EventEmitter();\n    /** Copies that are currently being attempted. */\n    _pending = new Set();\n    /** Whether the directive has been destroyed. */\n    _destroyed;\n    /** Timeout for the current copy attempt. */\n    _currentTimeout;\n    constructor() {\n      const config = inject(CDK_COPY_TO_CLIPBOARD_CONFIG, {\n        optional: true\n      });\n      if (config && config.attempts != null) {\n        this.attempts = config.attempts;\n      }\n    }\n    /** Copies the current text to the clipboard. */\n    copy(attempts = this.attempts) {\n      if (attempts > 1) {\n        let remainingAttempts = attempts;\n        const pending = this._clipboard.beginCopy(this.text);\n        this._pending.add(pending);\n        const attempt = () => {\n          const successful = pending.copy();\n          if (!successful && --remainingAttempts && !this._destroyed) {\n            // We use 1 for the timeout since it's more predictable when flushing in unit tests.\n            this._currentTimeout = this._ngZone.runOutsideAngular(() => setTimeout(attempt, 1));\n          } else {\n            this._currentTimeout = null;\n            this._pending.delete(pending);\n            pending.destroy();\n            this.copied.emit(successful);\n          }\n        };\n        attempt();\n      } else {\n        this.copied.emit(this._clipboard.copy(this.text));\n      }\n    }\n    ngOnDestroy() {\n      if (this._currentTimeout) {\n        clearTimeout(this._currentTimeout);\n      }\n      this._pending.forEach(copy => copy.destroy());\n      this._pending.clear();\n      this._destroyed = true;\n    }\n    static ɵfac = function CdkCopyToClipboard_Factory(__ngFactoryType__) {\n      return new (__ngFactoryType__ || CdkCopyToClipboard)();\n    };\n    static ɵdir = /* @__PURE__ */i0.ɵɵdefineDirective({\n      type: CdkCopyToClipboard,\n      selectors: [[\"\", \"cdkCopyToClipboard\", \"\"]],\n      hostBindings: function CdkCopyToClipboard_HostBindings(rf, ctx) {\n        if (rf & 1) {\n          i0.ɵɵlistener(\"click\", function CdkCopyToClipboard_click_HostBindingHandler() {\n            return ctx.copy();\n          });\n        }\n      },\n      inputs: {\n        text: [0, \"cdkCopyToClipboard\", \"text\"],\n        attempts: [0, \"cdkCopyToClipboardAttempts\", \"attempts\"]\n      },\n      outputs: {\n        copied: \"cdkCopyToClipboardCopied\"\n      }\n    });\n  }\n  return CdkCopyToClipboard;\n})();\n/*#__PURE__*/(() => {\n  (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\nlet ClipboardModule = /*#__PURE__*/(() => {\n  class ClipboardModule {\n    static ɵfac = function ClipboardModule_Factory(__ngFactoryType__) {\n      return new (__ngFactoryType__ || ClipboardModule)();\n    };\n    static ɵmod = /* @__PURE__ */i0.ɵɵdefineNgModule({\n      type: ClipboardModule\n    });\n    static ɵinj = /* @__PURE__ */i0.ɵɵdefineInjector({});\n  }\n  return ClipboardModule;\n})();\n/*#__PURE__*/(() => {\n  (typeof ngDevMode === \"undefined\" || ngDevMode) && void 0;\n})();\n\n/**\n * Generated bundle index. Do not edit.\n */\n\nexport { CDK_COPY_TO_CLIPBOARD_CONFIG, CdkCopyToClipboard, Clipboard, ClipboardModule, PendingCopy };\n"],"mappings":"wMAAA,IAiBMA,EAuDFC,EA4CEC,EAKFC,EAwFAC,EAjNJC,EAAAC,EAAA,KAAAC,IACAC,IACAA,IAeMR,EAAN,KAAkB,CAChB,UACA,UACA,YAAYS,EAAMC,EAAW,CAC3B,KAAK,UAAYA,EACjB,IAAMC,EAAW,KAAK,UAAY,KAAK,UAAU,cAAc,UAAU,EACnEC,EAASD,EAAS,MAIxBC,EAAO,SAAW,QAClBA,EAAO,IAAMA,EAAO,QAAU,IAC9BA,EAAO,KAAO,SACdD,EAAS,aAAa,cAAe,MAAM,EAC3CA,EAAS,MAAQF,EAEjBE,EAAS,SAAW,IAGnB,KAAK,UAAU,mBAAqB,KAAK,UAAU,MAAM,YAAYA,CAAQ,CAChF,CAEA,MAAO,CACL,IAAMA,EAAW,KAAK,UAClBE,EAAa,GACjB,GAAI,CAEF,GAAIF,EAAU,CACZ,IAAMG,EAAe,KAAK,UAAU,cACpCH,EAAS,OAAO,EAChBA,EAAS,kBAAkB,EAAGA,EAAS,MAAM,MAAM,EACnDE,EAAa,KAAK,UAAU,YAAY,MAAM,EAC1CC,GACFA,EAAa,MAAM,CAEvB,CACF,MAAQ,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CAAC,CAAC,GAElF,KAAK,gBAAkB,KACvB,KAAK,SAAS,OAAOD,CAAO,EAC5BA,EAAQ,QAAQ,EAChB,KAAK,OAAO,KAAKb,CAAU,EAE/B,EACAc,EAAQ,CACV,MACE,KAAK,OAAO,KAAK,KAAK,WAAW,KAAK,KAAK,IAAI,CAAC,CAEpD,CACA,aAAc,CACR,KAAK,iBACP,aAAa,KAAK,eAAe,EAEnC,KAAK,SAAS,QAAQC,GAAQA,EAAK,QAAQ,CAAC,EAC5C,KAAK,SAAS,MAAM,EACpB,KAAK,WAAa,EACpB,CACA,OAAO,UAAO,SAAoCV,EAAmB,CACnE,OAAO,IAAKA,GAAqBf,EACnC,EACA,OAAO,UAAyB0B,EAAkB,CAChD,KAAM1B,EACN,UAAW,CAAC,CAAC,GAAI,qBAAsB,EAAE,CAAC,EAC1C,aAAc,SAAyC2B,EAAIC,EAAK,CAC1DD,EAAK,GACJE,EAAW,QAAS,UAAuD,CAC5E,OAAOD,EAAI,KAAK,CAClB,CAAC,CAEL,EACA,OAAQ,CACN,KAAM,CAAC,EAAG,qBAAsB,MAAM,EACtC,SAAU,CAAC,EAAG,6BAA8B,UAAU,CACxD,EACA,QAAS,CACP,OAAQ,0BACV,CACF,CAAC,CACH,CACA,OAAO5B,CACT,GAAG,EAICC,GAAgC,IAAM,CACxC,MAAMA,CAAgB,CACpB,OAAO,UAAO,SAAiCc,EAAmB,CAChE,OAAO,IAAKA,GAAqBd,EACnC,EACA,OAAO,UAAyB6B,EAAiB,CAC/C,KAAM7B,CACR,CAAC,EACD,OAAO,UAAyB8B,EAAiB,CAAC,CAAC,CACrD,CACA,OAAO9B,CACT,GAAG","names":["PendingCopy","Clipboard","CDK_COPY_TO_CLIPBOARD_CONFIG","CdkCopyToClipboard","ClipboardModule","init_clipboard","__esmMin","init_common","init_core","text","_document","textarea","styles","successful","currentFocus","inject","DOCUMENT","pendingCopy","__ngFactoryType__","ɵɵdefineInjectable","InjectionToken","NgZone","EventEmitter","config","attempts","remainingAttempts","pending","attempt","copy","ɵɵdefineDirective","rf","ctx","ɵɵlistener","ɵɵdefineNgModule","ɵɵdefineInjector"],"x_google_ignoreList":[0]}