{"version":3,"sources":["node_modules/global/window.js","node_modules/dom-walk/index.js","node_modules/min-document/dom-comment.js","node_modules/min-document/dom-text.js","node_modules/min-document/event/dispatch-event.js","node_modules/min-document/event/add-event-listener.js","node_modules/min-document/event/remove-event-listener.js","node_modules/min-document/serialize.js","node_modules/min-document/dom-element.js","node_modules/min-document/dom-fragment.js","node_modules/min-document/event.js","node_modules/min-document/document.js","node_modules/min-document/index.js","node_modules/global/document.js","node_modules/safe-json-parse/tuple.js","node_modules/@babel/runtime/helpers/extends.js","node_modules/is-function/index.js","node_modules/@videojs/xhr/lib/interceptors.js","node_modules/@videojs/xhr/lib/retry.js","node_modules/@videojs/xhr/lib/http-handler.js","node_modules/@videojs/xhr/lib/index.js","node_modules/videojs-vtt.js/lib/vtt.js","node_modules/videojs-vtt.js/lib/vttcue.js","node_modules/videojs-vtt.js/lib/vttregion.js","node_modules/videojs-vtt.js/lib/browser-index.js","node_modules/url-toolkit/src/url-toolkit.js","node_modules/@xmldom/xmldom/lib/conventions.js","node_modules/@xmldom/xmldom/lib/dom.js","node_modules/@xmldom/xmldom/lib/entities.js","node_modules/@xmldom/xmldom/lib/sax.js","node_modules/@xmldom/xmldom/lib/dom-parser.js","node_modules/@xmldom/xmldom/lib/index.js","node_modules/mux.js/lib/utils/numbers.js","node_modules/mux.js/lib/tools/parse-sidx.js","node_modules/mux.js/lib/utils/clock.js","node_modules/@angular/core/fesm2022/core.mjs","node_modules/@angular/core/fesm2022/primitives/signals.mjs","node_modules/rxjs/dist/esm/internal/util/isFunction.js","node_modules/rxjs/dist/esm/internal/util/createErrorClass.js","node_modules/rxjs/dist/esm/internal/util/UnsubscriptionError.js","node_modules/rxjs/dist/esm/internal/util/arrRemove.js","node_modules/rxjs/dist/esm/internal/Subscription.js","node_modules/rxjs/dist/esm/internal/config.js","node_modules/rxjs/dist/esm/internal/scheduler/timeoutProvider.js","node_modules/rxjs/dist/esm/internal/util/reportUnhandledError.js","node_modules/rxjs/dist/esm/internal/util/noop.js","node_modules/rxjs/dist/esm/internal/NotificationFactories.js","node_modules/rxjs/dist/esm/internal/util/errorContext.js","node_modules/rxjs/dist/esm/internal/Subscriber.js","node_modules/rxjs/dist/esm/internal/symbol/observable.js","node_modules/rxjs/dist/esm/internal/util/identity.js","node_modules/rxjs/dist/esm/internal/util/pipe.js","node_modules/rxjs/dist/esm/internal/Observable.js","node_modules/rxjs/dist/esm/internal/util/lift.js","node_modules/rxjs/dist/esm/internal/operators/OperatorSubscriber.js","node_modules/rxjs/dist/esm/internal/operators/refCount.js","node_modules/rxjs/dist/esm/internal/observable/ConnectableObservable.js","node_modules/rxjs/dist/esm/internal/util/ObjectUnsubscribedError.js","node_modules/rxjs/dist/esm/internal/Subject.js","node_modules/rxjs/dist/esm/internal/BehaviorSubject.js","node_modules/rxjs/dist/esm/internal/scheduler/dateTimestampProvider.js","node_modules/rxjs/dist/esm/internal/ReplaySubject.js","node_modules/rxjs/dist/esm/internal/scheduler/Action.js","node_modules/rxjs/dist/esm/internal/scheduler/intervalProvider.js","node_modules/rxjs/dist/esm/internal/scheduler/AsyncAction.js","node_modules/rxjs/dist/esm/internal/Scheduler.js","node_modules/rxjs/dist/esm/internal/scheduler/AsyncScheduler.js","node_modules/rxjs/dist/esm/internal/scheduler/async.js","node_modules/rxjs/dist/esm/internal/observable/empty.js","node_modules/rxjs/dist/esm/internal/util/isScheduler.js","node_modules/rxjs/dist/esm/internal/util/args.js","node_modules/tslib/tslib.es6.mjs","node_modules/rxjs/dist/esm/internal/util/isArrayLike.js","node_modules/rxjs/dist/esm/internal/util/isPromise.js","node_modules/rxjs/dist/esm/internal/util/isInteropObservable.js","node_modules/rxjs/dist/esm/internal/util/isAsyncIterable.js","node_modules/rxjs/dist/esm/internal/util/throwUnobservableError.js","node_modules/rxjs/dist/esm/internal/symbol/iterator.js","node_modules/rxjs/dist/esm/internal/util/isIterable.js","node_modules/rxjs/dist/esm/internal/util/isReadableStreamLike.js","node_modules/rxjs/dist/esm/internal/observable/innerFrom.js","node_modules/rxjs/dist/esm/internal/util/executeSchedule.js","node_modules/rxjs/dist/esm/internal/operators/observeOn.js","node_modules/rxjs/dist/esm/internal/operators/subscribeOn.js","node_modules/rxjs/dist/esm/internal/scheduled/scheduleObservable.js","node_modules/rxjs/dist/esm/internal/scheduled/schedulePromise.js","node_modules/rxjs/dist/esm/internal/scheduled/scheduleArray.js","node_modules/rxjs/dist/esm/internal/scheduled/scheduleIterable.js","node_modules/rxjs/dist/esm/internal/scheduled/scheduleAsyncIterable.js","node_modules/rxjs/dist/esm/internal/scheduled/scheduleReadableStreamLike.js","node_modules/rxjs/dist/esm/internal/scheduled/scheduled.js","node_modules/rxjs/dist/esm/internal/observable/from.js","node_modules/rxjs/dist/esm/internal/observable/of.js","node_modules/rxjs/dist/esm/internal/observable/throwError.js","node_modules/rxjs/dist/esm/internal/util/isObservable.js","node_modules/rxjs/dist/esm/internal/util/EmptyError.js","node_modules/rxjs/dist/esm/internal/util/isDate.js","node_modules/rxjs/dist/esm/internal/operators/map.js","node_modules/rxjs/dist/esm/internal/util/mapOneOrManyArgs.js","node_modules/rxjs/dist/esm/internal/util/argsArgArrayOrObject.js","node_modules/rxjs/dist/esm/internal/util/createObject.js","node_modules/rxjs/dist/esm/internal/observable/combineLatest.js","node_modules/rxjs/dist/esm/internal/operators/mergeInternals.js","node_modules/rxjs/dist/esm/internal/operators/mergeMap.js","node_modules/rxjs/dist/esm/internal/operators/mergeAll.js","node_modules/rxjs/dist/esm/internal/operators/concatAll.js","node_modules/rxjs/dist/esm/internal/observable/concat.js","node_modules/rxjs/dist/esm/internal/observable/defer.js","node_modules/rxjs/dist/esm/internal/observable/forkJoin.js","node_modules/rxjs/dist/esm/internal/observable/fromEvent.js","node_modules/rxjs/dist/esm/internal/observable/timer.js","node_modules/rxjs/dist/esm/internal/observable/interval.js","node_modules/rxjs/dist/esm/internal/observable/merge.js","node_modules/rxjs/dist/esm/internal/observable/never.js","node_modules/rxjs/dist/esm/internal/util/argsOrArgArray.js","node_modules/rxjs/dist/esm/internal/operators/filter.js","node_modules/rxjs/dist/esm/internal/observable/race.js","node_modules/rxjs/dist/esm/internal/observable/zip.js","node_modules/rxjs/dist/esm/internal/operators/catchError.js","node_modules/rxjs/dist/esm/internal/operators/scanInternals.js","node_modules/rxjs/dist/esm/internal/operators/concatMap.js","node_modules/rxjs/dist/esm/internal/observable/fromSubscribable.js","node_modules/rxjs/dist/esm/internal/operators/connect.js","node_modules/rxjs/dist/esm/internal/operators/defaultIfEmpty.js","node_modules/rxjs/dist/esm/internal/operators/take.js","node_modules/rxjs/dist/esm/internal/operators/ignoreElements.js","node_modules/rxjs/dist/esm/internal/operators/mapTo.js","node_modules/rxjs/dist/esm/internal/operators/delayWhen.js","node_modules/rxjs/dist/esm/internal/operators/delay.js","node_modules/rxjs/dist/esm/internal/operators/distinctUntilChanged.js","node_modules/rxjs/dist/esm/internal/operators/throwIfEmpty.js","node_modules/rxjs/dist/esm/internal/operators/endWith.js","node_modules/rxjs/dist/esm/internal/operators/finalize.js","node_modules/rxjs/dist/esm/internal/operators/first.js","node_modules/rxjs/dist/esm/internal/operators/takeLast.js","node_modules/rxjs/dist/esm/internal/operators/last.js","node_modules/rxjs/dist/esm/internal/operators/multicast.js","node_modules/rxjs/dist/esm/internal/operators/publish.js","node_modules/rxjs/dist/esm/internal/operators/retry.js","node_modules/rxjs/dist/esm/internal/operators/scan.js","node_modules/rxjs/dist/esm/internal/operators/share.js","node_modules/rxjs/dist/esm/internal/operators/shareReplay.js","node_modules/rxjs/dist/esm/internal/operators/skip.js","node_modules/rxjs/dist/esm/internal/operators/startWith.js","node_modules/rxjs/dist/esm/internal/operators/switchMap.js","node_modules/rxjs/dist/esm/internal/operators/takeUntil.js","node_modules/rxjs/dist/esm/internal/operators/tap.js","node_modules/rxjs/dist/esm/internal/operators/withLatestFrom.js","node_modules/@angular/core/fesm2022/primitives/event-dispatch.mjs","node_modules/@angular/compiler/fesm2022/compiler.mjs","node_modules/@angular/common/fesm2022/common.mjs","node_modules/@angular/common/fesm2022/http.mjs","node_modules/@angular/platform-browser/fesm2022/platform-browser.mjs","node_modules/@angular/platform-browser-dynamic/fesm2022/platform-browser-dynamic.mjs","node_modules/@angular/router/fesm2022/router.mjs","angular:jit:template:file:src/app/homepage/homepage.component.html","angular:jit:style:file:src/app/homepage/homepage.component.scss","src/app/_classes/app-settings.ts","src/app/_classes/user-detail.ts","src/app/_services/token.service.ts","src/app/_services/user.service.ts","src/app/homepage/homepage.component.ts","angular:jit:template:file:src/app/subject-list/subject-list.component.html","angular:jit:style:file:src/app/subject-list/subject-list.component.scss","src/app/_classes/culture-string.ts","src/app/_classes/flash-card.ts","src/app/_classes/ec-subject.ts","src/app/_classes/ec-topic.ts","node_modules/@angular/core/fesm2022/rxjs-interop.mjs","node_modules/flat/index.js","node_modules/@jsverse/transloco/fesm2022/jsverse-transloco.mjs","src/app/_services/culture.service.ts","src/app/_classes/terminology-term.ts","src/app/_services/data.service.ts","src/app/subject-list/subject-list.component.ts","angular:jit:template:file:src/app/my-progress/my-progress.component.html","angular:jit:style:file:src/app/my-progress/my-progress.component.scss","src/app/my-progress/my-progress.component.ts","angular:jit:template:file:src/app/practice-exams/practice-exams.component.html","angular:jit:style:file:src/app/practice-exams/practice-exams.component.scss","src/app/_pipes/shuffle.pipe.ts","src/app/_classes/exam-question.ts","src/app/_classes/exam-time-event.ts","src/app/_classes/utility.ts","src/app/_classes/exam.ts","src/app/_services/user-data.service.ts","src/app/practice-exams/practice-exams.component.ts","angular:jit:template:file:src/app/info/info.component.html","angular:jit:style:file:src/app/info/info.component.scss","src/app/info/info.component.ts","angular:jit:template:file:src/app/progress-subjects/progress-subjects.component.html","angular:jit:style:file:src/app/progress-subjects/progress-subjects.component.scss","src/app/_services/fire-store-static.service.ts","src/app/progress-subjects/progress-subjects.component.ts","angular:jit:template:file:src/app/progress-exams/progress-exams.component.html","angular:jit:style:file:src/app/progress-exams/progress-exams.component.scss","src/app/progress-exams/progress-exams.component.ts","angular:jit:template:file:src/app/topic-list/topic-list.component.html","angular:jit:style:file:src/app/topic-list/topic-list.component.scss","src/app/topic-list/topic-list.component.ts","angular:jit:template:file:src/app/topic-detail/topic-detail.component.html","angular:jit:style:file:src/app/topic-detail/topic-detail.component.scss","src/app/topic-detail/topic-detail.component.ts","angular:jit:template:file:src/app/terminology/terminology.component.html","angular:jit:style:file:src/app/terminology/terminology.component.scss","node_modules/@angular/animations/fesm2022/animations.mjs","src/app/animations.ts","src/app/terminology/terminology.component.ts","angular:jit:template:file:src/app/flashcards/flashcards.component.html","angular:jit:style:file:src/app/flashcards/flashcards.component.scss","src/app/_pipes/random.pipe.ts","node_modules/@angular/forms/fesm2022/forms.mjs","node_modules/@popperjs/core/lib/enums.js","node_modules/@popperjs/core/lib/dom-utils/getNodeName.js","node_modules/@popperjs/core/lib/dom-utils/getWindow.js","node_modules/@popperjs/core/lib/dom-utils/instanceOf.js","node_modules/@popperjs/core/lib/modifiers/applyStyles.js","node_modules/@popperjs/core/lib/utils/getBasePlacement.js","node_modules/@popperjs/core/lib/utils/math.js","node_modules/@popperjs/core/lib/utils/userAgent.js","node_modules/@popperjs/core/lib/dom-utils/isLayoutViewport.js","node_modules/@popperjs/core/lib/dom-utils/getBoundingClientRect.js","node_modules/@popperjs/core/lib/dom-utils/getLayoutRect.js","node_modules/@popperjs/core/lib/dom-utils/contains.js","node_modules/@popperjs/core/lib/dom-utils/getComputedStyle.js","node_modules/@popperjs/core/lib/dom-utils/isTableElement.js","node_modules/@popperjs/core/lib/dom-utils/getDocumentElement.js","node_modules/@popperjs/core/lib/dom-utils/getParentNode.js","node_modules/@popperjs/core/lib/dom-utils/getOffsetParent.js","node_modules/@popperjs/core/lib/utils/getMainAxisFromPlacement.js","node_modules/@popperjs/core/lib/utils/within.js","node_modules/@popperjs/core/lib/utils/getFreshSideObject.js","node_modules/@popperjs/core/lib/utils/mergePaddingObject.js","node_modules/@popperjs/core/lib/utils/expandToHashMap.js","node_modules/@popperjs/core/lib/modifiers/arrow.js","node_modules/@popperjs/core/lib/utils/getVariation.js","node_modules/@popperjs/core/lib/modifiers/computeStyles.js","node_modules/@popperjs/core/lib/modifiers/eventListeners.js","node_modules/@popperjs/core/lib/utils/getOppositePlacement.js","node_modules/@popperjs/core/lib/utils/getOppositeVariationPlacement.js","node_modules/@popperjs/core/lib/dom-utils/getWindowScroll.js","node_modules/@popperjs/core/lib/dom-utils/getWindowScrollBarX.js","node_modules/@popperjs/core/lib/dom-utils/getViewportRect.js","node_modules/@popperjs/core/lib/dom-utils/getDocumentRect.js","node_modules/@popperjs/core/lib/dom-utils/isScrollParent.js","node_modules/@popperjs/core/lib/dom-utils/getScrollParent.js","node_modules/@popperjs/core/lib/dom-utils/listScrollParents.js","node_modules/@popperjs/core/lib/utils/rectToClientRect.js","node_modules/@popperjs/core/lib/dom-utils/getClippingRect.js","node_modules/@popperjs/core/lib/utils/computeOffsets.js","node_modules/@popperjs/core/lib/utils/detectOverflow.js","node_modules/@popperjs/core/lib/utils/computeAutoPlacement.js","node_modules/@popperjs/core/lib/modifiers/flip.js","node_modules/@popperjs/core/lib/modifiers/offset.js","node_modules/@popperjs/core/lib/modifiers/popperOffsets.js","node_modules/@popperjs/core/lib/utils/getAltAxis.js","node_modules/@popperjs/core/lib/modifiers/preventOverflow.js","node_modules/@popperjs/core/lib/dom-utils/getHTMLElementScroll.js","node_modules/@popperjs/core/lib/dom-utils/getNodeScroll.js","node_modules/@popperjs/core/lib/dom-utils/getCompositeRect.js","node_modules/@popperjs/core/lib/utils/orderModifiers.js","node_modules/@popperjs/core/lib/utils/debounce.js","node_modules/@popperjs/core/lib/utils/mergeByName.js","node_modules/@popperjs/core/lib/createPopper.js","node_modules/@popperjs/core/lib/popper-lite.js","node_modules/@ng-bootstrap/ng-bootstrap/fesm2022/ng-bootstrap.mjs","src/app/flashcards/flashcards.component.ts","angular:jit:template:file:src/app/quiz-landing/quiz-landing.component.html","angular:jit:style:file:src/app/quiz-landing/quiz-landing.component.scss","src/app/quiz-landing/quiz-landing.component.ts","angular:jit:template:file:src/app/quiz-questions/quiz-questions.component.html","angular:jit:style:file:src/app/quiz-questions/quiz-questions.component.scss","src/app/_classes/interstitial.ts","src/app/_services/fire-store-interstitials.service.ts","src/app/quiz-questions/quiz-questions.component.ts","angular:jit:template:file:src/app/get-started/get-started.component.html","angular:jit:style:file:src/app/get-started/get-started.component.scss","src/app/get-started/get-started.component.ts","angular:jit:template:file:src/app/faq/faq.component.html","angular:jit:style:file:src/app/faq/faq.component.scss","src/app/faq/faq.component.ts","angular:jit:template:file:src/app/sources/sources.component.html","angular:jit:style:file:src/app/sources/sources.component.scss","src/app/sources/sources.component.ts","angular:jit:template:file:src/app/contact/contact.component.html","angular:jit:style:file:src/app/contact/contact.component.scss","src/app/contact/contact.component.ts","src/app/_services/auth-guard.service.ts","angular:jit:template:file:src/app/login/login.component.html","angular:jit:style:file:src/app/login/login.component.scss","src/app/login/login.component.ts","angular:jit:template:file:src/app/quiz-review/quiz-review.component.html","angular:jit:style:file:src/app/quiz-review/quiz-review.component.scss","src/app/quiz-review/quiz-review.component.ts","angular:jit:template:file:src/app/purchase/purchase.component.html","angular:jit:style:file:src/app/purchase/purchase.component.scss","src/app/purchase/purchase.component.ts","angular:jit:template:file:src/app/exam-display/exam-display.component.html","angular:jit:style:file:src/app/exam-display/exam-display.component.scss","src/app/exam-display/exam-display.component.ts","angular:jit:template:file:src/app/search-results/search-results.component.html","angular:jit:style:file:src/app/search-results/search-results.component.scss","src/app/_services/search.service.ts","src/app/search-results/search-results.component.ts","angular:jit:template:file:src/app/add-to-home/add-to-home.component.html","angular:jit:style:file:src/app/add-to-home/add-to-home.component.scss","node_modules/ngx-device-detector/fesm2022/ngx-device-detector.mjs","src/app/add-to-home/add-to-home.component.ts","angular:jit:template:file:src/app/time-check/time-check.component.html","angular:jit:style:file:src/app/time-check/time-check.component.scss","src/app/time-check/time-check.component.ts","src/app/app-routing.module.ts","node_modules/@angular/animations/fesm2022/browser.mjs","node_modules/@angular/platform-browser/fesm2022/animations.mjs","angular:jit:template:file:src/app/app.component.html","angular:jit:style:file:src/app/app.component.scss","src/app/_services/firebase-function.service.ts","src/app/_services/user-agent-tracking.service.ts","src/app/app.component.ts","angular:jit:template:file:src/app/header/header.component.html","angular:jit:style:file:src/app/header/header.component.scss","src/app/header/header.component.ts","angular:jit:template:file:src/app/footer/footer.component.html","angular:jit:style:file:src/app/footer/footer.component.scss","src/app/footer/footer.component.ts","angular:jit:template:file:src/app/search/search.component.html","angular:jit:style:file:src/app/search/search.component.scss","src/app/search/search.component.ts","angular:jit:template:file:src/app/subject-topic-card/subject-topic-card.component.html","angular:jit:style:file:src/app/subject-topic-card/subject-topic-card.component.scss","src/app/subject-topic-card/subject-topic-card.component.ts","angular:jit:template:file:src/app/breadcrumb/breadcrumb.component.html","angular:jit:style:file:src/app/breadcrumb/breadcrumb.component.scss","src/app/breadcrumb/breadcrumb.component.ts","src/app/_classes/interceptor.ts","angular:jit:template:file:src/app/interstitial/interstitial.component.html","angular:jit:style:file:src/app/interstitial/interstitial.component.scss","src/app/interstitial/interstitial.component.ts","node_modules/@fortawesome/fontawesome-svg-core/index.mjs","node_modules/@fortawesome/angular-fontawesome/fesm2022/angular-fontawesome.mjs","node_modules/@fortawesome/free-solid-svg-icons/index.mjs","angular:jit:template:file:src/app/loading/loading.component.html","angular:jit:style:file:src/app/loading/loading.component.scss","src/app/loading/loading.component.ts","angular:jit:template:file:src/app/subject-topic-header/subject-topic-header.component.html","angular:jit:style:file:src/app/subject-topic-header/subject-topic-header.component.scss","src/app/subject-topic-header/subject-topic-header.component.ts","angular:jit:template:file:src/app/exam-button/exam-button.component.html","angular:jit:style:file:src/app/exam-button/exam-button.component.scss","src/app/exam-button/exam-button.component.ts","angular:jit:template:file:src/app/exam-question/exam-question.component.html","angular:jit:style:file:src/app/exam-question/exam-question.component.scss","src/app/exam-question/exam-question.component.ts","angular:jit:template:file:src/app/exam-alert/exam-alert.component.html","angular:jit:style:file:src/app/exam-alert/exam-alert.component.scss","src/app/exam-alert/exam-alert.component.ts","angular:jit:template:file:src/app/question-review/question-review.component.html","angular:jit:style:file:src/app/question-review/question-review.component.scss","src/app/question-review/question-review.component.ts","angular:jit:template:file:src/app/exam-review/exam-review.component.html","angular:jit:style:file:src/app/exam-review/exam-review.component.scss","src/app/exam-review/exam-review.component.ts","angular:jit:template:file:src/app/exam-timeline/exam-timeline.component.html","angular:jit:style:file:src/app/exam-timeline/exam-timeline.component.scss","src/app/exam-timeline/exam-timeline.component.ts","node_modules/@angular/service-worker/fesm2022/service-worker.mjs","src/environments/environment.ts","angular:jit:template:file:src/app/video-player/video-player.component.html","angular:jit:style:file:src/app/video-player/video-player.component.scss","node_modules/video.js/dist/video.es.js","node_modules/@babel/runtime/helpers/esm/extends.js","node_modules/@videojs/vhs-utils/es/resolve-url.js","node_modules/m3u8-parser/node_modules/@videojs/vhs-utils/es/stream.js","node_modules/m3u8-parser/node_modules/@videojs/vhs-utils/es/decode-b64-to-uint8-array.js","node_modules/m3u8-parser/dist/m3u8-parser.es.js","node_modules/@videojs/vhs-utils/es/codecs.js","node_modules/@videojs/vhs-utils/es/media-types.js","node_modules/@videojs/vhs-utils/es/byte-helpers.js","node_modules/mpd-parser/dist/mpd-parser.es.js","node_modules/@videojs/vhs-utils/es/media-groups.js","node_modules/@videojs/vhs-utils/es/decode-b64-to-uint8-array.js","node_modules/@videojs/vhs-utils/es/id3-helpers.js","node_modules/@videojs/vhs-utils/es/opus-helpers.js","node_modules/@videojs/vhs-utils/es/mp4-helpers.js","node_modules/@videojs/vhs-utils/es/ebml-helpers.js","node_modules/@videojs/vhs-utils/es/nal-helpers.js","node_modules/@videojs/vhs-utils/es/containers.js","src/app/video-player/video-player.component.ts","angular:jit:template:file:src/app/footer-prompt/footer-prompt.component.html","angular:jit:style:file:src/app/footer-prompt/footer-prompt.component.scss","src/app/footer-prompt/footer-prompt.component.ts","src/app/_pipes/culture.pipe.ts","angular:jit:template:file:src/app/culture-picker/culture-picker.component.html","angular:jit:style:file:src/app/culture-picker/culture-picker.component.css","src/app/culture-picker/culture-picker.component.ts","angular:jit:template:file:src/app/culture-string/culture-string.component.html","angular:jit:style:file:src/app/culture-string/culture-string.component.css","src/app/culture-string/culture-string.component.ts","src/app/transloco-loader.ts","src/app/transloco-root.module.ts","src/app/app.module.ts","src/main.ts"],"sourcesContent":["var win;\nif (typeof window !== \"undefined\") {\n win = window;\n} else if (typeof global !== \"undefined\") {\n win = global;\n} else if (typeof self !== \"undefined\") {\n win = self;\n} else {\n win = {};\n}\nmodule.exports = win;","var slice = Array.prototype.slice;\nmodule.exports = iterativelyWalk;\nfunction iterativelyWalk(nodes, cb) {\n if (!('length' in nodes)) {\n nodes = [nodes];\n }\n nodes = slice.call(nodes);\n while (nodes.length) {\n var node = nodes.shift(),\n ret = cb(node);\n if (ret) {\n return ret;\n }\n if (node.childNodes && node.childNodes.length) {\n nodes = slice.call(node.childNodes).concat(nodes);\n }\n }\n}","module.exports = Comment;\nfunction Comment(data, owner) {\n if (!(this instanceof Comment)) {\n return new Comment(data, owner);\n }\n this.data = data;\n this.nodeValue = data;\n this.length = data.length;\n this.ownerDocument = owner || null;\n}\nComment.prototype.nodeType = 8;\nComment.prototype.nodeName = \"#comment\";\nComment.prototype.toString = function _Comment_toString() {\n return \"[object Comment]\";\n};","module.exports = DOMText;\nfunction DOMText(value, owner) {\n if (!(this instanceof DOMText)) {\n return new DOMText(value);\n }\n this.data = value || \"\";\n this.length = this.data.length;\n this.ownerDocument = owner || null;\n}\nDOMText.prototype.type = \"DOMTextNode\";\nDOMText.prototype.nodeType = 3;\nDOMText.prototype.nodeName = \"#text\";\nDOMText.prototype.toString = function _Text_toString() {\n return this.data;\n};\nDOMText.prototype.replaceData = function replaceData(index, length, value) {\n var current = this.data;\n var left = current.substring(0, index);\n var right = current.substring(index + length, current.length);\n this.data = left + value + right;\n this.length = this.data.length;\n};","module.exports = dispatchEvent;\nfunction dispatchEvent(ev) {\n var elem = this;\n var type = ev.type;\n if (!ev.target) {\n ev.target = elem;\n }\n if (!elem.listeners) {\n elem.listeners = {};\n }\n var listeners = elem.listeners[type];\n if (listeners) {\n return listeners.forEach(function (listener) {\n ev.currentTarget = elem;\n if (typeof listener === 'function') {\n listener(ev);\n } else {\n listener.handleEvent(ev);\n }\n });\n }\n if (elem.parentNode) {\n elem.parentNode.dispatchEvent(ev);\n }\n}","module.exports = addEventListener;\nfunction addEventListener(type, listener) {\n var elem = this;\n if (!elem.listeners) {\n elem.listeners = {};\n }\n if (!elem.listeners[type]) {\n elem.listeners[type] = [];\n }\n if (elem.listeners[type].indexOf(listener) === -1) {\n elem.listeners[type].push(listener);\n }\n}","module.exports = removeEventListener;\nfunction removeEventListener(type, listener) {\n var elem = this;\n if (!elem.listeners) {\n return;\n }\n if (!elem.listeners[type]) {\n return;\n }\n var list = elem.listeners[type];\n var index = list.indexOf(listener);\n if (index !== -1) {\n list.splice(index, 1);\n }\n}","module.exports = serializeNode;\nvar voidElements = [\"area\", \"base\", \"br\", \"col\", \"embed\", \"hr\", \"img\", \"input\", \"keygen\", \"link\", \"menuitem\", \"meta\", \"param\", \"source\", \"track\", \"wbr\"];\nfunction serializeNode(node) {\n switch (node.nodeType) {\n case 3:\n return escapeText(node.data);\n case 8:\n return \"\";\n default:\n return serializeElement(node);\n }\n}\nfunction serializeElement(elem) {\n var strings = [];\n var tagname = elem.tagName;\n if (elem.namespaceURI === \"http://www.w3.org/1999/xhtml\") {\n tagname = tagname.toLowerCase();\n }\n strings.push(\"<\" + tagname + properties(elem) + datasetify(elem));\n if (voidElements.indexOf(tagname) > -1) {\n strings.push(\" />\");\n } else {\n strings.push(\">\");\n if (elem.childNodes.length) {\n strings.push.apply(strings, elem.childNodes.map(serializeNode));\n } else if (elem.textContent || elem.innerText) {\n strings.push(escapeText(elem.textContent || elem.innerText));\n } else if (elem.innerHTML) {\n strings.push(elem.innerHTML);\n }\n strings.push(\"\");\n }\n return strings.join(\"\");\n}\nfunction isProperty(elem, key) {\n var type = typeof elem[key];\n if (key === \"style\" && Object.keys(elem.style).length > 0) {\n return true;\n }\n return elem.hasOwnProperty(key) && (type === \"string\" || type === \"boolean\" || type === \"number\") && key !== \"nodeName\" && key !== \"className\" && key !== \"tagName\" && key !== \"textContent\" && key !== \"innerText\" && key !== \"namespaceURI\" && key !== \"innerHTML\";\n}\nfunction stylify(styles) {\n if (typeof styles === 'string') return styles;\n var attr = \"\";\n Object.keys(styles).forEach(function (key) {\n var value = styles[key];\n key = key.replace(/[A-Z]/g, function (c) {\n return \"-\" + c.toLowerCase();\n });\n attr += key + \":\" + value + \";\";\n });\n return attr;\n}\nfunction datasetify(elem) {\n var ds = elem.dataset;\n var props = [];\n for (var key in ds) {\n props.push({\n name: \"data-\" + key,\n value: ds[key]\n });\n }\n return props.length ? stringify(props) : \"\";\n}\nfunction stringify(list) {\n var attributes = [];\n list.forEach(function (tuple) {\n var name = tuple.name;\n var value = tuple.value;\n if (name === \"style\") {\n value = stylify(value);\n }\n attributes.push(name + \"=\" + \"\\\"\" + escapeAttributeValue(value) + \"\\\"\");\n });\n return attributes.length ? \" \" + attributes.join(\" \") : \"\";\n}\nfunction properties(elem) {\n var props = [];\n for (var key in elem) {\n if (isProperty(elem, key)) {\n props.push({\n name: key,\n value: elem[key]\n });\n }\n }\n for (var ns in elem._attributes) {\n for (var attribute in elem._attributes[ns]) {\n var prop = elem._attributes[ns][attribute];\n var name = (prop.prefix ? prop.prefix + \":\" : \"\") + attribute;\n props.push({\n name: name,\n value: prop.value\n });\n }\n }\n if (elem.className) {\n props.push({\n name: \"class\",\n value: elem.className\n });\n }\n return props.length ? stringify(props) : \"\";\n}\nfunction escapeText(s) {\n var str = '';\n if (typeof s === 'string') {\n str = s;\n } else if (s) {\n str = s.toString();\n }\n return str.replace(/&/g, \"&\").replace(//g, \">\");\n}\nfunction escapeAttributeValue(str) {\n return escapeText(str).replace(/\"/g, \""\");\n}","var domWalk = require(\"dom-walk\");\nvar dispatchEvent = require(\"./event/dispatch-event.js\");\nvar addEventListener = require(\"./event/add-event-listener.js\");\nvar removeEventListener = require(\"./event/remove-event-listener.js\");\nvar serializeNode = require(\"./serialize.js\");\nvar htmlns = \"http://www.w3.org/1999/xhtml\";\nmodule.exports = DOMElement;\nfunction DOMElement(tagName, owner, namespace) {\n if (!(this instanceof DOMElement)) {\n return new DOMElement(tagName);\n }\n var ns = namespace === undefined ? htmlns : namespace || null;\n this.tagName = ns === htmlns ? String(tagName).toUpperCase() : tagName;\n this.nodeName = this.tagName;\n this.className = \"\";\n this.dataset = {};\n this.childNodes = [];\n this.parentNode = null;\n this.style = {};\n this.ownerDocument = owner || null;\n this.namespaceURI = ns;\n this._attributes = {};\n if (this.tagName === 'INPUT') {\n this.type = 'text';\n }\n}\nDOMElement.prototype.type = \"DOMElement\";\nDOMElement.prototype.nodeType = 1;\nDOMElement.prototype.appendChild = function _Element_appendChild(child) {\n if (child.parentNode) {\n child.parentNode.removeChild(child);\n }\n this.childNodes.push(child);\n child.parentNode = this;\n return child;\n};\nDOMElement.prototype.replaceChild = function _Element_replaceChild(elem, needle) {\n // TODO: Throw NotFoundError if needle.parentNode !== this\n\n if (elem.parentNode) {\n elem.parentNode.removeChild(elem);\n }\n var index = this.childNodes.indexOf(needle);\n needle.parentNode = null;\n this.childNodes[index] = elem;\n elem.parentNode = this;\n return needle;\n};\nDOMElement.prototype.removeChild = function _Element_removeChild(elem) {\n // TODO: Throw NotFoundError if elem.parentNode !== this\n\n var index = this.childNodes.indexOf(elem);\n this.childNodes.splice(index, 1);\n elem.parentNode = null;\n return elem;\n};\nDOMElement.prototype.insertBefore = function _Element_insertBefore(elem, needle) {\n // TODO: Throw NotFoundError if referenceElement is a dom node\n // and parentNode !== this\n\n if (elem.parentNode) {\n elem.parentNode.removeChild(elem);\n }\n var index = needle === null || needle === undefined ? -1 : this.childNodes.indexOf(needle);\n if (index > -1) {\n this.childNodes.splice(index, 0, elem);\n } else {\n this.childNodes.push(elem);\n }\n elem.parentNode = this;\n return elem;\n};\nDOMElement.prototype.setAttributeNS = function _Element_setAttributeNS(namespace, name, value) {\n var prefix = null;\n var localName = name;\n var colonPosition = name.indexOf(\":\");\n if (colonPosition > -1) {\n prefix = name.substr(0, colonPosition);\n localName = name.substr(colonPosition + 1);\n }\n if (this.tagName === 'INPUT' && name === 'type') {\n this.type = value;\n } else {\n var attributes = this._attributes[namespace] || (this._attributes[namespace] = {});\n attributes[localName] = {\n value: value,\n prefix: prefix\n };\n }\n};\nDOMElement.prototype.getAttributeNS = function _Element_getAttributeNS(namespace, name) {\n var attributes = this._attributes[namespace];\n var value = attributes && attributes[name] && attributes[name].value;\n if (this.tagName === 'INPUT' && name === 'type') {\n return this.type;\n }\n if (typeof value !== \"string\") {\n return null;\n }\n return value;\n};\nDOMElement.prototype.removeAttributeNS = function _Element_removeAttributeNS(namespace, name) {\n var attributes = this._attributes[namespace];\n if (attributes) {\n delete attributes[name];\n }\n};\nDOMElement.prototype.hasAttributeNS = function _Element_hasAttributeNS(namespace, name) {\n var attributes = this._attributes[namespace];\n return !!attributes && name in attributes;\n};\nDOMElement.prototype.setAttribute = function _Element_setAttribute(name, value) {\n return this.setAttributeNS(null, name, value);\n};\nDOMElement.prototype.getAttribute = function _Element_getAttribute(name) {\n return this.getAttributeNS(null, name);\n};\nDOMElement.prototype.removeAttribute = function _Element_removeAttribute(name) {\n return this.removeAttributeNS(null, name);\n};\nDOMElement.prototype.hasAttribute = function _Element_hasAttribute(name) {\n return this.hasAttributeNS(null, name);\n};\nDOMElement.prototype.removeEventListener = removeEventListener;\nDOMElement.prototype.addEventListener = addEventListener;\nDOMElement.prototype.dispatchEvent = dispatchEvent;\n\n// Un-implemented\nDOMElement.prototype.focus = function _Element_focus() {\n return void 0;\n};\nDOMElement.prototype.toString = function _Element_toString() {\n return serializeNode(this);\n};\nDOMElement.prototype.getElementsByClassName = function _Element_getElementsByClassName(classNames) {\n var classes = classNames.split(\" \");\n var elems = [];\n domWalk(this, function (node) {\n if (node.nodeType === 1) {\n var nodeClassName = node.className || \"\";\n var nodeClasses = nodeClassName.split(\" \");\n if (classes.every(function (item) {\n return nodeClasses.indexOf(item) !== -1;\n })) {\n elems.push(node);\n }\n }\n });\n return elems;\n};\nDOMElement.prototype.getElementsByTagName = function _Element_getElementsByTagName(tagName) {\n tagName = tagName.toLowerCase();\n var elems = [];\n domWalk(this.childNodes, function (node) {\n if (node.nodeType === 1 && (tagName === '*' || node.tagName.toLowerCase() === tagName)) {\n elems.push(node);\n }\n });\n return elems;\n};\nDOMElement.prototype.contains = function _Element_contains(element) {\n return domWalk(this, function (node) {\n return element === node;\n }) || false;\n};","var DOMElement = require(\"./dom-element.js\");\nmodule.exports = DocumentFragment;\nfunction DocumentFragment(owner) {\n if (!(this instanceof DocumentFragment)) {\n return new DocumentFragment();\n }\n this.childNodes = [];\n this.parentNode = null;\n this.ownerDocument = owner || null;\n}\nDocumentFragment.prototype.type = \"DocumentFragment\";\nDocumentFragment.prototype.nodeType = 11;\nDocumentFragment.prototype.nodeName = \"#document-fragment\";\nDocumentFragment.prototype.appendChild = DOMElement.prototype.appendChild;\nDocumentFragment.prototype.replaceChild = DOMElement.prototype.replaceChild;\nDocumentFragment.prototype.removeChild = DOMElement.prototype.removeChild;\nDocumentFragment.prototype.toString = function _DocumentFragment_toString() {\n return this.childNodes.map(function (node) {\n return String(node);\n }).join(\"\");\n};","module.exports = Event;\nfunction Event(family) {}\nEvent.prototype.initEvent = function _Event_initEvent(type, bubbles, cancelable) {\n this.type = type;\n this.bubbles = bubbles;\n this.cancelable = cancelable;\n};\nEvent.prototype.preventDefault = function _Event_preventDefault() {};","var domWalk = require(\"dom-walk\");\nvar Comment = require(\"./dom-comment.js\");\nvar DOMText = require(\"./dom-text.js\");\nvar DOMElement = require(\"./dom-element.js\");\nvar DocumentFragment = require(\"./dom-fragment.js\");\nvar Event = require(\"./event.js\");\nvar dispatchEvent = require(\"./event/dispatch-event.js\");\nvar addEventListener = require(\"./event/add-event-listener.js\");\nvar removeEventListener = require(\"./event/remove-event-listener.js\");\nmodule.exports = Document;\nfunction Document() {\n if (!(this instanceof Document)) {\n return new Document();\n }\n this.head = this.createElement(\"head\");\n this.body = this.createElement(\"body\");\n this.documentElement = this.createElement(\"html\");\n this.documentElement.appendChild(this.head);\n this.documentElement.appendChild(this.body);\n this.childNodes = [this.documentElement];\n this.nodeType = 9;\n}\nvar proto = Document.prototype;\nproto.createTextNode = function createTextNode(value) {\n return new DOMText(value, this);\n};\nproto.createElementNS = function createElementNS(namespace, tagName) {\n var ns = namespace === null ? null : String(namespace);\n return new DOMElement(tagName, this, ns);\n};\nproto.createElement = function createElement(tagName) {\n return new DOMElement(tagName, this);\n};\nproto.createDocumentFragment = function createDocumentFragment() {\n return new DocumentFragment(this);\n};\nproto.createEvent = function createEvent(family) {\n return new Event(family);\n};\nproto.createComment = function createComment(data) {\n return new Comment(data, this);\n};\nproto.getElementById = function getElementById(id) {\n id = String(id);\n var result = domWalk(this.childNodes, function (node) {\n if (String(node.id) === id) {\n return node;\n }\n });\n return result || null;\n};\nproto.getElementsByClassName = DOMElement.prototype.getElementsByClassName;\nproto.getElementsByTagName = DOMElement.prototype.getElementsByTagName;\nproto.contains = DOMElement.prototype.contains;\nproto.removeEventListener = removeEventListener;\nproto.addEventListener = addEventListener;\nproto.dispatchEvent = dispatchEvent;","var Document = require('./document.js');\nmodule.exports = new Document();","var topLevel = typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : {};\nvar minDoc = require('min-document');\nvar doccy;\nif (typeof document !== 'undefined') {\n doccy = document;\n} else {\n doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'];\n if (!doccy) {\n doccy = topLevel['__GLOBAL_DOCUMENT_CACHE@4'] = minDoc;\n }\n}\nmodule.exports = doccy;","module.exports = SafeParseTuple;\nfunction SafeParseTuple(obj, reviver) {\n var json;\n var error = null;\n try {\n json = JSON.parse(obj, reviver);\n } catch (err) {\n error = err;\n }\n return [error, json];\n}","function _extends() {\n return (module.exports = _extends = Object.assign ? Object.assign.bind() : function (n) {\n for (var e = 1; e < arguments.length; e++) {\n var t = arguments[e];\n for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);\n }\n return n;\n }, module.exports.__esModule = true, module.exports[\"default\"] = module.exports), _extends.apply(null, arguments);\n}\nmodule.exports = _extends, module.exports.__esModule = true, module.exports[\"default\"] = module.exports;","module.exports = isFunction;\nvar toString = Object.prototype.toString;\nfunction isFunction(fn) {\n if (!fn) {\n return false;\n }\n var string = toString.call(fn);\n return string === '[object Function]' || typeof fn === 'function' && string !== '[object RegExp]' || typeof window !== 'undefined' && (\n // IE8 and below\n fn === window.setTimeout || fn === window.alert || fn === window.confirm || fn === window.prompt);\n}\n;","\"use strict\";\n\nfunction _createForOfIteratorHelperLoose(o, allowArrayLike) {\n var it = typeof Symbol !== \"undefined\" && o[Symbol.iterator] || o[\"@@iterator\"];\n if (it) return (it = it.call(o)).next.bind(it);\n if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") {\n if (it) o = it;\n var i = 0;\n return function () {\n if (i >= o.length) return {\n done: true\n };\n return {\n done: false,\n value: o[i++]\n };\n };\n }\n throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}\nfunction _unsupportedIterableToArray(o, minLen) {\n if (!o) return;\n if (typeof o === \"string\") return _arrayLikeToArray(o, minLen);\n var n = Object.prototype.toString.call(o).slice(8, -1);\n if (n === \"Object\" && o.constructor) n = o.constructor.name;\n if (n === \"Map\" || n === \"Set\") return Array.from(o);\n if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);\n}\nfunction _arrayLikeToArray(arr, len) {\n if (len == null || len > arr.length) len = arr.length;\n for (var i = 0, arr2 = new Array(len); i < len; i++) {\n arr2[i] = arr[i];\n }\n return arr2;\n}\nvar InterceptorsStorage = /*#__PURE__*/function () {\n function InterceptorsStorage() {\n this.typeToInterceptorsMap_ = new Map();\n this.enabled_ = false;\n }\n var _proto = InterceptorsStorage.prototype;\n _proto.getIsEnabled = function getIsEnabled() {\n return this.enabled_;\n };\n _proto.enable = function enable() {\n this.enabled_ = true;\n };\n _proto.disable = function disable() {\n this.enabled_ = false;\n };\n _proto.reset = function reset() {\n this.typeToInterceptorsMap_ = new Map();\n this.enabled_ = false;\n };\n _proto.addInterceptor = function addInterceptor(type, interceptor) {\n if (!this.typeToInterceptorsMap_.has(type)) {\n this.typeToInterceptorsMap_.set(type, new Set());\n }\n var interceptorsSet = this.typeToInterceptorsMap_.get(type);\n if (interceptorsSet.has(interceptor)) {\n // already have this interceptor\n return false;\n }\n interceptorsSet.add(interceptor);\n return true;\n };\n _proto.removeInterceptor = function removeInterceptor(type, interceptor) {\n var interceptorsSet = this.typeToInterceptorsMap_.get(type);\n if (interceptorsSet && interceptorsSet.has(interceptor)) {\n interceptorsSet.delete(interceptor);\n return true;\n }\n return false;\n };\n _proto.clearInterceptorsByType = function clearInterceptorsByType(type) {\n var interceptorsSet = this.typeToInterceptorsMap_.get(type);\n if (!interceptorsSet) {\n return false;\n }\n this.typeToInterceptorsMap_.delete(type);\n this.typeToInterceptorsMap_.set(type, new Set());\n return true;\n };\n _proto.clear = function clear() {\n if (!this.typeToInterceptorsMap_.size) {\n return false;\n }\n this.typeToInterceptorsMap_ = new Map();\n return true;\n };\n _proto.getForType = function getForType(type) {\n return this.typeToInterceptorsMap_.get(type) || new Set();\n };\n _proto.execute = function execute(type, payload) {\n var interceptors = this.getForType(type);\n for (var _iterator = _createForOfIteratorHelperLoose(interceptors), _step; !(_step = _iterator()).done;) {\n var interceptor = _step.value;\n try {\n payload = interceptor(payload);\n } catch (e) {//ignore\n }\n }\n return payload;\n };\n return InterceptorsStorage;\n}();\nmodule.exports = InterceptorsStorage;","\"use strict\";\n\nvar RetryManager = /*#__PURE__*/function () {\n function RetryManager() {\n this.maxAttempts_ = 1;\n this.delayFactor_ = 0.1;\n this.fuzzFactor_ = 0.1;\n this.initialDelay_ = 1000;\n this.enabled_ = false;\n }\n var _proto = RetryManager.prototype;\n _proto.getIsEnabled = function getIsEnabled() {\n return this.enabled_;\n };\n _proto.enable = function enable() {\n this.enabled_ = true;\n };\n _proto.disable = function disable() {\n this.enabled_ = false;\n };\n _proto.reset = function reset() {\n this.maxAttempts_ = 1;\n this.delayFactor_ = 0.1;\n this.fuzzFactor_ = 0.1;\n this.initialDelay_ = 1000;\n this.enabled_ = false;\n };\n _proto.getMaxAttempts = function getMaxAttempts() {\n return this.maxAttempts_;\n };\n _proto.setMaxAttempts = function setMaxAttempts(maxAttempts) {\n this.maxAttempts_ = maxAttempts;\n };\n _proto.getDelayFactor = function getDelayFactor() {\n return this.delayFactor_;\n };\n _proto.setDelayFactor = function setDelayFactor(delayFactor) {\n this.delayFactor_ = delayFactor;\n };\n _proto.getFuzzFactor = function getFuzzFactor() {\n return this.fuzzFactor_;\n };\n _proto.setFuzzFactor = function setFuzzFactor(fuzzFactor) {\n this.fuzzFactor_ = fuzzFactor;\n };\n _proto.getInitialDelay = function getInitialDelay() {\n return this.initialDelay_;\n };\n _proto.setInitialDelay = function setInitialDelay(initialDelay) {\n this.initialDelay_ = initialDelay;\n };\n _proto.createRetry = function createRetry(_temp) {\n var _ref = _temp === void 0 ? {} : _temp,\n maxAttempts = _ref.maxAttempts,\n delayFactor = _ref.delayFactor,\n fuzzFactor = _ref.fuzzFactor,\n initialDelay = _ref.initialDelay;\n return new Retry({\n maxAttempts: maxAttempts || this.maxAttempts_,\n delayFactor: delayFactor || this.delayFactor_,\n fuzzFactor: fuzzFactor || this.fuzzFactor_,\n initialDelay: initialDelay || this.initialDelay_\n });\n };\n return RetryManager;\n}();\nvar Retry = /*#__PURE__*/function () {\n function Retry(options) {\n this.maxAttempts_ = options.maxAttempts;\n this.delayFactor_ = options.delayFactor;\n this.fuzzFactor_ = options.fuzzFactor;\n this.currentDelay_ = options.initialDelay;\n this.currentAttempt_ = 1;\n }\n var _proto2 = Retry.prototype;\n _proto2.moveToNextAttempt = function moveToNextAttempt() {\n this.currentAttempt_++;\n var delayDelta = this.currentDelay_ * this.delayFactor_;\n this.currentDelay_ = this.currentDelay_ + delayDelta;\n };\n _proto2.shouldRetry = function shouldRetry() {\n return this.currentAttempt_ < this.maxAttempts_;\n };\n _proto2.getCurrentDelay = function getCurrentDelay() {\n return this.currentDelay_;\n };\n _proto2.getCurrentMinPossibleDelay = function getCurrentMinPossibleDelay() {\n return (1 - this.fuzzFactor_) * this.currentDelay_;\n };\n _proto2.getCurrentMaxPossibleDelay = function getCurrentMaxPossibleDelay() {\n return (1 + this.fuzzFactor_) * this.currentDelay_;\n }\n /**\n * For example fuzzFactor is 0.1\n * This means ±10% deviation\n * So if we have delay as 1000\n * This function can generate any value from 900 to 1100\n */;\n _proto2.getCurrentFuzzedDelay = function getCurrentFuzzedDelay() {\n var lowValue = this.getCurrentMinPossibleDelay();\n var highValue = this.getCurrentMaxPossibleDelay();\n return lowValue + Math.random() * (highValue - lowValue);\n };\n return Retry;\n}();\nmodule.exports = RetryManager;","\"use strict\";\n\nvar window = require('global/window');\nvar httpResponseHandler = function httpResponseHandler(callback, decodeResponseBody) {\n if (decodeResponseBody === void 0) {\n decodeResponseBody = false;\n }\n return function (err, response, responseBody) {\n // if the XHR failed, return that error\n if (err) {\n callback(err);\n return;\n } // if the HTTP status code is 4xx or 5xx, the request also failed\n\n if (response.statusCode >= 400 && response.statusCode <= 599) {\n var cause = responseBody;\n if (decodeResponseBody) {\n if (window.TextDecoder) {\n var charset = getCharset(response.headers && response.headers['content-type']);\n try {\n cause = new TextDecoder(charset).decode(responseBody);\n } catch (e) {}\n } else {\n cause = String.fromCharCode.apply(null, new Uint8Array(responseBody));\n }\n }\n callback({\n cause: cause\n });\n return;\n } // otherwise, request succeeded\n\n callback(null, responseBody);\n };\n};\nfunction getCharset(contentTypeHeader) {\n if (contentTypeHeader === void 0) {\n contentTypeHeader = '';\n }\n return contentTypeHeader.toLowerCase().split(';').reduce(function (charset, contentType) {\n var _contentType$split = contentType.split('='),\n type = _contentType$split[0],\n value = _contentType$split[1];\n if (type.trim() === 'charset') {\n return value.trim();\n }\n return charset;\n }, 'utf-8');\n}\nmodule.exports = httpResponseHandler;","\"use strict\";\n\nvar window = require(\"global/window\");\nvar _extends = require(\"@babel/runtime/helpers/extends\");\nvar isFunction = require('is-function');\nvar InterceptorsStorage = require('./interceptors.js');\nvar RetryManager = require(\"./retry.js\");\ncreateXHR.httpHandler = require('./http-handler.js');\ncreateXHR.requestInterceptorsStorage = new InterceptorsStorage();\ncreateXHR.responseInterceptorsStorage = new InterceptorsStorage();\ncreateXHR.retryManager = new RetryManager();\n/**\n * @license\n * slighly modified parse-headers 2.0.2 \n * Copyright (c) 2014 David Björklund\n * Available under the MIT license\n * \n */\n\nvar parseHeaders = function parseHeaders(headers) {\n var result = {};\n if (!headers) {\n return result;\n }\n headers.trim().split('\\n').forEach(function (row) {\n var index = row.indexOf(':');\n var key = row.slice(0, index).trim().toLowerCase();\n var value = row.slice(index + 1).trim();\n if (typeof result[key] === 'undefined') {\n result[key] = value;\n } else if (Array.isArray(result[key])) {\n result[key].push(value);\n } else {\n result[key] = [result[key], value];\n }\n });\n return result;\n};\nmodule.exports = createXHR; // Allow use of default import syntax in TypeScript\n\nmodule.exports.default = createXHR;\ncreateXHR.XMLHttpRequest = window.XMLHttpRequest || noop;\ncreateXHR.XDomainRequest = \"withCredentials\" in new createXHR.XMLHttpRequest() ? createXHR.XMLHttpRequest : window.XDomainRequest;\nforEachArray([\"get\", \"put\", \"post\", \"patch\", \"head\", \"delete\"], function (method) {\n createXHR[method === \"delete\" ? \"del\" : method] = function (uri, options, callback) {\n options = initParams(uri, options, callback);\n options.method = method.toUpperCase();\n return _createXHR(options);\n };\n});\nfunction forEachArray(array, iterator) {\n for (var i = 0; i < array.length; i++) {\n iterator(array[i]);\n }\n}\nfunction isEmpty(obj) {\n for (var i in obj) {\n if (obj.hasOwnProperty(i)) return false;\n }\n return true;\n}\nfunction initParams(uri, options, callback) {\n var params = uri;\n if (isFunction(options)) {\n callback = options;\n if (typeof uri === \"string\") {\n params = {\n uri: uri\n };\n }\n } else {\n params = _extends({}, options, {\n uri: uri\n });\n }\n params.callback = callback;\n return params;\n}\nfunction createXHR(uri, options, callback) {\n options = initParams(uri, options, callback);\n return _createXHR(options);\n}\nfunction _createXHR(options) {\n if (typeof options.callback === \"undefined\") {\n throw new Error(\"callback argument missing\");\n } // call all registered request interceptors for a given request type:\n\n if (options.requestType && createXHR.requestInterceptorsStorage.getIsEnabled()) {\n var requestInterceptorPayload = {\n uri: options.uri || options.url,\n headers: options.headers || {},\n body: options.body,\n metadata: options.metadata || {},\n retry: options.retry,\n timeout: options.timeout\n };\n var updatedPayload = createXHR.requestInterceptorsStorage.execute(options.requestType, requestInterceptorPayload);\n options.uri = updatedPayload.uri;\n options.headers = updatedPayload.headers;\n options.body = updatedPayload.body;\n options.metadata = updatedPayload.metadata;\n options.retry = updatedPayload.retry;\n options.timeout = updatedPayload.timeout;\n }\n var called = false;\n var callback = function cbOnce(err, response, body) {\n if (!called) {\n called = true;\n options.callback(err, response, body);\n }\n };\n function readystatechange() {\n // do not call load 2 times when response interceptors are enabled\n // why do we even need this 2nd load?\n if (xhr.readyState === 4 && !createXHR.responseInterceptorsStorage.getIsEnabled()) {\n setTimeout(loadFunc, 0);\n }\n }\n function getBody() {\n // Chrome with requestType=blob throws errors arround when even testing access to responseText\n var body = undefined;\n if (xhr.response) {\n body = xhr.response;\n } else {\n body = xhr.responseText || getXml(xhr);\n }\n if (isJson) {\n try {\n body = JSON.parse(body);\n } catch (e) {}\n }\n return body;\n }\n function errorFunc(evt) {\n clearTimeout(timeoutTimer);\n clearTimeout(options.retryTimeout);\n if (!(evt instanceof Error)) {\n evt = new Error(\"\" + (evt || \"Unknown XMLHttpRequest Error\"));\n }\n evt.statusCode = 0; // we would like to retry on error:\n\n if (!aborted && createXHR.retryManager.getIsEnabled() && options.retry && options.retry.shouldRetry()) {\n options.retryTimeout = setTimeout(function () {\n options.retry.moveToNextAttempt(); // we want to re-use the same options and the same xhr object:\n\n options.xhr = xhr;\n _createXHR(options);\n }, options.retry.getCurrentFuzzedDelay());\n return;\n } // call all registered response interceptors for a given request type:\n\n if (options.requestType && createXHR.responseInterceptorsStorage.getIsEnabled()) {\n var responseInterceptorPayload = {\n headers: failureResponse.headers || {},\n body: failureResponse.body,\n responseUrl: xhr.responseURL,\n responseType: xhr.responseType\n };\n var _updatedPayload = createXHR.responseInterceptorsStorage.execute(options.requestType, responseInterceptorPayload);\n failureResponse.body = _updatedPayload.body;\n failureResponse.headers = _updatedPayload.headers;\n }\n return callback(evt, failureResponse);\n } // will load the data & process the response in a special response object\n\n function loadFunc() {\n if (aborted) return;\n var status;\n clearTimeout(timeoutTimer);\n clearTimeout(options.retryTimeout);\n if (options.useXDR && xhr.status === undefined) {\n //IE8 CORS GET successful response doesn't have a status field, but body is fine\n status = 200;\n } else {\n status = xhr.status === 1223 ? 204 : xhr.status;\n }\n var response = failureResponse;\n var err = null;\n if (status !== 0) {\n response = {\n body: getBody(),\n statusCode: status,\n method: method,\n headers: {},\n url: uri,\n rawRequest: xhr\n };\n if (xhr.getAllResponseHeaders) {\n //remember xhr can in fact be XDR for CORS in IE\n response.headers = parseHeaders(xhr.getAllResponseHeaders());\n }\n } else {\n err = new Error(\"Internal XMLHttpRequest Error\");\n } // call all registered response interceptors for a given request type:\n\n if (options.requestType && createXHR.responseInterceptorsStorage.getIsEnabled()) {\n var responseInterceptorPayload = {\n headers: response.headers || {},\n body: response.body,\n responseUrl: xhr.responseURL,\n responseType: xhr.responseType\n };\n var _updatedPayload2 = createXHR.responseInterceptorsStorage.execute(options.requestType, responseInterceptorPayload);\n response.body = _updatedPayload2.body;\n response.headers = _updatedPayload2.headers;\n }\n return callback(err, response, response.body);\n }\n var xhr = options.xhr || null;\n if (!xhr) {\n if (options.cors || options.useXDR) {\n xhr = new createXHR.XDomainRequest();\n } else {\n xhr = new createXHR.XMLHttpRequest();\n }\n }\n var key;\n var aborted;\n var uri = xhr.url = options.uri || options.url;\n var method = xhr.method = options.method || \"GET\";\n var body = options.body || options.data;\n var headers = xhr.headers = options.headers || {};\n var sync = !!options.sync;\n var isJson = false;\n var timeoutTimer;\n var failureResponse = {\n body: undefined,\n headers: {},\n statusCode: 0,\n method: method,\n url: uri,\n rawRequest: xhr\n };\n if (\"json\" in options && options.json !== false) {\n isJson = true;\n headers[\"accept\"] || headers[\"Accept\"] || (headers[\"Accept\"] = \"application/json\"); //Don't override existing accept header declared by user\n\n if (method !== \"GET\" && method !== \"HEAD\") {\n headers[\"content-type\"] || headers[\"Content-Type\"] || (headers[\"Content-Type\"] = \"application/json\"); //Don't override existing accept header declared by user\n\n body = JSON.stringify(options.json === true ? body : options.json);\n }\n }\n xhr.onreadystatechange = readystatechange;\n xhr.onload = loadFunc;\n xhr.onerror = errorFunc; // IE9 must have onprogress be set to a unique function.\n\n xhr.onprogress = function () {// IE must die\n };\n xhr.onabort = function () {\n aborted = true;\n clearTimeout(options.retryTimeout);\n };\n xhr.ontimeout = errorFunc;\n xhr.open(method, uri, !sync, options.username, options.password); //has to be after open\n\n if (!sync) {\n xhr.withCredentials = !!options.withCredentials;\n } // Cannot set timeout with sync request\n // not setting timeout on the xhr object, because of old webkits etc. not handling that correctly\n // both npm's request and jquery 1.x use this kind of timeout, so this is being consistent\n\n if (!sync && options.timeout > 0) {\n timeoutTimer = setTimeout(function () {\n if (aborted) return;\n aborted = true; //IE9 may still call readystatechange\n\n xhr.abort(\"timeout\");\n var e = new Error(\"XMLHttpRequest timeout\");\n e.code = \"ETIMEDOUT\";\n errorFunc(e);\n }, options.timeout);\n }\n if (xhr.setRequestHeader) {\n for (key in headers) {\n if (headers.hasOwnProperty(key)) {\n xhr.setRequestHeader(key, headers[key]);\n }\n }\n } else if (options.headers && !isEmpty(options.headers)) {\n throw new Error(\"Headers cannot be set on an XDomainRequest object\");\n }\n if (\"responseType\" in options) {\n xhr.responseType = options.responseType;\n }\n if (\"beforeSend\" in options && typeof options.beforeSend === \"function\") {\n options.beforeSend(xhr);\n } // Microsoft Edge browser sends \"undefined\" when send is called with undefined value.\n // XMLHttpRequest spec says to pass null as body to indicate no body\n // See https://github.com/naugtur/xhr/issues/100.\n\n xhr.send(body || null);\n return xhr;\n}\nfunction getXml(xhr) {\n // xhr.responseXML will throw Exception \"InvalidStateError\" or \"DOMException\"\n // See https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/responseXML.\n try {\n if (xhr.responseType === \"document\") {\n return xhr.responseXML;\n }\n var firefoxBugTakenEffect = xhr.responseXML && xhr.responseXML.documentElement.nodeName === \"parsererror\";\n if (xhr.responseType === \"\" && !firefoxBugTakenEffect) {\n return xhr.responseXML;\n }\n } catch (e) {}\n return null;\n}\nfunction noop() {}","/**\n * Copyright 2013 vtt.js Contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */\n/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */\nvar document = require('global/document');\nvar _objCreate = Object.create || function () {\n function F() {}\n return function (o) {\n if (arguments.length !== 1) {\n throw new Error('Object.create shim only accepts one parameter.');\n }\n F.prototype = o;\n return new F();\n };\n}();\n\n// Creates a new ParserError object from an errorData object. The errorData\n// object should have default code and message properties. The default message\n// property can be overriden by passing in a message parameter.\n// See ParsingError.Errors below for acceptable errors.\nfunction ParsingError(errorData, message) {\n this.name = \"ParsingError\";\n this.code = errorData.code;\n this.message = message || errorData.message;\n}\nParsingError.prototype = _objCreate(Error.prototype);\nParsingError.prototype.constructor = ParsingError;\n\n// ParsingError metadata for acceptable ParsingErrors.\nParsingError.Errors = {\n BadSignature: {\n code: 0,\n message: \"Malformed WebVTT signature.\"\n },\n BadTimeStamp: {\n code: 1,\n message: \"Malformed time stamp.\"\n }\n};\n\n// Try to parse input as a time stamp.\nfunction parseTimeStamp(input) {\n function computeSeconds(h, m, s, f) {\n return (h | 0) * 3600 + (m | 0) * 60 + (s | 0) + (f | 0) / 1000;\n }\n var m = input.match(/^(\\d+):(\\d{1,2})(:\\d{1,2})?\\.(\\d{3})/);\n if (!m) {\n return null;\n }\n if (m[3]) {\n // Timestamp takes the form of [hours]:[minutes]:[seconds].[milliseconds]\n return computeSeconds(m[1], m[2], m[3].replace(\":\", \"\"), m[4]);\n } else if (m[1] > 59) {\n // Timestamp takes the form of [hours]:[minutes].[milliseconds]\n // First position is hours as it's over 59.\n return computeSeconds(m[1], m[2], 0, m[4]);\n } else {\n // Timestamp takes the form of [minutes]:[seconds].[milliseconds]\n return computeSeconds(0, m[1], m[2], m[4]);\n }\n}\n\n// A settings object holds key/value pairs and will ignore anything but the first\n// assignment to a specific key.\nfunction Settings() {\n this.values = _objCreate(null);\n}\nSettings.prototype = {\n // Only accept the first assignment to any key.\n set: function (k, v) {\n if (!this.get(k) && v !== \"\") {\n this.values[k] = v;\n }\n },\n // Return the value for a key, or a default value.\n // If 'defaultKey' is passed then 'dflt' is assumed to be an object with\n // a number of possible default values as properties where 'defaultKey' is\n // the key of the property that will be chosen; otherwise it's assumed to be\n // a single value.\n get: function (k, dflt, defaultKey) {\n if (defaultKey) {\n return this.has(k) ? this.values[k] : dflt[defaultKey];\n }\n return this.has(k) ? this.values[k] : dflt;\n },\n // Check whether we have a value for a key.\n has: function (k) {\n return k in this.values;\n },\n // Accept a setting if its one of the given alternatives.\n alt: function (k, v, a) {\n for (var n = 0; n < a.length; ++n) {\n if (v === a[n]) {\n this.set(k, v);\n break;\n }\n }\n },\n // Accept a setting if its a valid (signed) integer.\n integer: function (k, v) {\n if (/^-?\\d+$/.test(v)) {\n // integer\n this.set(k, parseInt(v, 10));\n }\n },\n // Accept a setting if its a valid percentage.\n percent: function (k, v) {\n var m;\n if (m = v.match(/^([\\d]{1,3})(\\.[\\d]*)?%$/)) {\n v = parseFloat(v);\n if (v >= 0 && v <= 100) {\n this.set(k, v);\n return true;\n }\n }\n return false;\n }\n};\n\n// Helper function to parse input into groups separated by 'groupDelim', and\n// interprete each group as a key/value pair separated by 'keyValueDelim'.\nfunction parseOptions(input, callback, keyValueDelim, groupDelim) {\n var groups = groupDelim ? input.split(groupDelim) : [input];\n for (var i in groups) {\n if (typeof groups[i] !== \"string\") {\n continue;\n }\n var kv = groups[i].split(keyValueDelim);\n if (kv.length !== 2) {\n continue;\n }\n var k = kv[0].trim();\n var v = kv[1].trim();\n callback(k, v);\n }\n}\nfunction parseCue(input, cue, regionList) {\n // Remember the original input if we need to throw an error.\n var oInput = input;\n // 4.1 WebVTT timestamp\n function consumeTimeStamp() {\n var ts = parseTimeStamp(input);\n if (ts === null) {\n throw new ParsingError(ParsingError.Errors.BadTimeStamp, \"Malformed timestamp: \" + oInput);\n }\n // Remove time stamp from input.\n input = input.replace(/^[^\\sa-zA-Z-]+/, \"\");\n return ts;\n }\n\n // 4.4.2 WebVTT cue settings\n function consumeCueSettings(input, cue) {\n var settings = new Settings();\n parseOptions(input, function (k, v) {\n switch (k) {\n case \"region\":\n // Find the last region we parsed with the same region id.\n for (var i = regionList.length - 1; i >= 0; i--) {\n if (regionList[i].id === v) {\n settings.set(k, regionList[i].region);\n break;\n }\n }\n break;\n case \"vertical\":\n settings.alt(k, v, [\"rl\", \"lr\"]);\n break;\n case \"line\":\n var vals = v.split(\",\"),\n vals0 = vals[0];\n settings.integer(k, vals0);\n settings.percent(k, vals0) ? settings.set(\"snapToLines\", false) : null;\n settings.alt(k, vals0, [\"auto\"]);\n if (vals.length === 2) {\n settings.alt(\"lineAlign\", vals[1], [\"start\", \"center\", \"end\"]);\n }\n break;\n case \"position\":\n vals = v.split(\",\");\n settings.percent(k, vals[0]);\n if (vals.length === 2) {\n settings.alt(\"positionAlign\", vals[1], [\"start\", \"center\", \"end\"]);\n }\n break;\n case \"size\":\n settings.percent(k, v);\n break;\n case \"align\":\n settings.alt(k, v, [\"start\", \"center\", \"end\", \"left\", \"right\"]);\n break;\n }\n }, /:/, /\\s/);\n\n // Apply default values for any missing fields.\n cue.region = settings.get(\"region\", null);\n cue.vertical = settings.get(\"vertical\", \"\");\n try {\n cue.line = settings.get(\"line\", \"auto\");\n } catch (e) {}\n cue.lineAlign = settings.get(\"lineAlign\", \"start\");\n cue.snapToLines = settings.get(\"snapToLines\", true);\n cue.size = settings.get(\"size\", 100);\n // Safari still uses the old middle value and won't accept center\n try {\n cue.align = settings.get(\"align\", \"center\");\n } catch (e) {\n cue.align = settings.get(\"align\", \"middle\");\n }\n try {\n cue.position = settings.get(\"position\", \"auto\");\n } catch (e) {\n cue.position = settings.get(\"position\", {\n start: 0,\n left: 0,\n center: 50,\n middle: 50,\n end: 100,\n right: 100\n }, cue.align);\n }\n cue.positionAlign = settings.get(\"positionAlign\", {\n start: \"start\",\n left: \"start\",\n center: \"center\",\n middle: \"center\",\n end: \"end\",\n right: \"end\"\n }, cue.align);\n }\n function skipWhitespace() {\n input = input.replace(/^\\s+/, \"\");\n }\n\n // 4.1 WebVTT cue timings.\n skipWhitespace();\n cue.startTime = consumeTimeStamp(); // (1) collect cue start time\n skipWhitespace();\n if (input.substr(0, 3) !== \"-->\") {\n // (3) next characters must match \"-->\"\n throw new ParsingError(ParsingError.Errors.BadTimeStamp, \"Malformed time stamp (time stamps must be separated by '-->'): \" + oInput);\n }\n input = input.substr(3);\n skipWhitespace();\n cue.endTime = consumeTimeStamp(); // (5) collect cue end time\n\n // 4.1 WebVTT cue settings list.\n skipWhitespace();\n consumeCueSettings(input, cue);\n}\n\n// When evaluating this file as part of a Webpack bundle for server\n// side rendering, `document` is an empty object.\nvar TEXTAREA_ELEMENT = document.createElement && document.createElement(\"textarea\");\nvar TAG_NAME = {\n c: \"span\",\n i: \"i\",\n b: \"b\",\n u: \"u\",\n ruby: \"ruby\",\n rt: \"rt\",\n v: \"span\",\n lang: \"span\"\n};\n\n// 5.1 default text color\n// 5.2 default text background color is equivalent to text color with bg_ prefix\nvar DEFAULT_COLOR_CLASS = {\n white: 'rgba(255,255,255,1)',\n lime: 'rgba(0,255,0,1)',\n cyan: 'rgba(0,255,255,1)',\n red: 'rgba(255,0,0,1)',\n yellow: 'rgba(255,255,0,1)',\n magenta: 'rgba(255,0,255,1)',\n blue: 'rgba(0,0,255,1)',\n black: 'rgba(0,0,0,1)'\n};\nvar TAG_ANNOTATION = {\n v: \"title\",\n lang: \"lang\"\n};\nvar NEEDS_PARENT = {\n rt: \"ruby\"\n};\n\n// Parse content into a document fragment.\nfunction parseContent(window, input) {\n function nextToken() {\n // Check for end-of-string.\n if (!input) {\n return null;\n }\n\n // Consume 'n' characters from the input.\n function consume(result) {\n input = input.substr(result.length);\n return result;\n }\n var m = input.match(/^([^<]*)(<[^>]*>?)?/);\n // If there is some text before the next tag, return it, otherwise return\n // the tag.\n return consume(m[1] ? m[1] : m[2]);\n }\n function unescape(s) {\n TEXTAREA_ELEMENT.innerHTML = s;\n s = TEXTAREA_ELEMENT.textContent;\n TEXTAREA_ELEMENT.textContent = \"\";\n return s;\n }\n function shouldAdd(current, element) {\n return !NEEDS_PARENT[element.localName] || NEEDS_PARENT[element.localName] === current.localName;\n }\n\n // Create an element for this tag.\n function createElement(type, annotation) {\n var tagName = TAG_NAME[type];\n if (!tagName) {\n return null;\n }\n var element = window.document.createElement(tagName);\n var name = TAG_ANNOTATION[type];\n if (name && annotation) {\n element[name] = annotation.trim();\n }\n return element;\n }\n var rootDiv = window.document.createElement(\"div\"),\n current = rootDiv,\n t,\n tagStack = [];\n while ((t = nextToken()) !== null) {\n if (t[0] === '<') {\n if (t[1] === \"/\") {\n // If the closing tag matches, move back up to the parent node.\n if (tagStack.length && tagStack[tagStack.length - 1] === t.substr(2).replace(\">\", \"\")) {\n tagStack.pop();\n current = current.parentNode;\n }\n // Otherwise just ignore the end tag.\n continue;\n }\n var ts = parseTimeStamp(t.substr(1, t.length - 2));\n var node;\n if (ts) {\n // Timestamps are lead nodes as well.\n node = window.document.createProcessingInstruction(\"timestamp\", ts);\n current.appendChild(node);\n continue;\n }\n var m = t.match(/^<([^.\\s/0-9>]+)(\\.[^\\s\\\\>]+)?([^>\\\\]+)?(\\\\?)>?$/);\n // If we can't parse the tag, skip to the next tag.\n if (!m) {\n continue;\n }\n // Try to construct an element, and ignore the tag if we couldn't.\n node = createElement(m[1], m[3]);\n if (!node) {\n continue;\n }\n // Determine if the tag should be added based on the context of where it\n // is placed in the cuetext.\n if (!shouldAdd(current, node)) {\n continue;\n }\n // Set the class list (as a list of classes, separated by space).\n if (m[2]) {\n var classes = m[2].split('.');\n classes.forEach(function (cl) {\n var bgColor = /^bg_/.test(cl);\n // slice out `bg_` if it's a background color\n var colorName = bgColor ? cl.slice(3) : cl;\n if (DEFAULT_COLOR_CLASS.hasOwnProperty(colorName)) {\n var propName = bgColor ? 'background-color' : 'color';\n var propValue = DEFAULT_COLOR_CLASS[colorName];\n node.style[propName] = propValue;\n }\n });\n node.className = classes.join(' ');\n }\n // Append the node to the current node, and enter the scope of the new\n // node.\n tagStack.push(m[1]);\n current.appendChild(node);\n current = node;\n continue;\n }\n\n // Text nodes are leaf nodes.\n current.appendChild(window.document.createTextNode(unescape(t)));\n }\n return rootDiv;\n}\n\n// This is a list of all the Unicode characters that have a strong\n// right-to-left category. What this means is that these characters are\n// written right-to-left for sure. It was generated by pulling all the strong\n// right-to-left characters out of the Unicode data table. That table can\n// found at: http://www.unicode.org/Public/UNIDATA/UnicodeData.txt\nvar strongRTLRanges = [[0x5be, 0x5be], [0x5c0, 0x5c0], [0x5c3, 0x5c3], [0x5c6, 0x5c6], [0x5d0, 0x5ea], [0x5f0, 0x5f4], [0x608, 0x608], [0x60b, 0x60b], [0x60d, 0x60d], [0x61b, 0x61b], [0x61e, 0x64a], [0x66d, 0x66f], [0x671, 0x6d5], [0x6e5, 0x6e6], [0x6ee, 0x6ef], [0x6fa, 0x70d], [0x70f, 0x710], [0x712, 0x72f], [0x74d, 0x7a5], [0x7b1, 0x7b1], [0x7c0, 0x7ea], [0x7f4, 0x7f5], [0x7fa, 0x7fa], [0x800, 0x815], [0x81a, 0x81a], [0x824, 0x824], [0x828, 0x828], [0x830, 0x83e], [0x840, 0x858], [0x85e, 0x85e], [0x8a0, 0x8a0], [0x8a2, 0x8ac], [0x200f, 0x200f], [0xfb1d, 0xfb1d], [0xfb1f, 0xfb28], [0xfb2a, 0xfb36], [0xfb38, 0xfb3c], [0xfb3e, 0xfb3e], [0xfb40, 0xfb41], [0xfb43, 0xfb44], [0xfb46, 0xfbc1], [0xfbd3, 0xfd3d], [0xfd50, 0xfd8f], [0xfd92, 0xfdc7], [0xfdf0, 0xfdfc], [0xfe70, 0xfe74], [0xfe76, 0xfefc], [0x10800, 0x10805], [0x10808, 0x10808], [0x1080a, 0x10835], [0x10837, 0x10838], [0x1083c, 0x1083c], [0x1083f, 0x10855], [0x10857, 0x1085f], [0x10900, 0x1091b], [0x10920, 0x10939], [0x1093f, 0x1093f], [0x10980, 0x109b7], [0x109be, 0x109bf], [0x10a00, 0x10a00], [0x10a10, 0x10a13], [0x10a15, 0x10a17], [0x10a19, 0x10a33], [0x10a40, 0x10a47], [0x10a50, 0x10a58], [0x10a60, 0x10a7f], [0x10b00, 0x10b35], [0x10b40, 0x10b55], [0x10b58, 0x10b72], [0x10b78, 0x10b7f], [0x10c00, 0x10c48], [0x1ee00, 0x1ee03], [0x1ee05, 0x1ee1f], [0x1ee21, 0x1ee22], [0x1ee24, 0x1ee24], [0x1ee27, 0x1ee27], [0x1ee29, 0x1ee32], [0x1ee34, 0x1ee37], [0x1ee39, 0x1ee39], [0x1ee3b, 0x1ee3b], [0x1ee42, 0x1ee42], [0x1ee47, 0x1ee47], [0x1ee49, 0x1ee49], [0x1ee4b, 0x1ee4b], [0x1ee4d, 0x1ee4f], [0x1ee51, 0x1ee52], [0x1ee54, 0x1ee54], [0x1ee57, 0x1ee57], [0x1ee59, 0x1ee59], [0x1ee5b, 0x1ee5b], [0x1ee5d, 0x1ee5d], [0x1ee5f, 0x1ee5f], [0x1ee61, 0x1ee62], [0x1ee64, 0x1ee64], [0x1ee67, 0x1ee6a], [0x1ee6c, 0x1ee72], [0x1ee74, 0x1ee77], [0x1ee79, 0x1ee7c], [0x1ee7e, 0x1ee7e], [0x1ee80, 0x1ee89], [0x1ee8b, 0x1ee9b], [0x1eea1, 0x1eea3], [0x1eea5, 0x1eea9], [0x1eeab, 0x1eebb], [0x10fffd, 0x10fffd]];\nfunction isStrongRTLChar(charCode) {\n for (var i = 0; i < strongRTLRanges.length; i++) {\n var currentRange = strongRTLRanges[i];\n if (charCode >= currentRange[0] && charCode <= currentRange[1]) {\n return true;\n }\n }\n return false;\n}\nfunction determineBidi(cueDiv) {\n var nodeStack = [],\n text = \"\",\n charCode;\n if (!cueDiv || !cueDiv.childNodes) {\n return \"ltr\";\n }\n function pushNodes(nodeStack, node) {\n for (var i = node.childNodes.length - 1; i >= 0; i--) {\n nodeStack.push(node.childNodes[i]);\n }\n }\n function nextTextNode(nodeStack) {\n if (!nodeStack || !nodeStack.length) {\n return null;\n }\n var node = nodeStack.pop(),\n text = node.textContent || node.innerText;\n if (text) {\n // TODO: This should match all unicode type B characters (paragraph\n // separator characters). See issue #115.\n var m = text.match(/^.*(\\n|\\r)/);\n if (m) {\n nodeStack.length = 0;\n return m[0];\n }\n return text;\n }\n if (node.tagName === \"ruby\") {\n return nextTextNode(nodeStack);\n }\n if (node.childNodes) {\n pushNodes(nodeStack, node);\n return nextTextNode(nodeStack);\n }\n }\n pushNodes(nodeStack, cueDiv);\n while (text = nextTextNode(nodeStack)) {\n for (var i = 0; i < text.length; i++) {\n charCode = text.charCodeAt(i);\n if (isStrongRTLChar(charCode)) {\n return \"rtl\";\n }\n }\n }\n return \"ltr\";\n}\nfunction computeLinePos(cue) {\n if (typeof cue.line === \"number\" && (cue.snapToLines || cue.line >= 0 && cue.line <= 100)) {\n return cue.line;\n }\n if (!cue.track || !cue.track.textTrackList || !cue.track.textTrackList.mediaElement) {\n return -1;\n }\n var track = cue.track,\n trackList = track.textTrackList,\n count = 0;\n for (var i = 0; i < trackList.length && trackList[i] !== track; i++) {\n if (trackList[i].mode === \"showing\") {\n count++;\n }\n }\n return ++count * -1;\n}\nfunction StyleBox() {}\n\n// Apply styles to a div. If there is no div passed then it defaults to the\n// div on 'this'.\nStyleBox.prototype.applyStyles = function (styles, div) {\n div = div || this.div;\n for (var prop in styles) {\n if (styles.hasOwnProperty(prop)) {\n div.style[prop] = styles[prop];\n }\n }\n};\nStyleBox.prototype.formatStyle = function (val, unit) {\n return val === 0 ? 0 : val + unit;\n};\n\n// Constructs the computed display state of the cue (a div). Places the div\n// into the overlay which should be a block level element (usually a div).\nfunction CueStyleBox(window, cue, styleOptions) {\n StyleBox.call(this);\n this.cue = cue;\n\n // Parse our cue's text into a DOM tree rooted at 'cueDiv'. This div will\n // have inline positioning and will function as the cue background box.\n this.cueDiv = parseContent(window, cue.text);\n var styles = {\n color: \"rgba(255, 255, 255, 1)\",\n backgroundColor: \"rgba(0, 0, 0, 0.8)\",\n position: \"relative\",\n left: 0,\n right: 0,\n top: 0,\n bottom: 0,\n display: \"inline\",\n writingMode: cue.vertical === \"\" ? \"horizontal-tb\" : cue.vertical === \"lr\" ? \"vertical-lr\" : \"vertical-rl\",\n unicodeBidi: \"plaintext\"\n };\n this.applyStyles(styles, this.cueDiv);\n\n // Create an absolutely positioned div that will be used to position the cue\n // div. Note, all WebVTT cue-setting alignments are equivalent to the CSS\n // mirrors of them except middle instead of center on Safari.\n this.div = window.document.createElement(\"div\");\n styles = {\n direction: determineBidi(this.cueDiv),\n writingMode: cue.vertical === \"\" ? \"horizontal-tb\" : cue.vertical === \"lr\" ? \"vertical-lr\" : \"vertical-rl\",\n unicodeBidi: \"plaintext\",\n textAlign: cue.align === \"middle\" ? \"center\" : cue.align,\n font: styleOptions.font,\n whiteSpace: \"pre-line\",\n position: \"absolute\"\n };\n this.applyStyles(styles);\n this.div.appendChild(this.cueDiv);\n\n // Calculate the distance from the reference edge of the viewport to the text\n // position of the cue box. The reference edge will be resolved later when\n // the box orientation styles are applied.\n var textPos = 0;\n switch (cue.positionAlign) {\n case \"start\":\n case \"line-left\":\n textPos = cue.position;\n break;\n case \"center\":\n textPos = cue.position - cue.size / 2;\n break;\n case \"end\":\n case \"line-right\":\n textPos = cue.position - cue.size;\n break;\n }\n\n // Horizontal box orientation; textPos is the distance from the left edge of the\n // area to the left edge of the box and cue.size is the distance extending to\n // the right from there.\n if (cue.vertical === \"\") {\n this.applyStyles({\n left: this.formatStyle(textPos, \"%\"),\n width: this.formatStyle(cue.size, \"%\")\n });\n // Vertical box orientation; textPos is the distance from the top edge of the\n // area to the top edge of the box and cue.size is the height extending\n // downwards from there.\n } else {\n this.applyStyles({\n top: this.formatStyle(textPos, \"%\"),\n height: this.formatStyle(cue.size, \"%\")\n });\n }\n this.move = function (box) {\n this.applyStyles({\n top: this.formatStyle(box.top, \"px\"),\n bottom: this.formatStyle(box.bottom, \"px\"),\n left: this.formatStyle(box.left, \"px\"),\n right: this.formatStyle(box.right, \"px\"),\n height: this.formatStyle(box.height, \"px\"),\n width: this.formatStyle(box.width, \"px\")\n });\n };\n}\nCueStyleBox.prototype = _objCreate(StyleBox.prototype);\nCueStyleBox.prototype.constructor = CueStyleBox;\n\n// Represents the co-ordinates of an Element in a way that we can easily\n// compute things with such as if it overlaps or intersects with another Element.\n// Can initialize it with either a StyleBox or another BoxPosition.\nfunction BoxPosition(obj) {\n // Either a BoxPosition was passed in and we need to copy it, or a StyleBox\n // was passed in and we need to copy the results of 'getBoundingClientRect'\n // as the object returned is readonly. All co-ordinate values are in reference\n // to the viewport origin (top left).\n var lh, height, width, top;\n if (obj.div) {\n height = obj.div.offsetHeight;\n width = obj.div.offsetWidth;\n top = obj.div.offsetTop;\n var rects = (rects = obj.div.childNodes) && (rects = rects[0]) && rects.getClientRects && rects.getClientRects();\n obj = obj.div.getBoundingClientRect();\n // In certain cases the outter div will be slightly larger then the sum of\n // the inner div's lines. This could be due to bold text, etc, on some platforms.\n // In this case we should get the average line height and use that. This will\n // result in the desired behaviour.\n lh = rects ? Math.max(rects[0] && rects[0].height || 0, obj.height / rects.length) : 0;\n }\n this.left = obj.left;\n this.right = obj.right;\n this.top = obj.top || top;\n this.height = obj.height || height;\n this.bottom = obj.bottom || top + (obj.height || height);\n this.width = obj.width || width;\n this.lineHeight = lh !== undefined ? lh : obj.lineHeight;\n}\n\n// Move the box along a particular axis. Optionally pass in an amount to move\n// the box. If no amount is passed then the default is the line height of the\n// box.\nBoxPosition.prototype.move = function (axis, toMove) {\n toMove = toMove !== undefined ? toMove : this.lineHeight;\n switch (axis) {\n case \"+x\":\n this.left += toMove;\n this.right += toMove;\n break;\n case \"-x\":\n this.left -= toMove;\n this.right -= toMove;\n break;\n case \"+y\":\n this.top += toMove;\n this.bottom += toMove;\n break;\n case \"-y\":\n this.top -= toMove;\n this.bottom -= toMove;\n break;\n }\n};\n\n// Check if this box overlaps another box, b2.\nBoxPosition.prototype.overlaps = function (b2) {\n return this.left < b2.right && this.right > b2.left && this.top < b2.bottom && this.bottom > b2.top;\n};\n\n// Check if this box overlaps any other boxes in boxes.\nBoxPosition.prototype.overlapsAny = function (boxes) {\n for (var i = 0; i < boxes.length; i++) {\n if (this.overlaps(boxes[i])) {\n return true;\n }\n }\n return false;\n};\n\n// Check if this box is within another box.\nBoxPosition.prototype.within = function (container) {\n return this.top >= container.top && this.bottom <= container.bottom && this.left >= container.left && this.right <= container.right;\n};\n\n// Check if this box is entirely within the container or it is overlapping\n// on the edge opposite of the axis direction passed. For example, if \"+x\" is\n// passed and the box is overlapping on the left edge of the container, then\n// return true.\nBoxPosition.prototype.overlapsOppositeAxis = function (container, axis) {\n switch (axis) {\n case \"+x\":\n return this.left < container.left;\n case \"-x\":\n return this.right > container.right;\n case \"+y\":\n return this.top < container.top;\n case \"-y\":\n return this.bottom > container.bottom;\n }\n};\n\n// Find the percentage of the area that this box is overlapping with another\n// box.\nBoxPosition.prototype.intersectPercentage = function (b2) {\n var x = Math.max(0, Math.min(this.right, b2.right) - Math.max(this.left, b2.left)),\n y = Math.max(0, Math.min(this.bottom, b2.bottom) - Math.max(this.top, b2.top)),\n intersectArea = x * y;\n return intersectArea / (this.height * this.width);\n};\n\n// Convert the positions from this box to CSS compatible positions using\n// the reference container's positions. This has to be done because this\n// box's positions are in reference to the viewport origin, whereas, CSS\n// values are in referecne to their respective edges.\nBoxPosition.prototype.toCSSCompatValues = function (reference) {\n return {\n top: this.top - reference.top,\n bottom: reference.bottom - this.bottom,\n left: this.left - reference.left,\n right: reference.right - this.right,\n height: this.height,\n width: this.width\n };\n};\n\n// Get an object that represents the box's position without anything extra.\n// Can pass a StyleBox, HTMLElement, or another BoxPositon.\nBoxPosition.getSimpleBoxPosition = function (obj) {\n var height = obj.div ? obj.div.offsetHeight : obj.tagName ? obj.offsetHeight : 0;\n var width = obj.div ? obj.div.offsetWidth : obj.tagName ? obj.offsetWidth : 0;\n var top = obj.div ? obj.div.offsetTop : obj.tagName ? obj.offsetTop : 0;\n obj = obj.div ? obj.div.getBoundingClientRect() : obj.tagName ? obj.getBoundingClientRect() : obj;\n var ret = {\n left: obj.left,\n right: obj.right,\n top: obj.top || top,\n height: obj.height || height,\n bottom: obj.bottom || top + (obj.height || height),\n width: obj.width || width\n };\n return ret;\n};\n\n// Move a StyleBox to its specified, or next best, position. The containerBox\n// is the box that contains the StyleBox, such as a div. boxPositions are\n// a list of other boxes that the styleBox can't overlap with.\nfunction moveBoxToLinePosition(window, styleBox, containerBox, boxPositions) {\n // Find the best position for a cue box, b, on the video. The axis parameter\n // is a list of axis, the order of which, it will move the box along. For example:\n // Passing [\"+x\", \"-x\"] will move the box first along the x axis in the positive\n // direction. If it doesn't find a good position for it there it will then move\n // it along the x axis in the negative direction.\n function findBestPosition(b, axis) {\n var bestPosition,\n specifiedPosition = new BoxPosition(b),\n percentage = 1; // Highest possible so the first thing we get is better.\n\n for (var i = 0; i < axis.length; i++) {\n while (b.overlapsOppositeAxis(containerBox, axis[i]) || b.within(containerBox) && b.overlapsAny(boxPositions)) {\n b.move(axis[i]);\n }\n // We found a spot where we aren't overlapping anything. This is our\n // best position.\n if (b.within(containerBox)) {\n return b;\n }\n var p = b.intersectPercentage(containerBox);\n // If we're outside the container box less then we were on our last try\n // then remember this position as the best position.\n if (percentage > p) {\n bestPosition = new BoxPosition(b);\n percentage = p;\n }\n // Reset the box position to the specified position.\n b = new BoxPosition(specifiedPosition);\n }\n return bestPosition || specifiedPosition;\n }\n var boxPosition = new BoxPosition(styleBox),\n cue = styleBox.cue,\n linePos = computeLinePos(cue),\n axis = [];\n\n // If we have a line number to align the cue to.\n if (cue.snapToLines) {\n var size;\n switch (cue.vertical) {\n case \"\":\n axis = [\"+y\", \"-y\"];\n size = \"height\";\n break;\n case \"rl\":\n axis = [\"+x\", \"-x\"];\n size = \"width\";\n break;\n case \"lr\":\n axis = [\"-x\", \"+x\"];\n size = \"width\";\n break;\n }\n var step = boxPosition.lineHeight,\n position = step * Math.round(linePos),\n maxPosition = containerBox[size] + step,\n initialAxis = axis[0];\n\n // If the specified intial position is greater then the max position then\n // clamp the box to the amount of steps it would take for the box to\n // reach the max position.\n if (Math.abs(position) > maxPosition) {\n position = position < 0 ? -1 : 1;\n position *= Math.ceil(maxPosition / step) * step;\n }\n\n // If computed line position returns negative then line numbers are\n // relative to the bottom of the video instead of the top. Therefore, we\n // need to increase our initial position by the length or width of the\n // video, depending on the writing direction, and reverse our axis directions.\n if (linePos < 0) {\n position += cue.vertical === \"\" ? containerBox.height : containerBox.width;\n axis = axis.reverse();\n }\n\n // Move the box to the specified position. This may not be its best\n // position.\n boxPosition.move(initialAxis, position);\n } else {\n // If we have a percentage line value for the cue.\n var calculatedPercentage = boxPosition.lineHeight / containerBox.height * 100;\n switch (cue.lineAlign) {\n case \"center\":\n linePos -= calculatedPercentage / 2;\n break;\n case \"end\":\n linePos -= calculatedPercentage;\n break;\n }\n\n // Apply initial line position to the cue box.\n switch (cue.vertical) {\n case \"\":\n styleBox.applyStyles({\n top: styleBox.formatStyle(linePos, \"%\")\n });\n break;\n case \"rl\":\n styleBox.applyStyles({\n left: styleBox.formatStyle(linePos, \"%\")\n });\n break;\n case \"lr\":\n styleBox.applyStyles({\n right: styleBox.formatStyle(linePos, \"%\")\n });\n break;\n }\n axis = [\"+y\", \"-x\", \"+x\", \"-y\"];\n\n // Get the box position again after we've applied the specified positioning\n // to it.\n boxPosition = new BoxPosition(styleBox);\n }\n var bestPosition = findBestPosition(boxPosition, axis);\n styleBox.move(bestPosition.toCSSCompatValues(containerBox));\n}\nfunction WebVTT() {\n // Nothing\n}\n\n// Helper to allow strings to be decoded instead of the default binary utf8 data.\nWebVTT.StringDecoder = function () {\n return {\n decode: function (data) {\n if (!data) {\n return \"\";\n }\n if (typeof data !== \"string\") {\n throw new Error(\"Error - expected string data.\");\n }\n return decodeURIComponent(encodeURIComponent(data));\n }\n };\n};\nWebVTT.convertCueToDOMTree = function (window, cuetext) {\n if (!window || !cuetext) {\n return null;\n }\n return parseContent(window, cuetext);\n};\nvar FONT_SIZE_PERCENT = 0.05;\nvar FONT_STYLE = \"sans-serif\";\nvar CUE_BACKGROUND_PADDING = \"1.5%\";\n\n// Runs the processing model over the cues and regions passed to it.\n// @param overlay A block level element (usually a div) that the computed cues\n// and regions will be placed into.\nWebVTT.processCues = function (window, cues, overlay) {\n if (!window || !cues || !overlay) {\n return null;\n }\n\n // Remove all previous children.\n while (overlay.firstChild) {\n overlay.removeChild(overlay.firstChild);\n }\n var paddedOverlay = window.document.createElement(\"div\");\n paddedOverlay.style.position = \"absolute\";\n paddedOverlay.style.left = \"0\";\n paddedOverlay.style.right = \"0\";\n paddedOverlay.style.top = \"0\";\n paddedOverlay.style.bottom = \"0\";\n paddedOverlay.style.margin = CUE_BACKGROUND_PADDING;\n overlay.appendChild(paddedOverlay);\n\n // Determine if we need to compute the display states of the cues. This could\n // be the case if a cue's state has been changed since the last computation or\n // if it has not been computed yet.\n function shouldCompute(cues) {\n for (var i = 0; i < cues.length; i++) {\n if (cues[i].hasBeenReset || !cues[i].displayState) {\n return true;\n }\n }\n return false;\n }\n\n // We don't need to recompute the cues' display states. Just reuse them.\n if (!shouldCompute(cues)) {\n for (var i = 0; i < cues.length; i++) {\n paddedOverlay.appendChild(cues[i].displayState);\n }\n return;\n }\n var boxPositions = [],\n containerBox = BoxPosition.getSimpleBoxPosition(paddedOverlay),\n fontSize = Math.round(containerBox.height * FONT_SIZE_PERCENT * 100) / 100;\n var styleOptions = {\n font: fontSize + \"px \" + FONT_STYLE\n };\n (function () {\n var styleBox, cue;\n for (var i = 0; i < cues.length; i++) {\n cue = cues[i];\n\n // Compute the intial position and styles of the cue div.\n styleBox = new CueStyleBox(window, cue, styleOptions);\n paddedOverlay.appendChild(styleBox.div);\n\n // Move the cue div to it's correct line position.\n moveBoxToLinePosition(window, styleBox, containerBox, boxPositions);\n\n // Remember the computed div so that we don't have to recompute it later\n // if we don't have too.\n cue.displayState = styleBox.div;\n boxPositions.push(BoxPosition.getSimpleBoxPosition(styleBox));\n }\n })();\n};\nWebVTT.Parser = function (window, vttjs, decoder) {\n if (!decoder) {\n decoder = vttjs;\n vttjs = {};\n }\n if (!vttjs) {\n vttjs = {};\n }\n this.window = window;\n this.vttjs = vttjs;\n this.state = \"INITIAL\";\n this.buffer = \"\";\n this.decoder = decoder || new TextDecoder(\"utf8\");\n this.regionList = [];\n};\nWebVTT.Parser.prototype = {\n // If the error is a ParsingError then report it to the consumer if\n // possible. If it's not a ParsingError then throw it like normal.\n reportOrThrowError: function (e) {\n if (e instanceof ParsingError) {\n this.onparsingerror && this.onparsingerror(e);\n } else {\n throw e;\n }\n },\n parse: function (data) {\n var self = this;\n\n // If there is no data then we won't decode it, but will just try to parse\n // whatever is in buffer already. This may occur in circumstances, for\n // example when flush() is called.\n if (data) {\n // Try to decode the data that we received.\n self.buffer += self.decoder.decode(data, {\n stream: true\n });\n }\n function collectNextLine() {\n var buffer = self.buffer;\n var pos = 0;\n while (pos < buffer.length && buffer[pos] !== '\\r' && buffer[pos] !== '\\n') {\n ++pos;\n }\n var line = buffer.substr(0, pos);\n // Advance the buffer early in case we fail below.\n if (buffer[pos] === '\\r') {\n ++pos;\n }\n if (buffer[pos] === '\\n') {\n ++pos;\n }\n self.buffer = buffer.substr(pos);\n return line;\n }\n\n // 3.4 WebVTT region and WebVTT region settings syntax\n function parseRegion(input) {\n var settings = new Settings();\n parseOptions(input, function (k, v) {\n switch (k) {\n case \"id\":\n settings.set(k, v);\n break;\n case \"width\":\n settings.percent(k, v);\n break;\n case \"lines\":\n settings.integer(k, v);\n break;\n case \"regionanchor\":\n case \"viewportanchor\":\n var xy = v.split(',');\n if (xy.length !== 2) {\n break;\n }\n // We have to make sure both x and y parse, so use a temporary\n // settings object here.\n var anchor = new Settings();\n anchor.percent(\"x\", xy[0]);\n anchor.percent(\"y\", xy[1]);\n if (!anchor.has(\"x\") || !anchor.has(\"y\")) {\n break;\n }\n settings.set(k + \"X\", anchor.get(\"x\"));\n settings.set(k + \"Y\", anchor.get(\"y\"));\n break;\n case \"scroll\":\n settings.alt(k, v, [\"up\"]);\n break;\n }\n }, /=/, /\\s/);\n\n // Create the region, using default values for any values that were not\n // specified.\n if (settings.has(\"id\")) {\n var region = new (self.vttjs.VTTRegion || self.window.VTTRegion)();\n region.width = settings.get(\"width\", 100);\n region.lines = settings.get(\"lines\", 3);\n region.regionAnchorX = settings.get(\"regionanchorX\", 0);\n region.regionAnchorY = settings.get(\"regionanchorY\", 100);\n region.viewportAnchorX = settings.get(\"viewportanchorX\", 0);\n region.viewportAnchorY = settings.get(\"viewportanchorY\", 100);\n region.scroll = settings.get(\"scroll\", \"\");\n // Register the region.\n self.onregion && self.onregion(region);\n // Remember the VTTRegion for later in case we parse any VTTCues that\n // reference it.\n self.regionList.push({\n id: settings.get(\"id\"),\n region: region\n });\n }\n }\n\n // draft-pantos-http-live-streaming-20\n // https://tools.ietf.org/html/draft-pantos-http-live-streaming-20#section-3.5\n // 3.5 WebVTT\n function parseTimestampMap(input) {\n var settings = new Settings();\n parseOptions(input, function (k, v) {\n switch (k) {\n case \"MPEGT\":\n settings.integer(k + 'S', v);\n break;\n case \"LOCA\":\n settings.set(k + 'L', parseTimeStamp(v));\n break;\n }\n }, /[^\\d]:/, /,/);\n self.ontimestampmap && self.ontimestampmap({\n \"MPEGTS\": settings.get(\"MPEGTS\"),\n \"LOCAL\": settings.get(\"LOCAL\")\n });\n }\n\n // 3.2 WebVTT metadata header syntax\n function parseHeader(input) {\n if (input.match(/X-TIMESTAMP-MAP/)) {\n // This line contains HLS X-TIMESTAMP-MAP metadata\n parseOptions(input, function (k, v) {\n switch (k) {\n case \"X-TIMESTAMP-MAP\":\n parseTimestampMap(v);\n break;\n }\n }, /=/);\n } else {\n parseOptions(input, function (k, v) {\n switch (k) {\n case \"Region\":\n // 3.3 WebVTT region metadata header syntax\n parseRegion(v);\n break;\n }\n }, /:/);\n }\n }\n\n // 5.1 WebVTT file parsing.\n try {\n var line;\n if (self.state === \"INITIAL\") {\n // We can't start parsing until we have the first line.\n if (!/\\r\\n|\\n/.test(self.buffer)) {\n return this;\n }\n line = collectNextLine();\n var m = line.match(/^WEBVTT([ \\t].*)?$/);\n if (!m || !m[0]) {\n throw new ParsingError(ParsingError.Errors.BadSignature);\n }\n self.state = \"HEADER\";\n }\n var alreadyCollectedLine = false;\n while (self.buffer) {\n // We can't parse a line until we have the full line.\n if (!/\\r\\n|\\n/.test(self.buffer)) {\n return this;\n }\n if (!alreadyCollectedLine) {\n line = collectNextLine();\n } else {\n alreadyCollectedLine = false;\n }\n switch (self.state) {\n case \"HEADER\":\n // 13-18 - Allow a header (metadata) under the WEBVTT line.\n if (/:/.test(line)) {\n parseHeader(line);\n } else if (!line) {\n // An empty line terminates the header and starts the body (cues).\n self.state = \"ID\";\n }\n continue;\n case \"NOTE\":\n // Ignore NOTE blocks.\n if (!line) {\n self.state = \"ID\";\n }\n continue;\n case \"ID\":\n // Check for the start of NOTE blocks.\n if (/^NOTE($|[ \\t])/.test(line)) {\n self.state = \"NOTE\";\n break;\n }\n // 19-29 - Allow any number of line terminators, then initialize new cue values.\n if (!line) {\n continue;\n }\n self.cue = new (self.vttjs.VTTCue || self.window.VTTCue)(0, 0, \"\");\n // Safari still uses the old middle value and won't accept center\n try {\n self.cue.align = \"center\";\n } catch (e) {\n self.cue.align = \"middle\";\n }\n self.state = \"CUE\";\n // 30-39 - Check if self line contains an optional identifier or timing data.\n if (line.indexOf(\"-->\") === -1) {\n self.cue.id = line;\n continue;\n }\n // Process line as start of a cue.\n /*falls through*/\n case \"CUE\":\n // 40 - Collect cue timings and settings.\n try {\n parseCue(line, self.cue, self.regionList);\n } catch (e) {\n self.reportOrThrowError(e);\n // In case of an error ignore rest of the cue.\n self.cue = null;\n self.state = \"BADCUE\";\n continue;\n }\n self.state = \"CUETEXT\";\n continue;\n case \"CUETEXT\":\n var hasSubstring = line.indexOf(\"-->\") !== -1;\n // 34 - If we have an empty line then report the cue.\n // 35 - If we have the special substring '-->' then report the cue,\n // but do not collect the line as we need to process the current\n // one as a new cue.\n if (!line || hasSubstring && (alreadyCollectedLine = true)) {\n // We are done parsing self cue.\n self.oncue && self.oncue(self.cue);\n self.cue = null;\n self.state = \"ID\";\n continue;\n }\n if (self.cue.text) {\n self.cue.text += \"\\n\";\n }\n self.cue.text += line.replace(/\\u2028/g, '\\n').replace(/u2029/g, '\\n');\n continue;\n case \"BADCUE\":\n // BADCUE\n // 54-62 - Collect and discard the remaining cue.\n if (!line) {\n self.state = \"ID\";\n }\n continue;\n }\n }\n } catch (e) {\n self.reportOrThrowError(e);\n\n // If we are currently parsing a cue, report what we have.\n if (self.state === \"CUETEXT\" && self.cue && self.oncue) {\n self.oncue(self.cue);\n }\n self.cue = null;\n // Enter BADWEBVTT state if header was not parsed correctly otherwise\n // another exception occurred so enter BADCUE state.\n self.state = self.state === \"INITIAL\" ? \"BADWEBVTT\" : \"BADCUE\";\n }\n return this;\n },\n flush: function () {\n var self = this;\n try {\n // Finish decoding the stream.\n self.buffer += self.decoder.decode();\n // Synthesize the end of the current cue or region.\n if (self.cue || self.state === \"HEADER\") {\n self.buffer += \"\\n\\n\";\n self.parse();\n }\n // If we've flushed, parsed, and we're still on the INITIAL state then\n // that means we don't have enough of the stream to parse the first\n // line.\n if (self.state === \"INITIAL\") {\n throw new ParsingError(ParsingError.Errors.BadSignature);\n }\n } catch (e) {\n self.reportOrThrowError(e);\n }\n self.onflush && self.onflush();\n return this;\n }\n};\nmodule.exports = WebVTT;","/**\n * Copyright 2013 vtt.js Contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar autoKeyword = \"auto\";\nvar directionSetting = {\n \"\": 1,\n \"lr\": 1,\n \"rl\": 1\n};\nvar alignSetting = {\n \"start\": 1,\n \"center\": 1,\n \"end\": 1,\n \"left\": 1,\n \"right\": 1,\n \"auto\": 1,\n \"line-left\": 1,\n \"line-right\": 1\n};\nfunction findDirectionSetting(value) {\n if (typeof value !== \"string\") {\n return false;\n }\n var dir = directionSetting[value.toLowerCase()];\n return dir ? value.toLowerCase() : false;\n}\nfunction findAlignSetting(value) {\n if (typeof value !== \"string\") {\n return false;\n }\n var align = alignSetting[value.toLowerCase()];\n return align ? value.toLowerCase() : false;\n}\nfunction VTTCue(startTime, endTime, text) {\n /**\n * Shim implementation specific properties. These properties are not in\n * the spec.\n */\n\n // Lets us know when the VTTCue's data has changed in such a way that we need\n // to recompute its display state. This lets us compute its display state\n // lazily.\n this.hasBeenReset = false;\n\n /**\n * VTTCue and TextTrackCue properties\n * http://dev.w3.org/html5/webvtt/#vttcue-interface\n */\n\n var _id = \"\";\n var _pauseOnExit = false;\n var _startTime = startTime;\n var _endTime = endTime;\n var _text = text;\n var _region = null;\n var _vertical = \"\";\n var _snapToLines = true;\n var _line = \"auto\";\n var _lineAlign = \"start\";\n var _position = \"auto\";\n var _positionAlign = \"auto\";\n var _size = 100;\n var _align = \"center\";\n Object.defineProperties(this, {\n \"id\": {\n enumerable: true,\n get: function () {\n return _id;\n },\n set: function (value) {\n _id = \"\" + value;\n }\n },\n \"pauseOnExit\": {\n enumerable: true,\n get: function () {\n return _pauseOnExit;\n },\n set: function (value) {\n _pauseOnExit = !!value;\n }\n },\n \"startTime\": {\n enumerable: true,\n get: function () {\n return _startTime;\n },\n set: function (value) {\n if (typeof value !== \"number\") {\n throw new TypeError(\"Start time must be set to a number.\");\n }\n _startTime = value;\n this.hasBeenReset = true;\n }\n },\n \"endTime\": {\n enumerable: true,\n get: function () {\n return _endTime;\n },\n set: function (value) {\n if (typeof value !== \"number\") {\n throw new TypeError(\"End time must be set to a number.\");\n }\n _endTime = value;\n this.hasBeenReset = true;\n }\n },\n \"text\": {\n enumerable: true,\n get: function () {\n return _text;\n },\n set: function (value) {\n _text = \"\" + value;\n this.hasBeenReset = true;\n }\n },\n \"region\": {\n enumerable: true,\n get: function () {\n return _region;\n },\n set: function (value) {\n _region = value;\n this.hasBeenReset = true;\n }\n },\n \"vertical\": {\n enumerable: true,\n get: function () {\n return _vertical;\n },\n set: function (value) {\n var setting = findDirectionSetting(value);\n // Have to check for false because the setting an be an empty string.\n if (setting === false) {\n throw new SyntaxError(\"Vertical: an invalid or illegal direction string was specified.\");\n }\n _vertical = setting;\n this.hasBeenReset = true;\n }\n },\n \"snapToLines\": {\n enumerable: true,\n get: function () {\n return _snapToLines;\n },\n set: function (value) {\n _snapToLines = !!value;\n this.hasBeenReset = true;\n }\n },\n \"line\": {\n enumerable: true,\n get: function () {\n return _line;\n },\n set: function (value) {\n if (typeof value !== \"number\" && value !== autoKeyword) {\n throw new SyntaxError(\"Line: an invalid number or illegal string was specified.\");\n }\n _line = value;\n this.hasBeenReset = true;\n }\n },\n \"lineAlign\": {\n enumerable: true,\n get: function () {\n return _lineAlign;\n },\n set: function (value) {\n var setting = findAlignSetting(value);\n if (!setting) {\n console.warn(\"lineAlign: an invalid or illegal string was specified.\");\n } else {\n _lineAlign = setting;\n this.hasBeenReset = true;\n }\n }\n },\n \"position\": {\n enumerable: true,\n get: function () {\n return _position;\n },\n set: function (value) {\n if (value < 0 || value > 100) {\n throw new Error(\"Position must be between 0 and 100.\");\n }\n _position = value;\n this.hasBeenReset = true;\n }\n },\n \"positionAlign\": {\n enumerable: true,\n get: function () {\n return _positionAlign;\n },\n set: function (value) {\n var setting = findAlignSetting(value);\n if (!setting) {\n console.warn(\"positionAlign: an invalid or illegal string was specified.\");\n } else {\n _positionAlign = setting;\n this.hasBeenReset = true;\n }\n }\n },\n \"size\": {\n enumerable: true,\n get: function () {\n return _size;\n },\n set: function (value) {\n if (value < 0 || value > 100) {\n throw new Error(\"Size must be between 0 and 100.\");\n }\n _size = value;\n this.hasBeenReset = true;\n }\n },\n \"align\": {\n enumerable: true,\n get: function () {\n return _align;\n },\n set: function (value) {\n var setting = findAlignSetting(value);\n if (!setting) {\n throw new SyntaxError(\"align: an invalid or illegal alignment string was specified.\");\n }\n _align = setting;\n this.hasBeenReset = true;\n }\n }\n });\n\n /**\n * Other spec defined properties\n */\n\n // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#text-track-cue-display-state\n this.displayState = undefined;\n}\n\n/**\n * VTTCue methods\n */\n\nVTTCue.prototype.getCueAsHTML = function () {\n // Assume WebVTT.convertCueToDOMTree is on the global.\n return WebVTT.convertCueToDOMTree(window, this.text);\n};\nmodule.exports = VTTCue;","/**\n * Copyright 2013 vtt.js Contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar scrollSetting = {\n \"\": true,\n \"up\": true\n};\nfunction findScrollSetting(value) {\n if (typeof value !== \"string\") {\n return false;\n }\n var scroll = scrollSetting[value.toLowerCase()];\n return scroll ? value.toLowerCase() : false;\n}\nfunction isValidPercentValue(value) {\n return typeof value === \"number\" && value >= 0 && value <= 100;\n}\n\n// VTTRegion shim http://dev.w3.org/html5/webvtt/#vttregion-interface\nfunction VTTRegion() {\n var _width = 100;\n var _lines = 3;\n var _regionAnchorX = 0;\n var _regionAnchorY = 100;\n var _viewportAnchorX = 0;\n var _viewportAnchorY = 100;\n var _scroll = \"\";\n Object.defineProperties(this, {\n \"width\": {\n enumerable: true,\n get: function () {\n return _width;\n },\n set: function (value) {\n if (!isValidPercentValue(value)) {\n throw new Error(\"Width must be between 0 and 100.\");\n }\n _width = value;\n }\n },\n \"lines\": {\n enumerable: true,\n get: function () {\n return _lines;\n },\n set: function (value) {\n if (typeof value !== \"number\") {\n throw new TypeError(\"Lines must be set to a number.\");\n }\n _lines = value;\n }\n },\n \"regionAnchorY\": {\n enumerable: true,\n get: function () {\n return _regionAnchorY;\n },\n set: function (value) {\n if (!isValidPercentValue(value)) {\n throw new Error(\"RegionAnchorX must be between 0 and 100.\");\n }\n _regionAnchorY = value;\n }\n },\n \"regionAnchorX\": {\n enumerable: true,\n get: function () {\n return _regionAnchorX;\n },\n set: function (value) {\n if (!isValidPercentValue(value)) {\n throw new Error(\"RegionAnchorY must be between 0 and 100.\");\n }\n _regionAnchorX = value;\n }\n },\n \"viewportAnchorY\": {\n enumerable: true,\n get: function () {\n return _viewportAnchorY;\n },\n set: function (value) {\n if (!isValidPercentValue(value)) {\n throw new Error(\"ViewportAnchorY must be between 0 and 100.\");\n }\n _viewportAnchorY = value;\n }\n },\n \"viewportAnchorX\": {\n enumerable: true,\n get: function () {\n return _viewportAnchorX;\n },\n set: function (value) {\n if (!isValidPercentValue(value)) {\n throw new Error(\"ViewportAnchorX must be between 0 and 100.\");\n }\n _viewportAnchorX = value;\n }\n },\n \"scroll\": {\n enumerable: true,\n get: function () {\n return _scroll;\n },\n set: function (value) {\n var setting = findScrollSetting(value);\n // Have to check for false as an empty string is a legal value.\n if (setting === false) {\n console.warn(\"Scroll: an invalid or illegal string was specified.\");\n } else {\n _scroll = setting;\n }\n }\n }\n });\n}\nmodule.exports = VTTRegion;","/**\n * Copyright 2013 vtt.js Contributors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// Default exports for Node. Export the extended versions of VTTCue and\n// VTTRegion in Node since we likely want the capability to convert back and\n// forth between JSON. If we don't then it's not that big of a deal since we're\n// off browser.\n\nvar window = require('global/window');\nvar vttjs = module.exports = {\n WebVTT: require(\"./vtt.js\"),\n VTTCue: require(\"./vttcue.js\"),\n VTTRegion: require(\"./vttregion.js\")\n};\nwindow.vttjs = vttjs;\nwindow.WebVTT = vttjs.WebVTT;\nvar cueShim = vttjs.VTTCue;\nvar regionShim = vttjs.VTTRegion;\nvar nativeVTTCue = window.VTTCue;\nvar nativeVTTRegion = window.VTTRegion;\nvttjs.shim = function () {\n window.VTTCue = cueShim;\n window.VTTRegion = regionShim;\n};\nvttjs.restore = function () {\n window.VTTCue = nativeVTTCue;\n window.VTTRegion = nativeVTTRegion;\n};\nif (!window.VTTCue) {\n vttjs.shim();\n}","// see https://tools.ietf.org/html/rfc1808\n\n(function (root) {\n var URL_REGEX = /^(?=((?:[a-zA-Z0-9+\\-.]+:)?))\\1(?=((?:\\/\\/[^\\/?#]*)?))\\2(?=((?:(?:[^?#\\/]*\\/)*[^;?#\\/]*)?))\\3((?:;[^?#]*)?)(\\?[^#]*)?(#[^]*)?$/;\n var FIRST_SEGMENT_REGEX = /^(?=([^\\/?#]*))\\1([^]*)$/;\n var SLASH_DOT_REGEX = /(?:\\/|^)\\.(?=\\/)/g;\n var SLASH_DOT_DOT_REGEX = /(?:\\/|^)\\.\\.\\/(?!\\.\\.\\/)[^\\/]*(?=\\/)/g;\n var URLToolkit = {\n // If opts.alwaysNormalize is true then the path will always be normalized even when it starts with / or //\n // E.g\n // With opts.alwaysNormalize = false (default, spec compliant)\n // http://a.com/b/cd + /e/f/../g => http://a.com/e/f/../g\n // With opts.alwaysNormalize = true (not spec compliant)\n // http://a.com/b/cd + /e/f/../g => http://a.com/e/g\n buildAbsoluteURL: function (baseURL, relativeURL, opts) {\n opts = opts || {};\n // remove any remaining space and CRLF\n baseURL = baseURL.trim();\n relativeURL = relativeURL.trim();\n if (!relativeURL) {\n // 2a) If the embedded URL is entirely empty, it inherits the\n // entire base URL (i.e., is set equal to the base URL)\n // and we are done.\n if (!opts.alwaysNormalize) {\n return baseURL;\n }\n var basePartsForNormalise = URLToolkit.parseURL(baseURL);\n if (!basePartsForNormalise) {\n throw new Error('Error trying to parse base URL.');\n }\n basePartsForNormalise.path = URLToolkit.normalizePath(basePartsForNormalise.path);\n return URLToolkit.buildURLFromParts(basePartsForNormalise);\n }\n var relativeParts = URLToolkit.parseURL(relativeURL);\n if (!relativeParts) {\n throw new Error('Error trying to parse relative URL.');\n }\n if (relativeParts.scheme) {\n // 2b) If the embedded URL starts with a scheme name, it is\n // interpreted as an absolute URL and we are done.\n if (!opts.alwaysNormalize) {\n return relativeURL;\n }\n relativeParts.path = URLToolkit.normalizePath(relativeParts.path);\n return URLToolkit.buildURLFromParts(relativeParts);\n }\n var baseParts = URLToolkit.parseURL(baseURL);\n if (!baseParts) {\n throw new Error('Error trying to parse base URL.');\n }\n if (!baseParts.netLoc && baseParts.path && baseParts.path[0] !== '/') {\n // If netLoc missing and path doesn't start with '/', assume everthing before the first '/' is the netLoc\n // This causes 'example.com/a' to be handled as '//example.com/a' instead of '/example.com/a'\n var pathParts = FIRST_SEGMENT_REGEX.exec(baseParts.path);\n baseParts.netLoc = pathParts[1];\n baseParts.path = pathParts[2];\n }\n if (baseParts.netLoc && !baseParts.path) {\n baseParts.path = '/';\n }\n var builtParts = {\n // 2c) Otherwise, the embedded URL inherits the scheme of\n // the base URL.\n scheme: baseParts.scheme,\n netLoc: relativeParts.netLoc,\n path: null,\n params: relativeParts.params,\n query: relativeParts.query,\n fragment: relativeParts.fragment\n };\n if (!relativeParts.netLoc) {\n // 3) If the embedded URL's is non-empty, we skip to\n // Step 7. Otherwise, the embedded URL inherits the \n // (if any) of the base URL.\n builtParts.netLoc = baseParts.netLoc;\n // 4) If the embedded URL path is preceded by a slash \"/\", the\n // path is not relative and we skip to Step 7.\n if (relativeParts.path[0] !== '/') {\n if (!relativeParts.path) {\n // 5) If the embedded URL path is empty (and not preceded by a\n // slash), then the embedded URL inherits the base URL path\n builtParts.path = baseParts.path;\n // 5a) if the embedded URL's is non-empty, we skip to\n // step 7; otherwise, it inherits the of the base\n // URL (if any) and\n if (!relativeParts.params) {\n builtParts.params = baseParts.params;\n // 5b) if the embedded URL's is non-empty, we skip to\n // step 7; otherwise, it inherits the of the base\n // URL (if any) and we skip to step 7.\n if (!relativeParts.query) {\n builtParts.query = baseParts.query;\n }\n }\n } else {\n // 6) The last segment of the base URL's path (anything\n // following the rightmost slash \"/\", or the entire path if no\n // slash is present) is removed and the embedded URL's path is\n // appended in its place.\n var baseURLPath = baseParts.path;\n var newPath = baseURLPath.substring(0, baseURLPath.lastIndexOf('/') + 1) + relativeParts.path;\n builtParts.path = URLToolkit.normalizePath(newPath);\n }\n }\n }\n if (builtParts.path === null) {\n builtParts.path = opts.alwaysNormalize ? URLToolkit.normalizePath(relativeParts.path) : relativeParts.path;\n }\n return URLToolkit.buildURLFromParts(builtParts);\n },\n parseURL: function (url) {\n var parts = URL_REGEX.exec(url);\n if (!parts) {\n return null;\n }\n return {\n scheme: parts[1] || '',\n netLoc: parts[2] || '',\n path: parts[3] || '',\n params: parts[4] || '',\n query: parts[5] || '',\n fragment: parts[6] || ''\n };\n },\n normalizePath: function (path) {\n // The following operations are\n // then applied, in order, to the new path:\n // 6a) All occurrences of \"./\", where \".\" is a complete path\n // segment, are removed.\n // 6b) If the path ends with \".\" as a complete path segment,\n // that \".\" is removed.\n path = path.split('').reverse().join('').replace(SLASH_DOT_REGEX, '');\n // 6c) All occurrences of \"/../\", where is a\n // complete path segment not equal to \"..\", are removed.\n // Removal of these path segments is performed iteratively,\n // removing the leftmost matching pattern on each iteration,\n // until no matching pattern remains.\n // 6d) If the path ends with \"/..\", where is a\n // complete path segment not equal to \"..\", that\n // \"/..\" is removed.\n while (path.length !== (path = path.replace(SLASH_DOT_DOT_REGEX, '')).length) {}\n return path.split('').reverse().join('');\n },\n buildURLFromParts: function (parts) {\n return parts.scheme + parts.netLoc + parts.path + parts.params + parts.query + parts.fragment;\n }\n };\n if (typeof exports === 'object' && typeof module === 'object') module.exports = URLToolkit;else if (typeof define === 'function' && define.amd) define([], function () {\n return URLToolkit;\n });else if (typeof exports === 'object') exports['URLToolkit'] = URLToolkit;else root['URLToolkit'] = URLToolkit;\n})(this);","'use strict';\n\n/**\n * Ponyfill for `Array.prototype.find` which is only available in ES6 runtimes.\n *\n * Works with anything that has a `length` property and index access properties, including NodeList.\n *\n * @template {unknown} T\n * @param {Array | ({length:number, [number]: T})} list\n * @param {function (item: T, index: number, list:Array | ({length:number, [number]: T})):boolean} predicate\n * @param {Partial>?} ac `Array.prototype` by default,\n * \t\t\t\tallows injecting a custom implementation in tests\n * @returns {T | undefined}\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find\n * @see https://tc39.es/ecma262/multipage/indexed-collections.html#sec-array.prototype.find\n */\nfunction find(list, predicate, ac) {\n if (ac === undefined) {\n ac = Array.prototype;\n }\n if (list && typeof ac.find === 'function') {\n return ac.find.call(list, predicate);\n }\n for (var i = 0; i < list.length; i++) {\n if (Object.prototype.hasOwnProperty.call(list, i)) {\n var item = list[i];\n if (predicate.call(undefined, item, i, list)) {\n return item;\n }\n }\n }\n}\n\n/**\n * \"Shallow freezes\" an object to render it immutable.\n * Uses `Object.freeze` if available,\n * otherwise the immutability is only in the type.\n *\n * Is used to create \"enum like\" objects.\n *\n * @template T\n * @param {T} object the object to freeze\n * @param {Pick = Object} oc `Object` by default,\n * \t\t\t\tallows to inject custom object constructor for tests\n * @returns {Readonly}\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze\n */\nfunction freeze(object, oc) {\n if (oc === undefined) {\n oc = Object;\n }\n return oc && typeof oc.freeze === 'function' ? oc.freeze(object) : object;\n}\n\n/**\n * Since we can not rely on `Object.assign` we provide a simplified version\n * that is sufficient for our needs.\n *\n * @param {Object} target\n * @param {Object | null | undefined} source\n *\n * @returns {Object} target\n * @throws TypeError if target is not an object\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign\n * @see https://tc39.es/ecma262/multipage/fundamental-objects.html#sec-object.assign\n */\nfunction assign(target, source) {\n if (target === null || typeof target !== 'object') {\n throw new TypeError('target is not an object');\n }\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n return target;\n}\n\n/**\n * All mime types that are allowed as input to `DOMParser.parseFromString`\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString#Argument02 MDN\n * @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#domparsersupportedtype WHATWG HTML Spec\n * @see DOMParser.prototype.parseFromString\n */\nvar MIME_TYPE = freeze({\n /**\n * `text/html`, the only mime type that triggers treating an XML document as HTML.\n *\n * @see DOMParser.SupportedType.isHTML\n * @see https://www.iana.org/assignments/media-types/text/html IANA MimeType registration\n * @see https://en.wikipedia.org/wiki/HTML Wikipedia\n * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString MDN\n * @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-domparser-parsefromstring WHATWG HTML Spec\n */\n HTML: 'text/html',\n /**\n * Helper method to check a mime type if it indicates an HTML document\n *\n * @param {string} [value]\n * @returns {boolean}\n *\n * @see https://www.iana.org/assignments/media-types/text/html IANA MimeType registration\n * @see https://en.wikipedia.org/wiki/HTML Wikipedia\n * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMParser/parseFromString MDN\n * @see https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-domparser-parsefromstring \t */\n isHTML: function (value) {\n return value === MIME_TYPE.HTML;\n },\n /**\n * `application/xml`, the standard mime type for XML documents.\n *\n * @see https://www.iana.org/assignments/media-types/application/xml IANA MimeType registration\n * @see https://tools.ietf.org/html/rfc7303#section-9.1 RFC 7303\n * @see https://en.wikipedia.org/wiki/XML_and_MIME Wikipedia\n */\n XML_APPLICATION: 'application/xml',\n /**\n * `text/html`, an alias for `application/xml`.\n *\n * @see https://tools.ietf.org/html/rfc7303#section-9.2 RFC 7303\n * @see https://www.iana.org/assignments/media-types/text/xml IANA MimeType registration\n * @see https://en.wikipedia.org/wiki/XML_and_MIME Wikipedia\n */\n XML_TEXT: 'text/xml',\n /**\n * `application/xhtml+xml`, indicates an XML document that has the default HTML namespace,\n * but is parsed as an XML document.\n *\n * @see https://www.iana.org/assignments/media-types/application/xhtml+xml IANA MimeType registration\n * @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocument WHATWG DOM Spec\n * @see https://en.wikipedia.org/wiki/XHTML Wikipedia\n */\n XML_XHTML_APPLICATION: 'application/xhtml+xml',\n /**\n * `image/svg+xml`,\n *\n * @see https://www.iana.org/assignments/media-types/image/svg+xml IANA MimeType registration\n * @see https://www.w3.org/TR/SVG11/ W3C SVG 1.1\n * @see https://en.wikipedia.org/wiki/Scalable_Vector_Graphics Wikipedia\n */\n XML_SVG_IMAGE: 'image/svg+xml'\n});\n\n/**\n * Namespaces that are used in this code base.\n *\n * @see http://www.w3.org/TR/REC-xml-names\n */\nvar NAMESPACE = freeze({\n /**\n * The XHTML namespace.\n *\n * @see http://www.w3.org/1999/xhtml\n */\n HTML: 'http://www.w3.org/1999/xhtml',\n /**\n * Checks if `uri` equals `NAMESPACE.HTML`.\n *\n * @param {string} [uri]\n *\n * @see NAMESPACE.HTML\n */\n isHTML: function (uri) {\n return uri === NAMESPACE.HTML;\n },\n /**\n * The SVG namespace.\n *\n * @see http://www.w3.org/2000/svg\n */\n SVG: 'http://www.w3.org/2000/svg',\n /**\n * The `xml:` namespace.\n *\n * @see http://www.w3.org/XML/1998/namespace\n */\n XML: 'http://www.w3.org/XML/1998/namespace',\n /**\n * The `xmlns:` namespace\n *\n * @see https://www.w3.org/2000/xmlns/\n */\n XMLNS: 'http://www.w3.org/2000/xmlns/'\n});\nexports.assign = assign;\nexports.find = find;\nexports.freeze = freeze;\nexports.MIME_TYPE = MIME_TYPE;\nexports.NAMESPACE = NAMESPACE;","var conventions = require(\"./conventions\");\nvar find = conventions.find;\nvar NAMESPACE = conventions.NAMESPACE;\n\n/**\n * A prerequisite for `[].filter`, to drop elements that are empty\n * @param {string} input\n * @returns {boolean}\n */\nfunction notEmptyString(input) {\n return input !== '';\n}\n/**\n * @see https://infra.spec.whatwg.org/#split-on-ascii-whitespace\n * @see https://infra.spec.whatwg.org/#ascii-whitespace\n *\n * @param {string} input\n * @returns {string[]} (can be empty)\n */\nfunction splitOnASCIIWhitespace(input) {\n // U+0009 TAB, U+000A LF, U+000C FF, U+000D CR, U+0020 SPACE\n return input ? input.split(/[\\t\\n\\f\\r ]+/).filter(notEmptyString) : [];\n}\n\n/**\n * Adds element as a key to current if it is not already present.\n *\n * @param {Record} current\n * @param {string} element\n * @returns {Record}\n */\nfunction orderedSetReducer(current, element) {\n if (!current.hasOwnProperty(element)) {\n current[element] = true;\n }\n return current;\n}\n\n/**\n * @see https://infra.spec.whatwg.org/#ordered-set\n * @param {string} input\n * @returns {string[]}\n */\nfunction toOrderedSet(input) {\n if (!input) return [];\n var list = splitOnASCIIWhitespace(input);\n return Object.keys(list.reduce(orderedSetReducer, {}));\n}\n\n/**\n * Uses `list.indexOf` to implement something like `Array.prototype.includes`,\n * which we can not rely on being available.\n *\n * @param {any[]} list\n * @returns {function(any): boolean}\n */\nfunction arrayIncludes(list) {\n return function (element) {\n return list && list.indexOf(element) !== -1;\n };\n}\nfunction copy(src, dest) {\n for (var p in src) {\n if (Object.prototype.hasOwnProperty.call(src, p)) {\n dest[p] = src[p];\n }\n }\n}\n\n/**\n^\\w+\\.prototype\\.([_\\w]+)\\s*=\\s*((?:.*\\{\\s*?[\\r\\n][\\s\\S]*?^})|\\S.*?(?=[;\\r\\n]));?\n^\\w+\\.prototype\\.([_\\w]+)\\s*=\\s*(\\S.*?(?=[;\\r\\n]));?\n */\nfunction _extends(Class, Super) {\n var pt = Class.prototype;\n if (!(pt instanceof Super)) {\n function t() {}\n ;\n t.prototype = Super.prototype;\n t = new t();\n copy(pt, t);\n Class.prototype = pt = t;\n }\n if (pt.constructor != Class) {\n if (typeof Class != 'function') {\n console.error(\"unknown Class:\" + Class);\n }\n pt.constructor = Class;\n }\n}\n\n// Node Types\nvar NodeType = {};\nvar ELEMENT_NODE = NodeType.ELEMENT_NODE = 1;\nvar ATTRIBUTE_NODE = NodeType.ATTRIBUTE_NODE = 2;\nvar TEXT_NODE = NodeType.TEXT_NODE = 3;\nvar CDATA_SECTION_NODE = NodeType.CDATA_SECTION_NODE = 4;\nvar ENTITY_REFERENCE_NODE = NodeType.ENTITY_REFERENCE_NODE = 5;\nvar ENTITY_NODE = NodeType.ENTITY_NODE = 6;\nvar PROCESSING_INSTRUCTION_NODE = NodeType.PROCESSING_INSTRUCTION_NODE = 7;\nvar COMMENT_NODE = NodeType.COMMENT_NODE = 8;\nvar DOCUMENT_NODE = NodeType.DOCUMENT_NODE = 9;\nvar DOCUMENT_TYPE_NODE = NodeType.DOCUMENT_TYPE_NODE = 10;\nvar DOCUMENT_FRAGMENT_NODE = NodeType.DOCUMENT_FRAGMENT_NODE = 11;\nvar NOTATION_NODE = NodeType.NOTATION_NODE = 12;\n\n// ExceptionCode\nvar ExceptionCode = {};\nvar ExceptionMessage = {};\nvar INDEX_SIZE_ERR = ExceptionCode.INDEX_SIZE_ERR = (ExceptionMessage[1] = \"Index size error\", 1);\nvar DOMSTRING_SIZE_ERR = ExceptionCode.DOMSTRING_SIZE_ERR = (ExceptionMessage[2] = \"DOMString size error\", 2);\nvar HIERARCHY_REQUEST_ERR = ExceptionCode.HIERARCHY_REQUEST_ERR = (ExceptionMessage[3] = \"Hierarchy request error\", 3);\nvar WRONG_DOCUMENT_ERR = ExceptionCode.WRONG_DOCUMENT_ERR = (ExceptionMessage[4] = \"Wrong document\", 4);\nvar INVALID_CHARACTER_ERR = ExceptionCode.INVALID_CHARACTER_ERR = (ExceptionMessage[5] = \"Invalid character\", 5);\nvar NO_DATA_ALLOWED_ERR = ExceptionCode.NO_DATA_ALLOWED_ERR = (ExceptionMessage[6] = \"No data allowed\", 6);\nvar NO_MODIFICATION_ALLOWED_ERR = ExceptionCode.NO_MODIFICATION_ALLOWED_ERR = (ExceptionMessage[7] = \"No modification allowed\", 7);\nvar NOT_FOUND_ERR = ExceptionCode.NOT_FOUND_ERR = (ExceptionMessage[8] = \"Not found\", 8);\nvar NOT_SUPPORTED_ERR = ExceptionCode.NOT_SUPPORTED_ERR = (ExceptionMessage[9] = \"Not supported\", 9);\nvar INUSE_ATTRIBUTE_ERR = ExceptionCode.INUSE_ATTRIBUTE_ERR = (ExceptionMessage[10] = \"Attribute in use\", 10);\n//level2\nvar INVALID_STATE_ERR = ExceptionCode.INVALID_STATE_ERR = (ExceptionMessage[11] = \"Invalid state\", 11);\nvar SYNTAX_ERR = ExceptionCode.SYNTAX_ERR = (ExceptionMessage[12] = \"Syntax error\", 12);\nvar INVALID_MODIFICATION_ERR = ExceptionCode.INVALID_MODIFICATION_ERR = (ExceptionMessage[13] = \"Invalid modification\", 13);\nvar NAMESPACE_ERR = ExceptionCode.NAMESPACE_ERR = (ExceptionMessage[14] = \"Invalid namespace\", 14);\nvar INVALID_ACCESS_ERR = ExceptionCode.INVALID_ACCESS_ERR = (ExceptionMessage[15] = \"Invalid access\", 15);\n\n/**\n * DOM Level 2\n * Object DOMException\n * @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/ecma-script-binding.html\n * @see http://www.w3.org/TR/REC-DOM-Level-1/ecma-script-language-binding.html\n */\nfunction DOMException(code, message) {\n if (message instanceof Error) {\n var error = message;\n } else {\n error = this;\n Error.call(this, ExceptionMessage[code]);\n this.message = ExceptionMessage[code];\n if (Error.captureStackTrace) Error.captureStackTrace(this, DOMException);\n }\n error.code = code;\n if (message) this.message = this.message + \": \" + message;\n return error;\n}\n;\nDOMException.prototype = Error.prototype;\ncopy(ExceptionCode, DOMException);\n\n/**\n * @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-536297177\n * The NodeList interface provides the abstraction of an ordered collection of nodes, without defining or constraining how this collection is implemented. NodeList objects in the DOM are live.\n * The items in the NodeList are accessible via an integral index, starting from 0.\n */\nfunction NodeList() {}\n;\nNodeList.prototype = {\n /**\n * The number of nodes in the list. The range of valid child node indices is 0 to length-1 inclusive.\n * @standard level1\n */\n length: 0,\n /**\n * Returns the indexth item in the collection. If index is greater than or equal to the number of nodes in the list, this returns null.\n * @standard level1\n * @param index unsigned long\n * Index into the collection.\n * @return Node\n * \tThe node at the indexth position in the NodeList, or null if that is not a valid index.\n */\n item: function (index) {\n return index >= 0 && index < this.length ? this[index] : null;\n },\n toString: function (isHTML, nodeFilter) {\n for (var buf = [], i = 0; i < this.length; i++) {\n serializeToString(this[i], buf, isHTML, nodeFilter);\n }\n return buf.join('');\n },\n /**\n * @private\n * @param {function (Node):boolean} predicate\n * @returns {Node[]}\n */\n filter: function (predicate) {\n return Array.prototype.filter.call(this, predicate);\n },\n /**\n * @private\n * @param {Node} item\n * @returns {number}\n */\n indexOf: function (item) {\n return Array.prototype.indexOf.call(this, item);\n }\n};\nfunction LiveNodeList(node, refresh) {\n this._node = node;\n this._refresh = refresh;\n _updateLiveList(this);\n}\nfunction _updateLiveList(list) {\n var inc = list._node._inc || list._node.ownerDocument._inc;\n if (list._inc !== inc) {\n var ls = list._refresh(list._node);\n __set__(list, 'length', ls.length);\n if (!list.$$length || ls.length < list.$$length) {\n for (var i = ls.length; (i in list); i++) {\n if (Object.prototype.hasOwnProperty.call(list, i)) {\n delete list[i];\n }\n }\n }\n copy(ls, list);\n list._inc = inc;\n }\n}\nLiveNodeList.prototype.item = function (i) {\n _updateLiveList(this);\n return this[i] || null;\n};\n_extends(LiveNodeList, NodeList);\n\n/**\n * Objects implementing the NamedNodeMap interface are used\n * to represent collections of nodes that can be accessed by name.\n * Note that NamedNodeMap does not inherit from NodeList;\n * NamedNodeMaps are not maintained in any particular order.\n * Objects contained in an object implementing NamedNodeMap may also be accessed by an ordinal index,\n * but this is simply to allow convenient enumeration of the contents of a NamedNodeMap,\n * and does not imply that the DOM specifies an order to these Nodes.\n * NamedNodeMap objects in the DOM are live.\n * used for attributes or DocumentType entities\n */\nfunction NamedNodeMap() {}\n;\nfunction _findNodeIndex(list, node) {\n var i = list.length;\n while (i--) {\n if (list[i] === node) {\n return i;\n }\n }\n}\nfunction _addNamedNode(el, list, newAttr, oldAttr) {\n if (oldAttr) {\n list[_findNodeIndex(list, oldAttr)] = newAttr;\n } else {\n list[list.length++] = newAttr;\n }\n if (el) {\n newAttr.ownerElement = el;\n var doc = el.ownerDocument;\n if (doc) {\n oldAttr && _onRemoveAttribute(doc, el, oldAttr);\n _onAddAttribute(doc, el, newAttr);\n }\n }\n}\nfunction _removeNamedNode(el, list, attr) {\n //console.log('remove attr:'+attr)\n var i = _findNodeIndex(list, attr);\n if (i >= 0) {\n var lastIndex = list.length - 1;\n while (i < lastIndex) {\n list[i] = list[++i];\n }\n list.length = lastIndex;\n if (el) {\n var doc = el.ownerDocument;\n if (doc) {\n _onRemoveAttribute(doc, el, attr);\n attr.ownerElement = null;\n }\n }\n } else {\n throw new DOMException(NOT_FOUND_ERR, new Error(el.tagName + '@' + attr));\n }\n}\nNamedNodeMap.prototype = {\n length: 0,\n item: NodeList.prototype.item,\n getNamedItem: function (key) {\n //\t\tif(key.indexOf(':')>0 || key == 'xmlns'){\n //\t\t\treturn null;\n //\t\t}\n //console.log()\n var i = this.length;\n while (i--) {\n var attr = this[i];\n //console.log(attr.nodeName,key)\n if (attr.nodeName == key) {\n return attr;\n }\n }\n },\n setNamedItem: function (attr) {\n var el = attr.ownerElement;\n if (el && el != this._ownerElement) {\n throw new DOMException(INUSE_ATTRIBUTE_ERR);\n }\n var oldAttr = this.getNamedItem(attr.nodeName);\n _addNamedNode(this._ownerElement, this, attr, oldAttr);\n return oldAttr;\n },\n /* returns Node */\n setNamedItemNS: function (attr) {\n // raises: WRONG_DOCUMENT_ERR,NO_MODIFICATION_ALLOWED_ERR,INUSE_ATTRIBUTE_ERR\n var el = attr.ownerElement,\n oldAttr;\n if (el && el != this._ownerElement) {\n throw new DOMException(INUSE_ATTRIBUTE_ERR);\n }\n oldAttr = this.getNamedItemNS(attr.namespaceURI, attr.localName);\n _addNamedNode(this._ownerElement, this, attr, oldAttr);\n return oldAttr;\n },\n /* returns Node */\n removeNamedItem: function (key) {\n var attr = this.getNamedItem(key);\n _removeNamedNode(this._ownerElement, this, attr);\n return attr;\n },\n // raises: NOT_FOUND_ERR,NO_MODIFICATION_ALLOWED_ERR\n\n //for level2\n removeNamedItemNS: function (namespaceURI, localName) {\n var attr = this.getNamedItemNS(namespaceURI, localName);\n _removeNamedNode(this._ownerElement, this, attr);\n return attr;\n },\n getNamedItemNS: function (namespaceURI, localName) {\n var i = this.length;\n while (i--) {\n var node = this[i];\n if (node.localName == localName && node.namespaceURI == namespaceURI) {\n return node;\n }\n }\n return null;\n }\n};\n\n/**\n * The DOMImplementation interface represents an object providing methods\n * which are not dependent on any particular document.\n * Such an object is returned by the `Document.implementation` property.\n *\n * __The individual methods describe the differences compared to the specs.__\n *\n * @constructor\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation MDN\n * @see https://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-102161490 DOM Level 1 Core (Initial)\n * @see https://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-102161490 DOM Level 2 Core\n * @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#ID-102161490 DOM Level 3 Core\n * @see https://dom.spec.whatwg.org/#domimplementation DOM Living Standard\n */\nfunction DOMImplementation() {}\nDOMImplementation.prototype = {\n /**\n * The DOMImplementation.hasFeature() method returns a Boolean flag indicating if a given feature is supported.\n * The different implementations fairly diverged in what kind of features were reported.\n * The latest version of the spec settled to force this method to always return true, where the functionality was accurate and in use.\n *\n * @deprecated It is deprecated and modern browsers return true in all cases.\n *\n * @param {string} feature\n * @param {string} [version]\n * @returns {boolean} always true\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/hasFeature MDN\n * @see https://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html#ID-5CED94D7 DOM Level 1 Core\n * @see https://dom.spec.whatwg.org/#dom-domimplementation-hasfeature DOM Living Standard\n */\n hasFeature: function (feature, version) {\n return true;\n },\n /**\n * Creates an XML Document object of the specified type with its document element.\n *\n * __It behaves slightly different from the description in the living standard__:\n * - There is no interface/class `XMLDocument`, it returns a `Document` instance.\n * - `contentType`, `encoding`, `mode`, `origin`, `url` fields are currently not declared.\n * - this implementation is not validating names or qualified names\n * (when parsing XML strings, the SAX parser takes care of that)\n *\n * @param {string|null} namespaceURI\n * @param {string} qualifiedName\n * @param {DocumentType=null} doctype\n * @returns {Document}\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createDocument MDN\n * @see https://www.w3.org/TR/DOM-Level-2-Core/core.html#Level-2-Core-DOM-createDocument DOM Level 2 Core (initial)\n * @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocument DOM Level 2 Core\n *\n * @see https://dom.spec.whatwg.org/#validate-and-extract DOM: Validate and extract\n * @see https://www.w3.org/TR/xml/#NT-NameStartChar XML Spec: Names\n * @see https://www.w3.org/TR/xml-names/#ns-qualnames XML Namespaces: Qualified names\n */\n createDocument: function (namespaceURI, qualifiedName, doctype) {\n var doc = new Document();\n doc.implementation = this;\n doc.childNodes = new NodeList();\n doc.doctype = doctype || null;\n if (doctype) {\n doc.appendChild(doctype);\n }\n if (qualifiedName) {\n var root = doc.createElementNS(namespaceURI, qualifiedName);\n doc.appendChild(root);\n }\n return doc;\n },\n /**\n * Returns a doctype, with the given `qualifiedName`, `publicId`, and `systemId`.\n *\n * __This behavior is slightly different from the in the specs__:\n * - this implementation is not validating names or qualified names\n * (when parsing XML strings, the SAX parser takes care of that)\n *\n * @param {string} qualifiedName\n * @param {string} [publicId]\n * @param {string} [systemId]\n * @returns {DocumentType} which can either be used with `DOMImplementation.createDocument` upon document creation\n * \t\t\t\t or can be put into the document via methods like `Node.insertBefore()` or `Node.replaceChild()`\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/createDocumentType MDN\n * @see https://www.w3.org/TR/DOM-Level-2-Core/core.html#Level-2-Core-DOM-createDocType DOM Level 2 Core\n * @see https://dom.spec.whatwg.org/#dom-domimplementation-createdocumenttype DOM Living Standard\n *\n * @see https://dom.spec.whatwg.org/#validate-and-extract DOM: Validate and extract\n * @see https://www.w3.org/TR/xml/#NT-NameStartChar XML Spec: Names\n * @see https://www.w3.org/TR/xml-names/#ns-qualnames XML Namespaces: Qualified names\n */\n createDocumentType: function (qualifiedName, publicId, systemId) {\n var node = new DocumentType();\n node.name = qualifiedName;\n node.nodeName = qualifiedName;\n node.publicId = publicId || '';\n node.systemId = systemId || '';\n return node;\n }\n};\n\n/**\n * @see http://www.w3.org/TR/2000/REC-DOM-Level-2-Core-20001113/core.html#ID-1950641247\n */\n\nfunction Node() {}\n;\nNode.prototype = {\n firstChild: null,\n lastChild: null,\n previousSibling: null,\n nextSibling: null,\n attributes: null,\n parentNode: null,\n childNodes: null,\n ownerDocument: null,\n nodeValue: null,\n namespaceURI: null,\n prefix: null,\n localName: null,\n // Modified in DOM Level 2:\n insertBefore: function (newChild, refChild) {\n //raises\n return _insertBefore(this, newChild, refChild);\n },\n replaceChild: function (newChild, oldChild) {\n //raises\n _insertBefore(this, newChild, oldChild, assertPreReplacementValidityInDocument);\n if (oldChild) {\n this.removeChild(oldChild);\n }\n },\n removeChild: function (oldChild) {\n return _removeChild(this, oldChild);\n },\n appendChild: function (newChild) {\n return this.insertBefore(newChild, null);\n },\n hasChildNodes: function () {\n return this.firstChild != null;\n },\n cloneNode: function (deep) {\n return cloneNode(this.ownerDocument || this, this, deep);\n },\n // Modified in DOM Level 2:\n normalize: function () {\n var child = this.firstChild;\n while (child) {\n var next = child.nextSibling;\n if (next && next.nodeType == TEXT_NODE && child.nodeType == TEXT_NODE) {\n this.removeChild(next);\n child.appendData(next.data);\n } else {\n child.normalize();\n child = next;\n }\n }\n },\n // Introduced in DOM Level 2:\n isSupported: function (feature, version) {\n return this.ownerDocument.implementation.hasFeature(feature, version);\n },\n // Introduced in DOM Level 2:\n hasAttributes: function () {\n return this.attributes.length > 0;\n },\n /**\n * Look up the prefix associated to the given namespace URI, starting from this node.\n * **The default namespace declarations are ignored by this method.**\n * See Namespace Prefix Lookup for details on the algorithm used by this method.\n *\n * _Note: The implementation seems to be incomplete when compared to the algorithm described in the specs._\n *\n * @param {string | null} namespaceURI\n * @returns {string | null}\n * @see https://www.w3.org/TR/DOM-Level-3-Core/core.html#Node3-lookupNamespacePrefix\n * @see https://www.w3.org/TR/DOM-Level-3-Core/namespaces-algorithms.html#lookupNamespacePrefixAlgo\n * @see https://dom.spec.whatwg.org/#dom-node-lookupprefix\n * @see https://github.com/xmldom/xmldom/issues/322\n */\n lookupPrefix: function (namespaceURI) {\n var el = this;\n while (el) {\n var map = el._nsMap;\n //console.dir(map)\n if (map) {\n for (var n in map) {\n if (Object.prototype.hasOwnProperty.call(map, n) && map[n] === namespaceURI) {\n return n;\n }\n }\n }\n el = el.nodeType == ATTRIBUTE_NODE ? el.ownerDocument : el.parentNode;\n }\n return null;\n },\n // Introduced in DOM Level 3:\n lookupNamespaceURI: function (prefix) {\n var el = this;\n while (el) {\n var map = el._nsMap;\n //console.dir(map)\n if (map) {\n if (Object.prototype.hasOwnProperty.call(map, prefix)) {\n return map[prefix];\n }\n }\n el = el.nodeType == ATTRIBUTE_NODE ? el.ownerDocument : el.parentNode;\n }\n return null;\n },\n // Introduced in DOM Level 3:\n isDefaultNamespace: function (namespaceURI) {\n var prefix = this.lookupPrefix(namespaceURI);\n return prefix == null;\n }\n};\nfunction _xmlEncoder(c) {\n return c == '<' && '<' || c == '>' && '>' || c == '&' && '&' || c == '\"' && '"' || '&#' + c.charCodeAt() + ';';\n}\ncopy(NodeType, Node);\ncopy(NodeType, Node.prototype);\n\n/**\n * @param callback return true for continue,false for break\n * @return boolean true: break visit;\n */\nfunction _visitNode(node, callback) {\n if (callback(node)) {\n return true;\n }\n if (node = node.firstChild) {\n do {\n if (_visitNode(node, callback)) {\n return true;\n }\n } while (node = node.nextSibling);\n }\n}\nfunction Document() {\n this.ownerDocument = this;\n}\nfunction _onAddAttribute(doc, el, newAttr) {\n doc && doc._inc++;\n var ns = newAttr.namespaceURI;\n if (ns === NAMESPACE.XMLNS) {\n //update namespace\n el._nsMap[newAttr.prefix ? newAttr.localName : ''] = newAttr.value;\n }\n}\nfunction _onRemoveAttribute(doc, el, newAttr, remove) {\n doc && doc._inc++;\n var ns = newAttr.namespaceURI;\n if (ns === NAMESPACE.XMLNS) {\n //update namespace\n delete el._nsMap[newAttr.prefix ? newAttr.localName : ''];\n }\n}\n\n/**\n * Updates `el.childNodes`, updating the indexed items and it's `length`.\n * Passing `newChild` means it will be appended.\n * Otherwise it's assumed that an item has been removed,\n * and `el.firstNode` and it's `.nextSibling` are used\n * to walk the current list of child nodes.\n *\n * @param {Document} doc\n * @param {Node} el\n * @param {Node} [newChild]\n * @private\n */\nfunction _onUpdateChild(doc, el, newChild) {\n if (doc && doc._inc) {\n doc._inc++;\n //update childNodes\n var cs = el.childNodes;\n if (newChild) {\n cs[cs.length++] = newChild;\n } else {\n var child = el.firstChild;\n var i = 0;\n while (child) {\n cs[i++] = child;\n child = child.nextSibling;\n }\n cs.length = i;\n delete cs[cs.length];\n }\n }\n}\n\n/**\n * Removes the connections between `parentNode` and `child`\n * and any existing `child.previousSibling` or `child.nextSibling`.\n *\n * @see https://github.com/xmldom/xmldom/issues/135\n * @see https://github.com/xmldom/xmldom/issues/145\n *\n * @param {Node} parentNode\n * @param {Node} child\n * @returns {Node} the child that was removed.\n * @private\n */\nfunction _removeChild(parentNode, child) {\n var previous = child.previousSibling;\n var next = child.nextSibling;\n if (previous) {\n previous.nextSibling = next;\n } else {\n parentNode.firstChild = next;\n }\n if (next) {\n next.previousSibling = previous;\n } else {\n parentNode.lastChild = previous;\n }\n child.parentNode = null;\n child.previousSibling = null;\n child.nextSibling = null;\n _onUpdateChild(parentNode.ownerDocument, parentNode);\n return child;\n}\n\n/**\n * Returns `true` if `node` can be a parent for insertion.\n * @param {Node} node\n * @returns {boolean}\n */\nfunction hasValidParentNodeType(node) {\n return node && (node.nodeType === Node.DOCUMENT_NODE || node.nodeType === Node.DOCUMENT_FRAGMENT_NODE || node.nodeType === Node.ELEMENT_NODE);\n}\n\n/**\n * Returns `true` if `node` can be inserted according to it's `nodeType`.\n * @param {Node} node\n * @returns {boolean}\n */\nfunction hasInsertableNodeType(node) {\n return node && (isElementNode(node) || isTextNode(node) || isDocTypeNode(node) || node.nodeType === Node.DOCUMENT_FRAGMENT_NODE || node.nodeType === Node.COMMENT_NODE || node.nodeType === Node.PROCESSING_INSTRUCTION_NODE);\n}\n\n/**\n * Returns true if `node` is a DOCTYPE node\n * @param {Node} node\n * @returns {boolean}\n */\nfunction isDocTypeNode(node) {\n return node && node.nodeType === Node.DOCUMENT_TYPE_NODE;\n}\n\n/**\n * Returns true if the node is an element\n * @param {Node} node\n * @returns {boolean}\n */\nfunction isElementNode(node) {\n return node && node.nodeType === Node.ELEMENT_NODE;\n}\n/**\n * Returns true if `node` is a text node\n * @param {Node} node\n * @returns {boolean}\n */\nfunction isTextNode(node) {\n return node && node.nodeType === Node.TEXT_NODE;\n}\n\n/**\n * Check if en element node can be inserted before `child`, or at the end if child is falsy,\n * according to the presence and position of a doctype node on the same level.\n *\n * @param {Document} doc The document node\n * @param {Node} child the node that would become the nextSibling if the element would be inserted\n * @returns {boolean} `true` if an element can be inserted before child\n * @private\n * https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity\n */\nfunction isElementInsertionPossible(doc, child) {\n var parentChildNodes = doc.childNodes || [];\n if (find(parentChildNodes, isElementNode) || isDocTypeNode(child)) {\n return false;\n }\n var docTypeNode = find(parentChildNodes, isDocTypeNode);\n return !(child && docTypeNode && parentChildNodes.indexOf(docTypeNode) > parentChildNodes.indexOf(child));\n}\n\n/**\n * Check if en element node can be inserted before `child`, or at the end if child is falsy,\n * according to the presence and position of a doctype node on the same level.\n *\n * @param {Node} doc The document node\n * @param {Node} child the node that would become the nextSibling if the element would be inserted\n * @returns {boolean} `true` if an element can be inserted before child\n * @private\n * https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity\n */\nfunction isElementReplacementPossible(doc, child) {\n var parentChildNodes = doc.childNodes || [];\n function hasElementChildThatIsNotChild(node) {\n return isElementNode(node) && node !== child;\n }\n if (find(parentChildNodes, hasElementChildThatIsNotChild)) {\n return false;\n }\n var docTypeNode = find(parentChildNodes, isDocTypeNode);\n return !(child && docTypeNode && parentChildNodes.indexOf(docTypeNode) > parentChildNodes.indexOf(child));\n}\n\n/**\n * @private\n * Steps 1-5 of the checks before inserting and before replacing a child are the same.\n *\n * @param {Node} parent the parent node to insert `node` into\n * @param {Node} node the node to insert\n * @param {Node=} child the node that should become the `nextSibling` of `node`\n * @returns {Node}\n * @throws DOMException for several node combinations that would create a DOM that is not well-formed.\n * @throws DOMException if `child` is provided but is not a child of `parent`.\n * @see https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity\n * @see https://dom.spec.whatwg.org/#concept-node-replace\n */\nfunction assertPreInsertionValidity1to5(parent, node, child) {\n // 1. If `parent` is not a Document, DocumentFragment, or Element node, then throw a \"HierarchyRequestError\" DOMException.\n if (!hasValidParentNodeType(parent)) {\n throw new DOMException(HIERARCHY_REQUEST_ERR, 'Unexpected parent node type ' + parent.nodeType);\n }\n // 2. If `node` is a host-including inclusive ancestor of `parent`, then throw a \"HierarchyRequestError\" DOMException.\n // not implemented!\n // 3. If `child` is non-null and its parent is not `parent`, then throw a \"NotFoundError\" DOMException.\n if (child && child.parentNode !== parent) {\n throw new DOMException(NOT_FOUND_ERR, 'child not in parent');\n }\n if (\n // 4. If `node` is not a DocumentFragment, DocumentType, Element, or CharacterData node, then throw a \"HierarchyRequestError\" DOMException.\n !hasInsertableNodeType(node) ||\n // 5. If either `node` is a Text node and `parent` is a document,\n // the sax parser currently adds top level text nodes, this will be fixed in 0.9.0\n // || (node.nodeType === Node.TEXT_NODE && parent.nodeType === Node.DOCUMENT_NODE)\n // or `node` is a doctype and `parent` is not a document, then throw a \"HierarchyRequestError\" DOMException.\n isDocTypeNode(node) && parent.nodeType !== Node.DOCUMENT_NODE) {\n throw new DOMException(HIERARCHY_REQUEST_ERR, 'Unexpected node type ' + node.nodeType + ' for parent node type ' + parent.nodeType);\n }\n}\n\n/**\n * @private\n * Step 6 of the checks before inserting and before replacing a child are different.\n *\n * @param {Document} parent the parent node to insert `node` into\n * @param {Node} node the node to insert\n * @param {Node | undefined} child the node that should become the `nextSibling` of `node`\n * @returns {Node}\n * @throws DOMException for several node combinations that would create a DOM that is not well-formed.\n * @throws DOMException if `child` is provided but is not a child of `parent`.\n * @see https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity\n * @see https://dom.spec.whatwg.org/#concept-node-replace\n */\nfunction assertPreInsertionValidityInDocument(parent, node, child) {\n var parentChildNodes = parent.childNodes || [];\n var nodeChildNodes = node.childNodes || [];\n\n // DocumentFragment\n if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {\n var nodeChildElements = nodeChildNodes.filter(isElementNode);\n // If node has more than one element child or has a Text node child.\n if (nodeChildElements.length > 1 || find(nodeChildNodes, isTextNode)) {\n throw new DOMException(HIERARCHY_REQUEST_ERR, 'More than one element or text in fragment');\n }\n // Otherwise, if `node` has one element child and either `parent` has an element child,\n // `child` is a doctype, or `child` is non-null and a doctype is following `child`.\n if (nodeChildElements.length === 1 && !isElementInsertionPossible(parent, child)) {\n throw new DOMException(HIERARCHY_REQUEST_ERR, 'Element in fragment can not be inserted before doctype');\n }\n }\n // Element\n if (isElementNode(node)) {\n // `parent` has an element child, `child` is a doctype,\n // or `child` is non-null and a doctype is following `child`.\n if (!isElementInsertionPossible(parent, child)) {\n throw new DOMException(HIERARCHY_REQUEST_ERR, 'Only one element can be added and only after doctype');\n }\n }\n // DocumentType\n if (isDocTypeNode(node)) {\n // `parent` has a doctype child,\n if (find(parentChildNodes, isDocTypeNode)) {\n throw new DOMException(HIERARCHY_REQUEST_ERR, 'Only one doctype is allowed');\n }\n var parentElementChild = find(parentChildNodes, isElementNode);\n // `child` is non-null and an element is preceding `child`,\n if (child && parentChildNodes.indexOf(parentElementChild) < parentChildNodes.indexOf(child)) {\n throw new DOMException(HIERARCHY_REQUEST_ERR, 'Doctype can only be inserted before an element');\n }\n // or `child` is null and `parent` has an element child.\n if (!child && parentElementChild) {\n throw new DOMException(HIERARCHY_REQUEST_ERR, 'Doctype can not be appended since element is present');\n }\n }\n}\n\n/**\n * @private\n * Step 6 of the checks before inserting and before replacing a child are different.\n *\n * @param {Document} parent the parent node to insert `node` into\n * @param {Node} node the node to insert\n * @param {Node | undefined} child the node that should become the `nextSibling` of `node`\n * @returns {Node}\n * @throws DOMException for several node combinations that would create a DOM that is not well-formed.\n * @throws DOMException if `child` is provided but is not a child of `parent`.\n * @see https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity\n * @see https://dom.spec.whatwg.org/#concept-node-replace\n */\nfunction assertPreReplacementValidityInDocument(parent, node, child) {\n var parentChildNodes = parent.childNodes || [];\n var nodeChildNodes = node.childNodes || [];\n\n // DocumentFragment\n if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {\n var nodeChildElements = nodeChildNodes.filter(isElementNode);\n // If `node` has more than one element child or has a Text node child.\n if (nodeChildElements.length > 1 || find(nodeChildNodes, isTextNode)) {\n throw new DOMException(HIERARCHY_REQUEST_ERR, 'More than one element or text in fragment');\n }\n // Otherwise, if `node` has one element child and either `parent` has an element child that is not `child` or a doctype is following `child`.\n if (nodeChildElements.length === 1 && !isElementReplacementPossible(parent, child)) {\n throw new DOMException(HIERARCHY_REQUEST_ERR, 'Element in fragment can not be inserted before doctype');\n }\n }\n // Element\n if (isElementNode(node)) {\n // `parent` has an element child that is not `child` or a doctype is following `child`.\n if (!isElementReplacementPossible(parent, child)) {\n throw new DOMException(HIERARCHY_REQUEST_ERR, 'Only one element can be added and only after doctype');\n }\n }\n // DocumentType\n if (isDocTypeNode(node)) {\n function hasDoctypeChildThatIsNotChild(node) {\n return isDocTypeNode(node) && node !== child;\n }\n\n // `parent` has a doctype child that is not `child`,\n if (find(parentChildNodes, hasDoctypeChildThatIsNotChild)) {\n throw new DOMException(HIERARCHY_REQUEST_ERR, 'Only one doctype is allowed');\n }\n var parentElementChild = find(parentChildNodes, isElementNode);\n // or an element is preceding `child`.\n if (child && parentChildNodes.indexOf(parentElementChild) < parentChildNodes.indexOf(child)) {\n throw new DOMException(HIERARCHY_REQUEST_ERR, 'Doctype can only be inserted before an element');\n }\n }\n}\n\n/**\n * @private\n * @param {Node} parent the parent node to insert `node` into\n * @param {Node} node the node to insert\n * @param {Node=} child the node that should become the `nextSibling` of `node`\n * @returns {Node}\n * @throws DOMException for several node combinations that would create a DOM that is not well-formed.\n * @throws DOMException if `child` is provided but is not a child of `parent`.\n * @see https://dom.spec.whatwg.org/#concept-node-ensure-pre-insertion-validity\n */\nfunction _insertBefore(parent, node, child, _inDocumentAssertion) {\n // To ensure pre-insertion validity of a node into a parent before a child, run these steps:\n assertPreInsertionValidity1to5(parent, node, child);\n\n // If parent is a document, and any of the statements below, switched on the interface node implements,\n // are true, then throw a \"HierarchyRequestError\" DOMException.\n if (parent.nodeType === Node.DOCUMENT_NODE) {\n (_inDocumentAssertion || assertPreInsertionValidityInDocument)(parent, node, child);\n }\n var cp = node.parentNode;\n if (cp) {\n cp.removeChild(node); //remove and update\n }\n if (node.nodeType === DOCUMENT_FRAGMENT_NODE) {\n var newFirst = node.firstChild;\n if (newFirst == null) {\n return node;\n }\n var newLast = node.lastChild;\n } else {\n newFirst = newLast = node;\n }\n var pre = child ? child.previousSibling : parent.lastChild;\n newFirst.previousSibling = pre;\n newLast.nextSibling = child;\n if (pre) {\n pre.nextSibling = newFirst;\n } else {\n parent.firstChild = newFirst;\n }\n if (child == null) {\n parent.lastChild = newLast;\n } else {\n child.previousSibling = newLast;\n }\n do {\n newFirst.parentNode = parent;\n } while (newFirst !== newLast && (newFirst = newFirst.nextSibling));\n _onUpdateChild(parent.ownerDocument || parent, parent);\n //console.log(parent.lastChild.nextSibling == null)\n if (node.nodeType == DOCUMENT_FRAGMENT_NODE) {\n node.firstChild = node.lastChild = null;\n }\n return node;\n}\n\n/**\n * Appends `newChild` to `parentNode`.\n * If `newChild` is already connected to a `parentNode` it is first removed from it.\n *\n * @see https://github.com/xmldom/xmldom/issues/135\n * @see https://github.com/xmldom/xmldom/issues/145\n * @param {Node} parentNode\n * @param {Node} newChild\n * @returns {Node}\n * @private\n */\nfunction _appendSingleChild(parentNode, newChild) {\n if (newChild.parentNode) {\n newChild.parentNode.removeChild(newChild);\n }\n newChild.parentNode = parentNode;\n newChild.previousSibling = parentNode.lastChild;\n newChild.nextSibling = null;\n if (newChild.previousSibling) {\n newChild.previousSibling.nextSibling = newChild;\n } else {\n parentNode.firstChild = newChild;\n }\n parentNode.lastChild = newChild;\n _onUpdateChild(parentNode.ownerDocument, parentNode, newChild);\n return newChild;\n}\nDocument.prototype = {\n //implementation : null,\n nodeName: '#document',\n nodeType: DOCUMENT_NODE,\n /**\n * The DocumentType node of the document.\n *\n * @readonly\n * @type DocumentType\n */\n doctype: null,\n documentElement: null,\n _inc: 1,\n insertBefore: function (newChild, refChild) {\n //raises\n if (newChild.nodeType == DOCUMENT_FRAGMENT_NODE) {\n var child = newChild.firstChild;\n while (child) {\n var next = child.nextSibling;\n this.insertBefore(child, refChild);\n child = next;\n }\n return newChild;\n }\n _insertBefore(this, newChild, refChild);\n newChild.ownerDocument = this;\n if (this.documentElement === null && newChild.nodeType === ELEMENT_NODE) {\n this.documentElement = newChild;\n }\n return newChild;\n },\n removeChild: function (oldChild) {\n if (this.documentElement == oldChild) {\n this.documentElement = null;\n }\n return _removeChild(this, oldChild);\n },\n replaceChild: function (newChild, oldChild) {\n //raises\n _insertBefore(this, newChild, oldChild, assertPreReplacementValidityInDocument);\n newChild.ownerDocument = this;\n if (oldChild) {\n this.removeChild(oldChild);\n }\n if (isElementNode(newChild)) {\n this.documentElement = newChild;\n }\n },\n // Introduced in DOM Level 2:\n importNode: function (importedNode, deep) {\n return importNode(this, importedNode, deep);\n },\n // Introduced in DOM Level 2:\n getElementById: function (id) {\n var rtv = null;\n _visitNode(this.documentElement, function (node) {\n if (node.nodeType == ELEMENT_NODE) {\n if (node.getAttribute('id') == id) {\n rtv = node;\n return true;\n }\n }\n });\n return rtv;\n },\n /**\n * The `getElementsByClassName` method of `Document` interface returns an array-like object\n * of all child elements which have **all** of the given class name(s).\n *\n * Returns an empty list if `classeNames` is an empty string or only contains HTML white space characters.\n *\n *\n * Warning: This is a live LiveNodeList.\n * Changes in the DOM will reflect in the array as the changes occur.\n * If an element selected by this array no longer qualifies for the selector,\n * it will automatically be removed. Be aware of this for iteration purposes.\n *\n * @param {string} classNames is a string representing the class name(s) to match; multiple class names are separated by (ASCII-)whitespace\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Document/getElementsByClassName\n * @see https://dom.spec.whatwg.org/#concept-getelementsbyclassname\n */\n getElementsByClassName: function (classNames) {\n var classNamesSet = toOrderedSet(classNames);\n return new LiveNodeList(this, function (base) {\n var ls = [];\n if (classNamesSet.length > 0) {\n _visitNode(base.documentElement, function (node) {\n if (node !== base && node.nodeType === ELEMENT_NODE) {\n var nodeClassNames = node.getAttribute('class');\n // can be null if the attribute does not exist\n if (nodeClassNames) {\n // before splitting and iterating just compare them for the most common case\n var matches = classNames === nodeClassNames;\n if (!matches) {\n var nodeClassNamesSet = toOrderedSet(nodeClassNames);\n matches = classNamesSet.every(arrayIncludes(nodeClassNamesSet));\n }\n if (matches) {\n ls.push(node);\n }\n }\n }\n });\n }\n return ls;\n });\n },\n //document factory method:\n createElement: function (tagName) {\n var node = new Element();\n node.ownerDocument = this;\n node.nodeName = tagName;\n node.tagName = tagName;\n node.localName = tagName;\n node.childNodes = new NodeList();\n var attrs = node.attributes = new NamedNodeMap();\n attrs._ownerElement = node;\n return node;\n },\n createDocumentFragment: function () {\n var node = new DocumentFragment();\n node.ownerDocument = this;\n node.childNodes = new NodeList();\n return node;\n },\n createTextNode: function (data) {\n var node = new Text();\n node.ownerDocument = this;\n node.appendData(data);\n return node;\n },\n createComment: function (data) {\n var node = new Comment();\n node.ownerDocument = this;\n node.appendData(data);\n return node;\n },\n createCDATASection: function (data) {\n var node = new CDATASection();\n node.ownerDocument = this;\n node.appendData(data);\n return node;\n },\n createProcessingInstruction: function (target, data) {\n var node = new ProcessingInstruction();\n node.ownerDocument = this;\n node.tagName = node.nodeName = node.target = target;\n node.nodeValue = node.data = data;\n return node;\n },\n createAttribute: function (name) {\n var node = new Attr();\n node.ownerDocument = this;\n node.name = name;\n node.nodeName = name;\n node.localName = name;\n node.specified = true;\n return node;\n },\n createEntityReference: function (name) {\n var node = new EntityReference();\n node.ownerDocument = this;\n node.nodeName = name;\n return node;\n },\n // Introduced in DOM Level 2:\n createElementNS: function (namespaceURI, qualifiedName) {\n var node = new Element();\n var pl = qualifiedName.split(':');\n var attrs = node.attributes = new NamedNodeMap();\n node.childNodes = new NodeList();\n node.ownerDocument = this;\n node.nodeName = qualifiedName;\n node.tagName = qualifiedName;\n node.namespaceURI = namespaceURI;\n if (pl.length == 2) {\n node.prefix = pl[0];\n node.localName = pl[1];\n } else {\n //el.prefix = null;\n node.localName = qualifiedName;\n }\n attrs._ownerElement = node;\n return node;\n },\n // Introduced in DOM Level 2:\n createAttributeNS: function (namespaceURI, qualifiedName) {\n var node = new Attr();\n var pl = qualifiedName.split(':');\n node.ownerDocument = this;\n node.nodeName = qualifiedName;\n node.name = qualifiedName;\n node.namespaceURI = namespaceURI;\n node.specified = true;\n if (pl.length == 2) {\n node.prefix = pl[0];\n node.localName = pl[1];\n } else {\n //el.prefix = null;\n node.localName = qualifiedName;\n }\n return node;\n }\n};\n_extends(Document, Node);\nfunction Element() {\n this._nsMap = {};\n}\n;\nElement.prototype = {\n nodeType: ELEMENT_NODE,\n hasAttribute: function (name) {\n return this.getAttributeNode(name) != null;\n },\n getAttribute: function (name) {\n var attr = this.getAttributeNode(name);\n return attr && attr.value || '';\n },\n getAttributeNode: function (name) {\n return this.attributes.getNamedItem(name);\n },\n setAttribute: function (name, value) {\n var attr = this.ownerDocument.createAttribute(name);\n attr.value = attr.nodeValue = \"\" + value;\n this.setAttributeNode(attr);\n },\n removeAttribute: function (name) {\n var attr = this.getAttributeNode(name);\n attr && this.removeAttributeNode(attr);\n },\n //four real opeartion method\n appendChild: function (newChild) {\n if (newChild.nodeType === DOCUMENT_FRAGMENT_NODE) {\n return this.insertBefore(newChild, null);\n } else {\n return _appendSingleChild(this, newChild);\n }\n },\n setAttributeNode: function (newAttr) {\n return this.attributes.setNamedItem(newAttr);\n },\n setAttributeNodeNS: function (newAttr) {\n return this.attributes.setNamedItemNS(newAttr);\n },\n removeAttributeNode: function (oldAttr) {\n //console.log(this == oldAttr.ownerElement)\n return this.attributes.removeNamedItem(oldAttr.nodeName);\n },\n //get real attribute name,and remove it by removeAttributeNode\n removeAttributeNS: function (namespaceURI, localName) {\n var old = this.getAttributeNodeNS(namespaceURI, localName);\n old && this.removeAttributeNode(old);\n },\n hasAttributeNS: function (namespaceURI, localName) {\n return this.getAttributeNodeNS(namespaceURI, localName) != null;\n },\n getAttributeNS: function (namespaceURI, localName) {\n var attr = this.getAttributeNodeNS(namespaceURI, localName);\n return attr && attr.value || '';\n },\n setAttributeNS: function (namespaceURI, qualifiedName, value) {\n var attr = this.ownerDocument.createAttributeNS(namespaceURI, qualifiedName);\n attr.value = attr.nodeValue = \"\" + value;\n this.setAttributeNode(attr);\n },\n getAttributeNodeNS: function (namespaceURI, localName) {\n return this.attributes.getNamedItemNS(namespaceURI, localName);\n },\n getElementsByTagName: function (tagName) {\n return new LiveNodeList(this, function (base) {\n var ls = [];\n _visitNode(base, function (node) {\n if (node !== base && node.nodeType == ELEMENT_NODE && (tagName === '*' || node.tagName == tagName)) {\n ls.push(node);\n }\n });\n return ls;\n });\n },\n getElementsByTagNameNS: function (namespaceURI, localName) {\n return new LiveNodeList(this, function (base) {\n var ls = [];\n _visitNode(base, function (node) {\n if (node !== base && node.nodeType === ELEMENT_NODE && (namespaceURI === '*' || node.namespaceURI === namespaceURI) && (localName === '*' || node.localName == localName)) {\n ls.push(node);\n }\n });\n return ls;\n });\n }\n};\nDocument.prototype.getElementsByTagName = Element.prototype.getElementsByTagName;\nDocument.prototype.getElementsByTagNameNS = Element.prototype.getElementsByTagNameNS;\n_extends(Element, Node);\nfunction Attr() {}\n;\nAttr.prototype.nodeType = ATTRIBUTE_NODE;\n_extends(Attr, Node);\nfunction CharacterData() {}\n;\nCharacterData.prototype = {\n data: '',\n substringData: function (offset, count) {\n return this.data.substring(offset, offset + count);\n },\n appendData: function (text) {\n text = this.data + text;\n this.nodeValue = this.data = text;\n this.length = text.length;\n },\n insertData: function (offset, text) {\n this.replaceData(offset, 0, text);\n },\n appendChild: function (newChild) {\n throw new Error(ExceptionMessage[HIERARCHY_REQUEST_ERR]);\n },\n deleteData: function (offset, count) {\n this.replaceData(offset, count, \"\");\n },\n replaceData: function (offset, count, text) {\n var start = this.data.substring(0, offset);\n var end = this.data.substring(offset + count);\n text = start + text + end;\n this.nodeValue = this.data = text;\n this.length = text.length;\n }\n};\n_extends(CharacterData, Node);\nfunction Text() {}\n;\nText.prototype = {\n nodeName: \"#text\",\n nodeType: TEXT_NODE,\n splitText: function (offset) {\n var text = this.data;\n var newText = text.substring(offset);\n text = text.substring(0, offset);\n this.data = this.nodeValue = text;\n this.length = text.length;\n var newNode = this.ownerDocument.createTextNode(newText);\n if (this.parentNode) {\n this.parentNode.insertBefore(newNode, this.nextSibling);\n }\n return newNode;\n }\n};\n_extends(Text, CharacterData);\nfunction Comment() {}\n;\nComment.prototype = {\n nodeName: \"#comment\",\n nodeType: COMMENT_NODE\n};\n_extends(Comment, CharacterData);\nfunction CDATASection() {}\n;\nCDATASection.prototype = {\n nodeName: \"#cdata-section\",\n nodeType: CDATA_SECTION_NODE\n};\n_extends(CDATASection, CharacterData);\nfunction DocumentType() {}\n;\nDocumentType.prototype.nodeType = DOCUMENT_TYPE_NODE;\n_extends(DocumentType, Node);\nfunction Notation() {}\n;\nNotation.prototype.nodeType = NOTATION_NODE;\n_extends(Notation, Node);\nfunction Entity() {}\n;\nEntity.prototype.nodeType = ENTITY_NODE;\n_extends(Entity, Node);\nfunction EntityReference() {}\n;\nEntityReference.prototype.nodeType = ENTITY_REFERENCE_NODE;\n_extends(EntityReference, Node);\nfunction DocumentFragment() {}\n;\nDocumentFragment.prototype.nodeName = \"#document-fragment\";\nDocumentFragment.prototype.nodeType = DOCUMENT_FRAGMENT_NODE;\n_extends(DocumentFragment, Node);\nfunction ProcessingInstruction() {}\nProcessingInstruction.prototype.nodeType = PROCESSING_INSTRUCTION_NODE;\n_extends(ProcessingInstruction, Node);\nfunction XMLSerializer() {}\nXMLSerializer.prototype.serializeToString = function (node, isHtml, nodeFilter) {\n return nodeSerializeToString.call(node, isHtml, nodeFilter);\n};\nNode.prototype.toString = nodeSerializeToString;\nfunction nodeSerializeToString(isHtml, nodeFilter) {\n var buf = [];\n var refNode = this.nodeType == 9 && this.documentElement || this;\n var prefix = refNode.prefix;\n var uri = refNode.namespaceURI;\n if (uri && prefix == null) {\n //console.log(prefix)\n var prefix = refNode.lookupPrefix(uri);\n if (prefix == null) {\n //isHTML = true;\n var visibleNamespaces = [{\n namespace: uri,\n prefix: null\n }\n //{namespace:uri,prefix:''}\n ];\n }\n }\n serializeToString(this, buf, isHtml, nodeFilter, visibleNamespaces);\n //console.log('###',this.nodeType,uri,prefix,buf.join(''))\n return buf.join('');\n}\nfunction needNamespaceDefine(node, isHTML, visibleNamespaces) {\n var prefix = node.prefix || '';\n var uri = node.namespaceURI;\n // According to [Namespaces in XML 1.0](https://www.w3.org/TR/REC-xml-names/#ns-using) ,\n // and more specifically https://www.w3.org/TR/REC-xml-names/#nsc-NoPrefixUndecl :\n // > In a namespace declaration for a prefix [...], the attribute value MUST NOT be empty.\n // in a similar manner [Namespaces in XML 1.1](https://www.w3.org/TR/xml-names11/#ns-using)\n // and more specifically https://www.w3.org/TR/xml-names11/#nsc-NSDeclared :\n // > [...] Furthermore, the attribute value [...] must not be an empty string.\n // so serializing empty namespace value like xmlns:ds=\"\" would produce an invalid XML document.\n if (!uri) {\n return false;\n }\n if (prefix === \"xml\" && uri === NAMESPACE.XML || uri === NAMESPACE.XMLNS) {\n return false;\n }\n var i = visibleNamespaces.length;\n while (i--) {\n var ns = visibleNamespaces[i];\n // get namespace prefix\n if (ns.prefix === prefix) {\n return ns.namespace !== uri;\n }\n }\n return true;\n}\n/**\n * Well-formed constraint: No < in Attribute Values\n * > The replacement text of any entity referred to directly or indirectly\n * > in an attribute value must not contain a <.\n * @see https://www.w3.org/TR/xml11/#CleanAttrVals\n * @see https://www.w3.org/TR/xml11/#NT-AttValue\n *\n * Literal whitespace other than space that appear in attribute values\n * are serialized as their entity references, so they will be preserved.\n * (In contrast to whitespace literals in the input which are normalized to spaces)\n * @see https://www.w3.org/TR/xml11/#AVNormalize\n * @see https://w3c.github.io/DOM-Parsing/#serializing-an-element-s-attributes\n */\nfunction addSerializedAttribute(buf, qualifiedName, value) {\n buf.push(' ', qualifiedName, '=\"', value.replace(/[<>&\"\\t\\n\\r]/g, _xmlEncoder), '\"');\n}\nfunction serializeToString(node, buf, isHTML, nodeFilter, visibleNamespaces) {\n if (!visibleNamespaces) {\n visibleNamespaces = [];\n }\n if (nodeFilter) {\n node = nodeFilter(node);\n if (node) {\n if (typeof node == 'string') {\n buf.push(node);\n return;\n }\n } else {\n return;\n }\n //buf.sort.apply(attrs, attributeSorter);\n }\n switch (node.nodeType) {\n case ELEMENT_NODE:\n var attrs = node.attributes;\n var len = attrs.length;\n var child = node.firstChild;\n var nodeName = node.tagName;\n isHTML = NAMESPACE.isHTML(node.namespaceURI) || isHTML;\n var prefixedNodeName = nodeName;\n if (!isHTML && !node.prefix && node.namespaceURI) {\n var defaultNS;\n // lookup current default ns from `xmlns` attribute\n for (var ai = 0; ai < attrs.length; ai++) {\n if (attrs.item(ai).name === 'xmlns') {\n defaultNS = attrs.item(ai).value;\n break;\n }\n }\n if (!defaultNS) {\n // lookup current default ns in visibleNamespaces\n for (var nsi = visibleNamespaces.length - 1; nsi >= 0; nsi--) {\n var namespace = visibleNamespaces[nsi];\n if (namespace.prefix === '' && namespace.namespace === node.namespaceURI) {\n defaultNS = namespace.namespace;\n break;\n }\n }\n }\n if (defaultNS !== node.namespaceURI) {\n for (var nsi = visibleNamespaces.length - 1; nsi >= 0; nsi--) {\n var namespace = visibleNamespaces[nsi];\n if (namespace.namespace === node.namespaceURI) {\n if (namespace.prefix) {\n prefixedNodeName = namespace.prefix + ':' + nodeName;\n }\n break;\n }\n }\n }\n }\n buf.push('<', prefixedNodeName);\n for (var i = 0; i < len; i++) {\n // add namespaces for attributes\n var attr = attrs.item(i);\n if (attr.prefix == 'xmlns') {\n visibleNamespaces.push({\n prefix: attr.localName,\n namespace: attr.value\n });\n } else if (attr.nodeName == 'xmlns') {\n visibleNamespaces.push({\n prefix: '',\n namespace: attr.value\n });\n }\n }\n for (var i = 0; i < len; i++) {\n var attr = attrs.item(i);\n if (needNamespaceDefine(attr, isHTML, visibleNamespaces)) {\n var prefix = attr.prefix || '';\n var uri = attr.namespaceURI;\n addSerializedAttribute(buf, prefix ? 'xmlns:' + prefix : \"xmlns\", uri);\n visibleNamespaces.push({\n prefix: prefix,\n namespace: uri\n });\n }\n serializeToString(attr, buf, isHTML, nodeFilter, visibleNamespaces);\n }\n\n // add namespace for current node\n if (nodeName === prefixedNodeName && needNamespaceDefine(node, isHTML, visibleNamespaces)) {\n var prefix = node.prefix || '';\n var uri = node.namespaceURI;\n addSerializedAttribute(buf, prefix ? 'xmlns:' + prefix : \"xmlns\", uri);\n visibleNamespaces.push({\n prefix: prefix,\n namespace: uri\n });\n }\n if (child || isHTML && !/^(?:meta|link|img|br|hr|input)$/i.test(nodeName)) {\n buf.push('>');\n //if is cdata child node\n if (isHTML && /^script$/i.test(nodeName)) {\n while (child) {\n if (child.data) {\n buf.push(child.data);\n } else {\n serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice());\n }\n child = child.nextSibling;\n }\n } else {\n while (child) {\n serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice());\n child = child.nextSibling;\n }\n }\n buf.push('');\n } else {\n buf.push('/>');\n }\n // remove added visible namespaces\n //visibleNamespaces.length = startVisibleNamespaces;\n return;\n case DOCUMENT_NODE:\n case DOCUMENT_FRAGMENT_NODE:\n var child = node.firstChild;\n while (child) {\n serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice());\n child = child.nextSibling;\n }\n return;\n case ATTRIBUTE_NODE:\n return addSerializedAttribute(buf, node.name, node.value);\n case TEXT_NODE:\n /**\n * The ampersand character (&) and the left angle bracket (<) must not appear in their literal form,\n * except when used as markup delimiters, or within a comment, a processing instruction, or a CDATA section.\n * If they are needed elsewhere, they must be escaped using either numeric character references or the strings\n * `&` and `<` respectively.\n * The right angle bracket (>) may be represented using the string \" > \", and must, for compatibility,\n * be escaped using either `>` or a character reference when it appears in the string `]]>` in content,\n * when that string is not marking the end of a CDATA section.\n *\n * In the content of elements, character data is any string of characters\n * which does not contain the start-delimiter of any markup\n * and does not include the CDATA-section-close delimiter, `]]>`.\n *\n * @see https://www.w3.org/TR/xml/#NT-CharData\n * @see https://w3c.github.io/DOM-Parsing/#xml-serializing-a-text-node\n */\n return buf.push(node.data.replace(/[<&>]/g, _xmlEncoder));\n case CDATA_SECTION_NODE:\n return buf.push('');\n case COMMENT_NODE:\n return buf.push(\"\");\n case DOCUMENT_TYPE_NODE:\n var pubid = node.publicId;\n var sysid = node.systemId;\n buf.push('');\n } else if (sysid && sysid != '.') {\n buf.push(' SYSTEM ', sysid, '>');\n } else {\n var sub = node.internalSubset;\n if (sub) {\n buf.push(\" [\", sub, \"]\");\n }\n buf.push(\">\");\n }\n return;\n case PROCESSING_INSTRUCTION_NODE:\n return buf.push(\"\");\n case ENTITY_REFERENCE_NODE:\n return buf.push('&', node.nodeName, ';');\n //case ENTITY_NODE:\n //case NOTATION_NODE:\n default:\n buf.push('??', node.nodeName);\n }\n}\nfunction importNode(doc, node, deep) {\n var node2;\n switch (node.nodeType) {\n case ELEMENT_NODE:\n node2 = node.cloneNode(false);\n node2.ownerDocument = doc;\n //var attrs = node2.attributes;\n //var len = attrs.length;\n //for(var i=0;i',\n lt: '<',\n quot: '\"'\n});\n\n/**\n * A map of all entities that are detected in an HTML document.\n * They contain all entries from `XML_ENTITIES`.\n *\n * @see XML_ENTITIES\n * @see DOMParser.parseFromString\n * @see DOMImplementation.prototype.createHTMLDocument\n * @see https://html.spec.whatwg.org/#named-character-references WHATWG HTML(5) Spec\n * @see https://html.spec.whatwg.org/entities.json JSON\n * @see https://www.w3.org/TR/xml-entity-names/ W3C XML Entity Names\n * @see https://www.w3.org/TR/html4/sgml/entities.html W3C HTML4/SGML\n * @see https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Character_entity_references_in_HTML Wikipedia (HTML)\n * @see https://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references#Entities_representing_special_characters_in_XHTML Wikpedia (XHTML)\n */\nexports.HTML_ENTITIES = freeze({\n Aacute: '\\u00C1',\n aacute: '\\u00E1',\n Abreve: '\\u0102',\n abreve: '\\u0103',\n ac: '\\u223E',\n acd: '\\u223F',\n acE: '\\u223E\\u0333',\n Acirc: '\\u00C2',\n acirc: '\\u00E2',\n acute: '\\u00B4',\n Acy: '\\u0410',\n acy: '\\u0430',\n AElig: '\\u00C6',\n aelig: '\\u00E6',\n af: '\\u2061',\n Afr: '\\uD835\\uDD04',\n afr: '\\uD835\\uDD1E',\n Agrave: '\\u00C0',\n agrave: '\\u00E0',\n alefsym: '\\u2135',\n aleph: '\\u2135',\n Alpha: '\\u0391',\n alpha: '\\u03B1',\n Amacr: '\\u0100',\n amacr: '\\u0101',\n amalg: '\\u2A3F',\n AMP: '\\u0026',\n amp: '\\u0026',\n And: '\\u2A53',\n and: '\\u2227',\n andand: '\\u2A55',\n andd: '\\u2A5C',\n andslope: '\\u2A58',\n andv: '\\u2A5A',\n ang: '\\u2220',\n ange: '\\u29A4',\n angle: '\\u2220',\n angmsd: '\\u2221',\n angmsdaa: '\\u29A8',\n angmsdab: '\\u29A9',\n angmsdac: '\\u29AA',\n angmsdad: '\\u29AB',\n angmsdae: '\\u29AC',\n angmsdaf: '\\u29AD',\n angmsdag: '\\u29AE',\n angmsdah: '\\u29AF',\n angrt: '\\u221F',\n angrtvb: '\\u22BE',\n angrtvbd: '\\u299D',\n angsph: '\\u2222',\n angst: '\\u00C5',\n angzarr: '\\u237C',\n Aogon: '\\u0104',\n aogon: '\\u0105',\n Aopf: '\\uD835\\uDD38',\n aopf: '\\uD835\\uDD52',\n ap: '\\u2248',\n apacir: '\\u2A6F',\n apE: '\\u2A70',\n ape: '\\u224A',\n apid: '\\u224B',\n apos: '\\u0027',\n ApplyFunction: '\\u2061',\n approx: '\\u2248',\n approxeq: '\\u224A',\n Aring: '\\u00C5',\n aring: '\\u00E5',\n Ascr: '\\uD835\\uDC9C',\n ascr: '\\uD835\\uDCB6',\n Assign: '\\u2254',\n ast: '\\u002A',\n asymp: '\\u2248',\n asympeq: '\\u224D',\n Atilde: '\\u00C3',\n atilde: '\\u00E3',\n Auml: '\\u00C4',\n auml: '\\u00E4',\n awconint: '\\u2233',\n awint: '\\u2A11',\n backcong: '\\u224C',\n backepsilon: '\\u03F6',\n backprime: '\\u2035',\n backsim: '\\u223D',\n backsimeq: '\\u22CD',\n Backslash: '\\u2216',\n Barv: '\\u2AE7',\n barvee: '\\u22BD',\n Barwed: '\\u2306',\n barwed: '\\u2305',\n barwedge: '\\u2305',\n bbrk: '\\u23B5',\n bbrktbrk: '\\u23B6',\n bcong: '\\u224C',\n Bcy: '\\u0411',\n bcy: '\\u0431',\n bdquo: '\\u201E',\n becaus: '\\u2235',\n Because: '\\u2235',\n because: '\\u2235',\n bemptyv: '\\u29B0',\n bepsi: '\\u03F6',\n bernou: '\\u212C',\n Bernoullis: '\\u212C',\n Beta: '\\u0392',\n beta: '\\u03B2',\n beth: '\\u2136',\n between: '\\u226C',\n Bfr: '\\uD835\\uDD05',\n bfr: '\\uD835\\uDD1F',\n bigcap: '\\u22C2',\n bigcirc: '\\u25EF',\n bigcup: '\\u22C3',\n bigodot: '\\u2A00',\n bigoplus: '\\u2A01',\n bigotimes: '\\u2A02',\n bigsqcup: '\\u2A06',\n bigstar: '\\u2605',\n bigtriangledown: '\\u25BD',\n bigtriangleup: '\\u25B3',\n biguplus: '\\u2A04',\n bigvee: '\\u22C1',\n bigwedge: '\\u22C0',\n bkarow: '\\u290D',\n blacklozenge: '\\u29EB',\n blacksquare: '\\u25AA',\n blacktriangle: '\\u25B4',\n blacktriangledown: '\\u25BE',\n blacktriangleleft: '\\u25C2',\n blacktriangleright: '\\u25B8',\n blank: '\\u2423',\n blk12: '\\u2592',\n blk14: '\\u2591',\n blk34: '\\u2593',\n block: '\\u2588',\n bne: '\\u003D\\u20E5',\n bnequiv: '\\u2261\\u20E5',\n bNot: '\\u2AED',\n bnot: '\\u2310',\n Bopf: '\\uD835\\uDD39',\n bopf: '\\uD835\\uDD53',\n bot: '\\u22A5',\n bottom: '\\u22A5',\n bowtie: '\\u22C8',\n boxbox: '\\u29C9',\n boxDL: '\\u2557',\n boxDl: '\\u2556',\n boxdL: '\\u2555',\n boxdl: '\\u2510',\n boxDR: '\\u2554',\n boxDr: '\\u2553',\n boxdR: '\\u2552',\n boxdr: '\\u250C',\n boxH: '\\u2550',\n boxh: '\\u2500',\n boxHD: '\\u2566',\n boxHd: '\\u2564',\n boxhD: '\\u2565',\n boxhd: '\\u252C',\n boxHU: '\\u2569',\n boxHu: '\\u2567',\n boxhU: '\\u2568',\n boxhu: '\\u2534',\n boxminus: '\\u229F',\n boxplus: '\\u229E',\n boxtimes: '\\u22A0',\n boxUL: '\\u255D',\n boxUl: '\\u255C',\n boxuL: '\\u255B',\n boxul: '\\u2518',\n boxUR: '\\u255A',\n boxUr: '\\u2559',\n boxuR: '\\u2558',\n boxur: '\\u2514',\n boxV: '\\u2551',\n boxv: '\\u2502',\n boxVH: '\\u256C',\n boxVh: '\\u256B',\n boxvH: '\\u256A',\n boxvh: '\\u253C',\n boxVL: '\\u2563',\n boxVl: '\\u2562',\n boxvL: '\\u2561',\n boxvl: '\\u2524',\n boxVR: '\\u2560',\n boxVr: '\\u255F',\n boxvR: '\\u255E',\n boxvr: '\\u251C',\n bprime: '\\u2035',\n Breve: '\\u02D8',\n breve: '\\u02D8',\n brvbar: '\\u00A6',\n Bscr: '\\u212C',\n bscr: '\\uD835\\uDCB7',\n bsemi: '\\u204F',\n bsim: '\\u223D',\n bsime: '\\u22CD',\n bsol: '\\u005C',\n bsolb: '\\u29C5',\n bsolhsub: '\\u27C8',\n bull: '\\u2022',\n bullet: '\\u2022',\n bump: '\\u224E',\n bumpE: '\\u2AAE',\n bumpe: '\\u224F',\n Bumpeq: '\\u224E',\n bumpeq: '\\u224F',\n Cacute: '\\u0106',\n cacute: '\\u0107',\n Cap: '\\u22D2',\n cap: '\\u2229',\n capand: '\\u2A44',\n capbrcup: '\\u2A49',\n capcap: '\\u2A4B',\n capcup: '\\u2A47',\n capdot: '\\u2A40',\n CapitalDifferentialD: '\\u2145',\n caps: '\\u2229\\uFE00',\n caret: '\\u2041',\n caron: '\\u02C7',\n Cayleys: '\\u212D',\n ccaps: '\\u2A4D',\n Ccaron: '\\u010C',\n ccaron: '\\u010D',\n Ccedil: '\\u00C7',\n ccedil: '\\u00E7',\n Ccirc: '\\u0108',\n ccirc: '\\u0109',\n Cconint: '\\u2230',\n ccups: '\\u2A4C',\n ccupssm: '\\u2A50',\n Cdot: '\\u010A',\n cdot: '\\u010B',\n cedil: '\\u00B8',\n Cedilla: '\\u00B8',\n cemptyv: '\\u29B2',\n cent: '\\u00A2',\n CenterDot: '\\u00B7',\n centerdot: '\\u00B7',\n Cfr: '\\u212D',\n cfr: '\\uD835\\uDD20',\n CHcy: '\\u0427',\n chcy: '\\u0447',\n check: '\\u2713',\n checkmark: '\\u2713',\n Chi: '\\u03A7',\n chi: '\\u03C7',\n cir: '\\u25CB',\n circ: '\\u02C6',\n circeq: '\\u2257',\n circlearrowleft: '\\u21BA',\n circlearrowright: '\\u21BB',\n circledast: '\\u229B',\n circledcirc: '\\u229A',\n circleddash: '\\u229D',\n CircleDot: '\\u2299',\n circledR: '\\u00AE',\n circledS: '\\u24C8',\n CircleMinus: '\\u2296',\n CirclePlus: '\\u2295',\n CircleTimes: '\\u2297',\n cirE: '\\u29C3',\n cire: '\\u2257',\n cirfnint: '\\u2A10',\n cirmid: '\\u2AEF',\n cirscir: '\\u29C2',\n ClockwiseContourIntegral: '\\u2232',\n CloseCurlyDoubleQuote: '\\u201D',\n CloseCurlyQuote: '\\u2019',\n clubs: '\\u2663',\n clubsuit: '\\u2663',\n Colon: '\\u2237',\n colon: '\\u003A',\n Colone: '\\u2A74',\n colone: '\\u2254',\n coloneq: '\\u2254',\n comma: '\\u002C',\n commat: '\\u0040',\n comp: '\\u2201',\n compfn: '\\u2218',\n complement: '\\u2201',\n complexes: '\\u2102',\n cong: '\\u2245',\n congdot: '\\u2A6D',\n Congruent: '\\u2261',\n Conint: '\\u222F',\n conint: '\\u222E',\n ContourIntegral: '\\u222E',\n Copf: '\\u2102',\n copf: '\\uD835\\uDD54',\n coprod: '\\u2210',\n Coproduct: '\\u2210',\n COPY: '\\u00A9',\n copy: '\\u00A9',\n copysr: '\\u2117',\n CounterClockwiseContourIntegral: '\\u2233',\n crarr: '\\u21B5',\n Cross: '\\u2A2F',\n cross: '\\u2717',\n Cscr: '\\uD835\\uDC9E',\n cscr: '\\uD835\\uDCB8',\n csub: '\\u2ACF',\n csube: '\\u2AD1',\n csup: '\\u2AD0',\n csupe: '\\u2AD2',\n ctdot: '\\u22EF',\n cudarrl: '\\u2938',\n cudarrr: '\\u2935',\n cuepr: '\\u22DE',\n cuesc: '\\u22DF',\n cularr: '\\u21B6',\n cularrp: '\\u293D',\n Cup: '\\u22D3',\n cup: '\\u222A',\n cupbrcap: '\\u2A48',\n CupCap: '\\u224D',\n cupcap: '\\u2A46',\n cupcup: '\\u2A4A',\n cupdot: '\\u228D',\n cupor: '\\u2A45',\n cups: '\\u222A\\uFE00',\n curarr: '\\u21B7',\n curarrm: '\\u293C',\n curlyeqprec: '\\u22DE',\n curlyeqsucc: '\\u22DF',\n curlyvee: '\\u22CE',\n curlywedge: '\\u22CF',\n curren: '\\u00A4',\n curvearrowleft: '\\u21B6',\n curvearrowright: '\\u21B7',\n cuvee: '\\u22CE',\n cuwed: '\\u22CF',\n cwconint: '\\u2232',\n cwint: '\\u2231',\n cylcty: '\\u232D',\n Dagger: '\\u2021',\n dagger: '\\u2020',\n daleth: '\\u2138',\n Darr: '\\u21A1',\n dArr: '\\u21D3',\n darr: '\\u2193',\n dash: '\\u2010',\n Dashv: '\\u2AE4',\n dashv: '\\u22A3',\n dbkarow: '\\u290F',\n dblac: '\\u02DD',\n Dcaron: '\\u010E',\n dcaron: '\\u010F',\n Dcy: '\\u0414',\n dcy: '\\u0434',\n DD: '\\u2145',\n dd: '\\u2146',\n ddagger: '\\u2021',\n ddarr: '\\u21CA',\n DDotrahd: '\\u2911',\n ddotseq: '\\u2A77',\n deg: '\\u00B0',\n Del: '\\u2207',\n Delta: '\\u0394',\n delta: '\\u03B4',\n demptyv: '\\u29B1',\n dfisht: '\\u297F',\n Dfr: '\\uD835\\uDD07',\n dfr: '\\uD835\\uDD21',\n dHar: '\\u2965',\n dharl: '\\u21C3',\n dharr: '\\u21C2',\n DiacriticalAcute: '\\u00B4',\n DiacriticalDot: '\\u02D9',\n DiacriticalDoubleAcute: '\\u02DD',\n DiacriticalGrave: '\\u0060',\n DiacriticalTilde: '\\u02DC',\n diam: '\\u22C4',\n Diamond: '\\u22C4',\n diamond: '\\u22C4',\n diamondsuit: '\\u2666',\n diams: '\\u2666',\n die: '\\u00A8',\n DifferentialD: '\\u2146',\n digamma: '\\u03DD',\n disin: '\\u22F2',\n div: '\\u00F7',\n divide: '\\u00F7',\n divideontimes: '\\u22C7',\n divonx: '\\u22C7',\n DJcy: '\\u0402',\n djcy: '\\u0452',\n dlcorn: '\\u231E',\n dlcrop: '\\u230D',\n dollar: '\\u0024',\n Dopf: '\\uD835\\uDD3B',\n dopf: '\\uD835\\uDD55',\n Dot: '\\u00A8',\n dot: '\\u02D9',\n DotDot: '\\u20DC',\n doteq: '\\u2250',\n doteqdot: '\\u2251',\n DotEqual: '\\u2250',\n dotminus: '\\u2238',\n dotplus: '\\u2214',\n dotsquare: '\\u22A1',\n doublebarwedge: '\\u2306',\n DoubleContourIntegral: '\\u222F',\n DoubleDot: '\\u00A8',\n DoubleDownArrow: '\\u21D3',\n DoubleLeftArrow: '\\u21D0',\n DoubleLeftRightArrow: '\\u21D4',\n DoubleLeftTee: '\\u2AE4',\n DoubleLongLeftArrow: '\\u27F8',\n DoubleLongLeftRightArrow: '\\u27FA',\n DoubleLongRightArrow: '\\u27F9',\n DoubleRightArrow: '\\u21D2',\n DoubleRightTee: '\\u22A8',\n DoubleUpArrow: '\\u21D1',\n DoubleUpDownArrow: '\\u21D5',\n DoubleVerticalBar: '\\u2225',\n DownArrow: '\\u2193',\n Downarrow: '\\u21D3',\n downarrow: '\\u2193',\n DownArrowBar: '\\u2913',\n DownArrowUpArrow: '\\u21F5',\n DownBreve: '\\u0311',\n downdownarrows: '\\u21CA',\n downharpoonleft: '\\u21C3',\n downharpoonright: '\\u21C2',\n DownLeftRightVector: '\\u2950',\n DownLeftTeeVector: '\\u295E',\n DownLeftVector: '\\u21BD',\n DownLeftVectorBar: '\\u2956',\n DownRightTeeVector: '\\u295F',\n DownRightVector: '\\u21C1',\n DownRightVectorBar: '\\u2957',\n DownTee: '\\u22A4',\n DownTeeArrow: '\\u21A7',\n drbkarow: '\\u2910',\n drcorn: '\\u231F',\n drcrop: '\\u230C',\n Dscr: '\\uD835\\uDC9F',\n dscr: '\\uD835\\uDCB9',\n DScy: '\\u0405',\n dscy: '\\u0455',\n dsol: '\\u29F6',\n Dstrok: '\\u0110',\n dstrok: '\\u0111',\n dtdot: '\\u22F1',\n dtri: '\\u25BF',\n dtrif: '\\u25BE',\n duarr: '\\u21F5',\n duhar: '\\u296F',\n dwangle: '\\u29A6',\n DZcy: '\\u040F',\n dzcy: '\\u045F',\n dzigrarr: '\\u27FF',\n Eacute: '\\u00C9',\n eacute: '\\u00E9',\n easter: '\\u2A6E',\n Ecaron: '\\u011A',\n ecaron: '\\u011B',\n ecir: '\\u2256',\n Ecirc: '\\u00CA',\n ecirc: '\\u00EA',\n ecolon: '\\u2255',\n Ecy: '\\u042D',\n ecy: '\\u044D',\n eDDot: '\\u2A77',\n Edot: '\\u0116',\n eDot: '\\u2251',\n edot: '\\u0117',\n ee: '\\u2147',\n efDot: '\\u2252',\n Efr: '\\uD835\\uDD08',\n efr: '\\uD835\\uDD22',\n eg: '\\u2A9A',\n Egrave: '\\u00C8',\n egrave: '\\u00E8',\n egs: '\\u2A96',\n egsdot: '\\u2A98',\n el: '\\u2A99',\n Element: '\\u2208',\n elinters: '\\u23E7',\n ell: '\\u2113',\n els: '\\u2A95',\n elsdot: '\\u2A97',\n Emacr: '\\u0112',\n emacr: '\\u0113',\n empty: '\\u2205',\n emptyset: '\\u2205',\n EmptySmallSquare: '\\u25FB',\n emptyv: '\\u2205',\n EmptyVerySmallSquare: '\\u25AB',\n emsp: '\\u2003',\n emsp13: '\\u2004',\n emsp14: '\\u2005',\n ENG: '\\u014A',\n eng: '\\u014B',\n ensp: '\\u2002',\n Eogon: '\\u0118',\n eogon: '\\u0119',\n Eopf: '\\uD835\\uDD3C',\n eopf: '\\uD835\\uDD56',\n epar: '\\u22D5',\n eparsl: '\\u29E3',\n eplus: '\\u2A71',\n epsi: '\\u03B5',\n Epsilon: '\\u0395',\n epsilon: '\\u03B5',\n epsiv: '\\u03F5',\n eqcirc: '\\u2256',\n eqcolon: '\\u2255',\n eqsim: '\\u2242',\n eqslantgtr: '\\u2A96',\n eqslantless: '\\u2A95',\n Equal: '\\u2A75',\n equals: '\\u003D',\n EqualTilde: '\\u2242',\n equest: '\\u225F',\n Equilibrium: '\\u21CC',\n equiv: '\\u2261',\n equivDD: '\\u2A78',\n eqvparsl: '\\u29E5',\n erarr: '\\u2971',\n erDot: '\\u2253',\n Escr: '\\u2130',\n escr: '\\u212F',\n esdot: '\\u2250',\n Esim: '\\u2A73',\n esim: '\\u2242',\n Eta: '\\u0397',\n eta: '\\u03B7',\n ETH: '\\u00D0',\n eth: '\\u00F0',\n Euml: '\\u00CB',\n euml: '\\u00EB',\n euro: '\\u20AC',\n excl: '\\u0021',\n exist: '\\u2203',\n Exists: '\\u2203',\n expectation: '\\u2130',\n ExponentialE: '\\u2147',\n exponentiale: '\\u2147',\n fallingdotseq: '\\u2252',\n Fcy: '\\u0424',\n fcy: '\\u0444',\n female: '\\u2640',\n ffilig: '\\uFB03',\n fflig: '\\uFB00',\n ffllig: '\\uFB04',\n Ffr: '\\uD835\\uDD09',\n ffr: '\\uD835\\uDD23',\n filig: '\\uFB01',\n FilledSmallSquare: '\\u25FC',\n FilledVerySmallSquare: '\\u25AA',\n fjlig: '\\u0066\\u006A',\n flat: '\\u266D',\n fllig: '\\uFB02',\n fltns: '\\u25B1',\n fnof: '\\u0192',\n Fopf: '\\uD835\\uDD3D',\n fopf: '\\uD835\\uDD57',\n ForAll: '\\u2200',\n forall: '\\u2200',\n fork: '\\u22D4',\n forkv: '\\u2AD9',\n Fouriertrf: '\\u2131',\n fpartint: '\\u2A0D',\n frac12: '\\u00BD',\n frac13: '\\u2153',\n frac14: '\\u00BC',\n frac15: '\\u2155',\n frac16: '\\u2159',\n frac18: '\\u215B',\n frac23: '\\u2154',\n frac25: '\\u2156',\n frac34: '\\u00BE',\n frac35: '\\u2157',\n frac38: '\\u215C',\n frac45: '\\u2158',\n frac56: '\\u215A',\n frac58: '\\u215D',\n frac78: '\\u215E',\n frasl: '\\u2044',\n frown: '\\u2322',\n Fscr: '\\u2131',\n fscr: '\\uD835\\uDCBB',\n gacute: '\\u01F5',\n Gamma: '\\u0393',\n gamma: '\\u03B3',\n Gammad: '\\u03DC',\n gammad: '\\u03DD',\n gap: '\\u2A86',\n Gbreve: '\\u011E',\n gbreve: '\\u011F',\n Gcedil: '\\u0122',\n Gcirc: '\\u011C',\n gcirc: '\\u011D',\n Gcy: '\\u0413',\n gcy: '\\u0433',\n Gdot: '\\u0120',\n gdot: '\\u0121',\n gE: '\\u2267',\n ge: '\\u2265',\n gEl: '\\u2A8C',\n gel: '\\u22DB',\n geq: '\\u2265',\n geqq: '\\u2267',\n geqslant: '\\u2A7E',\n ges: '\\u2A7E',\n gescc: '\\u2AA9',\n gesdot: '\\u2A80',\n gesdoto: '\\u2A82',\n gesdotol: '\\u2A84',\n gesl: '\\u22DB\\uFE00',\n gesles: '\\u2A94',\n Gfr: '\\uD835\\uDD0A',\n gfr: '\\uD835\\uDD24',\n Gg: '\\u22D9',\n gg: '\\u226B',\n ggg: '\\u22D9',\n gimel: '\\u2137',\n GJcy: '\\u0403',\n gjcy: '\\u0453',\n gl: '\\u2277',\n gla: '\\u2AA5',\n glE: '\\u2A92',\n glj: '\\u2AA4',\n gnap: '\\u2A8A',\n gnapprox: '\\u2A8A',\n gnE: '\\u2269',\n gne: '\\u2A88',\n gneq: '\\u2A88',\n gneqq: '\\u2269',\n gnsim: '\\u22E7',\n Gopf: '\\uD835\\uDD3E',\n gopf: '\\uD835\\uDD58',\n grave: '\\u0060',\n GreaterEqual: '\\u2265',\n GreaterEqualLess: '\\u22DB',\n GreaterFullEqual: '\\u2267',\n GreaterGreater: '\\u2AA2',\n GreaterLess: '\\u2277',\n GreaterSlantEqual: '\\u2A7E',\n GreaterTilde: '\\u2273',\n Gscr: '\\uD835\\uDCA2',\n gscr: '\\u210A',\n gsim: '\\u2273',\n gsime: '\\u2A8E',\n gsiml: '\\u2A90',\n Gt: '\\u226B',\n GT: '\\u003E',\n gt: '\\u003E',\n gtcc: '\\u2AA7',\n gtcir: '\\u2A7A',\n gtdot: '\\u22D7',\n gtlPar: '\\u2995',\n gtquest: '\\u2A7C',\n gtrapprox: '\\u2A86',\n gtrarr: '\\u2978',\n gtrdot: '\\u22D7',\n gtreqless: '\\u22DB',\n gtreqqless: '\\u2A8C',\n gtrless: '\\u2277',\n gtrsim: '\\u2273',\n gvertneqq: '\\u2269\\uFE00',\n gvnE: '\\u2269\\uFE00',\n Hacek: '\\u02C7',\n hairsp: '\\u200A',\n half: '\\u00BD',\n hamilt: '\\u210B',\n HARDcy: '\\u042A',\n hardcy: '\\u044A',\n hArr: '\\u21D4',\n harr: '\\u2194',\n harrcir: '\\u2948',\n harrw: '\\u21AD',\n Hat: '\\u005E',\n hbar: '\\u210F',\n Hcirc: '\\u0124',\n hcirc: '\\u0125',\n hearts: '\\u2665',\n heartsuit: '\\u2665',\n hellip: '\\u2026',\n hercon: '\\u22B9',\n Hfr: '\\u210C',\n hfr: '\\uD835\\uDD25',\n HilbertSpace: '\\u210B',\n hksearow: '\\u2925',\n hkswarow: '\\u2926',\n hoarr: '\\u21FF',\n homtht: '\\u223B',\n hookleftarrow: '\\u21A9',\n hookrightarrow: '\\u21AA',\n Hopf: '\\u210D',\n hopf: '\\uD835\\uDD59',\n horbar: '\\u2015',\n HorizontalLine: '\\u2500',\n Hscr: '\\u210B',\n hscr: '\\uD835\\uDCBD',\n hslash: '\\u210F',\n Hstrok: '\\u0126',\n hstrok: '\\u0127',\n HumpDownHump: '\\u224E',\n HumpEqual: '\\u224F',\n hybull: '\\u2043',\n hyphen: '\\u2010',\n Iacute: '\\u00CD',\n iacute: '\\u00ED',\n ic: '\\u2063',\n Icirc: '\\u00CE',\n icirc: '\\u00EE',\n Icy: '\\u0418',\n icy: '\\u0438',\n Idot: '\\u0130',\n IEcy: '\\u0415',\n iecy: '\\u0435',\n iexcl: '\\u00A1',\n iff: '\\u21D4',\n Ifr: '\\u2111',\n ifr: '\\uD835\\uDD26',\n Igrave: '\\u00CC',\n igrave: '\\u00EC',\n ii: '\\u2148',\n iiiint: '\\u2A0C',\n iiint: '\\u222D',\n iinfin: '\\u29DC',\n iiota: '\\u2129',\n IJlig: '\\u0132',\n ijlig: '\\u0133',\n Im: '\\u2111',\n Imacr: '\\u012A',\n imacr: '\\u012B',\n image: '\\u2111',\n ImaginaryI: '\\u2148',\n imagline: '\\u2110',\n imagpart: '\\u2111',\n imath: '\\u0131',\n imof: '\\u22B7',\n imped: '\\u01B5',\n Implies: '\\u21D2',\n in: '\\u2208',\n incare: '\\u2105',\n infin: '\\u221E',\n infintie: '\\u29DD',\n inodot: '\\u0131',\n Int: '\\u222C',\n int: '\\u222B',\n intcal: '\\u22BA',\n integers: '\\u2124',\n Integral: '\\u222B',\n intercal: '\\u22BA',\n Intersection: '\\u22C2',\n intlarhk: '\\u2A17',\n intprod: '\\u2A3C',\n InvisibleComma: '\\u2063',\n InvisibleTimes: '\\u2062',\n IOcy: '\\u0401',\n iocy: '\\u0451',\n Iogon: '\\u012E',\n iogon: '\\u012F',\n Iopf: '\\uD835\\uDD40',\n iopf: '\\uD835\\uDD5A',\n Iota: '\\u0399',\n iota: '\\u03B9',\n iprod: '\\u2A3C',\n iquest: '\\u00BF',\n Iscr: '\\u2110',\n iscr: '\\uD835\\uDCBE',\n isin: '\\u2208',\n isindot: '\\u22F5',\n isinE: '\\u22F9',\n isins: '\\u22F4',\n isinsv: '\\u22F3',\n isinv: '\\u2208',\n it: '\\u2062',\n Itilde: '\\u0128',\n itilde: '\\u0129',\n Iukcy: '\\u0406',\n iukcy: '\\u0456',\n Iuml: '\\u00CF',\n iuml: '\\u00EF',\n Jcirc: '\\u0134',\n jcirc: '\\u0135',\n Jcy: '\\u0419',\n jcy: '\\u0439',\n Jfr: '\\uD835\\uDD0D',\n jfr: '\\uD835\\uDD27',\n jmath: '\\u0237',\n Jopf: '\\uD835\\uDD41',\n jopf: '\\uD835\\uDD5B',\n Jscr: '\\uD835\\uDCA5',\n jscr: '\\uD835\\uDCBF',\n Jsercy: '\\u0408',\n jsercy: '\\u0458',\n Jukcy: '\\u0404',\n jukcy: '\\u0454',\n Kappa: '\\u039A',\n kappa: '\\u03BA',\n kappav: '\\u03F0',\n Kcedil: '\\u0136',\n kcedil: '\\u0137',\n Kcy: '\\u041A',\n kcy: '\\u043A',\n Kfr: '\\uD835\\uDD0E',\n kfr: '\\uD835\\uDD28',\n kgreen: '\\u0138',\n KHcy: '\\u0425',\n khcy: '\\u0445',\n KJcy: '\\u040C',\n kjcy: '\\u045C',\n Kopf: '\\uD835\\uDD42',\n kopf: '\\uD835\\uDD5C',\n Kscr: '\\uD835\\uDCA6',\n kscr: '\\uD835\\uDCC0',\n lAarr: '\\u21DA',\n Lacute: '\\u0139',\n lacute: '\\u013A',\n laemptyv: '\\u29B4',\n lagran: '\\u2112',\n Lambda: '\\u039B',\n lambda: '\\u03BB',\n Lang: '\\u27EA',\n lang: '\\u27E8',\n langd: '\\u2991',\n langle: '\\u27E8',\n lap: '\\u2A85',\n Laplacetrf: '\\u2112',\n laquo: '\\u00AB',\n Larr: '\\u219E',\n lArr: '\\u21D0',\n larr: '\\u2190',\n larrb: '\\u21E4',\n larrbfs: '\\u291F',\n larrfs: '\\u291D',\n larrhk: '\\u21A9',\n larrlp: '\\u21AB',\n larrpl: '\\u2939',\n larrsim: '\\u2973',\n larrtl: '\\u21A2',\n lat: '\\u2AAB',\n lAtail: '\\u291B',\n latail: '\\u2919',\n late: '\\u2AAD',\n lates: '\\u2AAD\\uFE00',\n lBarr: '\\u290E',\n lbarr: '\\u290C',\n lbbrk: '\\u2772',\n lbrace: '\\u007B',\n lbrack: '\\u005B',\n lbrke: '\\u298B',\n lbrksld: '\\u298F',\n lbrkslu: '\\u298D',\n Lcaron: '\\u013D',\n lcaron: '\\u013E',\n Lcedil: '\\u013B',\n lcedil: '\\u013C',\n lceil: '\\u2308',\n lcub: '\\u007B',\n Lcy: '\\u041B',\n lcy: '\\u043B',\n ldca: '\\u2936',\n ldquo: '\\u201C',\n ldquor: '\\u201E',\n ldrdhar: '\\u2967',\n ldrushar: '\\u294B',\n ldsh: '\\u21B2',\n lE: '\\u2266',\n le: '\\u2264',\n LeftAngleBracket: '\\u27E8',\n LeftArrow: '\\u2190',\n Leftarrow: '\\u21D0',\n leftarrow: '\\u2190',\n LeftArrowBar: '\\u21E4',\n LeftArrowRightArrow: '\\u21C6',\n leftarrowtail: '\\u21A2',\n LeftCeiling: '\\u2308',\n LeftDoubleBracket: '\\u27E6',\n LeftDownTeeVector: '\\u2961',\n LeftDownVector: '\\u21C3',\n LeftDownVectorBar: '\\u2959',\n LeftFloor: '\\u230A',\n leftharpoondown: '\\u21BD',\n leftharpoonup: '\\u21BC',\n leftleftarrows: '\\u21C7',\n LeftRightArrow: '\\u2194',\n Leftrightarrow: '\\u21D4',\n leftrightarrow: '\\u2194',\n leftrightarrows: '\\u21C6',\n leftrightharpoons: '\\u21CB',\n leftrightsquigarrow: '\\u21AD',\n LeftRightVector: '\\u294E',\n LeftTee: '\\u22A3',\n LeftTeeArrow: '\\u21A4',\n LeftTeeVector: '\\u295A',\n leftthreetimes: '\\u22CB',\n LeftTriangle: '\\u22B2',\n LeftTriangleBar: '\\u29CF',\n LeftTriangleEqual: '\\u22B4',\n LeftUpDownVector: '\\u2951',\n LeftUpTeeVector: '\\u2960',\n LeftUpVector: '\\u21BF',\n LeftUpVectorBar: '\\u2958',\n LeftVector: '\\u21BC',\n LeftVectorBar: '\\u2952',\n lEg: '\\u2A8B',\n leg: '\\u22DA',\n leq: '\\u2264',\n leqq: '\\u2266',\n leqslant: '\\u2A7D',\n les: '\\u2A7D',\n lescc: '\\u2AA8',\n lesdot: '\\u2A7F',\n lesdoto: '\\u2A81',\n lesdotor: '\\u2A83',\n lesg: '\\u22DA\\uFE00',\n lesges: '\\u2A93',\n lessapprox: '\\u2A85',\n lessdot: '\\u22D6',\n lesseqgtr: '\\u22DA',\n lesseqqgtr: '\\u2A8B',\n LessEqualGreater: '\\u22DA',\n LessFullEqual: '\\u2266',\n LessGreater: '\\u2276',\n lessgtr: '\\u2276',\n LessLess: '\\u2AA1',\n lesssim: '\\u2272',\n LessSlantEqual: '\\u2A7D',\n LessTilde: '\\u2272',\n lfisht: '\\u297C',\n lfloor: '\\u230A',\n Lfr: '\\uD835\\uDD0F',\n lfr: '\\uD835\\uDD29',\n lg: '\\u2276',\n lgE: '\\u2A91',\n lHar: '\\u2962',\n lhard: '\\u21BD',\n lharu: '\\u21BC',\n lharul: '\\u296A',\n lhblk: '\\u2584',\n LJcy: '\\u0409',\n ljcy: '\\u0459',\n Ll: '\\u22D8',\n ll: '\\u226A',\n llarr: '\\u21C7',\n llcorner: '\\u231E',\n Lleftarrow: '\\u21DA',\n llhard: '\\u296B',\n lltri: '\\u25FA',\n Lmidot: '\\u013F',\n lmidot: '\\u0140',\n lmoust: '\\u23B0',\n lmoustache: '\\u23B0',\n lnap: '\\u2A89',\n lnapprox: '\\u2A89',\n lnE: '\\u2268',\n lne: '\\u2A87',\n lneq: '\\u2A87',\n lneqq: '\\u2268',\n lnsim: '\\u22E6',\n loang: '\\u27EC',\n loarr: '\\u21FD',\n lobrk: '\\u27E6',\n LongLeftArrow: '\\u27F5',\n Longleftarrow: '\\u27F8',\n longleftarrow: '\\u27F5',\n LongLeftRightArrow: '\\u27F7',\n Longleftrightarrow: '\\u27FA',\n longleftrightarrow: '\\u27F7',\n longmapsto: '\\u27FC',\n LongRightArrow: '\\u27F6',\n Longrightarrow: '\\u27F9',\n longrightarrow: '\\u27F6',\n looparrowleft: '\\u21AB',\n looparrowright: '\\u21AC',\n lopar: '\\u2985',\n Lopf: '\\uD835\\uDD43',\n lopf: '\\uD835\\uDD5D',\n loplus: '\\u2A2D',\n lotimes: '\\u2A34',\n lowast: '\\u2217',\n lowbar: '\\u005F',\n LowerLeftArrow: '\\u2199',\n LowerRightArrow: '\\u2198',\n loz: '\\u25CA',\n lozenge: '\\u25CA',\n lozf: '\\u29EB',\n lpar: '\\u0028',\n lparlt: '\\u2993',\n lrarr: '\\u21C6',\n lrcorner: '\\u231F',\n lrhar: '\\u21CB',\n lrhard: '\\u296D',\n lrm: '\\u200E',\n lrtri: '\\u22BF',\n lsaquo: '\\u2039',\n Lscr: '\\u2112',\n lscr: '\\uD835\\uDCC1',\n Lsh: '\\u21B0',\n lsh: '\\u21B0',\n lsim: '\\u2272',\n lsime: '\\u2A8D',\n lsimg: '\\u2A8F',\n lsqb: '\\u005B',\n lsquo: '\\u2018',\n lsquor: '\\u201A',\n Lstrok: '\\u0141',\n lstrok: '\\u0142',\n Lt: '\\u226A',\n LT: '\\u003C',\n lt: '\\u003C',\n ltcc: '\\u2AA6',\n ltcir: '\\u2A79',\n ltdot: '\\u22D6',\n lthree: '\\u22CB',\n ltimes: '\\u22C9',\n ltlarr: '\\u2976',\n ltquest: '\\u2A7B',\n ltri: '\\u25C3',\n ltrie: '\\u22B4',\n ltrif: '\\u25C2',\n ltrPar: '\\u2996',\n lurdshar: '\\u294A',\n luruhar: '\\u2966',\n lvertneqq: '\\u2268\\uFE00',\n lvnE: '\\u2268\\uFE00',\n macr: '\\u00AF',\n male: '\\u2642',\n malt: '\\u2720',\n maltese: '\\u2720',\n Map: '\\u2905',\n map: '\\u21A6',\n mapsto: '\\u21A6',\n mapstodown: '\\u21A7',\n mapstoleft: '\\u21A4',\n mapstoup: '\\u21A5',\n marker: '\\u25AE',\n mcomma: '\\u2A29',\n Mcy: '\\u041C',\n mcy: '\\u043C',\n mdash: '\\u2014',\n mDDot: '\\u223A',\n measuredangle: '\\u2221',\n MediumSpace: '\\u205F',\n Mellintrf: '\\u2133',\n Mfr: '\\uD835\\uDD10',\n mfr: '\\uD835\\uDD2A',\n mho: '\\u2127',\n micro: '\\u00B5',\n mid: '\\u2223',\n midast: '\\u002A',\n midcir: '\\u2AF0',\n middot: '\\u00B7',\n minus: '\\u2212',\n minusb: '\\u229F',\n minusd: '\\u2238',\n minusdu: '\\u2A2A',\n MinusPlus: '\\u2213',\n mlcp: '\\u2ADB',\n mldr: '\\u2026',\n mnplus: '\\u2213',\n models: '\\u22A7',\n Mopf: '\\uD835\\uDD44',\n mopf: '\\uD835\\uDD5E',\n mp: '\\u2213',\n Mscr: '\\u2133',\n mscr: '\\uD835\\uDCC2',\n mstpos: '\\u223E',\n Mu: '\\u039C',\n mu: '\\u03BC',\n multimap: '\\u22B8',\n mumap: '\\u22B8',\n nabla: '\\u2207',\n Nacute: '\\u0143',\n nacute: '\\u0144',\n nang: '\\u2220\\u20D2',\n nap: '\\u2249',\n napE: '\\u2A70\\u0338',\n napid: '\\u224B\\u0338',\n napos: '\\u0149',\n napprox: '\\u2249',\n natur: '\\u266E',\n natural: '\\u266E',\n naturals: '\\u2115',\n nbsp: '\\u00A0',\n nbump: '\\u224E\\u0338',\n nbumpe: '\\u224F\\u0338',\n ncap: '\\u2A43',\n Ncaron: '\\u0147',\n ncaron: '\\u0148',\n Ncedil: '\\u0145',\n ncedil: '\\u0146',\n ncong: '\\u2247',\n ncongdot: '\\u2A6D\\u0338',\n ncup: '\\u2A42',\n Ncy: '\\u041D',\n ncy: '\\u043D',\n ndash: '\\u2013',\n ne: '\\u2260',\n nearhk: '\\u2924',\n neArr: '\\u21D7',\n nearr: '\\u2197',\n nearrow: '\\u2197',\n nedot: '\\u2250\\u0338',\n NegativeMediumSpace: '\\u200B',\n NegativeThickSpace: '\\u200B',\n NegativeThinSpace: '\\u200B',\n NegativeVeryThinSpace: '\\u200B',\n nequiv: '\\u2262',\n nesear: '\\u2928',\n nesim: '\\u2242\\u0338',\n NestedGreaterGreater: '\\u226B',\n NestedLessLess: '\\u226A',\n NewLine: '\\u000A',\n nexist: '\\u2204',\n nexists: '\\u2204',\n Nfr: '\\uD835\\uDD11',\n nfr: '\\uD835\\uDD2B',\n ngE: '\\u2267\\u0338',\n nge: '\\u2271',\n ngeq: '\\u2271',\n ngeqq: '\\u2267\\u0338',\n ngeqslant: '\\u2A7E\\u0338',\n nges: '\\u2A7E\\u0338',\n nGg: '\\u22D9\\u0338',\n ngsim: '\\u2275',\n nGt: '\\u226B\\u20D2',\n ngt: '\\u226F',\n ngtr: '\\u226F',\n nGtv: '\\u226B\\u0338',\n nhArr: '\\u21CE',\n nharr: '\\u21AE',\n nhpar: '\\u2AF2',\n ni: '\\u220B',\n nis: '\\u22FC',\n nisd: '\\u22FA',\n niv: '\\u220B',\n NJcy: '\\u040A',\n njcy: '\\u045A',\n nlArr: '\\u21CD',\n nlarr: '\\u219A',\n nldr: '\\u2025',\n nlE: '\\u2266\\u0338',\n nle: '\\u2270',\n nLeftarrow: '\\u21CD',\n nleftarrow: '\\u219A',\n nLeftrightarrow: '\\u21CE',\n nleftrightarrow: '\\u21AE',\n nleq: '\\u2270',\n nleqq: '\\u2266\\u0338',\n nleqslant: '\\u2A7D\\u0338',\n nles: '\\u2A7D\\u0338',\n nless: '\\u226E',\n nLl: '\\u22D8\\u0338',\n nlsim: '\\u2274',\n nLt: '\\u226A\\u20D2',\n nlt: '\\u226E',\n nltri: '\\u22EA',\n nltrie: '\\u22EC',\n nLtv: '\\u226A\\u0338',\n nmid: '\\u2224',\n NoBreak: '\\u2060',\n NonBreakingSpace: '\\u00A0',\n Nopf: '\\u2115',\n nopf: '\\uD835\\uDD5F',\n Not: '\\u2AEC',\n not: '\\u00AC',\n NotCongruent: '\\u2262',\n NotCupCap: '\\u226D',\n NotDoubleVerticalBar: '\\u2226',\n NotElement: '\\u2209',\n NotEqual: '\\u2260',\n NotEqualTilde: '\\u2242\\u0338',\n NotExists: '\\u2204',\n NotGreater: '\\u226F',\n NotGreaterEqual: '\\u2271',\n NotGreaterFullEqual: '\\u2267\\u0338',\n NotGreaterGreater: '\\u226B\\u0338',\n NotGreaterLess: '\\u2279',\n NotGreaterSlantEqual: '\\u2A7E\\u0338',\n NotGreaterTilde: '\\u2275',\n NotHumpDownHump: '\\u224E\\u0338',\n NotHumpEqual: '\\u224F\\u0338',\n notin: '\\u2209',\n notindot: '\\u22F5\\u0338',\n notinE: '\\u22F9\\u0338',\n notinva: '\\u2209',\n notinvb: '\\u22F7',\n notinvc: '\\u22F6',\n NotLeftTriangle: '\\u22EA',\n NotLeftTriangleBar: '\\u29CF\\u0338',\n NotLeftTriangleEqual: '\\u22EC',\n NotLess: '\\u226E',\n NotLessEqual: '\\u2270',\n NotLessGreater: '\\u2278',\n NotLessLess: '\\u226A\\u0338',\n NotLessSlantEqual: '\\u2A7D\\u0338',\n NotLessTilde: '\\u2274',\n NotNestedGreaterGreater: '\\u2AA2\\u0338',\n NotNestedLessLess: '\\u2AA1\\u0338',\n notni: '\\u220C',\n notniva: '\\u220C',\n notnivb: '\\u22FE',\n notnivc: '\\u22FD',\n NotPrecedes: '\\u2280',\n NotPrecedesEqual: '\\u2AAF\\u0338',\n NotPrecedesSlantEqual: '\\u22E0',\n NotReverseElement: '\\u220C',\n NotRightTriangle: '\\u22EB',\n NotRightTriangleBar: '\\u29D0\\u0338',\n NotRightTriangleEqual: '\\u22ED',\n NotSquareSubset: '\\u228F\\u0338',\n NotSquareSubsetEqual: '\\u22E2',\n NotSquareSuperset: '\\u2290\\u0338',\n NotSquareSupersetEqual: '\\u22E3',\n NotSubset: '\\u2282\\u20D2',\n NotSubsetEqual: '\\u2288',\n NotSucceeds: '\\u2281',\n NotSucceedsEqual: '\\u2AB0\\u0338',\n NotSucceedsSlantEqual: '\\u22E1',\n NotSucceedsTilde: '\\u227F\\u0338',\n NotSuperset: '\\u2283\\u20D2',\n NotSupersetEqual: '\\u2289',\n NotTilde: '\\u2241',\n NotTildeEqual: '\\u2244',\n NotTildeFullEqual: '\\u2247',\n NotTildeTilde: '\\u2249',\n NotVerticalBar: '\\u2224',\n npar: '\\u2226',\n nparallel: '\\u2226',\n nparsl: '\\u2AFD\\u20E5',\n npart: '\\u2202\\u0338',\n npolint: '\\u2A14',\n npr: '\\u2280',\n nprcue: '\\u22E0',\n npre: '\\u2AAF\\u0338',\n nprec: '\\u2280',\n npreceq: '\\u2AAF\\u0338',\n nrArr: '\\u21CF',\n nrarr: '\\u219B',\n nrarrc: '\\u2933\\u0338',\n nrarrw: '\\u219D\\u0338',\n nRightarrow: '\\u21CF',\n nrightarrow: '\\u219B',\n nrtri: '\\u22EB',\n nrtrie: '\\u22ED',\n nsc: '\\u2281',\n nsccue: '\\u22E1',\n nsce: '\\u2AB0\\u0338',\n Nscr: '\\uD835\\uDCA9',\n nscr: '\\uD835\\uDCC3',\n nshortmid: '\\u2224',\n nshortparallel: '\\u2226',\n nsim: '\\u2241',\n nsime: '\\u2244',\n nsimeq: '\\u2244',\n nsmid: '\\u2224',\n nspar: '\\u2226',\n nsqsube: '\\u22E2',\n nsqsupe: '\\u22E3',\n nsub: '\\u2284',\n nsubE: '\\u2AC5\\u0338',\n nsube: '\\u2288',\n nsubset: '\\u2282\\u20D2',\n nsubseteq: '\\u2288',\n nsubseteqq: '\\u2AC5\\u0338',\n nsucc: '\\u2281',\n nsucceq: '\\u2AB0\\u0338',\n nsup: '\\u2285',\n nsupE: '\\u2AC6\\u0338',\n nsupe: '\\u2289',\n nsupset: '\\u2283\\u20D2',\n nsupseteq: '\\u2289',\n nsupseteqq: '\\u2AC6\\u0338',\n ntgl: '\\u2279',\n Ntilde: '\\u00D1',\n ntilde: '\\u00F1',\n ntlg: '\\u2278',\n ntriangleleft: '\\u22EA',\n ntrianglelefteq: '\\u22EC',\n ntriangleright: '\\u22EB',\n ntrianglerighteq: '\\u22ED',\n Nu: '\\u039D',\n nu: '\\u03BD',\n num: '\\u0023',\n numero: '\\u2116',\n numsp: '\\u2007',\n nvap: '\\u224D\\u20D2',\n nVDash: '\\u22AF',\n nVdash: '\\u22AE',\n nvDash: '\\u22AD',\n nvdash: '\\u22AC',\n nvge: '\\u2265\\u20D2',\n nvgt: '\\u003E\\u20D2',\n nvHarr: '\\u2904',\n nvinfin: '\\u29DE',\n nvlArr: '\\u2902',\n nvle: '\\u2264\\u20D2',\n nvlt: '\\u003C\\u20D2',\n nvltrie: '\\u22B4\\u20D2',\n nvrArr: '\\u2903',\n nvrtrie: '\\u22B5\\u20D2',\n nvsim: '\\u223C\\u20D2',\n nwarhk: '\\u2923',\n nwArr: '\\u21D6',\n nwarr: '\\u2196',\n nwarrow: '\\u2196',\n nwnear: '\\u2927',\n Oacute: '\\u00D3',\n oacute: '\\u00F3',\n oast: '\\u229B',\n ocir: '\\u229A',\n Ocirc: '\\u00D4',\n ocirc: '\\u00F4',\n Ocy: '\\u041E',\n ocy: '\\u043E',\n odash: '\\u229D',\n Odblac: '\\u0150',\n odblac: '\\u0151',\n odiv: '\\u2A38',\n odot: '\\u2299',\n odsold: '\\u29BC',\n OElig: '\\u0152',\n oelig: '\\u0153',\n ofcir: '\\u29BF',\n Ofr: '\\uD835\\uDD12',\n ofr: '\\uD835\\uDD2C',\n ogon: '\\u02DB',\n Ograve: '\\u00D2',\n ograve: '\\u00F2',\n ogt: '\\u29C1',\n ohbar: '\\u29B5',\n ohm: '\\u03A9',\n oint: '\\u222E',\n olarr: '\\u21BA',\n olcir: '\\u29BE',\n olcross: '\\u29BB',\n oline: '\\u203E',\n olt: '\\u29C0',\n Omacr: '\\u014C',\n omacr: '\\u014D',\n Omega: '\\u03A9',\n omega: '\\u03C9',\n Omicron: '\\u039F',\n omicron: '\\u03BF',\n omid: '\\u29B6',\n ominus: '\\u2296',\n Oopf: '\\uD835\\uDD46',\n oopf: '\\uD835\\uDD60',\n opar: '\\u29B7',\n OpenCurlyDoubleQuote: '\\u201C',\n OpenCurlyQuote: '\\u2018',\n operp: '\\u29B9',\n oplus: '\\u2295',\n Or: '\\u2A54',\n or: '\\u2228',\n orarr: '\\u21BB',\n ord: '\\u2A5D',\n order: '\\u2134',\n orderof: '\\u2134',\n ordf: '\\u00AA',\n ordm: '\\u00BA',\n origof: '\\u22B6',\n oror: '\\u2A56',\n orslope: '\\u2A57',\n orv: '\\u2A5B',\n oS: '\\u24C8',\n Oscr: '\\uD835\\uDCAA',\n oscr: '\\u2134',\n Oslash: '\\u00D8',\n oslash: '\\u00F8',\n osol: '\\u2298',\n Otilde: '\\u00D5',\n otilde: '\\u00F5',\n Otimes: '\\u2A37',\n otimes: '\\u2297',\n otimesas: '\\u2A36',\n Ouml: '\\u00D6',\n ouml: '\\u00F6',\n ovbar: '\\u233D',\n OverBar: '\\u203E',\n OverBrace: '\\u23DE',\n OverBracket: '\\u23B4',\n OverParenthesis: '\\u23DC',\n par: '\\u2225',\n para: '\\u00B6',\n parallel: '\\u2225',\n parsim: '\\u2AF3',\n parsl: '\\u2AFD',\n part: '\\u2202',\n PartialD: '\\u2202',\n Pcy: '\\u041F',\n pcy: '\\u043F',\n percnt: '\\u0025',\n period: '\\u002E',\n permil: '\\u2030',\n perp: '\\u22A5',\n pertenk: '\\u2031',\n Pfr: '\\uD835\\uDD13',\n pfr: '\\uD835\\uDD2D',\n Phi: '\\u03A6',\n phi: '\\u03C6',\n phiv: '\\u03D5',\n phmmat: '\\u2133',\n phone: '\\u260E',\n Pi: '\\u03A0',\n pi: '\\u03C0',\n pitchfork: '\\u22D4',\n piv: '\\u03D6',\n planck: '\\u210F',\n planckh: '\\u210E',\n plankv: '\\u210F',\n plus: '\\u002B',\n plusacir: '\\u2A23',\n plusb: '\\u229E',\n pluscir: '\\u2A22',\n plusdo: '\\u2214',\n plusdu: '\\u2A25',\n pluse: '\\u2A72',\n PlusMinus: '\\u00B1',\n plusmn: '\\u00B1',\n plussim: '\\u2A26',\n plustwo: '\\u2A27',\n pm: '\\u00B1',\n Poincareplane: '\\u210C',\n pointint: '\\u2A15',\n Popf: '\\u2119',\n popf: '\\uD835\\uDD61',\n pound: '\\u00A3',\n Pr: '\\u2ABB',\n pr: '\\u227A',\n prap: '\\u2AB7',\n prcue: '\\u227C',\n prE: '\\u2AB3',\n pre: '\\u2AAF',\n prec: '\\u227A',\n precapprox: '\\u2AB7',\n preccurlyeq: '\\u227C',\n Precedes: '\\u227A',\n PrecedesEqual: '\\u2AAF',\n PrecedesSlantEqual: '\\u227C',\n PrecedesTilde: '\\u227E',\n preceq: '\\u2AAF',\n precnapprox: '\\u2AB9',\n precneqq: '\\u2AB5',\n precnsim: '\\u22E8',\n precsim: '\\u227E',\n Prime: '\\u2033',\n prime: '\\u2032',\n primes: '\\u2119',\n prnap: '\\u2AB9',\n prnE: '\\u2AB5',\n prnsim: '\\u22E8',\n prod: '\\u220F',\n Product: '\\u220F',\n profalar: '\\u232E',\n profline: '\\u2312',\n profsurf: '\\u2313',\n prop: '\\u221D',\n Proportion: '\\u2237',\n Proportional: '\\u221D',\n propto: '\\u221D',\n prsim: '\\u227E',\n prurel: '\\u22B0',\n Pscr: '\\uD835\\uDCAB',\n pscr: '\\uD835\\uDCC5',\n Psi: '\\u03A8',\n psi: '\\u03C8',\n puncsp: '\\u2008',\n Qfr: '\\uD835\\uDD14',\n qfr: '\\uD835\\uDD2E',\n qint: '\\u2A0C',\n Qopf: '\\u211A',\n qopf: '\\uD835\\uDD62',\n qprime: '\\u2057',\n Qscr: '\\uD835\\uDCAC',\n qscr: '\\uD835\\uDCC6',\n quaternions: '\\u210D',\n quatint: '\\u2A16',\n quest: '\\u003F',\n questeq: '\\u225F',\n QUOT: '\\u0022',\n quot: '\\u0022',\n rAarr: '\\u21DB',\n race: '\\u223D\\u0331',\n Racute: '\\u0154',\n racute: '\\u0155',\n radic: '\\u221A',\n raemptyv: '\\u29B3',\n Rang: '\\u27EB',\n rang: '\\u27E9',\n rangd: '\\u2992',\n range: '\\u29A5',\n rangle: '\\u27E9',\n raquo: '\\u00BB',\n Rarr: '\\u21A0',\n rArr: '\\u21D2',\n rarr: '\\u2192',\n rarrap: '\\u2975',\n rarrb: '\\u21E5',\n rarrbfs: '\\u2920',\n rarrc: '\\u2933',\n rarrfs: '\\u291E',\n rarrhk: '\\u21AA',\n rarrlp: '\\u21AC',\n rarrpl: '\\u2945',\n rarrsim: '\\u2974',\n Rarrtl: '\\u2916',\n rarrtl: '\\u21A3',\n rarrw: '\\u219D',\n rAtail: '\\u291C',\n ratail: '\\u291A',\n ratio: '\\u2236',\n rationals: '\\u211A',\n RBarr: '\\u2910',\n rBarr: '\\u290F',\n rbarr: '\\u290D',\n rbbrk: '\\u2773',\n rbrace: '\\u007D',\n rbrack: '\\u005D',\n rbrke: '\\u298C',\n rbrksld: '\\u298E',\n rbrkslu: '\\u2990',\n Rcaron: '\\u0158',\n rcaron: '\\u0159',\n Rcedil: '\\u0156',\n rcedil: '\\u0157',\n rceil: '\\u2309',\n rcub: '\\u007D',\n Rcy: '\\u0420',\n rcy: '\\u0440',\n rdca: '\\u2937',\n rdldhar: '\\u2969',\n rdquo: '\\u201D',\n rdquor: '\\u201D',\n rdsh: '\\u21B3',\n Re: '\\u211C',\n real: '\\u211C',\n realine: '\\u211B',\n realpart: '\\u211C',\n reals: '\\u211D',\n rect: '\\u25AD',\n REG: '\\u00AE',\n reg: '\\u00AE',\n ReverseElement: '\\u220B',\n ReverseEquilibrium: '\\u21CB',\n ReverseUpEquilibrium: '\\u296F',\n rfisht: '\\u297D',\n rfloor: '\\u230B',\n Rfr: '\\u211C',\n rfr: '\\uD835\\uDD2F',\n rHar: '\\u2964',\n rhard: '\\u21C1',\n rharu: '\\u21C0',\n rharul: '\\u296C',\n Rho: '\\u03A1',\n rho: '\\u03C1',\n rhov: '\\u03F1',\n RightAngleBracket: '\\u27E9',\n RightArrow: '\\u2192',\n Rightarrow: '\\u21D2',\n rightarrow: '\\u2192',\n RightArrowBar: '\\u21E5',\n RightArrowLeftArrow: '\\u21C4',\n rightarrowtail: '\\u21A3',\n RightCeiling: '\\u2309',\n RightDoubleBracket: '\\u27E7',\n RightDownTeeVector: '\\u295D',\n RightDownVector: '\\u21C2',\n RightDownVectorBar: '\\u2955',\n RightFloor: '\\u230B',\n rightharpoondown: '\\u21C1',\n rightharpoonup: '\\u21C0',\n rightleftarrows: '\\u21C4',\n rightleftharpoons: '\\u21CC',\n rightrightarrows: '\\u21C9',\n rightsquigarrow: '\\u219D',\n RightTee: '\\u22A2',\n RightTeeArrow: '\\u21A6',\n RightTeeVector: '\\u295B',\n rightthreetimes: '\\u22CC',\n RightTriangle: '\\u22B3',\n RightTriangleBar: '\\u29D0',\n RightTriangleEqual: '\\u22B5',\n RightUpDownVector: '\\u294F',\n RightUpTeeVector: '\\u295C',\n RightUpVector: '\\u21BE',\n RightUpVectorBar: '\\u2954',\n RightVector: '\\u21C0',\n RightVectorBar: '\\u2953',\n ring: '\\u02DA',\n risingdotseq: '\\u2253',\n rlarr: '\\u21C4',\n rlhar: '\\u21CC',\n rlm: '\\u200F',\n rmoust: '\\u23B1',\n rmoustache: '\\u23B1',\n rnmid: '\\u2AEE',\n roang: '\\u27ED',\n roarr: '\\u21FE',\n robrk: '\\u27E7',\n ropar: '\\u2986',\n Ropf: '\\u211D',\n ropf: '\\uD835\\uDD63',\n roplus: '\\u2A2E',\n rotimes: '\\u2A35',\n RoundImplies: '\\u2970',\n rpar: '\\u0029',\n rpargt: '\\u2994',\n rppolint: '\\u2A12',\n rrarr: '\\u21C9',\n Rrightarrow: '\\u21DB',\n rsaquo: '\\u203A',\n Rscr: '\\u211B',\n rscr: '\\uD835\\uDCC7',\n Rsh: '\\u21B1',\n rsh: '\\u21B1',\n rsqb: '\\u005D',\n rsquo: '\\u2019',\n rsquor: '\\u2019',\n rthree: '\\u22CC',\n rtimes: '\\u22CA',\n rtri: '\\u25B9',\n rtrie: '\\u22B5',\n rtrif: '\\u25B8',\n rtriltri: '\\u29CE',\n RuleDelayed: '\\u29F4',\n ruluhar: '\\u2968',\n rx: '\\u211E',\n Sacute: '\\u015A',\n sacute: '\\u015B',\n sbquo: '\\u201A',\n Sc: '\\u2ABC',\n sc: '\\u227B',\n scap: '\\u2AB8',\n Scaron: '\\u0160',\n scaron: '\\u0161',\n sccue: '\\u227D',\n scE: '\\u2AB4',\n sce: '\\u2AB0',\n Scedil: '\\u015E',\n scedil: '\\u015F',\n Scirc: '\\u015C',\n scirc: '\\u015D',\n scnap: '\\u2ABA',\n scnE: '\\u2AB6',\n scnsim: '\\u22E9',\n scpolint: '\\u2A13',\n scsim: '\\u227F',\n Scy: '\\u0421',\n scy: '\\u0441',\n sdot: '\\u22C5',\n sdotb: '\\u22A1',\n sdote: '\\u2A66',\n searhk: '\\u2925',\n seArr: '\\u21D8',\n searr: '\\u2198',\n searrow: '\\u2198',\n sect: '\\u00A7',\n semi: '\\u003B',\n seswar: '\\u2929',\n setminus: '\\u2216',\n setmn: '\\u2216',\n sext: '\\u2736',\n Sfr: '\\uD835\\uDD16',\n sfr: '\\uD835\\uDD30',\n sfrown: '\\u2322',\n sharp: '\\u266F',\n SHCHcy: '\\u0429',\n shchcy: '\\u0449',\n SHcy: '\\u0428',\n shcy: '\\u0448',\n ShortDownArrow: '\\u2193',\n ShortLeftArrow: '\\u2190',\n shortmid: '\\u2223',\n shortparallel: '\\u2225',\n ShortRightArrow: '\\u2192',\n ShortUpArrow: '\\u2191',\n shy: '\\u00AD',\n Sigma: '\\u03A3',\n sigma: '\\u03C3',\n sigmaf: '\\u03C2',\n sigmav: '\\u03C2',\n sim: '\\u223C',\n simdot: '\\u2A6A',\n sime: '\\u2243',\n simeq: '\\u2243',\n simg: '\\u2A9E',\n simgE: '\\u2AA0',\n siml: '\\u2A9D',\n simlE: '\\u2A9F',\n simne: '\\u2246',\n simplus: '\\u2A24',\n simrarr: '\\u2972',\n slarr: '\\u2190',\n SmallCircle: '\\u2218',\n smallsetminus: '\\u2216',\n smashp: '\\u2A33',\n smeparsl: '\\u29E4',\n smid: '\\u2223',\n smile: '\\u2323',\n smt: '\\u2AAA',\n smte: '\\u2AAC',\n smtes: '\\u2AAC\\uFE00',\n SOFTcy: '\\u042C',\n softcy: '\\u044C',\n sol: '\\u002F',\n solb: '\\u29C4',\n solbar: '\\u233F',\n Sopf: '\\uD835\\uDD4A',\n sopf: '\\uD835\\uDD64',\n spades: '\\u2660',\n spadesuit: '\\u2660',\n spar: '\\u2225',\n sqcap: '\\u2293',\n sqcaps: '\\u2293\\uFE00',\n sqcup: '\\u2294',\n sqcups: '\\u2294\\uFE00',\n Sqrt: '\\u221A',\n sqsub: '\\u228F',\n sqsube: '\\u2291',\n sqsubset: '\\u228F',\n sqsubseteq: '\\u2291',\n sqsup: '\\u2290',\n sqsupe: '\\u2292',\n sqsupset: '\\u2290',\n sqsupseteq: '\\u2292',\n squ: '\\u25A1',\n Square: '\\u25A1',\n square: '\\u25A1',\n SquareIntersection: '\\u2293',\n SquareSubset: '\\u228F',\n SquareSubsetEqual: '\\u2291',\n SquareSuperset: '\\u2290',\n SquareSupersetEqual: '\\u2292',\n SquareUnion: '\\u2294',\n squarf: '\\u25AA',\n squf: '\\u25AA',\n srarr: '\\u2192',\n Sscr: '\\uD835\\uDCAE',\n sscr: '\\uD835\\uDCC8',\n ssetmn: '\\u2216',\n ssmile: '\\u2323',\n sstarf: '\\u22C6',\n Star: '\\u22C6',\n star: '\\u2606',\n starf: '\\u2605',\n straightepsilon: '\\u03F5',\n straightphi: '\\u03D5',\n strns: '\\u00AF',\n Sub: '\\u22D0',\n sub: '\\u2282',\n subdot: '\\u2ABD',\n subE: '\\u2AC5',\n sube: '\\u2286',\n subedot: '\\u2AC3',\n submult: '\\u2AC1',\n subnE: '\\u2ACB',\n subne: '\\u228A',\n subplus: '\\u2ABF',\n subrarr: '\\u2979',\n Subset: '\\u22D0',\n subset: '\\u2282',\n subseteq: '\\u2286',\n subseteqq: '\\u2AC5',\n SubsetEqual: '\\u2286',\n subsetneq: '\\u228A',\n subsetneqq: '\\u2ACB',\n subsim: '\\u2AC7',\n subsub: '\\u2AD5',\n subsup: '\\u2AD3',\n succ: '\\u227B',\n succapprox: '\\u2AB8',\n succcurlyeq: '\\u227D',\n Succeeds: '\\u227B',\n SucceedsEqual: '\\u2AB0',\n SucceedsSlantEqual: '\\u227D',\n SucceedsTilde: '\\u227F',\n succeq: '\\u2AB0',\n succnapprox: '\\u2ABA',\n succneqq: '\\u2AB6',\n succnsim: '\\u22E9',\n succsim: '\\u227F',\n SuchThat: '\\u220B',\n Sum: '\\u2211',\n sum: '\\u2211',\n sung: '\\u266A',\n Sup: '\\u22D1',\n sup: '\\u2283',\n sup1: '\\u00B9',\n sup2: '\\u00B2',\n sup3: '\\u00B3',\n supdot: '\\u2ABE',\n supdsub: '\\u2AD8',\n supE: '\\u2AC6',\n supe: '\\u2287',\n supedot: '\\u2AC4',\n Superset: '\\u2283',\n SupersetEqual: '\\u2287',\n suphsol: '\\u27C9',\n suphsub: '\\u2AD7',\n suplarr: '\\u297B',\n supmult: '\\u2AC2',\n supnE: '\\u2ACC',\n supne: '\\u228B',\n supplus: '\\u2AC0',\n Supset: '\\u22D1',\n supset: '\\u2283',\n supseteq: '\\u2287',\n supseteqq: '\\u2AC6',\n supsetneq: '\\u228B',\n supsetneqq: '\\u2ACC',\n supsim: '\\u2AC8',\n supsub: '\\u2AD4',\n supsup: '\\u2AD6',\n swarhk: '\\u2926',\n swArr: '\\u21D9',\n swarr: '\\u2199',\n swarrow: '\\u2199',\n swnwar: '\\u292A',\n szlig: '\\u00DF',\n Tab: '\\u0009',\n target: '\\u2316',\n Tau: '\\u03A4',\n tau: '\\u03C4',\n tbrk: '\\u23B4',\n Tcaron: '\\u0164',\n tcaron: '\\u0165',\n Tcedil: '\\u0162',\n tcedil: '\\u0163',\n Tcy: '\\u0422',\n tcy: '\\u0442',\n tdot: '\\u20DB',\n telrec: '\\u2315',\n Tfr: '\\uD835\\uDD17',\n tfr: '\\uD835\\uDD31',\n there4: '\\u2234',\n Therefore: '\\u2234',\n therefore: '\\u2234',\n Theta: '\\u0398',\n theta: '\\u03B8',\n thetasym: '\\u03D1',\n thetav: '\\u03D1',\n thickapprox: '\\u2248',\n thicksim: '\\u223C',\n ThickSpace: '\\u205F\\u200A',\n thinsp: '\\u2009',\n ThinSpace: '\\u2009',\n thkap: '\\u2248',\n thksim: '\\u223C',\n THORN: '\\u00DE',\n thorn: '\\u00FE',\n Tilde: '\\u223C',\n tilde: '\\u02DC',\n TildeEqual: '\\u2243',\n TildeFullEqual: '\\u2245',\n TildeTilde: '\\u2248',\n times: '\\u00D7',\n timesb: '\\u22A0',\n timesbar: '\\u2A31',\n timesd: '\\u2A30',\n tint: '\\u222D',\n toea: '\\u2928',\n top: '\\u22A4',\n topbot: '\\u2336',\n topcir: '\\u2AF1',\n Topf: '\\uD835\\uDD4B',\n topf: '\\uD835\\uDD65',\n topfork: '\\u2ADA',\n tosa: '\\u2929',\n tprime: '\\u2034',\n TRADE: '\\u2122',\n trade: '\\u2122',\n triangle: '\\u25B5',\n triangledown: '\\u25BF',\n triangleleft: '\\u25C3',\n trianglelefteq: '\\u22B4',\n triangleq: '\\u225C',\n triangleright: '\\u25B9',\n trianglerighteq: '\\u22B5',\n tridot: '\\u25EC',\n trie: '\\u225C',\n triminus: '\\u2A3A',\n TripleDot: '\\u20DB',\n triplus: '\\u2A39',\n trisb: '\\u29CD',\n tritime: '\\u2A3B',\n trpezium: '\\u23E2',\n Tscr: '\\uD835\\uDCAF',\n tscr: '\\uD835\\uDCC9',\n TScy: '\\u0426',\n tscy: '\\u0446',\n TSHcy: '\\u040B',\n tshcy: '\\u045B',\n Tstrok: '\\u0166',\n tstrok: '\\u0167',\n twixt: '\\u226C',\n twoheadleftarrow: '\\u219E',\n twoheadrightarrow: '\\u21A0',\n Uacute: '\\u00DA',\n uacute: '\\u00FA',\n Uarr: '\\u219F',\n uArr: '\\u21D1',\n uarr: '\\u2191',\n Uarrocir: '\\u2949',\n Ubrcy: '\\u040E',\n ubrcy: '\\u045E',\n Ubreve: '\\u016C',\n ubreve: '\\u016D',\n Ucirc: '\\u00DB',\n ucirc: '\\u00FB',\n Ucy: '\\u0423',\n ucy: '\\u0443',\n udarr: '\\u21C5',\n Udblac: '\\u0170',\n udblac: '\\u0171',\n udhar: '\\u296E',\n ufisht: '\\u297E',\n Ufr: '\\uD835\\uDD18',\n ufr: '\\uD835\\uDD32',\n Ugrave: '\\u00D9',\n ugrave: '\\u00F9',\n uHar: '\\u2963',\n uharl: '\\u21BF',\n uharr: '\\u21BE',\n uhblk: '\\u2580',\n ulcorn: '\\u231C',\n ulcorner: '\\u231C',\n ulcrop: '\\u230F',\n ultri: '\\u25F8',\n Umacr: '\\u016A',\n umacr: '\\u016B',\n uml: '\\u00A8',\n UnderBar: '\\u005F',\n UnderBrace: '\\u23DF',\n UnderBracket: '\\u23B5',\n UnderParenthesis: '\\u23DD',\n Union: '\\u22C3',\n UnionPlus: '\\u228E',\n Uogon: '\\u0172',\n uogon: '\\u0173',\n Uopf: '\\uD835\\uDD4C',\n uopf: '\\uD835\\uDD66',\n UpArrow: '\\u2191',\n Uparrow: '\\u21D1',\n uparrow: '\\u2191',\n UpArrowBar: '\\u2912',\n UpArrowDownArrow: '\\u21C5',\n UpDownArrow: '\\u2195',\n Updownarrow: '\\u21D5',\n updownarrow: '\\u2195',\n UpEquilibrium: '\\u296E',\n upharpoonleft: '\\u21BF',\n upharpoonright: '\\u21BE',\n uplus: '\\u228E',\n UpperLeftArrow: '\\u2196',\n UpperRightArrow: '\\u2197',\n Upsi: '\\u03D2',\n upsi: '\\u03C5',\n upsih: '\\u03D2',\n Upsilon: '\\u03A5',\n upsilon: '\\u03C5',\n UpTee: '\\u22A5',\n UpTeeArrow: '\\u21A5',\n upuparrows: '\\u21C8',\n urcorn: '\\u231D',\n urcorner: '\\u231D',\n urcrop: '\\u230E',\n Uring: '\\u016E',\n uring: '\\u016F',\n urtri: '\\u25F9',\n Uscr: '\\uD835\\uDCB0',\n uscr: '\\uD835\\uDCCA',\n utdot: '\\u22F0',\n Utilde: '\\u0168',\n utilde: '\\u0169',\n utri: '\\u25B5',\n utrif: '\\u25B4',\n uuarr: '\\u21C8',\n Uuml: '\\u00DC',\n uuml: '\\u00FC',\n uwangle: '\\u29A7',\n vangrt: '\\u299C',\n varepsilon: '\\u03F5',\n varkappa: '\\u03F0',\n varnothing: '\\u2205',\n varphi: '\\u03D5',\n varpi: '\\u03D6',\n varpropto: '\\u221D',\n vArr: '\\u21D5',\n varr: '\\u2195',\n varrho: '\\u03F1',\n varsigma: '\\u03C2',\n varsubsetneq: '\\u228A\\uFE00',\n varsubsetneqq: '\\u2ACB\\uFE00',\n varsupsetneq: '\\u228B\\uFE00',\n varsupsetneqq: '\\u2ACC\\uFE00',\n vartheta: '\\u03D1',\n vartriangleleft: '\\u22B2',\n vartriangleright: '\\u22B3',\n Vbar: '\\u2AEB',\n vBar: '\\u2AE8',\n vBarv: '\\u2AE9',\n Vcy: '\\u0412',\n vcy: '\\u0432',\n VDash: '\\u22AB',\n Vdash: '\\u22A9',\n vDash: '\\u22A8',\n vdash: '\\u22A2',\n Vdashl: '\\u2AE6',\n Vee: '\\u22C1',\n vee: '\\u2228',\n veebar: '\\u22BB',\n veeeq: '\\u225A',\n vellip: '\\u22EE',\n Verbar: '\\u2016',\n verbar: '\\u007C',\n Vert: '\\u2016',\n vert: '\\u007C',\n VerticalBar: '\\u2223',\n VerticalLine: '\\u007C',\n VerticalSeparator: '\\u2758',\n VerticalTilde: '\\u2240',\n VeryThinSpace: '\\u200A',\n Vfr: '\\uD835\\uDD19',\n vfr: '\\uD835\\uDD33',\n vltri: '\\u22B2',\n vnsub: '\\u2282\\u20D2',\n vnsup: '\\u2283\\u20D2',\n Vopf: '\\uD835\\uDD4D',\n vopf: '\\uD835\\uDD67',\n vprop: '\\u221D',\n vrtri: '\\u22B3',\n Vscr: '\\uD835\\uDCB1',\n vscr: '\\uD835\\uDCCB',\n vsubnE: '\\u2ACB\\uFE00',\n vsubne: '\\u228A\\uFE00',\n vsupnE: '\\u2ACC\\uFE00',\n vsupne: '\\u228B\\uFE00',\n Vvdash: '\\u22AA',\n vzigzag: '\\u299A',\n Wcirc: '\\u0174',\n wcirc: '\\u0175',\n wedbar: '\\u2A5F',\n Wedge: '\\u22C0',\n wedge: '\\u2227',\n wedgeq: '\\u2259',\n weierp: '\\u2118',\n Wfr: '\\uD835\\uDD1A',\n wfr: '\\uD835\\uDD34',\n Wopf: '\\uD835\\uDD4E',\n wopf: '\\uD835\\uDD68',\n wp: '\\u2118',\n wr: '\\u2240',\n wreath: '\\u2240',\n Wscr: '\\uD835\\uDCB2',\n wscr: '\\uD835\\uDCCC',\n xcap: '\\u22C2',\n xcirc: '\\u25EF',\n xcup: '\\u22C3',\n xdtri: '\\u25BD',\n Xfr: '\\uD835\\uDD1B',\n xfr: '\\uD835\\uDD35',\n xhArr: '\\u27FA',\n xharr: '\\u27F7',\n Xi: '\\u039E',\n xi: '\\u03BE',\n xlArr: '\\u27F8',\n xlarr: '\\u27F5',\n xmap: '\\u27FC',\n xnis: '\\u22FB',\n xodot: '\\u2A00',\n Xopf: '\\uD835\\uDD4F',\n xopf: '\\uD835\\uDD69',\n xoplus: '\\u2A01',\n xotime: '\\u2A02',\n xrArr: '\\u27F9',\n xrarr: '\\u27F6',\n Xscr: '\\uD835\\uDCB3',\n xscr: '\\uD835\\uDCCD',\n xsqcup: '\\u2A06',\n xuplus: '\\u2A04',\n xutri: '\\u25B3',\n xvee: '\\u22C1',\n xwedge: '\\u22C0',\n Yacute: '\\u00DD',\n yacute: '\\u00FD',\n YAcy: '\\u042F',\n yacy: '\\u044F',\n Ycirc: '\\u0176',\n ycirc: '\\u0177',\n Ycy: '\\u042B',\n ycy: '\\u044B',\n yen: '\\u00A5',\n Yfr: '\\uD835\\uDD1C',\n yfr: '\\uD835\\uDD36',\n YIcy: '\\u0407',\n yicy: '\\u0457',\n Yopf: '\\uD835\\uDD50',\n yopf: '\\uD835\\uDD6A',\n Yscr: '\\uD835\\uDCB4',\n yscr: '\\uD835\\uDCCE',\n YUcy: '\\u042E',\n yucy: '\\u044E',\n Yuml: '\\u0178',\n yuml: '\\u00FF',\n Zacute: '\\u0179',\n zacute: '\\u017A',\n Zcaron: '\\u017D',\n zcaron: '\\u017E',\n Zcy: '\\u0417',\n zcy: '\\u0437',\n Zdot: '\\u017B',\n zdot: '\\u017C',\n zeetrf: '\\u2128',\n ZeroWidthSpace: '\\u200B',\n Zeta: '\\u0396',\n zeta: '\\u03B6',\n Zfr: '\\u2128',\n zfr: '\\uD835\\uDD37',\n ZHcy: '\\u0416',\n zhcy: '\\u0436',\n zigrarr: '\\u21DD',\n Zopf: '\\u2124',\n zopf: '\\uD835\\uDD6B',\n Zscr: '\\uD835\\uDCB5',\n zscr: '\\uD835\\uDCCF',\n zwj: '\\u200D',\n zwnj: '\\u200C'\n});\n\n/**\n * @deprecated use `HTML_ENTITIES` instead\n * @see HTML_ENTITIES\n */\nexports.entityMap = exports.HTML_ENTITIES;","var NAMESPACE = require(\"./conventions\").NAMESPACE;\n\n//[4] \tNameStartChar\t ::= \t\":\" | [A-Z] | \"_\" | [a-z] | [#xC0-#xD6] | [#xD8-#xF6] | [#xF8-#x2FF] | [#x370-#x37D] | [#x37F-#x1FFF] | [#x200C-#x200D] | [#x2070-#x218F] | [#x2C00-#x2FEF] | [#x3001-#xD7FF] | [#xF900-#xFDCF] | [#xFDF0-#xFFFD] | [#x10000-#xEFFFF]\n//[4a] \tNameChar\t ::= \tNameStartChar | \"-\" | \".\" | [0-9] | #xB7 | [#x0300-#x036F] | [#x203F-#x2040]\n//[5] \tName\t ::= \tNameStartChar (NameChar)*\nvar nameStartChar = /[A-Z_a-z\\xC0-\\xD6\\xD8-\\xF6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD]/; //\\u10000-\\uEFFFF\nvar nameChar = new RegExp(\"[\\\\-\\\\.0-9\" + nameStartChar.source.slice(1, -1) + \"\\\\u00B7\\\\u0300-\\\\u036F\\\\u203F-\\\\u2040]\");\nvar tagNamePattern = new RegExp('^' + nameStartChar.source + nameChar.source + '*(?:\\:' + nameStartChar.source + nameChar.source + '*)?$');\n//var tagNamePattern = /^[a-zA-Z_][\\w\\-\\.]*(?:\\:[a-zA-Z_][\\w\\-\\.]*)?$/\n//var handlers = 'resolveEntity,getExternalSubset,characters,endDocument,endElement,endPrefixMapping,ignorableWhitespace,processingInstruction,setDocumentLocator,skippedEntity,startDocument,startElement,startPrefixMapping,notationDecl,unparsedEntityDecl,error,fatalError,warning,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,comment,endCDATA,endDTD,endEntity,startCDATA,startDTD,startEntity'.split(',')\n\n//S_TAG,\tS_ATTR,\tS_EQ,\tS_ATTR_NOQUOT_VALUE\n//S_ATTR_SPACE,\tS_ATTR_END,\tS_TAG_SPACE, S_TAG_CLOSE\nvar S_TAG = 0; //tag name offerring\nvar S_ATTR = 1; //attr name offerring\nvar S_ATTR_SPACE = 2; //attr name end and space offer\nvar S_EQ = 3; //=space?\nvar S_ATTR_NOQUOT_VALUE = 4; //attr value(no quot value only)\nvar S_ATTR_END = 5; //attr value end and no space(quot end)\nvar S_TAG_SPACE = 6; //(attr value end || tag end ) && (space offer)\nvar S_TAG_CLOSE = 7; //closed el\n\n/**\n * Creates an error that will not be caught by XMLReader aka the SAX parser.\n *\n * @param {string} message\n * @param {any?} locator Optional, can provide details about the location in the source\n * @constructor\n */\nfunction ParseError(message, locator) {\n this.message = message;\n this.locator = locator;\n if (Error.captureStackTrace) Error.captureStackTrace(this, ParseError);\n}\nParseError.prototype = new Error();\nParseError.prototype.name = ParseError.name;\nfunction XMLReader() {}\nXMLReader.prototype = {\n parse: function (source, defaultNSMap, entityMap) {\n var domBuilder = this.domBuilder;\n domBuilder.startDocument();\n _copy(defaultNSMap, defaultNSMap = {});\n parse(source, defaultNSMap, entityMap, domBuilder, this.errorHandler);\n domBuilder.endDocument();\n }\n};\nfunction parse(source, defaultNSMapCopy, entityMap, domBuilder, errorHandler) {\n function fixedFromCharCode(code) {\n // String.prototype.fromCharCode does not supports\n // > 2 bytes unicode chars directly\n if (code > 0xffff) {\n code -= 0x10000;\n var surrogate1 = 0xd800 + (code >> 10),\n surrogate2 = 0xdc00 + (code & 0x3ff);\n return String.fromCharCode(surrogate1, surrogate2);\n } else {\n return String.fromCharCode(code);\n }\n }\n function entityReplacer(a) {\n var k = a.slice(1, -1);\n if (Object.hasOwnProperty.call(entityMap, k)) {\n return entityMap[k];\n } else if (k.charAt(0) === '#') {\n return fixedFromCharCode(parseInt(k.substr(1).replace('x', '0x')));\n } else {\n errorHandler.error('entity not found:' + a);\n return a;\n }\n }\n function appendText(end) {\n //has some bugs\n if (end > start) {\n var xt = source.substring(start, end).replace(/&#?\\w+;/g, entityReplacer);\n locator && position(start);\n domBuilder.characters(xt, 0, end - start);\n start = end;\n }\n }\n function position(p, m) {\n while (p >= lineEnd && (m = linePattern.exec(source))) {\n lineStart = m.index;\n lineEnd = lineStart + m[0].length;\n locator.lineNumber++;\n //console.log('line++:',locator,startPos,endPos)\n }\n locator.columnNumber = p - lineStart + 1;\n }\n var lineStart = 0;\n var lineEnd = 0;\n var linePattern = /.*(?:\\r\\n?|\\n)|.*$/g;\n var locator = domBuilder.locator;\n var parseStack = [{\n currentNSMap: defaultNSMapCopy\n }];\n var closeMap = {};\n var start = 0;\n while (true) {\n try {\n var tagStart = source.indexOf('<', start);\n if (tagStart < 0) {\n if (!source.substr(start).match(/^\\s*$/)) {\n var doc = domBuilder.doc;\n var text = doc.createTextNode(source.substr(start));\n doc.appendChild(text);\n domBuilder.currentElement = text;\n }\n return;\n }\n if (tagStart > start) {\n appendText(tagStart);\n }\n switch (source.charAt(tagStart + 1)) {\n case '/':\n var end = source.indexOf('>', tagStart + 3);\n var tagName = source.substring(tagStart + 2, end).replace(/[ \\t\\n\\r]+$/g, '');\n var config = parseStack.pop();\n if (end < 0) {\n tagName = source.substring(tagStart + 2).replace(/[\\s<].*/, '');\n errorHandler.error(\"end tag name: \" + tagName + ' is not complete:' + config.tagName);\n end = tagStart + 1 + tagName.length;\n } else if (tagName.match(/\\s\n locator && position(tagStart);\n end = parseInstruction(source, tagStart, domBuilder);\n break;\n case '!':\n // start) {\n start = end;\n } else {\n //TODO: 这里有可能sax回退,有位置错误风险\n appendText(Math.max(tagStart, start) + 1);\n }\n }\n}\nfunction copyLocator(f, t) {\n t.lineNumber = f.lineNumber;\n t.columnNumber = f.columnNumber;\n return t;\n}\n\n/**\n * @see #appendElement(source,elStartEnd,el,selfClosed,entityReplacer,domBuilder,parseStack);\n * @return end of the elementStartPart(end of elementEndPart for selfClosed el)\n */\nfunction parseElementStartPart(source, start, el, currentNSMap, entityReplacer, errorHandler) {\n /**\n * @param {string} qname\n * @param {string} value\n * @param {number} startIndex\n */\n function addAttribute(qname, value, startIndex) {\n if (el.attributeNames.hasOwnProperty(qname)) {\n errorHandler.fatalError('Attribute ' + qname + ' redefined');\n }\n el.addValue(qname,\n // @see https://www.w3.org/TR/xml/#AVNormalize\n // since the xmldom sax parser does not \"interpret\" DTD the following is not implemented:\n // - recursive replacement of (DTD) entity references\n // - trimming and collapsing multiple spaces into a single one for attributes that are not of type CDATA\n value.replace(/[\\t\\n\\r]/g, ' ').replace(/&#?\\w+;/g, entityReplacer), startIndex);\n }\n var attrName;\n var value;\n var p = ++start;\n var s = S_TAG; //status\n while (true) {\n var c = source.charAt(p);\n switch (c) {\n case '=':\n if (s === S_ATTR) {\n //attrName\n attrName = source.slice(start, p);\n s = S_EQ;\n } else if (s === S_ATTR_SPACE) {\n s = S_EQ;\n } else {\n //fatalError: equal must after attrName or space after attrName\n throw new Error('attribute equal must after attrName'); // No known test case\n }\n break;\n case '\\'':\n case '\"':\n if (s === S_EQ || s === S_ATTR //|| s == S_ATTR_SPACE\n ) {\n //equal\n if (s === S_ATTR) {\n errorHandler.warning('attribute value must after \"=\"');\n attrName = source.slice(start, p);\n }\n start = p + 1;\n p = source.indexOf(c, start);\n if (p > 0) {\n value = source.slice(start, p);\n addAttribute(attrName, value, start - 1);\n s = S_ATTR_END;\n } else {\n //fatalError: no end quot match\n throw new Error('attribute value no end \\'' + c + '\\' match');\n }\n } else if (s == S_ATTR_NOQUOT_VALUE) {\n value = source.slice(start, p);\n addAttribute(attrName, value, start);\n errorHandler.warning('attribute \"' + attrName + '\" missed start quot(' + c + ')!!');\n start = p + 1;\n s = S_ATTR_END;\n } else {\n //fatalError: no equal before\n throw new Error('attribute value must after \"=\"'); // No known test case\n }\n break;\n case '/':\n switch (s) {\n case S_TAG:\n el.setTagName(source.slice(start, p));\n case S_ATTR_END:\n case S_TAG_SPACE:\n case S_TAG_CLOSE:\n s = S_TAG_CLOSE;\n el.closed = true;\n case S_ATTR_NOQUOT_VALUE:\n case S_ATTR:\n break;\n case S_ATTR_SPACE:\n el.closed = true;\n break;\n //case S_EQ:\n default:\n throw new Error(\"attribute invalid close char('/')\");\n // No known test case\n }\n break;\n case '':\n //end document\n errorHandler.error('unexpected end of input');\n if (s == S_TAG) {\n el.setTagName(source.slice(start, p));\n }\n return p;\n case '>':\n switch (s) {\n case S_TAG:\n el.setTagName(source.slice(start, p));\n case S_ATTR_END:\n case S_TAG_SPACE:\n case S_TAG_CLOSE:\n break;\n //normal\n case S_ATTR_NOQUOT_VALUE: //Compatible state\n case S_ATTR:\n value = source.slice(start, p);\n if (value.slice(-1) === '/') {\n el.closed = true;\n value = value.slice(0, -1);\n }\n case S_ATTR_SPACE:\n if (s === S_ATTR_SPACE) {\n value = attrName;\n }\n if (s == S_ATTR_NOQUOT_VALUE) {\n errorHandler.warning('attribute \"' + value + '\" missed quot(\")!');\n addAttribute(attrName, value, start);\n } else {\n if (!NAMESPACE.isHTML(currentNSMap['']) || !value.match(/^(?:disabled|checked|selected)$/i)) {\n errorHandler.warning('attribute \"' + value + '\" missed value!! \"' + value + '\" instead!!');\n }\n addAttribute(value, value, start);\n }\n break;\n case S_EQ:\n throw new Error('attribute value missed!!');\n }\n //\t\t\tconsole.log(tagName,tagNamePattern,tagNamePattern.test(tagName))\n return p;\n /*xml space '\\x20' | #x9 | #xD | #xA; */\n case '\\u0080':\n c = ' ';\n default:\n if (c <= ' ') {\n //space\n switch (s) {\n case S_TAG:\n el.setTagName(source.slice(start, p)); //tagName\n s = S_TAG_SPACE;\n break;\n case S_ATTR:\n attrName = source.slice(start, p);\n s = S_ATTR_SPACE;\n break;\n case S_ATTR_NOQUOT_VALUE:\n var value = source.slice(start, p);\n errorHandler.warning('attribute \"' + value + '\" missed quot(\")!!');\n addAttribute(attrName, value, start);\n case S_ATTR_END:\n s = S_TAG_SPACE;\n break;\n //case S_TAG_SPACE:\n //case S_EQ:\n //case S_ATTR_SPACE:\n //\tvoid();break;\n //case S_TAG_CLOSE:\n //ignore warning\n }\n } else {\n //not space\n //S_TAG,\tS_ATTR,\tS_EQ,\tS_ATTR_NOQUOT_VALUE\n //S_ATTR_SPACE,\tS_ATTR_END,\tS_TAG_SPACE, S_TAG_CLOSE\n switch (s) {\n //case S_TAG:void();break;\n //case S_ATTR:void();break;\n //case S_ATTR_NOQUOT_VALUE:void();break;\n case S_ATTR_SPACE:\n var tagName = el.tagName;\n if (!NAMESPACE.isHTML(currentNSMap['']) || !attrName.match(/^(?:disabled|checked|selected)$/i)) {\n errorHandler.warning('attribute \"' + attrName + '\" missed value!! \"' + attrName + '\" instead2!!');\n }\n addAttribute(attrName, attrName, start);\n start = p;\n s = S_ATTR;\n break;\n case S_ATTR_END:\n errorHandler.warning('attribute space is required\"' + attrName + '\"!!');\n case S_TAG_SPACE:\n s = S_ATTR;\n start = p;\n break;\n case S_EQ:\n s = S_ATTR_NOQUOT_VALUE;\n start = p;\n break;\n case S_TAG_CLOSE:\n throw new Error(\"elements closed character '/' and '>' must be connected to\");\n }\n }\n } //end outer switch\n //console.log('p++',p)\n p++;\n }\n}\n/**\n * @return true if has new namespace define\n */\nfunction appendElement(el, domBuilder, currentNSMap) {\n var tagName = el.tagName;\n var localNSMap = null;\n //var currentNSMap = parseStack[parseStack.length-1].currentNSMap;\n var i = el.length;\n while (i--) {\n var a = el[i];\n var qName = a.qName;\n var value = a.value;\n var nsp = qName.indexOf(':');\n if (nsp > 0) {\n var prefix = a.prefix = qName.slice(0, nsp);\n var localName = qName.slice(nsp + 1);\n var nsPrefix = prefix === 'xmlns' && localName;\n } else {\n localName = qName;\n prefix = null;\n nsPrefix = qName === 'xmlns' && '';\n }\n //can not set prefix,because prefix !== ''\n a.localName = localName;\n //prefix == null for no ns prefix attribute\n if (nsPrefix !== false) {\n //hack!!\n if (localNSMap == null) {\n localNSMap = {};\n //console.log(currentNSMap,0)\n _copy(currentNSMap, currentNSMap = {});\n //console.log(currentNSMap,1)\n }\n currentNSMap[nsPrefix] = localNSMap[nsPrefix] = value;\n a.uri = NAMESPACE.XMLNS;\n domBuilder.startPrefixMapping(nsPrefix, value);\n }\n }\n var i = el.length;\n while (i--) {\n a = el[i];\n var prefix = a.prefix;\n if (prefix) {\n //no prefix attribute has no namespace\n if (prefix === 'xml') {\n a.uri = NAMESPACE.XML;\n }\n if (prefix !== 'xmlns') {\n a.uri = currentNSMap[prefix || ''];\n\n //{console.log('###'+a.qName,domBuilder.locator.systemId+'',currentNSMap,a.uri)}\n }\n }\n }\n var nsp = tagName.indexOf(':');\n if (nsp > 0) {\n prefix = el.prefix = tagName.slice(0, nsp);\n localName = el.localName = tagName.slice(nsp + 1);\n } else {\n prefix = null; //important!!\n localName = el.localName = tagName;\n }\n //no prefix element has default namespace\n var ns = el.uri = currentNSMap[prefix || ''];\n domBuilder.startElement(ns, localName, tagName, el);\n //endPrefixMapping and startPrefixMapping have not any help for dom builder\n //localNSMap = null\n if (el.closed) {\n domBuilder.endElement(ns, localName, tagName);\n if (localNSMap) {\n for (prefix in localNSMap) {\n if (Object.prototype.hasOwnProperty.call(localNSMap, prefix)) {\n domBuilder.endPrefixMapping(prefix);\n }\n }\n }\n } else {\n el.currentNSMap = currentNSMap;\n el.localNSMap = localNSMap;\n //parseStack.push(el);\n return true;\n }\n}\nfunction parseHtmlSpecialContent(source, elStartEnd, tagName, entityReplacer, domBuilder) {\n if (/^(?:script|textarea)$/i.test(tagName)) {\n var elEndStart = source.indexOf('', elStartEnd);\n var text = source.substring(elStartEnd + 1, elEndStart);\n if (/[&<]/.test(text)) {\n if (/^script$/i.test(tagName)) {\n //if(!/\\]\\]>/.test(text)){\n //lexHandler.startCDATA();\n domBuilder.characters(text, 0, text.length);\n //lexHandler.endCDATA();\n return elEndStart;\n //}\n } //}else{//text area\n text = text.replace(/&#?\\w+;/g, entityReplacer);\n domBuilder.characters(text, 0, text.length);\n return elEndStart;\n //}\n }\n }\n return elStartEnd + 1;\n}\nfunction fixSelfClosed(source, elStartEnd, tagName, closeMap) {\n //if(tagName in closeMap){\n var pos = closeMap[tagName];\n if (pos == null) {\n //console.log(tagName)\n pos = source.lastIndexOf('');\n if (pos < elStartEnd) {\n //忘记闭合\n pos = source.lastIndexOf('', start + 4);\n //append comment source.substring(4,end)//\n * \n * Should not match component / directive because we are in ngNonBindable.\n * \n * \n * \n * ```\n *\n * @codeGenApi\n */\nfunction ɵɵenableBindings() {\n instructionState.bindingsEnabled = true;\n}\n/**\n * Sets a flag to specify that the TNode is in a skip hydration block.\n * @param tNode the current TNode\n */\nfunction enterSkipHydrationBlock(tNode) {\n instructionState.skipHydrationRootTNode = tNode;\n}\n/**\n * Disables directive matching on element.\n *\n * * Example:\n * ```\n * \n * Should match component / directive.\n * \n *
\n * \n * \n * Should not match component / directive because we are in ngNonBindable.\n * \n * \n *
\n * ```\n *\n * @codeGenApi\n */\nfunction ɵɵdisableBindings() {\n instructionState.bindingsEnabled = false;\n}\n/**\n * Clears the root skip hydration node when leaving a skip hydration block.\n */\nfunction leaveSkipHydrationBlock() {\n instructionState.skipHydrationRootTNode = null;\n}\n/**\n * Return the current `LView`.\n */\nfunction getLView() {\n return instructionState.lFrame.lView;\n}\n/**\n * Return the current `TView`.\n */\nfunction getTView() {\n return instructionState.lFrame.tView;\n}\n/**\n * Restores `contextViewData` to the given OpaqueViewState instance.\n *\n * Used in conjunction with the getCurrentView() instruction to save a snapshot\n * of the current view and restore it when listeners are invoked. This allows\n * walking the declaration view tree in listeners to get vars from parent views.\n *\n * @param viewToRestore The OpaqueViewState instance to restore.\n * @returns Context of the restored OpaqueViewState instance.\n *\n * @codeGenApi\n */\nfunction ɵɵrestoreView(viewToRestore) {\n instructionState.lFrame.contextLView = viewToRestore;\n return viewToRestore[CONTEXT];\n}\n/**\n * Clears the view set in `ɵɵrestoreView` from memory. Returns the passed in\n * value so that it can be used as a return value of an instruction.\n *\n * @codeGenApi\n */\nfunction ɵɵresetView(value) {\n instructionState.lFrame.contextLView = null;\n return value;\n}\nfunction getCurrentTNode() {\n let currentTNode = getCurrentTNodePlaceholderOk();\n while (currentTNode !== null && currentTNode.type === 64 /* TNodeType.Placeholder */) {\n currentTNode = currentTNode.parent;\n }\n return currentTNode;\n}\nfunction getCurrentTNodePlaceholderOk() {\n return instructionState.lFrame.currentTNode;\n}\nfunction getCurrentParentTNode() {\n const lFrame = instructionState.lFrame;\n const currentTNode = lFrame.currentTNode;\n return lFrame.isParent ? currentTNode : currentTNode.parent;\n}\nfunction setCurrentTNode(tNode, isParent) {\n ngDevMode && tNode && assertTNodeForTView(tNode, instructionState.lFrame.tView);\n const lFrame = instructionState.lFrame;\n lFrame.currentTNode = tNode;\n lFrame.isParent = isParent;\n}\nfunction isCurrentTNodeParent() {\n return instructionState.lFrame.isParent;\n}\nfunction setCurrentTNodeAsNotParent() {\n instructionState.lFrame.isParent = false;\n}\nfunction getContextLView() {\n const contextLView = instructionState.lFrame.contextLView;\n ngDevMode && assertDefined(contextLView, 'contextLView must be defined.');\n return contextLView;\n}\nfunction isInCheckNoChangesMode() {\n !ngDevMode && throwError('Must never be called in production mode');\n return _checkNoChangesMode !== CheckNoChangesMode.Off;\n}\nfunction isExhaustiveCheckNoChanges() {\n !ngDevMode && throwError('Must never be called in production mode');\n return _checkNoChangesMode === CheckNoChangesMode.Exhaustive;\n}\nfunction setIsInCheckNoChangesMode(mode) {\n !ngDevMode && throwError('Must never be called in production mode');\n _checkNoChangesMode = mode;\n}\nfunction isRefreshingViews() {\n return _isRefreshingViews;\n}\nfunction setIsRefreshingViews(mode) {\n _isRefreshingViews = mode;\n}\n// top level variables should not be exported for performance reasons (PERF_NOTES.md)\nfunction getBindingRoot() {\n const lFrame = instructionState.lFrame;\n let index = lFrame.bindingRootIndex;\n if (index === -1) {\n index = lFrame.bindingRootIndex = lFrame.tView.bindingStartIndex;\n }\n return index;\n}\nfunction getBindingIndex() {\n return instructionState.lFrame.bindingIndex;\n}\nfunction setBindingIndex(value) {\n return instructionState.lFrame.bindingIndex = value;\n}\nfunction nextBindingIndex() {\n return instructionState.lFrame.bindingIndex++;\n}\nfunction incrementBindingIndex(count) {\n const lFrame = instructionState.lFrame;\n const index = lFrame.bindingIndex;\n lFrame.bindingIndex = lFrame.bindingIndex + count;\n return index;\n}\nfunction isInI18nBlock() {\n return instructionState.lFrame.inI18n;\n}\nfunction setInI18nBlock(isInI18nBlock) {\n instructionState.lFrame.inI18n = isInI18nBlock;\n}\n/**\n * Set a new binding root index so that host template functions can execute.\n *\n * Bindings inside the host template are 0 index. But because we don't know ahead of time\n * how many host bindings we have we can't pre-compute them. For this reason they are all\n * 0 index and we just shift the root so that they match next available location in the LView.\n *\n * @param bindingRootIndex Root index for `hostBindings`\n * @param currentDirectiveIndex `TData[currentDirectiveIndex]` will point to the current directive\n * whose `hostBindings` are being processed.\n */\nfunction setBindingRootForHostBindings(bindingRootIndex, currentDirectiveIndex) {\n const lFrame = instructionState.lFrame;\n lFrame.bindingIndex = lFrame.bindingRootIndex = bindingRootIndex;\n setCurrentDirectiveIndex(currentDirectiveIndex);\n}\n/**\n * When host binding is executing this points to the directive index.\n * `TView.data[getCurrentDirectiveIndex()]` is `DirectiveDef`\n * `LView[getCurrentDirectiveIndex()]` is directive instance.\n */\nfunction getCurrentDirectiveIndex() {\n return instructionState.lFrame.currentDirectiveIndex;\n}\n/**\n * Sets an index of a directive whose `hostBindings` are being processed.\n *\n * @param currentDirectiveIndex `TData` index where current directive instance can be found.\n */\nfunction setCurrentDirectiveIndex(currentDirectiveIndex) {\n instructionState.lFrame.currentDirectiveIndex = currentDirectiveIndex;\n}\n/**\n * Retrieve the current `DirectiveDef` which is active when `hostBindings` instruction is being\n * executed.\n *\n * @param tData Current `TData` where the `DirectiveDef` will be looked up at.\n */\nfunction getCurrentDirectiveDef(tData) {\n const currentDirectiveIndex = instructionState.lFrame.currentDirectiveIndex;\n return currentDirectiveIndex === -1 ? null : tData[currentDirectiveIndex];\n}\nfunction getCurrentQueryIndex() {\n return instructionState.lFrame.currentQueryIndex;\n}\nfunction setCurrentQueryIndex(value) {\n instructionState.lFrame.currentQueryIndex = value;\n}\n/**\n * Returns a `TNode` of the location where the current `LView` is declared at.\n *\n * @param lView an `LView` that we want to find parent `TNode` for.\n */\nfunction getDeclarationTNode(lView) {\n const tView = lView[TVIEW];\n // Return the declaration parent for embedded views\n if (tView.type === 2 /* TViewType.Embedded */) {\n ngDevMode && assertDefined(tView.declTNode, 'Embedded TNodes should have declaration parents.');\n return tView.declTNode;\n }\n // Components don't have `TView.declTNode` because each instance of component could be\n // inserted in different location, hence `TView.declTNode` is meaningless.\n // Falling back to `T_HOST` in case we cross component boundary.\n if (tView.type === 1 /* TViewType.Component */) {\n return lView[T_HOST];\n }\n // Remaining TNode type is `TViewType.Root` which doesn't have a parent TNode.\n return null;\n}\n/**\n * This is a light weight version of the `enterView` which is needed by the DI system.\n *\n * @param lView `LView` location of the DI context.\n * @param tNode `TNode` for DI context\n * @param flags DI context flags. if `SkipSelf` flag is set than we walk up the declaration\n * tree from `tNode` until we find parent declared `TElementNode`.\n * @returns `true` if we have successfully entered DI associated with `tNode` (or with declared\n * `TNode` if `flags` has `SkipSelf`). Failing to enter DI implies that no associated\n * `NodeInjector` can be found and we should instead use `ModuleInjector`.\n * - If `true` than this call must be fallowed by `leaveDI`\n * - If `false` than this call failed and we should NOT call `leaveDI`\n */\nfunction enterDI(lView, tNode, flags) {\n ngDevMode && assertLViewOrUndefined(lView);\n if (flags & InjectFlags.SkipSelf) {\n ngDevMode && assertTNodeForTView(tNode, lView[TVIEW]);\n let parentTNode = tNode;\n let parentLView = lView;\n while (true) {\n ngDevMode && assertDefined(parentTNode, 'Parent TNode should be defined');\n parentTNode = parentTNode.parent;\n if (parentTNode === null && !(flags & InjectFlags.Host)) {\n parentTNode = getDeclarationTNode(parentLView);\n if (parentTNode === null) break;\n // In this case, a parent exists and is definitely an element. So it will definitely\n // have an existing lView as the declaration view, which is why we can assume it's defined.\n ngDevMode && assertDefined(parentLView, 'Parent LView should be defined');\n parentLView = parentLView[DECLARATION_VIEW];\n // In Ivy there are Comment nodes that correspond to ngIf and NgFor embedded directives\n // We want to skip those and look only at Elements and ElementContainers to ensure\n // we're looking at true parent nodes, and not content or other types.\n if (parentTNode.type & (2 /* TNodeType.Element */ | 8 /* TNodeType.ElementContainer */)) {\n break;\n }\n } else {\n break;\n }\n }\n if (parentTNode === null) {\n // If we failed to find a parent TNode this means that we should use module injector.\n return false;\n } else {\n tNode = parentTNode;\n lView = parentLView;\n }\n }\n ngDevMode && assertTNodeForLView(tNode, lView);\n const lFrame = instructionState.lFrame = allocLFrame();\n lFrame.currentTNode = tNode;\n lFrame.lView = lView;\n return true;\n}\n/**\n * Swap the current lView with a new lView.\n *\n * For performance reasons we store the lView in the top level of the module.\n * This way we minimize the number of properties to read. Whenever a new view\n * is entered we have to store the lView for later, and when the view is\n * exited the state has to be restored\n *\n * @param newView New lView to become active\n * @returns the previously active lView;\n */\nfunction enterView(newView) {\n ngDevMode && assertNotEqual(newView[0], newView[1], '????');\n ngDevMode && assertLViewOrUndefined(newView);\n const newLFrame = allocLFrame();\n if (ngDevMode) {\n assertEqual(newLFrame.isParent, true, 'Expected clean LFrame');\n assertEqual(newLFrame.lView, null, 'Expected clean LFrame');\n assertEqual(newLFrame.tView, null, 'Expected clean LFrame');\n assertEqual(newLFrame.selectedIndex, -1, 'Expected clean LFrame');\n assertEqual(newLFrame.elementDepthCount, 0, 'Expected clean LFrame');\n assertEqual(newLFrame.currentDirectiveIndex, -1, 'Expected clean LFrame');\n assertEqual(newLFrame.currentNamespace, null, 'Expected clean LFrame');\n assertEqual(newLFrame.bindingRootIndex, -1, 'Expected clean LFrame');\n assertEqual(newLFrame.currentQueryIndex, 0, 'Expected clean LFrame');\n }\n const tView = newView[TVIEW];\n instructionState.lFrame = newLFrame;\n ngDevMode && tView.firstChild && assertTNodeForTView(tView.firstChild, tView);\n newLFrame.currentTNode = tView.firstChild;\n newLFrame.lView = newView;\n newLFrame.tView = tView;\n newLFrame.contextLView = newView;\n newLFrame.bindingIndex = tView.bindingStartIndex;\n newLFrame.inI18n = false;\n}\n/**\n * Allocates next free LFrame. This function tries to reuse the `LFrame`s to lower memory pressure.\n */\nfunction allocLFrame() {\n const currentLFrame = instructionState.lFrame;\n const childLFrame = currentLFrame === null ? null : currentLFrame.child;\n const newLFrame = childLFrame === null ? createLFrame(currentLFrame) : childLFrame;\n return newLFrame;\n}\nfunction createLFrame(parent) {\n const lFrame = {\n currentTNode: null,\n isParent: true,\n lView: null,\n tView: null,\n selectedIndex: -1,\n contextLView: null,\n elementDepthCount: 0,\n currentNamespace: null,\n currentDirectiveIndex: -1,\n bindingRootIndex: -1,\n bindingIndex: -1,\n currentQueryIndex: 0,\n parent: parent,\n child: null,\n inI18n: false\n };\n parent !== null && (parent.child = lFrame); // link the new LFrame for reuse.\n return lFrame;\n}\n/**\n * A lightweight version of leave which is used with DI.\n *\n * This function only resets `currentTNode` and `LView` as those are the only properties\n * used with DI (`enterDI()`).\n *\n * NOTE: This function is reexported as `leaveDI`. However `leaveDI` has return type of `void` where\n * as `leaveViewLight` has `LFrame`. This is so that `leaveViewLight` can be used in `leaveView`.\n */\nfunction leaveViewLight() {\n const oldLFrame = instructionState.lFrame;\n instructionState.lFrame = oldLFrame.parent;\n oldLFrame.currentTNode = null;\n oldLFrame.lView = null;\n return oldLFrame;\n}\n/**\n * This is a lightweight version of the `leaveView` which is needed by the DI system.\n *\n * NOTE: this function is an alias so that we can change the type of the function to have `void`\n * return type.\n */\nconst leaveDI = leaveViewLight;\n/**\n * Leave the current `LView`\n *\n * This pops the `LFrame` with the associated `LView` from the stack.\n *\n * IMPORTANT: We must zero out the `LFrame` values here otherwise they will be retained. This is\n * because for performance reasons we don't release `LFrame` but rather keep it for next use.\n */\nfunction leaveView() {\n const oldLFrame = leaveViewLight();\n oldLFrame.isParent = true;\n oldLFrame.tView = null;\n oldLFrame.selectedIndex = -1;\n oldLFrame.contextLView = null;\n oldLFrame.elementDepthCount = 0;\n oldLFrame.currentDirectiveIndex = -1;\n oldLFrame.currentNamespace = null;\n oldLFrame.bindingRootIndex = -1;\n oldLFrame.bindingIndex = -1;\n oldLFrame.currentQueryIndex = 0;\n}\nfunction nextContextImpl(level) {\n const contextLView = instructionState.lFrame.contextLView = walkUpViews(level, instructionState.lFrame.contextLView);\n return contextLView[CONTEXT];\n}\n/**\n * Gets the currently selected element index.\n *\n * Used with {@link property} instruction (and more in the future) to identify the index in the\n * current `LView` to act on.\n */\nfunction getSelectedIndex() {\n return instructionState.lFrame.selectedIndex;\n}\n/**\n * Sets the most recent index passed to {@link select}\n *\n * Used with {@link property} instruction (and more in the future) to identify the index in the\n * current `LView` to act on.\n *\n * (Note that if an \"exit function\" was set earlier (via `setElementExitFn()`) then that will be\n * run if and when the provided `index` value is different from the current selected index value.)\n */\nfunction setSelectedIndex(index) {\n ngDevMode && index !== -1 && assertGreaterThanOrEqual(index, HEADER_OFFSET, 'Index must be past HEADER_OFFSET (or -1).');\n ngDevMode && assertLessThan(index, instructionState.lFrame.lView.length, \"Can't set index passed end of LView\");\n instructionState.lFrame.selectedIndex = index;\n}\n/**\n * Gets the `tNode` that represents currently selected element.\n */\nfunction getSelectedTNode() {\n const lFrame = instructionState.lFrame;\n return getTNode(lFrame.tView, lFrame.selectedIndex);\n}\n/**\n * Sets the namespace used to create elements to `'http://www.w3.org/2000/svg'` in global state.\n *\n * @codeGenApi\n */\nfunction ɵɵnamespaceSVG() {\n instructionState.lFrame.currentNamespace = SVG_NAMESPACE;\n}\n/**\n * Sets the namespace used to create elements to `'http://www.w3.org/1998/MathML/'` in global state.\n *\n * @codeGenApi\n */\nfunction ɵɵnamespaceMathML() {\n instructionState.lFrame.currentNamespace = MATH_ML_NAMESPACE;\n}\n/**\n * Sets the namespace used to create elements to `null`, which forces element creation to use\n * `createElement` rather than `createElementNS`.\n *\n * @codeGenApi\n */\nfunction ɵɵnamespaceHTML() {\n namespaceHTMLInternal();\n}\n/**\n * Sets the namespace used to create elements to `null`, which forces element creation to use\n * `createElement` rather than `createElementNS`.\n */\nfunction namespaceHTMLInternal() {\n instructionState.lFrame.currentNamespace = null;\n}\nfunction getNamespace$1() {\n return instructionState.lFrame.currentNamespace;\n}\nlet _wasLastNodeCreated = true;\n/**\n * Retrieves a global flag that indicates whether the most recent DOM node\n * was created or hydrated.\n */\nfunction wasLastNodeCreated() {\n return _wasLastNodeCreated;\n}\n/**\n * Sets a global flag to indicate whether the most recent DOM node\n * was created or hydrated.\n */\nfunction lastNodeWasCreated(flag) {\n _wasLastNodeCreated = flag;\n}\n\n/**\n * Adds all directive lifecycle hooks from the given `DirectiveDef` to the given `TView`.\n *\n * Must be run *only* on the first template pass.\n *\n * Sets up the pre-order hooks on the provided `tView`,\n * see {@link HookData} for details about the data structure.\n *\n * @param directiveIndex The index of the directive in LView\n * @param directiveDef The definition containing the hooks to setup in tView\n * @param tView The current TView\n */\nfunction registerPreOrderHooks(directiveIndex, directiveDef, tView) {\n ngDevMode && assertFirstCreatePass(tView);\n const {\n ngOnChanges,\n ngOnInit,\n ngDoCheck\n } = directiveDef.type.prototype;\n if (ngOnChanges) {\n const wrappedOnChanges = NgOnChangesFeatureImpl(directiveDef);\n (tView.preOrderHooks ??= []).push(directiveIndex, wrappedOnChanges);\n (tView.preOrderCheckHooks ??= []).push(directiveIndex, wrappedOnChanges);\n }\n if (ngOnInit) {\n (tView.preOrderHooks ??= []).push(0 - directiveIndex, ngOnInit);\n }\n if (ngDoCheck) {\n (tView.preOrderHooks ??= []).push(directiveIndex, ngDoCheck);\n (tView.preOrderCheckHooks ??= []).push(directiveIndex, ngDoCheck);\n }\n}\n/**\n *\n * Loops through the directives on the provided `tNode` and queues hooks to be\n * run that are not initialization hooks.\n *\n * Should be executed during `elementEnd()` and similar to\n * preserve hook execution order. Content, view, and destroy hooks for projected\n * components and directives must be called *before* their hosts.\n *\n * Sets up the content, view, and destroy hooks on the provided `tView`,\n * see {@link HookData} for details about the data structure.\n *\n * NOTE: This does not set up `onChanges`, `onInit` or `doCheck`, those are set up\n * separately at `elementStart`.\n *\n * @param tView The current TView\n * @param tNode The TNode whose directives are to be searched for hooks to queue\n */\nfunction registerPostOrderHooks(tView, tNode) {\n ngDevMode && assertFirstCreatePass(tView);\n // It's necessary to loop through the directives at elementEnd() (rather than processing in\n // directiveCreate) so we can preserve the current hook order. Content, view, and destroy\n // hooks for projected components and directives must be called *before* their hosts.\n for (let i = tNode.directiveStart, end = tNode.directiveEnd; i < end; i++) {\n const directiveDef = tView.data[i];\n ngDevMode && assertDefined(directiveDef, 'Expecting DirectiveDef');\n const lifecycleHooks = directiveDef.type.prototype;\n const {\n ngAfterContentInit,\n ngAfterContentChecked,\n ngAfterViewInit,\n ngAfterViewChecked,\n ngOnDestroy\n } = lifecycleHooks;\n if (ngAfterContentInit) {\n (tView.contentHooks ??= []).push(-i, ngAfterContentInit);\n }\n if (ngAfterContentChecked) {\n (tView.contentHooks ??= []).push(i, ngAfterContentChecked);\n (tView.contentCheckHooks ??= []).push(i, ngAfterContentChecked);\n }\n if (ngAfterViewInit) {\n (tView.viewHooks ??= []).push(-i, ngAfterViewInit);\n }\n if (ngAfterViewChecked) {\n (tView.viewHooks ??= []).push(i, ngAfterViewChecked);\n (tView.viewCheckHooks ??= []).push(i, ngAfterViewChecked);\n }\n if (ngOnDestroy != null) {\n (tView.destroyHooks ??= []).push(i, ngOnDestroy);\n }\n }\n}\n/**\n * Executing hooks requires complex logic as we need to deal with 2 constraints.\n *\n * 1. Init hooks (ngOnInit, ngAfterContentInit, ngAfterViewInit) must all be executed once and only\n * once, across many change detection cycles. This must be true even if some hooks throw, or if\n * some recursively trigger a change detection cycle.\n * To solve that, it is required to track the state of the execution of these init hooks.\n * This is done by storing and maintaining flags in the view: the {@link InitPhaseState},\n * and the index within that phase. They can be seen as a cursor in the following structure:\n * [[onInit1, onInit2], [afterContentInit1], [afterViewInit1, afterViewInit2, afterViewInit3]]\n * They are stored as flags in LView[FLAGS].\n *\n * 2. Pre-order hooks can be executed in batches, because of the select instruction.\n * To be able to pause and resume their execution, we also need some state about the hook's array\n * that is being processed:\n * - the index of the next hook to be executed\n * - the number of init hooks already found in the processed part of the array\n * They are stored as flags in LView[PREORDER_HOOK_FLAGS].\n */\n/**\n * Executes pre-order check hooks ( OnChanges, DoChanges) given a view where all the init hooks were\n * executed once. This is a light version of executeInitAndCheckPreOrderHooks where we can skip read\n * / write of the init-hooks related flags.\n * @param lView The LView where hooks are defined\n * @param hooks Hooks to be run\n * @param nodeIndex 3 cases depending on the value:\n * - undefined: all hooks from the array should be executed (post-order case)\n * - null: execute hooks only from the saved index until the end of the array (pre-order case, when\n * flushing the remaining hooks)\n * - number: execute hooks only from the saved index until that node index exclusive (pre-order\n * case, when executing select(number))\n */\nfunction executeCheckHooks(lView, hooks, nodeIndex) {\n callHooks(lView, hooks, 3 /* InitPhaseState.InitPhaseCompleted */, nodeIndex);\n}\n/**\n * Executes post-order init and check hooks (one of AfterContentInit, AfterContentChecked,\n * AfterViewInit, AfterViewChecked) given a view where there are pending init hooks to be executed.\n * @param lView The LView where hooks are defined\n * @param hooks Hooks to be run\n * @param initPhase A phase for which hooks should be run\n * @param nodeIndex 3 cases depending on the value:\n * - undefined: all hooks from the array should be executed (post-order case)\n * - null: execute hooks only from the saved index until the end of the array (pre-order case, when\n * flushing the remaining hooks)\n * - number: execute hooks only from the saved index until that node index exclusive (pre-order\n * case, when executing select(number))\n */\nfunction executeInitAndCheckHooks(lView, hooks, initPhase, nodeIndex) {\n ngDevMode && assertNotEqual(initPhase, 3 /* InitPhaseState.InitPhaseCompleted */, 'Init pre-order hooks should not be called more than once');\n if ((lView[FLAGS] & 3 /* LViewFlags.InitPhaseStateMask */) === initPhase) {\n callHooks(lView, hooks, initPhase, nodeIndex);\n }\n}\nfunction incrementInitPhaseFlags(lView, initPhase) {\n ngDevMode && assertNotEqual(initPhase, 3 /* InitPhaseState.InitPhaseCompleted */, 'Init hooks phase should not be incremented after all init hooks have been run.');\n let flags = lView[FLAGS];\n if ((flags & 3 /* LViewFlags.InitPhaseStateMask */) === initPhase) {\n flags &= 16383 /* LViewFlags.IndexWithinInitPhaseReset */;\n flags += 1 /* LViewFlags.InitPhaseStateIncrementer */;\n lView[FLAGS] = flags;\n }\n}\n/**\n * Calls lifecycle hooks with their contexts, skipping init hooks if it's not\n * the first LView pass\n *\n * @param currentView The current view\n * @param arr The array in which the hooks are found\n * @param initPhaseState the current state of the init phase\n * @param currentNodeIndex 3 cases depending on the value:\n * - undefined: all hooks from the array should be executed (post-order case)\n * - null: execute hooks only from the saved index until the end of the array (pre-order case, when\n * flushing the remaining hooks)\n * - number: execute hooks only from the saved index until that node index exclusive (pre-order\n * case, when executing select(number))\n */\nfunction callHooks(currentView, arr, initPhase, currentNodeIndex) {\n ngDevMode && assertEqual(isInCheckNoChangesMode(), false, 'Hooks should never be run when in check no changes mode.');\n const startIndex = currentNodeIndex !== undefined ? currentView[PREORDER_HOOK_FLAGS] & 65535 /* PreOrderHookFlags.IndexOfTheNextPreOrderHookMaskMask */ : 0;\n const nodeIndexLimit = currentNodeIndex != null ? currentNodeIndex : -1;\n const max = arr.length - 1; // Stop the loop at length - 1, because we look for the hook at i + 1\n let lastNodeIndexFound = 0;\n for (let i = startIndex; i < max; i++) {\n const hook = arr[i + 1];\n if (typeof hook === 'number') {\n lastNodeIndexFound = arr[i];\n if (currentNodeIndex != null && lastNodeIndexFound >= currentNodeIndex) {\n break;\n }\n } else {\n const isInitHook = arr[i] < 0;\n if (isInitHook) {\n currentView[PREORDER_HOOK_FLAGS] += 65536 /* PreOrderHookFlags.NumberOfInitHooksCalledIncrementer */;\n }\n if (lastNodeIndexFound < nodeIndexLimit || nodeIndexLimit == -1) {\n callHook(currentView, initPhase, arr, i);\n currentView[PREORDER_HOOK_FLAGS] = (currentView[PREORDER_HOOK_FLAGS] & 4294901760 /* PreOrderHookFlags.NumberOfInitHooksCalledMask */) + i + 2;\n }\n i++;\n }\n }\n}\n/**\n * Executes a single lifecycle hook, making sure that:\n * - it is called in the non-reactive context;\n * - profiling data are registered.\n */\nfunction callHookInternal(directive, hook) {\n profiler(4 /* ProfilerEvent.LifecycleHookStart */, directive, hook);\n const prevConsumer = setActiveConsumer$1(null);\n try {\n hook.call(directive);\n } finally {\n setActiveConsumer$1(prevConsumer);\n profiler(5 /* ProfilerEvent.LifecycleHookEnd */, directive, hook);\n }\n}\n/**\n * Execute one hook against the current `LView`.\n *\n * @param currentView The current view\n * @param initPhaseState the current state of the init phase\n * @param arr The array in which the hooks are found\n * @param i The current index within the hook data array\n */\nfunction callHook(currentView, initPhase, arr, i) {\n const isInitHook = arr[i] < 0;\n const hook = arr[i + 1];\n const directiveIndex = isInitHook ? -arr[i] : arr[i];\n const directive = currentView[directiveIndex];\n if (isInitHook) {\n const indexWithintInitPhase = currentView[FLAGS] >> 14 /* LViewFlags.IndexWithinInitPhaseShift */;\n // The init phase state must be always checked here as it may have been recursively updated.\n if (indexWithintInitPhase < currentView[PREORDER_HOOK_FLAGS] >> 16 /* PreOrderHookFlags.NumberOfInitHooksCalledShift */ && (currentView[FLAGS] & 3 /* LViewFlags.InitPhaseStateMask */) === initPhase) {\n currentView[FLAGS] += 16384 /* LViewFlags.IndexWithinInitPhaseIncrementer */;\n callHookInternal(directive, hook);\n }\n } else {\n callHookInternal(directive, hook);\n }\n}\nconst NO_PARENT_INJECTOR = -1;\n/**\n * Each injector is saved in 9 contiguous slots in `LView` and 9 contiguous slots in\n * `TView.data`. This allows us to store information about the current node's tokens (which\n * can be shared in `TView`) as well as the tokens of its ancestor nodes (which cannot be\n * shared, so they live in `LView`).\n *\n * Each of these slots (aside from the last slot) contains a bloom filter. This bloom filter\n * determines whether a directive is available on the associated node or not. This prevents us\n * from searching the directives array at this level unless it's probable the directive is in it.\n *\n * See: https://en.wikipedia.org/wiki/Bloom_filter for more about bloom filters.\n *\n * Because all injectors have been flattened into `LView` and `TViewData`, they cannot typed\n * using interfaces as they were previously. The start index of each `LInjector` and `TInjector`\n * will differ based on where it is flattened into the main array, so it's not possible to know\n * the indices ahead of time and save their types here. The interfaces are still included here\n * for documentation purposes.\n *\n * export interface LInjector extends Array {\n *\n * // Cumulative bloom for directive IDs 0-31 (IDs are % BLOOM_SIZE)\n * [0]: number;\n *\n * // Cumulative bloom for directive IDs 32-63\n * [1]: number;\n *\n * // Cumulative bloom for directive IDs 64-95\n * [2]: number;\n *\n * // Cumulative bloom for directive IDs 96-127\n * [3]: number;\n *\n * // Cumulative bloom for directive IDs 128-159\n * [4]: number;\n *\n * // Cumulative bloom for directive IDs 160 - 191\n * [5]: number;\n *\n * // Cumulative bloom for directive IDs 192 - 223\n * [6]: number;\n *\n * // Cumulative bloom for directive IDs 224 - 255\n * [7]: number;\n *\n * // We need to store a reference to the injector's parent so DI can keep looking up\n * // the injector tree until it finds the dependency it's looking for.\n * [PARENT_INJECTOR]: number;\n * }\n *\n * export interface TInjector extends Array {\n *\n * // Shared node bloom for directive IDs 0-31 (IDs are % BLOOM_SIZE)\n * [0]: number;\n *\n * // Shared node bloom for directive IDs 32-63\n * [1]: number;\n *\n * // Shared node bloom for directive IDs 64-95\n * [2]: number;\n *\n * // Shared node bloom for directive IDs 96-127\n * [3]: number;\n *\n * // Shared node bloom for directive IDs 128-159\n * [4]: number;\n *\n * // Shared node bloom for directive IDs 160 - 191\n * [5]: number;\n *\n * // Shared node bloom for directive IDs 192 - 223\n * [6]: number;\n *\n * // Shared node bloom for directive IDs 224 - 255\n * [7]: number;\n *\n * // Necessary to find directive indices for a particular node.\n * [TNODE]: TElementNode|TElementContainerNode|TContainerNode;\n * }\n */\n/**\n * Factory for creating instances of injectors in the NodeInjector.\n *\n * This factory is complicated by the fact that it can resolve `multi` factories as well.\n *\n * NOTE: Some of the fields are optional which means that this class has two hidden classes.\n * - One without `multi` support (most common)\n * - One with `multi` values, (rare).\n *\n * Since VMs can cache up to 4 inline hidden classes this is OK.\n *\n * - Single factory: Only `resolving` and `factory` is defined.\n * - `providers` factory: `componentProviders` is a number and `index = -1`.\n * - `viewProviders` factory: `componentProviders` is a number and `index` points to `providers`.\n */\nclass NodeInjectorFactory {\n constructor(\n /**\n * Factory to invoke in order to create a new instance.\n */\n factory,\n /**\n * Set to `true` if the token is declared in `viewProviders` (or if it is component).\n */\n isViewProvider, injectImplementation) {\n this.factory = factory;\n /**\n * Marker set to true during factory invocation to see if we get into recursive loop.\n * Recursive loop causes an error to be displayed.\n */\n this.resolving = false;\n ngDevMode && assertDefined(factory, 'Factory not specified');\n ngDevMode && assertEqual(typeof factory, 'function', 'Expected factory function.');\n this.canSeeViewProviders = isViewProvider;\n this.injectImpl = injectImplementation;\n }\n}\nfunction isFactory(obj) {\n return obj instanceof NodeInjectorFactory;\n}\n\n/**\n * Converts `TNodeType` into human readable text.\n * Make sure this matches with `TNodeType`\n */\nfunction toTNodeTypeAsString(tNodeType) {\n let text = '';\n tNodeType & 1 /* TNodeType.Text */ && (text += '|Text');\n tNodeType & 2 /* TNodeType.Element */ && (text += '|Element');\n tNodeType & 4 /* TNodeType.Container */ && (text += '|Container');\n tNodeType & 8 /* TNodeType.ElementContainer */ && (text += '|ElementContainer');\n tNodeType & 16 /* TNodeType.Projection */ && (text += '|Projection');\n tNodeType & 32 /* TNodeType.Icu */ && (text += '|IcuContainer');\n tNodeType & 64 /* TNodeType.Placeholder */ && (text += '|Placeholder');\n tNodeType & 128 /* TNodeType.LetDeclaration */ && (text += '|LetDeclaration');\n return text.length > 0 ? text.substring(1) : text;\n}\n/**\n * Helper function to detect if a given value matches a `TNode` shape.\n *\n * The logic uses the `insertBeforeIndex` and its possible values as\n * a way to differentiate a TNode shape from other types of objects\n * within the `TView.data`. This is not a perfect check, but it can\n * be a reasonable differentiator, since we control the shapes of objects\n * within `TView.data`.\n */\nfunction isTNodeShape(value) {\n return value != null && typeof value === 'object' && (value.insertBeforeIndex === null || typeof value.insertBeforeIndex === 'number' || Array.isArray(value.insertBeforeIndex));\n}\n/**\n * Returns `true` if the `TNode` has a directive which has `@Input()` for `class` binding.\n *\n * ```\n *
\n * ```\n * and\n * ```\n * @Directive({\n * })\n * class MyDirective {\n * @Input()\n * class: string;\n * }\n * ```\n *\n * In the above case it is necessary to write the reconciled styling information into the\n * directive's input.\n *\n * @param tNode\n */\nfunction hasClassInput(tNode) {\n return (tNode.flags & 8 /* TNodeFlags.hasClassInput */) !== 0;\n}\n/**\n * Returns `true` if the `TNode` has a directive which has `@Input()` for `style` binding.\n *\n * ```\n *
\n * ```\n * and\n * ```\n * @Directive({\n * })\n * class MyDirective {\n * @Input()\n * class: string;\n * }\n * ```\n *\n * In the above case it is necessary to write the reconciled styling information into the\n * directive's input.\n *\n * @param tNode\n */\nfunction hasStyleInput(tNode) {\n return (tNode.flags & 16 /* TNodeFlags.hasStyleInput */) !== 0;\n}\nfunction assertTNodeType(tNode, expectedTypes, message) {\n assertDefined(tNode, 'should be called with a TNode');\n if ((tNode.type & expectedTypes) === 0) {\n throwError(message || `Expected [${toTNodeTypeAsString(expectedTypes)}] but got ${toTNodeTypeAsString(tNode.type)}.`);\n }\n}\nfunction assertPureTNodeType(type) {\n if (!(type === 2 /* TNodeType.Element */ || type === 1 /* TNodeType.Text */ || type === 4 /* TNodeType.Container */ || type === 8 /* TNodeType.ElementContainer */ || type === 32 /* TNodeType.Icu */ || type === 16 /* TNodeType.Projection */ || type === 64 /* TNodeType.Placeholder */ || type === 128 /* TNodeType.LetDeclaration */)) {\n throwError(`Expected TNodeType to have only a single type selected, but got ${toTNodeTypeAsString(type)}.`);\n }\n}\n\n// This default value is when checking the hierarchy for a token.\n//\n// It means both:\n// - the token is not provided by the current injector,\n// - only the element injectors should be checked (ie do not check module injectors\n//\n// mod1\n// /\n// el1 mod2\n// \\ /\n// el2\n//\n// When requesting el2.injector.get(token), we should check in the following order and return the\n// first found value:\n// - el2.injector.get(token, default)\n// - el1.injector.get(token, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) -> do not check the module\n// - mod2.injector.get(token, default)\nconst NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR = {};\n\n/**\n * Injector that looks up a value using a specific injector, before falling back to the module\n * injector. Used primarily when creating components or embedded views dynamically.\n */\nclass ChainedInjector {\n constructor(injector, parentInjector) {\n this.injector = injector;\n this.parentInjector = parentInjector;\n }\n get(token, notFoundValue, flags) {\n flags = convertToBitFlags(flags);\n const value = this.injector.get(token, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR, flags);\n if (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR || notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) {\n // Return the value from the root element injector when\n // - it provides it\n // (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR)\n // - the module injector should not be checked\n // (notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR)\n return value;\n }\n return this.parentInjector.get(token, notFoundValue, flags);\n }\n}\n\n/// Parent Injector Utils ///////////////////////////////////////////////////////////////\nfunction hasParentInjector(parentLocation) {\n return parentLocation !== NO_PARENT_INJECTOR;\n}\nfunction getParentInjectorIndex(parentLocation) {\n if (ngDevMode) {\n assertNumber(parentLocation, 'Number expected');\n assertNotEqual(parentLocation, -1, 'Not a valid state.');\n const parentInjectorIndex = parentLocation & 32767 /* RelativeInjectorLocationFlags.InjectorIndexMask */;\n assertGreaterThan(parentInjectorIndex, HEADER_OFFSET, 'Parent injector must be pointing past HEADER_OFFSET.');\n }\n return parentLocation & 32767 /* RelativeInjectorLocationFlags.InjectorIndexMask */;\n}\nfunction getParentInjectorViewOffset(parentLocation) {\n return parentLocation >> 16 /* RelativeInjectorLocationFlags.ViewOffsetShift */;\n}\n/**\n * Unwraps a parent injector location number to find the view offset from the current injector,\n * then walks up the declaration view tree until the view is found that contains the parent\n * injector.\n *\n * @param location The location of the parent injector, which contains the view offset\n * @param startView The LView instance from which to start walking up the view tree\n * @returns The LView instance that contains the parent injector\n */\nfunction getParentInjectorView(location, startView) {\n let viewOffset = getParentInjectorViewOffset(location);\n let parentView = startView;\n // For most cases, the parent injector can be found on the host node (e.g. for component\n // or container), but we must keep the loop here to support the rarer case of deeply nested\n // tags or inline views, where the parent injector might live many views\n // above the child injector.\n while (viewOffset > 0) {\n parentView = parentView[DECLARATION_VIEW];\n viewOffset--;\n }\n return parentView;\n}\n/**\n * Detects whether an injector is an instance of a `ChainedInjector`,\n * created based on the `OutletInjector`.\n */\nfunction isRouterOutletInjector(currentInjector) {\n return currentInjector instanceof ChainedInjector && typeof currentInjector.injector.__ngOutletInjector === 'function';\n}\n\n/**\n * Defines if the call to `inject` should include `viewProviders` in its resolution.\n *\n * This is set to true when we try to instantiate a component. This value is reset in\n * `getNodeInjectable` to a value which matches the declaration location of the token about to be\n * instantiated. This is done so that if we are injecting a token which was declared outside of\n * `viewProviders` we don't accidentally pull `viewProviders` in.\n *\n * Example:\n *\n * ```\n * @Injectable()\n * class MyService {\n * constructor(public value: String) {}\n * }\n *\n * @Component({\n * providers: [\n * MyService,\n * {provide: String, value: 'providers' }\n * ]\n * viewProviders: [\n * {provide: String, value: 'viewProviders'}\n * ]\n * })\n * class MyComponent {\n * constructor(myService: MyService, value: String) {\n * // We expect that Component can see into `viewProviders`.\n * expect(value).toEqual('viewProviders');\n * // `MyService` was not declared in `viewProviders` hence it can't see it.\n * expect(myService.value).toEqual('providers');\n * }\n * }\n *\n * ```\n */\nlet includeViewProviders = true;\nfunction setIncludeViewProviders(v) {\n const oldValue = includeViewProviders;\n includeViewProviders = v;\n return oldValue;\n}\n/**\n * The number of slots in each bloom filter (used by DI). The larger this number, the fewer\n * directives that will share slots, and thus, the fewer false positives when checking for\n * the existence of a directive.\n */\nconst BLOOM_SIZE = 256;\nconst BLOOM_MASK = BLOOM_SIZE - 1;\n/**\n * The number of bits that is represented by a single bloom bucket. JS bit operations are 32 bits,\n * so each bucket represents 32 distinct tokens which accounts for log2(32) = 5 bits of a bloom hash\n * number.\n */\nconst BLOOM_BUCKET_BITS = 5;\n/** Counter used to generate unique IDs for directives. */\nlet nextNgElementId = 0;\n/** Value used when something wasn't found by an injector. */\nconst NOT_FOUND = {};\n/**\n * Registers this directive as present in its node's injector by flipping the directive's\n * corresponding bit in the injector's bloom filter.\n *\n * @param injectorIndex The index of the node injector where this token should be registered\n * @param tView The TView for the injector's bloom filters\n * @param type The directive token to register\n */\nfunction bloomAdd(injectorIndex, tView, type) {\n ngDevMode && assertEqual(tView.firstCreatePass, true, 'expected firstCreatePass to be true');\n let id;\n if (typeof type === 'string') {\n id = type.charCodeAt(0) || 0;\n } else if (type.hasOwnProperty(NG_ELEMENT_ID)) {\n id = type[NG_ELEMENT_ID];\n }\n // Set a unique ID on the directive type, so if something tries to inject the directive,\n // we can easily retrieve the ID and hash it into the bloom bit that should be checked.\n if (id == null) {\n id = type[NG_ELEMENT_ID] = nextNgElementId++;\n }\n // We only have BLOOM_SIZE (256) slots in our bloom filter (8 buckets * 32 bits each),\n // so all unique IDs must be modulo-ed into a number from 0 - 255 to fit into the filter.\n const bloomHash = id & BLOOM_MASK;\n // Create a mask that targets the specific bit associated with the directive.\n // JS bit operations are 32 bits, so this will be a number between 2^0 and 2^31, corresponding\n // to bit positions 0 - 31 in a 32 bit integer.\n const mask = 1 << bloomHash;\n // Each bloom bucket in `tData` represents `BLOOM_BUCKET_BITS` number of bits of `bloomHash`.\n // Any bits in `bloomHash` beyond `BLOOM_BUCKET_BITS` indicate the bucket offset that the mask\n // should be written to.\n tView.data[injectorIndex + (bloomHash >> BLOOM_BUCKET_BITS)] |= mask;\n}\n/**\n * Creates (or gets an existing) injector for a given element or container.\n *\n * @param tNode for which an injector should be retrieved / created.\n * @param lView View where the node is stored\n * @returns Node injector\n */\nfunction getOrCreateNodeInjectorForNode(tNode, lView) {\n const existingInjectorIndex = getInjectorIndex(tNode, lView);\n if (existingInjectorIndex !== -1) {\n return existingInjectorIndex;\n }\n const tView = lView[TVIEW];\n if (tView.firstCreatePass) {\n tNode.injectorIndex = lView.length;\n insertBloom(tView.data, tNode); // foundation for node bloom\n insertBloom(lView, null); // foundation for cumulative bloom\n insertBloom(tView.blueprint, null);\n }\n const parentLoc = getParentInjectorLocation(tNode, lView);\n const injectorIndex = tNode.injectorIndex;\n // If a parent injector can't be found, its location is set to -1.\n // In that case, we don't need to set up a cumulative bloom\n if (hasParentInjector(parentLoc)) {\n const parentIndex = getParentInjectorIndex(parentLoc);\n const parentLView = getParentInjectorView(parentLoc, lView);\n const parentData = parentLView[TVIEW].data;\n // Creates a cumulative bloom filter that merges the parent's bloom filter\n // and its own cumulative bloom (which contains tokens for all ancestors)\n for (let i = 0; i < 8 /* NodeInjectorOffset.BLOOM_SIZE */; i++) {\n lView[injectorIndex + i] = parentLView[parentIndex + i] | parentData[parentIndex + i];\n }\n }\n lView[injectorIndex + 8 /* NodeInjectorOffset.PARENT */] = parentLoc;\n return injectorIndex;\n}\nfunction insertBloom(arr, footer) {\n arr.push(0, 0, 0, 0, 0, 0, 0, 0, footer);\n}\nfunction getInjectorIndex(tNode, lView) {\n if (tNode.injectorIndex === -1 ||\n // If the injector index is the same as its parent's injector index, then the index has been\n // copied down from the parent node. No injector has been created yet on this node.\n tNode.parent && tNode.parent.injectorIndex === tNode.injectorIndex ||\n // After the first template pass, the injector index might exist but the parent values\n // might not have been calculated yet for this instance\n lView[tNode.injectorIndex + 8 /* NodeInjectorOffset.PARENT */] === null) {\n return -1;\n } else {\n ngDevMode && assertIndexInRange(lView, tNode.injectorIndex);\n return tNode.injectorIndex;\n }\n}\n/**\n * Finds the index of the parent injector, with a view offset if applicable. Used to set the\n * parent injector initially.\n *\n * @returns Returns a number that is the combination of the number of LViews that we have to go up\n * to find the LView containing the parent inject AND the index of the injector within that LView.\n */\nfunction getParentInjectorLocation(tNode, lView) {\n if (tNode.parent && tNode.parent.injectorIndex !== -1) {\n // If we have a parent `TNode` and there is an injector associated with it we are done, because\n // the parent injector is within the current `LView`.\n return tNode.parent.injectorIndex; // ViewOffset is 0\n }\n // When parent injector location is computed it may be outside of the current view. (ie it could\n // be pointing to a declared parent location). This variable stores number of declaration parents\n // we need to walk up in order to find the parent injector location.\n let declarationViewOffset = 0;\n let parentTNode = null;\n let lViewCursor = lView;\n // The parent injector is not in the current `LView`. We will have to walk the declared parent\n // `LView` hierarchy and look for it. If we walk of the top, that means that there is no parent\n // `NodeInjector`.\n while (lViewCursor !== null) {\n parentTNode = getTNodeFromLView(lViewCursor);\n if (parentTNode === null) {\n // If we have no parent, than we are done.\n return NO_PARENT_INJECTOR;\n }\n ngDevMode && parentTNode && assertTNodeForLView(parentTNode, lViewCursor[DECLARATION_VIEW]);\n // Every iteration of the loop requires that we go to the declared parent.\n declarationViewOffset++;\n lViewCursor = lViewCursor[DECLARATION_VIEW];\n if (parentTNode.injectorIndex !== -1) {\n // We found a NodeInjector which points to something.\n return parentTNode.injectorIndex | declarationViewOffset << 16 /* RelativeInjectorLocationFlags.ViewOffsetShift */;\n }\n }\n return NO_PARENT_INJECTOR;\n}\n/**\n * Makes a type or an injection token public to the DI system by adding it to an\n * injector's bloom filter.\n *\n * @param di The node injector in which a directive will be added\n * @param token The type or the injection token to be made public\n */\nfunction diPublicInInjector(injectorIndex, tView, token) {\n bloomAdd(injectorIndex, tView, token);\n}\n/**\n * Inject static attribute value into directive constructor.\n *\n * This method is used with `factory` functions which are generated as part of\n * `defineDirective` or `defineComponent`. The method retrieves the static value\n * of an attribute. (Dynamic attributes are not supported since they are not resolved\n * at the time of injection and can change over time.)\n *\n * # Example\n * Given:\n * ```\n * @Component(...)\n * class MyComponent {\n * constructor(@Attribute('title') title: string) { ... }\n * }\n * ```\n * When instantiated with\n * ```\n * \n * ```\n *\n * Then factory method generated is:\n * ```\n * MyComponent.ɵcmp = defineComponent({\n * factory: () => new MyComponent(injectAttribute('title'))\n * ...\n * })\n * ```\n *\n * @publicApi\n */\nfunction injectAttributeImpl(tNode, attrNameToInject) {\n ngDevMode && assertTNodeType(tNode, 12 /* TNodeType.AnyContainer */ | 3 /* TNodeType.AnyRNode */);\n ngDevMode && assertDefined(tNode, 'expecting tNode');\n if (attrNameToInject === 'class') {\n return tNode.classes;\n }\n if (attrNameToInject === 'style') {\n return tNode.styles;\n }\n const attrs = tNode.attrs;\n if (attrs) {\n const attrsLength = attrs.length;\n let i = 0;\n while (i < attrsLength) {\n const value = attrs[i];\n // If we hit a `Bindings` or `Template` marker then we are done.\n if (isNameOnlyAttributeMarker(value)) break;\n // Skip namespaced attributes\n if (value === 0 /* AttributeMarker.NamespaceURI */) {\n // we skip the next two values\n // as namespaced attributes looks like\n // [..., AttributeMarker.NamespaceURI, 'http://someuri.com/test', 'test:exist',\n // 'existValue', ...]\n i = i + 2;\n } else if (typeof value === 'number') {\n // Skip to the first value of the marked attribute.\n i++;\n while (i < attrsLength && typeof attrs[i] === 'string') {\n i++;\n }\n } else if (value === attrNameToInject) {\n return attrs[i + 1];\n } else {\n i = i + 2;\n }\n }\n }\n return null;\n}\nfunction notFoundValueOrThrow(notFoundValue, token, flags) {\n if (flags & InjectFlags.Optional || notFoundValue !== undefined) {\n return notFoundValue;\n } else {\n throwProviderNotFoundError(token, 'NodeInjector');\n }\n}\n/**\n * Returns the value associated to the given token from the ModuleInjector or throws exception\n *\n * @param lView The `LView` that contains the `tNode`\n * @param token The token to look for\n * @param flags Injection flags\n * @param notFoundValue The value to return when the injection flags is `InjectFlags.Optional`\n * @returns the value from the injector or throws an exception\n */\nfunction lookupTokenUsingModuleInjector(lView, token, flags, notFoundValue) {\n if (flags & InjectFlags.Optional && notFoundValue === undefined) {\n // This must be set or the NullInjector will throw for optional deps\n notFoundValue = null;\n }\n if ((flags & (InjectFlags.Self | InjectFlags.Host)) === 0) {\n const moduleInjector = lView[INJECTOR];\n // switch to `injectInjectorOnly` implementation for module injector, since module injector\n // should not have access to Component/Directive DI scope (that may happen through\n // `directiveInject` implementation)\n const previousInjectImplementation = setInjectImplementation(undefined);\n try {\n if (moduleInjector) {\n return moduleInjector.get(token, notFoundValue, flags & InjectFlags.Optional);\n } else {\n return injectRootLimpMode(token, notFoundValue, flags & InjectFlags.Optional);\n }\n } finally {\n setInjectImplementation(previousInjectImplementation);\n }\n }\n return notFoundValueOrThrow(notFoundValue, token, flags);\n}\n/**\n * Returns the value associated to the given token from the NodeInjectors => ModuleInjector.\n *\n * Look for the injector providing the token by walking up the node injector tree and then\n * the module injector tree.\n *\n * This function patches `token` with `__NG_ELEMENT_ID__` which contains the id for the bloom\n * filter. `-1` is reserved for injecting `Injector` (implemented by `NodeInjector`)\n *\n * @param tNode The Node where the search for the injector should start\n * @param lView The `LView` that contains the `tNode`\n * @param token The token to look for\n * @param flags Injection flags\n * @param notFoundValue The value to return when the injection flags is `InjectFlags.Optional`\n * @returns the value from the injector, `null` when not found, or `notFoundValue` if provided\n */\nfunction getOrCreateInjectable(tNode, lView, token, flags = InjectFlags.Default, notFoundValue) {\n if (tNode !== null) {\n // If the view or any of its ancestors have an embedded\n // view injector, we have to look it up there first.\n if (lView[FLAGS] & 2048 /* LViewFlags.HasEmbeddedViewInjector */ &&\n // The token must be present on the current node injector when the `Self`\n // flag is set, so the lookup on embedded view injector(s) can be skipped.\n !(flags & InjectFlags.Self)) {\n const embeddedInjectorValue = lookupTokenUsingEmbeddedInjector(tNode, lView, token, flags, NOT_FOUND);\n if (embeddedInjectorValue !== NOT_FOUND) {\n return embeddedInjectorValue;\n }\n }\n // Otherwise try the node injector.\n const value = lookupTokenUsingNodeInjector(tNode, lView, token, flags, NOT_FOUND);\n if (value !== NOT_FOUND) {\n return value;\n }\n }\n // Finally, fall back to the module injector.\n return lookupTokenUsingModuleInjector(lView, token, flags, notFoundValue);\n}\n/**\n * Returns the value associated to the given token from the node injector.\n *\n * @param tNode The Node where the search for the injector should start\n * @param lView The `LView` that contains the `tNode`\n * @param token The token to look for\n * @param flags Injection flags\n * @param notFoundValue The value to return when the injection flags is `InjectFlags.Optional`\n * @returns the value from the injector, `null` when not found, or `notFoundValue` if provided\n */\nfunction lookupTokenUsingNodeInjector(tNode, lView, token, flags, notFoundValue) {\n const bloomHash = bloomHashBitOrFactory(token);\n // If the ID stored here is a function, this is a special object like ElementRef or TemplateRef\n // so just call the factory function to create it.\n if (typeof bloomHash === 'function') {\n if (!enterDI(lView, tNode, flags)) {\n // Failed to enter DI, try module injector instead. If a token is injected with the @Host\n // flag, the module injector is not searched for that token in Ivy.\n return flags & InjectFlags.Host ? notFoundValueOrThrow(notFoundValue, token, flags) : lookupTokenUsingModuleInjector(lView, token, flags, notFoundValue);\n }\n try {\n let value;\n if (ngDevMode) {\n runInInjectorProfilerContext(new NodeInjector(getCurrentTNode(), getLView()), token, () => {\n value = bloomHash(flags);\n if (value != null) {\n emitInstanceCreatedByInjectorEvent(value);\n }\n });\n } else {\n value = bloomHash(flags);\n }\n if (value == null && !(flags & InjectFlags.Optional)) {\n throwProviderNotFoundError(token);\n } else {\n return value;\n }\n } finally {\n leaveDI();\n }\n } else if (typeof bloomHash === 'number') {\n // A reference to the previous injector TView that was found while climbing the element\n // injector tree. This is used to know if viewProviders can be accessed on the current\n // injector.\n let previousTView = null;\n let injectorIndex = getInjectorIndex(tNode, lView);\n let parentLocation = NO_PARENT_INJECTOR;\n let hostTElementNode = flags & InjectFlags.Host ? lView[DECLARATION_COMPONENT_VIEW][T_HOST] : null;\n // If we should skip this injector, or if there is no injector on this node, start by\n // searching the parent injector.\n if (injectorIndex === -1 || flags & InjectFlags.SkipSelf) {\n parentLocation = injectorIndex === -1 ? getParentInjectorLocation(tNode, lView) : lView[injectorIndex + 8 /* NodeInjectorOffset.PARENT */];\n if (parentLocation === NO_PARENT_INJECTOR || !shouldSearchParent(flags, false)) {\n injectorIndex = -1;\n } else {\n previousTView = lView[TVIEW];\n injectorIndex = getParentInjectorIndex(parentLocation);\n lView = getParentInjectorView(parentLocation, lView);\n }\n }\n // Traverse up the injector tree until we find a potential match or until we know there\n // *isn't* a match.\n while (injectorIndex !== -1) {\n ngDevMode && assertNodeInjector(lView, injectorIndex);\n // Check the current injector. If it matches, see if it contains token.\n const tView = lView[TVIEW];\n ngDevMode && assertTNodeForLView(tView.data[injectorIndex + 8 /* NodeInjectorOffset.TNODE */], lView);\n if (bloomHasToken(bloomHash, injectorIndex, tView.data)) {\n // At this point, we have an injector which *may* contain the token, so we step through\n // the providers and directives associated with the injector's corresponding node to get\n // the instance.\n const instance = searchTokensOnInjector(injectorIndex, lView, token, previousTView, flags, hostTElementNode);\n if (instance !== NOT_FOUND) {\n return instance;\n }\n }\n parentLocation = lView[injectorIndex + 8 /* NodeInjectorOffset.PARENT */];\n if (parentLocation !== NO_PARENT_INJECTOR && shouldSearchParent(flags, lView[TVIEW].data[injectorIndex + 8 /* NodeInjectorOffset.TNODE */] === hostTElementNode) && bloomHasToken(bloomHash, injectorIndex, lView)) {\n // The def wasn't found anywhere on this node, so it was a false positive.\n // Traverse up the tree and continue searching.\n previousTView = tView;\n injectorIndex = getParentInjectorIndex(parentLocation);\n lView = getParentInjectorView(parentLocation, lView);\n } else {\n // If we should not search parent OR If the ancestor bloom filter value does not have the\n // bit corresponding to the directive we can give up on traversing up to find the specific\n // injector.\n injectorIndex = -1;\n }\n }\n }\n return notFoundValue;\n}\nfunction searchTokensOnInjector(injectorIndex, lView, token, previousTView, flags, hostTElementNode) {\n const currentTView = lView[TVIEW];\n const tNode = currentTView.data[injectorIndex + 8 /* NodeInjectorOffset.TNODE */];\n // First, we need to determine if view providers can be accessed by the starting element.\n // There are two possibilities\n const canAccessViewProviders = previousTView == null ?\n // 1) This is the first invocation `previousTView == null` which means that we are at the\n // `TNode` of where injector is starting to look. In such a case the only time we are allowed\n // to look into the ViewProviders is if:\n // - we are on a component\n // - AND the injector set `includeViewProviders` to true (implying that the token can see\n // ViewProviders because it is the Component or a Service which itself was declared in\n // ViewProviders)\n isComponentHost(tNode) && includeViewProviders :\n // 2) `previousTView != null` which means that we are now walking across the parent nodes.\n // In such a case we are only allowed to look into the ViewProviders if:\n // - We just crossed from child View to Parent View `previousTView != currentTView`\n // - AND the parent TNode is an Element.\n // This means that we just came from the Component's View and therefore are allowed to see\n // into the ViewProviders.\n previousTView != currentTView && (tNode.type & 3 /* TNodeType.AnyRNode */) !== 0;\n // This special case happens when there is a @host on the inject and when we are searching\n // on the host element node.\n const isHostSpecialCase = flags & InjectFlags.Host && hostTElementNode === tNode;\n const injectableIdx = locateDirectiveOrProvider(tNode, currentTView, token, canAccessViewProviders, isHostSpecialCase);\n if (injectableIdx !== null) {\n return getNodeInjectable(lView, currentTView, injectableIdx, tNode);\n } else {\n return NOT_FOUND;\n }\n}\n/**\n * Searches for the given token among the node's directives and providers.\n *\n * @param tNode TNode on which directives are present.\n * @param tView The tView we are currently processing\n * @param token Provider token or type of a directive to look for.\n * @param canAccessViewProviders Whether view providers should be considered.\n * @param isHostSpecialCase Whether the host special case applies.\n * @returns Index of a found directive or provider, or null when none found.\n */\nfunction locateDirectiveOrProvider(tNode, tView, token, canAccessViewProviders, isHostSpecialCase) {\n const nodeProviderIndexes = tNode.providerIndexes;\n const tInjectables = tView.data;\n const injectablesStart = nodeProviderIndexes & 1048575 /* TNodeProviderIndexes.ProvidersStartIndexMask */;\n const directivesStart = tNode.directiveStart;\n const directiveEnd = tNode.directiveEnd;\n const cptViewProvidersCount = nodeProviderIndexes >> 20 /* TNodeProviderIndexes.CptViewProvidersCountShift */;\n const startingIndex = canAccessViewProviders ? injectablesStart : injectablesStart + cptViewProvidersCount;\n // When the host special case applies, only the viewProviders and the component are visible\n const endIndex = isHostSpecialCase ? injectablesStart + cptViewProvidersCount : directiveEnd;\n for (let i = startingIndex; i < endIndex; i++) {\n const providerTokenOrDef = tInjectables[i];\n if (i < directivesStart && token === providerTokenOrDef || i >= directivesStart && providerTokenOrDef.type === token) {\n return i;\n }\n }\n if (isHostSpecialCase) {\n const dirDef = tInjectables[directivesStart];\n if (dirDef && isComponentDef(dirDef) && dirDef.type === token) {\n return directivesStart;\n }\n }\n return null;\n}\n/**\n * Retrieve or instantiate the injectable from the `LView` at particular `index`.\n *\n * This function checks to see if the value has already been instantiated and if so returns the\n * cached `injectable`. Otherwise if it detects that the value is still a factory it\n * instantiates the `injectable` and caches the value.\n */\nfunction getNodeInjectable(lView, tView, index, tNode) {\n let value = lView[index];\n const tData = tView.data;\n if (isFactory(value)) {\n const factory = value;\n if (factory.resolving) {\n throwCyclicDependencyError(stringifyForError(tData[index]));\n }\n const previousIncludeViewProviders = setIncludeViewProviders(factory.canSeeViewProviders);\n factory.resolving = true;\n let prevInjectContext;\n if (ngDevMode) {\n // tData indexes mirror the concrete instances in its corresponding LView.\n // lView[index] here is either the injectable instace itself or a factory,\n // therefore tData[index] is the constructor of that injectable or a\n // definition object that contains the constructor in a `.type` field.\n const token = tData[index].type || tData[index];\n const injector = new NodeInjector(tNode, lView);\n prevInjectContext = setInjectorProfilerContext({\n injector,\n token\n });\n }\n const previousInjectImplementation = factory.injectImpl ? setInjectImplementation(factory.injectImpl) : null;\n const success = enterDI(lView, tNode, InjectFlags.Default);\n ngDevMode && assertEqual(success, true, \"Because flags do not contain `SkipSelf' we expect this to always succeed.\");\n try {\n value = lView[index] = factory.factory(undefined, tData, lView, tNode);\n ngDevMode && emitInstanceCreatedByInjectorEvent(value);\n // This code path is hit for both directives and providers.\n // For perf reasons, we want to avoid searching for hooks on providers.\n // It does no harm to try (the hooks just won't exist), but the extra\n // checks are unnecessary and this is a hot path. So we check to see\n // if the index of the dependency is in the directive range for this\n // tNode. If it's not, we know it's a provider and skip hook registration.\n if (tView.firstCreatePass && index >= tNode.directiveStart) {\n ngDevMode && assertDirectiveDef(tData[index]);\n registerPreOrderHooks(index, tData[index], tView);\n }\n } finally {\n ngDevMode && setInjectorProfilerContext(prevInjectContext);\n previousInjectImplementation !== null && setInjectImplementation(previousInjectImplementation);\n setIncludeViewProviders(previousIncludeViewProviders);\n factory.resolving = false;\n leaveDI();\n }\n }\n return value;\n}\n/**\n * Returns the bit in an injector's bloom filter that should be used to determine whether or not\n * the directive might be provided by the injector.\n *\n * When a directive is public, it is added to the bloom filter and given a unique ID that can be\n * retrieved on the Type. When the directive isn't public or the token is not a directive `null`\n * is returned as the node injector can not possibly provide that token.\n *\n * @param token the injection token\n * @returns the matching bit to check in the bloom filter or `null` if the token is not known.\n * When the returned value is negative then it represents special values such as `Injector`.\n */\nfunction bloomHashBitOrFactory(token) {\n ngDevMode && assertDefined(token, 'token must be defined');\n if (typeof token === 'string') {\n return token.charCodeAt(0) || 0;\n }\n const tokenId =\n // First check with `hasOwnProperty` so we don't get an inherited ID.\n token.hasOwnProperty(NG_ELEMENT_ID) ? token[NG_ELEMENT_ID] : undefined;\n // Negative token IDs are used for special objects such as `Injector`\n if (typeof tokenId === 'number') {\n if (tokenId >= 0) {\n return tokenId & BLOOM_MASK;\n } else {\n ngDevMode && assertEqual(tokenId, -1 /* InjectorMarkers.Injector */, 'Expecting to get Special Injector Id');\n return createNodeInjector;\n }\n } else {\n return tokenId;\n }\n}\nfunction bloomHasToken(bloomHash, injectorIndex, injectorView) {\n // Create a mask that targets the specific bit associated with the directive we're looking for.\n // JS bit operations are 32 bits, so this will be a number between 2^0 and 2^31, corresponding\n // to bit positions 0 - 31 in a 32 bit integer.\n const mask = 1 << bloomHash;\n // Each bloom bucket in `injectorView` represents `BLOOM_BUCKET_BITS` number of bits of\n // `bloomHash`. Any bits in `bloomHash` beyond `BLOOM_BUCKET_BITS` indicate the bucket offset\n // that should be used.\n const value = injectorView[injectorIndex + (bloomHash >> BLOOM_BUCKET_BITS)];\n // If the bloom filter value has the bit corresponding to the directive's bloomBit flipped on,\n // this injector is a potential match.\n return !!(value & mask);\n}\n/** Returns true if flags prevent parent injector from being searched for tokens */\nfunction shouldSearchParent(flags, isFirstHostTNode) {\n return !(flags & InjectFlags.Self) && !(flags & InjectFlags.Host && isFirstHostTNode);\n}\nfunction getNodeInjectorLView(nodeInjector) {\n return nodeInjector._lView;\n}\nfunction getNodeInjectorTNode(nodeInjector) {\n return nodeInjector._tNode;\n}\nclass NodeInjector {\n constructor(_tNode, _lView) {\n this._tNode = _tNode;\n this._lView = _lView;\n }\n get(token, notFoundValue, flags) {\n return getOrCreateInjectable(this._tNode, this._lView, token, convertToBitFlags(flags), notFoundValue);\n }\n}\n/** Creates a `NodeInjector` for the current node. */\nfunction createNodeInjector() {\n return new NodeInjector(getCurrentTNode(), getLView());\n}\n/**\n * @codeGenApi\n */\nfunction ɵɵgetInheritedFactory(type) {\n return noSideEffects(() => {\n const ownConstructor = type.prototype.constructor;\n const ownFactory = ownConstructor[NG_FACTORY_DEF] || getFactoryOf(ownConstructor);\n const objectPrototype = Object.prototype;\n let parent = Object.getPrototypeOf(type.prototype).constructor;\n // Go up the prototype until we hit `Object`.\n while (parent && parent !== objectPrototype) {\n const factory = parent[NG_FACTORY_DEF] || getFactoryOf(parent);\n // If we hit something that has a factory and the factory isn't the same as the type,\n // we've found the inherited factory. Note the check that the factory isn't the type's\n // own factory is redundant in most cases, but if the user has custom decorators on the\n // class, this lookup will start one level down in the prototype chain, causing us to\n // find the own factory first and potentially triggering an infinite loop downstream.\n if (factory && factory !== ownFactory) {\n return factory;\n }\n parent = Object.getPrototypeOf(parent);\n }\n // There is no factory defined. Either this was improper usage of inheritance\n // (no Angular decorator on the superclass) or there is no constructor at all\n // in the inheritance chain. Since the two cases cannot be distinguished, the\n // latter has to be assumed.\n return t => new t();\n });\n}\nfunction getFactoryOf(type) {\n if (isForwardRef(type)) {\n return () => {\n const factory = getFactoryOf(resolveForwardRef(type));\n return factory && factory();\n };\n }\n return getFactoryDef(type);\n}\n/**\n * Returns a value from the closest embedded or node injector.\n *\n * @param tNode The Node where the search for the injector should start\n * @param lView The `LView` that contains the `tNode`\n * @param token The token to look for\n * @param flags Injection flags\n * @param notFoundValue The value to return when the injection flags is `InjectFlags.Optional`\n * @returns the value from the injector, `null` when not found, or `notFoundValue` if provided\n */\nfunction lookupTokenUsingEmbeddedInjector(tNode, lView, token, flags, notFoundValue) {\n let currentTNode = tNode;\n let currentLView = lView;\n // When an LView with an embedded view injector is inserted, it'll likely be interlaced with\n // nodes who may have injectors (e.g. node injector -> embedded view injector -> node injector).\n // Since the bloom filters for the node injectors have already been constructed and we don't\n // have a way of extracting the records from an injector, the only way to maintain the correct\n // hierarchy when resolving the value is to walk it node-by-node while attempting to resolve\n // the token at each level.\n while (currentTNode !== null && currentLView !== null && currentLView[FLAGS] & 2048 /* LViewFlags.HasEmbeddedViewInjector */ && !(currentLView[FLAGS] & 512 /* LViewFlags.IsRoot */)) {\n ngDevMode && assertTNodeForLView(currentTNode, currentLView);\n // Note that this lookup on the node injector is using the `Self` flag, because\n // we don't want the node injector to look at any parent injectors since we\n // may hit the embedded view injector first.\n const nodeInjectorValue = lookupTokenUsingNodeInjector(currentTNode, currentLView, token, flags | InjectFlags.Self, NOT_FOUND);\n if (nodeInjectorValue !== NOT_FOUND) {\n return nodeInjectorValue;\n }\n // Has an explicit type due to a TS bug: https://github.com/microsoft/TypeScript/issues/33191\n let parentTNode = currentTNode.parent;\n // `TNode.parent` includes the parent within the current view only. If it doesn't exist,\n // it means that we've hit the view boundary and we need to go up to the next view.\n if (!parentTNode) {\n // Before we go to the next LView, check if the token exists on the current embedded injector.\n const embeddedViewInjector = currentLView[EMBEDDED_VIEW_INJECTOR];\n if (embeddedViewInjector) {\n const embeddedViewInjectorValue = embeddedViewInjector.get(token, NOT_FOUND, flags);\n if (embeddedViewInjectorValue !== NOT_FOUND) {\n return embeddedViewInjectorValue;\n }\n }\n // Otherwise keep going up the tree.\n parentTNode = getTNodeFromLView(currentLView);\n currentLView = currentLView[DECLARATION_VIEW];\n }\n currentTNode = parentTNode;\n }\n return notFoundValue;\n}\n/** Gets the TNode associated with an LView inside of the declaration view. */\nfunction getTNodeFromLView(lView) {\n const tView = lView[TVIEW];\n const tViewType = tView.type;\n // The parent pointer differs based on `TView.type`.\n if (tViewType === 2 /* TViewType.Embedded */) {\n ngDevMode && assertDefined(tView.declTNode, 'Embedded TNodes should have declaration parents.');\n return tView.declTNode;\n } else if (tViewType === 1 /* TViewType.Component */) {\n // Components don't have `TView.declTNode` because each instance of component could be\n // inserted in different location, hence `TView.declTNode` is meaningless.\n return lView[T_HOST];\n }\n return null;\n}\n\n/**\n * Facade for the attribute injection from DI.\n *\n * @codeGenApi\n */\nfunction ɵɵinjectAttribute(attrNameToInject) {\n return injectAttributeImpl(getCurrentTNode(), attrNameToInject);\n}\n\n/**\n * Attribute decorator and metadata.\n *\n * @Annotation\n * @publicApi\n */\nconst Attribute = makeParamDecorator('Attribute', attributeName => ({\n attributeName,\n __NG_ELEMENT_ID__: () => ɵɵinjectAttribute(attributeName)\n}));\nlet _reflect = null;\nfunction getReflect() {\n return _reflect = _reflect || new ReflectionCapabilities();\n}\nfunction reflectDependencies(type) {\n return convertDependencies(getReflect().parameters(type));\n}\nfunction convertDependencies(deps) {\n return deps.map(dep => reflectDependency(dep));\n}\nfunction reflectDependency(dep) {\n const meta = {\n token: null,\n attribute: null,\n host: false,\n optional: false,\n self: false,\n skipSelf: false\n };\n if (Array.isArray(dep) && dep.length > 0) {\n for (let j = 0; j < dep.length; j++) {\n const param = dep[j];\n if (param === undefined) {\n // param may be undefined if type of dep is not set by ngtsc\n continue;\n }\n const proto = Object.getPrototypeOf(param);\n if (param instanceof Optional || proto.ngMetadataName === 'Optional') {\n meta.optional = true;\n } else if (param instanceof SkipSelf || proto.ngMetadataName === 'SkipSelf') {\n meta.skipSelf = true;\n } else if (param instanceof Self || proto.ngMetadataName === 'Self') {\n meta.self = true;\n } else if (param instanceof Host || proto.ngMetadataName === 'Host') {\n meta.host = true;\n } else if (param instanceof Inject) {\n meta.token = param.token;\n } else if (param instanceof Attribute) {\n if (param.attributeName === undefined) {\n throw new RuntimeError(204 /* RuntimeErrorCode.INVALID_INJECTION_TOKEN */, ngDevMode && `Attribute name must be defined.`);\n }\n meta.attribute = param.attributeName;\n } else {\n meta.token = param;\n }\n }\n } else if (dep === undefined || Array.isArray(dep) && dep.length === 0) {\n meta.token = null;\n } else {\n meta.token = dep;\n }\n return meta;\n}\n\n/**\n * Compile an Angular injectable according to its `Injectable` metadata, and patch the resulting\n * injectable def (`ɵprov`) onto the injectable type.\n */\nfunction compileInjectable(type, meta) {\n let ngInjectableDef = null;\n let ngFactoryDef = null;\n // if NG_PROV_DEF is already defined on this class then don't overwrite it\n if (!type.hasOwnProperty(NG_PROV_DEF)) {\n Object.defineProperty(type, NG_PROV_DEF, {\n get: () => {\n if (ngInjectableDef === null) {\n const compiler = getCompilerFacade({\n usage: 0 /* JitCompilerUsage.Decorator */,\n kind: 'injectable',\n type\n });\n ngInjectableDef = compiler.compileInjectable(angularCoreDiEnv, `ng:///${type.name}/ɵprov.js`, getInjectableMetadata(type, meta));\n }\n return ngInjectableDef;\n }\n });\n }\n // if NG_FACTORY_DEF is already defined on this class then don't overwrite it\n if (!type.hasOwnProperty(NG_FACTORY_DEF)) {\n Object.defineProperty(type, NG_FACTORY_DEF, {\n get: () => {\n if (ngFactoryDef === null) {\n const compiler = getCompilerFacade({\n usage: 0 /* JitCompilerUsage.Decorator */,\n kind: 'injectable',\n type\n });\n ngFactoryDef = compiler.compileFactory(angularCoreDiEnv, `ng:///${type.name}/ɵfac.js`, {\n name: type.name,\n type,\n typeArgumentCount: 0,\n // In JIT mode types are not available nor used.\n deps: reflectDependencies(type),\n target: compiler.FactoryTarget.Injectable\n });\n }\n return ngFactoryDef;\n },\n // Leave this configurable so that the factories from directives or pipes can take precedence.\n configurable: true\n });\n }\n}\nconst USE_VALUE = getClosureSafeProperty({\n provide: String,\n useValue: getClosureSafeProperty\n});\nfunction isUseClassProvider(meta) {\n return meta.useClass !== undefined;\n}\nfunction isUseValueProvider(meta) {\n return USE_VALUE in meta;\n}\nfunction isUseFactoryProvider(meta) {\n return meta.useFactory !== undefined;\n}\nfunction isUseExistingProvider(meta) {\n return meta.useExisting !== undefined;\n}\nfunction getInjectableMetadata(type, srcMeta) {\n // Allow the compilation of a class with a `@Injectable()` decorator without parameters\n const meta = srcMeta || {\n providedIn: null\n };\n const compilerMeta = {\n name: type.name,\n type: type,\n typeArgumentCount: 0,\n providedIn: meta.providedIn\n };\n if ((isUseClassProvider(meta) || isUseFactoryProvider(meta)) && meta.deps !== undefined) {\n compilerMeta.deps = convertDependencies(meta.deps);\n }\n // Check to see if the user explicitly provided a `useXxxx` property.\n if (isUseClassProvider(meta)) {\n compilerMeta.useClass = meta.useClass;\n } else if (isUseValueProvider(meta)) {\n compilerMeta.useValue = meta.useValue;\n } else if (isUseFactoryProvider(meta)) {\n compilerMeta.useFactory = meta.useFactory;\n } else if (isUseExistingProvider(meta)) {\n compilerMeta.useExisting = meta.useExisting;\n }\n return compilerMeta;\n}\n\n/**\n * Injectable decorator and metadata.\n *\n * @Annotation\n * @publicApi\n */\nconst Injectable = makeDecorator('Injectable', undefined, undefined, undefined, (type, meta) => compileInjectable(type, meta));\n\n/**\n * Create a new `Injector` which is configured using a `defType` of `InjectorType`s.\n */\nfunction createInjector(defType, parent = null, additionalProviders = null, name) {\n const injector = createInjectorWithoutInjectorInstances(defType, parent, additionalProviders, name);\n injector.resolveInjectorInitializers();\n return injector;\n}\n/**\n * Creates a new injector without eagerly resolving its injector types. Can be used in places\n * where resolving the injector types immediately can lead to an infinite loop. The injector types\n * should be resolved at a later point by calling `_resolveInjectorDefTypes`.\n */\nfunction createInjectorWithoutInjectorInstances(defType, parent = null, additionalProviders = null, name, scopes = new Set()) {\n const providers = [additionalProviders || EMPTY_ARRAY, importProvidersFrom(defType)];\n name = name || (typeof defType === 'object' ? undefined : stringify(defType));\n return new R3Injector(providers, parent || getNullInjector(), name || null, scopes);\n}\n\n/**\n * Concrete injectors implement this interface. Injectors are configured\n * with [providers](guide/di/dependency-injection-providers) that associate\n * dependencies of various types with [injection tokens](guide/di/dependency-injection-providers).\n *\n * @see [DI Providers](guide/di/dependency-injection-providers).\n * @see {@link StaticProvider}\n *\n * @usageNotes\n *\n * The following example creates a service injector instance.\n *\n * {@example core/di/ts/provider_spec.ts region='ConstructorProvider'}\n *\n * ### Usage example\n *\n * {@example core/di/ts/injector_spec.ts region='Injector'}\n *\n * `Injector` returns itself when given `Injector` as a token:\n *\n * {@example core/di/ts/injector_spec.ts region='injectInjector'}\n *\n * @publicApi\n */\nclass Injector {\n static {\n this.THROW_IF_NOT_FOUND = THROW_IF_NOT_FOUND;\n }\n static {\n this.NULL = new NullInjector();\n }\n static create(options, parent) {\n if (Array.isArray(options)) {\n return createInjector({\n name: ''\n }, parent, options, '');\n } else {\n const name = options.name ?? '';\n return createInjector({\n name\n }, options.parent, options.providers, name);\n }\n }\n /** @nocollapse */\n static {\n this.ɵprov = ɵɵdefineInjectable({\n token: Injector,\n providedIn: 'any',\n factory: () => ɵɵinject(INJECTOR$1)\n });\n }\n /**\n * @internal\n * @nocollapse\n */\n static {\n this.__NG_ELEMENT_ID__ = -1 /* InjectorMarkers.Injector */;\n }\n}\n\n/*!\n * @license\n * Copyright Google LLC All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n/**\n * Creates a token that can be used to inject static attributes of the host node.\n *\n * @usageNotes\n * ### Injecting an attribute that is known to exist\n * ```typescript\n * @Directive()\n * class MyDir {\n * attr: string = inject(new HostAttributeToken('some-attr'));\n * }\n * ```\n *\n * ### Optionally injecting an attribute\n * ```typescript\n * @Directive()\n * class MyDir {\n * attr: string | null = inject(new HostAttributeToken('some-attr'), {optional: true});\n * }\n * ```\n * @publicApi\n */\nclass HostAttributeToken {\n constructor(attributeName) {\n this.attributeName = attributeName;\n /** @internal */\n this.__NG_ELEMENT_ID__ = () => ɵɵinjectAttribute(this.attributeName);\n }\n toString() {\n return `HostAttributeToken ${this.attributeName}`;\n }\n}\n\n/**\n * A token that can be used to inject the tag name of the host node.\n *\n * @usageNotes\n * ### Injecting a tag name that is known to exist\n * ```typescript\n * @Directive()\n * class MyDir {\n * tagName: string = inject(HOST_TAG_NAME);\n * }\n * ```\n *\n * ### Optionally injecting a tag name\n * ```typescript\n * @Directive()\n * class MyDir {\n * tagName: string | null = inject(HOST_TAG_NAME, {optional: true});\n * }\n * ```\n * @publicApi\n */\nconst HOST_TAG_NAME = new InjectionToken(ngDevMode ? 'HOST_TAG_NAME' : '');\n// HOST_TAG_NAME should be resolved at the current node, similar to e.g. ElementRef,\n// so we manually specify __NG_ELEMENT_ID__ here, instead of using a factory.\n// tslint:disable-next-line:no-toplevel-property-access\nHOST_TAG_NAME.__NG_ELEMENT_ID__ = flags => {\n const tNode = getCurrentTNode();\n if (tNode === null) {\n throw new RuntimeError(204 /* RuntimeErrorCode.INVALID_INJECTION_TOKEN */, ngDevMode && 'HOST_TAG_NAME can only be injected in directives and components ' + 'during construction time (in a class constructor or as a class field initializer)');\n }\n if (tNode.type & 2 /* TNodeType.Element */) {\n return tNode.value;\n }\n if (flags & InjectFlags.Optional) {\n return null;\n }\n throw new RuntimeError(204 /* RuntimeErrorCode.INVALID_INJECTION_TOKEN */, ngDevMode && `HOST_TAG_NAME was used on ${getDevModeNodeName(tNode)} which doesn't have an underlying element in the DOM. ` + `This is invalid, and so the dependency should be marked as optional.`);\n};\nfunction getDevModeNodeName(tNode) {\n if (tNode.type & 8 /* TNodeType.ElementContainer */) {\n return 'an ';\n } else if (tNode.type & 4 /* TNodeType.Container */) {\n return 'an ';\n } else if (tNode.type & 128 /* TNodeType.LetDeclaration */) {\n return 'an @let declaration';\n } else {\n return 'a node';\n }\n}\n\n/**\n * @module\n * @description\n * The `di` module provides dependency injection container services.\n */\n\n/**\n * This file should not be necessary because node resolution should just default to `./di/index`!\n *\n * However it does not seem to work and it breaks:\n * - //packages/animations/browser/test:test_web_chromium-local\n * - //packages/compiler-cli/test:extract_i18n\n * - //packages/compiler-cli/test:ngc\n * - //packages/compiler-cli/test:perform_watch\n * - //packages/compiler-cli/test/diagnostics:check_types\n * - //packages/compiler-cli/test/transformers:test\n * - //packages/compiler/test:test\n * - //tools/public_api_guard:core_api\n *\n * Remove this file once the above is solved or wait until `ngc` is deleted and then it should be\n * safe to delete this file.\n */\n\nconst ERROR_ORIGINAL_ERROR = 'ngOriginalError';\nfunction wrappedError(message, originalError) {\n const msg = `${message} caused by: ${originalError instanceof Error ? originalError.message : originalError}`;\n const error = Error(msg);\n error[ERROR_ORIGINAL_ERROR] = originalError;\n return error;\n}\nfunction getOriginalError(error) {\n return error[ERROR_ORIGINAL_ERROR];\n}\n\n/**\n * Provides a hook for centralized exception handling.\n *\n * The default implementation of `ErrorHandler` prints error messages to the `console`. To\n * intercept error handling, write a custom exception handler that replaces this default as\n * appropriate for your app.\n *\n * @usageNotes\n * ### Example\n *\n * ```\n * class MyErrorHandler implements ErrorHandler {\n * handleError(error) {\n * // do something with the exception\n * }\n * }\n *\n * @NgModule({\n * providers: [{provide: ErrorHandler, useClass: MyErrorHandler}]\n * })\n * class MyModule {}\n * ```\n *\n * @publicApi\n */\nclass ErrorHandler {\n constructor() {\n /**\n * @internal\n */\n this._console = console;\n }\n handleError(error) {\n const originalError = this._findOriginalError(error);\n this._console.error('ERROR', error);\n if (originalError) {\n this._console.error('ORIGINAL ERROR', originalError);\n }\n }\n /** @internal */\n _findOriginalError(error) {\n let e = error && getOriginalError(error);\n while (e && getOriginalError(e)) {\n e = getOriginalError(e);\n }\n return e || null;\n }\n}\n/**\n * `InjectionToken` used to configure how to call the `ErrorHandler`.\n *\n * `NgZone` is provided by default today so the default (and only) implementation for this\n * is calling `ErrorHandler.handleError` outside of the Angular zone.\n */\nconst INTERNAL_APPLICATION_ERROR_HANDLER = new InjectionToken(typeof ngDevMode === 'undefined' || ngDevMode ? 'internal error handler' : '', {\n providedIn: 'root',\n factory: () => {\n const userErrorHandler = inject(ErrorHandler);\n return userErrorHandler.handleError.bind(undefined);\n }\n});\n\n/**\n * `DestroyRef` lets you set callbacks to run for any cleanup or destruction behavior.\n * The scope of this destruction depends on where `DestroyRef` is injected. If `DestroyRef`\n * is injected in a component or directive, the callbacks run when that component or\n * directive is destroyed. Otherwise the callbacks run when a corresponding injector is destroyed.\n *\n * @publicApi\n */\nclass DestroyRef {\n /**\n * @internal\n * @nocollapse\n */\n static {\n this.__NG_ELEMENT_ID__ = injectDestroyRef;\n }\n /**\n * @internal\n * @nocollapse\n */\n static {\n this.__NG_ENV_ID__ = injector => injector;\n }\n}\nclass NodeInjectorDestroyRef extends DestroyRef {\n constructor(_lView) {\n super();\n this._lView = _lView;\n }\n onDestroy(callback) {\n storeLViewOnDestroy(this._lView, callback);\n return () => removeLViewOnDestroy(this._lView, callback);\n }\n}\nfunction injectDestroyRef() {\n return new NodeInjectorDestroyRef(getLView());\n}\n\n/**\n * An `OutputEmitterRef` is created by the `output()` function and can be\n * used to emit values to consumers of your directive or component.\n *\n * Consumers of your directive/component can bind to the output and\n * subscribe to changes via the bound event syntax. For example:\n *\n * ```html\n * \n * ```\n *\n * @developerPreview\n */\nclass OutputEmitterRef {\n constructor() {\n this.destroyed = false;\n this.listeners = null;\n this.errorHandler = inject(ErrorHandler, {\n optional: true\n });\n /** @internal */\n this.destroyRef = inject(DestroyRef);\n // Clean-up all listeners and mark as destroyed upon destroy.\n this.destroyRef.onDestroy(() => {\n this.destroyed = true;\n this.listeners = null;\n });\n }\n subscribe(callback) {\n if (this.destroyed) {\n throw new RuntimeError(953 /* RuntimeErrorCode.OUTPUT_REF_DESTROYED */, ngDevMode && 'Unexpected subscription to destroyed `OutputRef`. ' + 'The owning directive/component is destroyed.');\n }\n (this.listeners ??= []).push(callback);\n return {\n unsubscribe: () => {\n const idx = this.listeners?.indexOf(callback);\n if (idx !== undefined && idx !== -1) {\n this.listeners?.splice(idx, 1);\n }\n }\n };\n }\n /** Emits a new value to the output. */\n emit(value) {\n if (this.destroyed) {\n throw new RuntimeError(953 /* RuntimeErrorCode.OUTPUT_REF_DESTROYED */, ngDevMode && 'Unexpected emit for destroyed `OutputRef`. ' + 'The owning directive/component is destroyed.');\n }\n if (this.listeners === null) {\n return;\n }\n const previousConsumer = setActiveConsumer$1(null);\n try {\n for (const listenerFn of this.listeners) {\n try {\n listenerFn(value);\n } catch (err) {\n this.errorHandler?.handleError(err);\n }\n }\n } finally {\n setActiveConsumer$1(previousConsumer);\n }\n }\n}\n/** Gets the owning `DestroyRef` for the given output. */\nfunction getOutputDestroyRef(ref) {\n return ref.destroyRef;\n}\n\n/**\n * The `output` function allows declaration of Angular outputs in\n * directives and components.\n *\n * You can use outputs to emit values to parent directives and component.\n * Parents can subscribe to changes via:\n *\n * - template event bindings. For example, `(myOutput)=\"doSomething($event)\"`\n * - programmatic subscription by using `OutputRef#subscribe`.\n *\n * @usageNotes\n *\n * To use `output()`, import the function from `@angular/core`.\n *\n * ```\n * import {output} from '@angular/core`;\n * ```\n *\n * Inside your component, introduce a new class member and initialize\n * it with a call to `output`.\n *\n * ```ts\n * @Directive({\n * ...\n * })\n * export class MyDir {\n * nameChange = output(); // OutputEmitterRef\n * onClick = output(); // OutputEmitterRef\n * }\n * ```\n *\n * You can emit values to consumers of your directive, by using\n * the `emit` method from `OutputEmitterRef`.\n *\n * ```ts\n * updateName(newName: string): void {\n * this.nameChange.emit(newName);\n * }\n * ```\n *\n * @developerPreview\n * @initializerApiFunction {\"showTypesInSignaturePreview\": true}\n */\nfunction output(opts) {\n ngDevMode && assertInInjectionContext(output);\n return new OutputEmitterRef();\n}\nfunction inputFunction(initialValue, opts) {\n ngDevMode && assertInInjectionContext(input);\n return createInputSignal(initialValue, opts);\n}\nfunction inputRequiredFunction(opts) {\n ngDevMode && assertInInjectionContext(input);\n return createInputSignal(REQUIRED_UNSET_VALUE, opts);\n}\n/**\n * The `input` function allows declaration of Angular inputs in directives\n * and components.\n *\n * There are two variants of inputs that can be declared:\n *\n * 1. **Optional inputs** with an initial value.\n * 2. **Required inputs** that consumers need to set.\n *\n * By default, the `input` function will declare optional inputs that\n * always have an initial value. Required inputs can be declared\n * using the `input.required()` function.\n *\n * Inputs are signals. The values of an input are exposed as a `Signal`.\n * The signal always holds the latest value of the input that is bound\n * from the parent.\n *\n * @usageNotes\n * To use signal-based inputs, import `input` from `@angular/core`.\n *\n * ```\n * import {input} from '@angular/core`;\n * ```\n *\n * Inside your component, introduce a new class member and initialize\n * it with a call to `input` or `input.required`.\n *\n * ```ts\n * @Component({\n * ...\n * })\n * export class UserProfileComponent {\n * firstName = input(); // Signal\n * lastName = input.required(); // Signal\n * age = input(0) // Signal\n * }\n * ```\n *\n * Inside your component template, you can display values of the inputs\n * by calling the signal.\n *\n * ```html\n * {{firstName()}}\n * ```\n *\n * @developerPreview\n * @initializerApiFunction\n */\nconst input = (() => {\n // Note: This may be considered a side-effect, but nothing will depend on\n // this assignment, unless this `input` constant export is accessed. It's a\n // self-contained side effect that is local to the user facing`input` export.\n inputFunction.required = inputRequiredFunction;\n return inputFunction;\n})();\n\n/**\n * Creates an ElementRef from the most recent node.\n *\n * @returns The ElementRef instance to use\n */\nfunction injectElementRef() {\n return createElementRef(getCurrentTNode(), getLView());\n}\n/**\n * Creates an ElementRef given a node.\n *\n * @param tNode The node for which you'd like an ElementRef\n * @param lView The view to which the node belongs\n * @returns The ElementRef instance to use\n */\nfunction createElementRef(tNode, lView) {\n return new ElementRef(getNativeByTNode(tNode, lView));\n}\n/**\n * A wrapper around a native element inside of a View.\n *\n * An `ElementRef` is backed by a render-specific element. In the browser, this is usually a DOM\n * element.\n *\n * @security Permitting direct access to the DOM can make your application more vulnerable to\n * XSS attacks. Carefully review any use of `ElementRef` in your code. For more detail, see the\n * [Security Guide](https://g.co/ng/security).\n *\n * @publicApi\n */\n// Note: We don't expose things like `Injector`, `ViewContainer`, ... here,\n// i.e. users have to ask for what they need. With that, we can build better analysis tools\n// and could do better codegen in the future.\nclass ElementRef {\n constructor(nativeElement) {\n this.nativeElement = nativeElement;\n }\n /**\n * @internal\n * @nocollapse\n */\n static {\n this.__NG_ELEMENT_ID__ = injectElementRef;\n }\n}\n/**\n * Unwraps `ElementRef` and return the `nativeElement`.\n *\n * @param value value to unwrap\n * @returns `nativeElement` if `ElementRef` otherwise returns value as is.\n */\nfunction unwrapElementRef(value) {\n return value instanceof ElementRef ? value.nativeElement : value;\n}\n\n/**\n * Internal implementation of the pending tasks service.\n */\nclass PendingTasks {\n constructor() {\n this.taskId = 0;\n this.pendingTasks = new Set();\n this.hasPendingTasks = new BehaviorSubject(false);\n }\n get _hasPendingTasks() {\n return this.hasPendingTasks.value;\n }\n add() {\n if (!this._hasPendingTasks) {\n this.hasPendingTasks.next(true);\n }\n const taskId = this.taskId++;\n this.pendingTasks.add(taskId);\n return taskId;\n }\n remove(taskId) {\n this.pendingTasks.delete(taskId);\n if (this.pendingTasks.size === 0 && this._hasPendingTasks) {\n this.hasPendingTasks.next(false);\n }\n }\n ngOnDestroy() {\n this.pendingTasks.clear();\n if (this._hasPendingTasks) {\n this.hasPendingTasks.next(false);\n }\n }\n /** @nocollapse */\n static {\n this.ɵprov = ɵɵdefineInjectable({\n token: PendingTasks,\n providedIn: 'root',\n factory: () => new PendingTasks()\n });\n }\n}\n/**\n * Experimental service that keeps track of pending tasks contributing to the stableness of Angular\n * application. While several existing Angular services (ex.: `HttpClient`) will internally manage\n * tasks influencing stability, this API gives control over stability to library and application\n * developers for specific cases not covered by Angular internals.\n *\n * The concept of stability comes into play in several important scenarios:\n * - SSR process needs to wait for the application stability before serializing and sending rendered\n * HTML;\n * - tests might want to delay assertions until the application becomes stable;\n *\n * @usageNotes\n * ```typescript\n * const pendingTasks = inject(ExperimentalPendingTasks);\n * const taskCleanup = pendingTasks.add();\n * // do work that should block application's stability and then:\n * taskCleanup();\n * ```\n *\n * This API is experimental. Neither the shape, nor the underlying behavior is stable and can change\n * in patch versions. We will iterate on the exact API based on the feedback and our understanding\n * of the problem and solution space.\n *\n * @publicApi\n * @experimental\n */\nclass ExperimentalPendingTasks {\n constructor() {\n this.internalPendingTasks = inject(PendingTasks);\n }\n /**\n * Adds a new task that should block application's stability.\n * @returns A cleanup function that removes a task when called.\n */\n add() {\n const taskId = this.internalPendingTasks.add();\n return () => this.internalPendingTasks.remove(taskId);\n }\n /** @nocollapse */\n static {\n this.ɵprov = ɵɵdefineInjectable({\n token: ExperimentalPendingTasks,\n providedIn: 'root',\n factory: () => new ExperimentalPendingTasks()\n });\n }\n}\nclass EventEmitter_ extends Subject {\n constructor(isAsync = false) {\n super();\n this.destroyRef = undefined;\n this.pendingTasks = undefined;\n this.__isAsync = isAsync;\n // Attempt to retrieve a `DestroyRef` and `PendingTasks` optionally.\n // For backwards compatibility reasons, this cannot be required.\n if (isInInjectionContext()) {\n this.destroyRef = inject(DestroyRef, {\n optional: true\n }) ?? undefined;\n this.pendingTasks = inject(PendingTasks, {\n optional: true\n }) ?? undefined;\n }\n }\n emit(value) {\n const prevConsumer = setActiveConsumer$1(null);\n try {\n super.next(value);\n } finally {\n setActiveConsumer$1(prevConsumer);\n }\n }\n subscribe(observerOrNext, error, complete) {\n let nextFn = observerOrNext;\n let errorFn = error || (() => null);\n let completeFn = complete;\n if (observerOrNext && typeof observerOrNext === 'object') {\n const observer = observerOrNext;\n nextFn = observer.next?.bind(observer);\n errorFn = observer.error?.bind(observer);\n completeFn = observer.complete?.bind(observer);\n }\n if (this.__isAsync) {\n errorFn = this.wrapInTimeout(errorFn);\n if (nextFn) {\n nextFn = this.wrapInTimeout(nextFn);\n }\n if (completeFn) {\n completeFn = this.wrapInTimeout(completeFn);\n }\n }\n const sink = super.subscribe({\n next: nextFn,\n error: errorFn,\n complete: completeFn\n });\n if (observerOrNext instanceof Subscription) {\n observerOrNext.add(sink);\n }\n return sink;\n }\n wrapInTimeout(fn) {\n return value => {\n const taskId = this.pendingTasks?.add();\n setTimeout(() => {\n fn(value);\n if (taskId !== undefined) {\n this.pendingTasks?.remove(taskId);\n }\n });\n };\n }\n}\n/**\n * @publicApi\n */\nconst EventEmitter = EventEmitter_;\nfunction symbolIterator() {\n // @ts-expect-error accessing a private member\n return this._results[Symbol.iterator]();\n}\n/**\n * An unmodifiable list of items that Angular keeps up to date when the state\n * of the application changes.\n *\n * The type of object that {@link ViewChildren}, {@link ContentChildren}, and {@link QueryList}\n * provide.\n *\n * Implements an iterable interface, therefore it can be used in both ES6\n * javascript `for (var i of items)` loops as well as in Angular templates with\n * `*ngFor=\"let i of myList\"`.\n *\n * Changes can be observed by subscribing to the changes `Observable`.\n *\n * NOTE: In the future this class will implement an `Observable` interface.\n *\n * @usageNotes\n * ### Example\n * ```typescript\n * @Component({...})\n * class Container {\n * @ViewChildren(Item) items:QueryList;\n * }\n * ```\n *\n * @publicApi\n */\nclass QueryList {\n static {\n Symbol.iterator;\n }\n /**\n * Returns `Observable` of `QueryList` notifying the subscriber of changes.\n */\n get changes() {\n return this._changes ??= new EventEmitter();\n }\n /**\n * @param emitDistinctChangesOnly Whether `QueryList.changes` should fire only when actual change\n * has occurred. Or if it should fire when query is recomputed. (recomputing could resolve in\n * the same result)\n */\n constructor(_emitDistinctChangesOnly = false) {\n this._emitDistinctChangesOnly = _emitDistinctChangesOnly;\n this.dirty = true;\n this._onDirty = undefined;\n this._results = [];\n this._changesDetected = false;\n this._changes = undefined;\n this.length = 0;\n this.first = undefined;\n this.last = undefined;\n // This function should be declared on the prototype, but doing so there will cause the class\n // declaration to have side-effects and become not tree-shakable. For this reason we do it in\n // the constructor.\n // [Symbol.iterator](): Iterator { ... }\n const proto = QueryList.prototype;\n if (!proto[Symbol.iterator]) proto[Symbol.iterator] = symbolIterator;\n }\n /**\n * Returns the QueryList entry at `index`.\n */\n get(index) {\n return this._results[index];\n }\n /**\n * See\n * [Array.map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map)\n */\n map(fn) {\n return this._results.map(fn);\n }\n filter(fn) {\n return this._results.filter(fn);\n }\n /**\n * See\n * [Array.find](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find)\n */\n find(fn) {\n return this._results.find(fn);\n }\n /**\n * See\n * [Array.reduce](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce)\n */\n reduce(fn, init) {\n return this._results.reduce(fn, init);\n }\n /**\n * See\n * [Array.forEach](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach)\n */\n forEach(fn) {\n this._results.forEach(fn);\n }\n /**\n * See\n * [Array.some](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some)\n */\n some(fn) {\n return this._results.some(fn);\n }\n /**\n * Returns a copy of the internal results list as an Array.\n */\n toArray() {\n return this._results.slice();\n }\n toString() {\n return this._results.toString();\n }\n /**\n * Updates the stored data of the query list, and resets the `dirty` flag to `false`, so that\n * on change detection, it will not notify of changes to the queries, unless a new change\n * occurs.\n *\n * @param resultsTree The query results to store\n * @param identityAccessor Optional function for extracting stable object identity from a value\n * in the array. This function is executed for each element of the query result list while\n * comparing current query list with the new one (provided as a first argument of the `reset`\n * function) to detect if the lists are different. If the function is not provided, elements\n * are compared as is (without any pre-processing).\n */\n reset(resultsTree, identityAccessor) {\n this.dirty = false;\n const newResultFlat = flatten(resultsTree);\n if (this._changesDetected = !arrayEquals(this._results, newResultFlat, identityAccessor)) {\n this._results = newResultFlat;\n this.length = newResultFlat.length;\n this.last = newResultFlat[this.length - 1];\n this.first = newResultFlat[0];\n }\n }\n /**\n * Triggers a change event by emitting on the `changes` {@link EventEmitter}.\n */\n notifyOnChanges() {\n if (this._changes !== undefined && (this._changesDetected || !this._emitDistinctChangesOnly)) this._changes.emit(this);\n }\n /** @internal */\n onDirty(cb) {\n this._onDirty = cb;\n }\n /** internal */\n setDirty() {\n this.dirty = true;\n this._onDirty?.();\n }\n /** internal */\n destroy() {\n if (this._changes !== undefined) {\n this._changes.complete();\n this._changes.unsubscribe();\n }\n }\n}\n\n/**\n * The name of an attribute that can be added to the hydration boundary node\n * (component host node) to disable hydration for the content within that boundary.\n */\nconst SKIP_HYDRATION_ATTR_NAME = 'ngSkipHydration';\n/** Lowercase name of the `ngSkipHydration` attribute used for case-insensitive comparisons. */\nconst SKIP_HYDRATION_ATTR_NAME_LOWER_CASE = 'ngskiphydration';\n/**\n * Helper function to check if a given TNode has the 'ngSkipHydration' attribute.\n */\nfunction hasSkipHydrationAttrOnTNode(tNode) {\n const attrs = tNode.mergedAttrs;\n if (attrs === null) return false;\n // only ever look at the attribute name and skip the values\n for (let i = 0; i < attrs.length; i += 2) {\n const value = attrs[i];\n // This is a marker, which means that the static attributes section is over,\n // so we can exit early.\n if (typeof value === 'number') return false;\n if (typeof value === 'string' && value.toLowerCase() === SKIP_HYDRATION_ATTR_NAME_LOWER_CASE) {\n return true;\n }\n }\n return false;\n}\n/**\n * Helper function to check if a given RElement has the 'ngSkipHydration' attribute.\n */\nfunction hasSkipHydrationAttrOnRElement(rNode) {\n return rNode.hasAttribute(SKIP_HYDRATION_ATTR_NAME);\n}\n/**\n * Checks whether a TNode has a flag to indicate that it's a part of\n * a skip hydration block.\n */\nfunction hasInSkipHydrationBlockFlag(tNode) {\n return (tNode.flags & 128 /* TNodeFlags.inSkipHydrationBlock */) === 128 /* TNodeFlags.inSkipHydrationBlock */;\n}\n/**\n * Helper function that determines if a given node is within a skip hydration block\n * by navigating up the TNode tree to see if any parent nodes have skip hydration\n * attribute.\n */\nfunction isInSkipHydrationBlock(tNode) {\n if (hasInSkipHydrationBlockFlag(tNode)) {\n return true;\n }\n let currentTNode = tNode.parent;\n while (currentTNode) {\n if (hasInSkipHydrationBlockFlag(tNode) || hasSkipHydrationAttrOnTNode(currentTNode)) {\n return true;\n }\n currentTNode = currentTNode.parent;\n }\n return false;\n}\n\n// Keeps track of the currently-active LViews.\nconst TRACKED_LVIEWS = new Map();\n// Used for generating unique IDs for LViews.\nlet uniqueIdCounter = 0;\n/** Gets a unique ID that can be assigned to an LView. */\nfunction getUniqueLViewId() {\n return uniqueIdCounter++;\n}\n/** Starts tracking an LView. */\nfunction registerLView(lView) {\n ngDevMode && assertNumber(lView[ID], 'LView must have an ID in order to be registered');\n TRACKED_LVIEWS.set(lView[ID], lView);\n}\n/** Gets an LView by its unique ID. */\nfunction getLViewById(id) {\n ngDevMode && assertNumber(id, 'ID used for LView lookup must be a number');\n return TRACKED_LVIEWS.get(id) || null;\n}\n/** Stops tracking an LView. */\nfunction unregisterLView(lView) {\n ngDevMode && assertNumber(lView[ID], 'Cannot stop tracking an LView that does not have an ID');\n TRACKED_LVIEWS.delete(lView[ID]);\n}\n\n/**\n * The internal view context which is specific to a given DOM element, directive or\n * component instance. Each value in here (besides the LView and element node details)\n * can be present, null or undefined. If undefined then it implies the value has not been\n * looked up yet, otherwise, if null, then a lookup was executed and nothing was found.\n *\n * Each value will get filled when the respective value is examined within the getContext\n * function. The component, element and each directive instance will share the same instance\n * of the context.\n */\nclass LContext {\n /** Component's parent view data. */\n get lView() {\n return getLViewById(this.lViewId);\n }\n constructor(\n /**\n * ID of the component's parent view data.\n */\n lViewId,\n /**\n * The index instance of the node.\n */\n nodeIndex,\n /**\n * The instance of the DOM node that is attached to the lNode.\n */\n native) {\n this.lViewId = lViewId;\n this.nodeIndex = nodeIndex;\n this.native = native;\n }\n}\n\n/**\n * Returns the matching `LContext` data for a given DOM node, directive or component instance.\n *\n * This function will examine the provided DOM element, component, or directive instance\\'s\n * monkey-patched property to derive the `LContext` data. Once called then the monkey-patched\n * value will be that of the newly created `LContext`.\n *\n * If the monkey-patched value is the `LView` instance then the context value for that\n * target will be created and the monkey-patch reference will be updated. Therefore when this\n * function is called it may mutate the provided element\\'s, component\\'s or any of the associated\n * directive\\'s monkey-patch values.\n *\n * If the monkey-patch value is not detected then the code will walk up the DOM until an element\n * is found which contains a monkey-patch reference. When that occurs then the provided element\n * will be updated with a new context (which is then returned). If the monkey-patch value is not\n * detected for a component/directive instance then it will throw an error (all components and\n * directives should be automatically monkey-patched by ivy).\n *\n * @param target Component, Directive or DOM Node.\n */\nfunction getLContext(target) {\n let mpValue = readPatchedData(target);\n if (mpValue) {\n // only when it's an array is it considered an LView instance\n // ... otherwise it's an already constructed LContext instance\n if (isLView(mpValue)) {\n const lView = mpValue;\n let nodeIndex;\n let component = undefined;\n let directives = undefined;\n if (isComponentInstance(target)) {\n nodeIndex = findViaComponent(lView, target);\n if (nodeIndex == -1) {\n throw new Error('The provided component was not found in the application');\n }\n component = target;\n } else if (isDirectiveInstance(target)) {\n nodeIndex = findViaDirective(lView, target);\n if (nodeIndex == -1) {\n throw new Error('The provided directive was not found in the application');\n }\n directives = getDirectivesAtNodeIndex(nodeIndex, lView);\n } else {\n nodeIndex = findViaNativeElement(lView, target);\n if (nodeIndex == -1) {\n return null;\n }\n }\n // the goal is not to fill the entire context full of data because the lookups\n // are expensive. Instead, only the target data (the element, component, container, ICU\n // expression or directive details) are filled into the context. If called multiple times\n // with different target values then the missing target data will be filled in.\n const native = unwrapRNode(lView[nodeIndex]);\n const existingCtx = readPatchedData(native);\n const context = existingCtx && !Array.isArray(existingCtx) ? existingCtx : createLContext(lView, nodeIndex, native);\n // only when the component has been discovered then update the monkey-patch\n if (component && context.component === undefined) {\n context.component = component;\n attachPatchData(context.component, context);\n }\n // only when the directives have been discovered then update the monkey-patch\n if (directives && context.directives === undefined) {\n context.directives = directives;\n for (let i = 0; i < directives.length; i++) {\n attachPatchData(directives[i], context);\n }\n }\n attachPatchData(context.native, context);\n mpValue = context;\n }\n } else {\n const rElement = target;\n ngDevMode && assertDomNode(rElement);\n // if the context is not found then we need to traverse upwards up the DOM\n // to find the nearest element that has already been monkey patched with data\n let parent = rElement;\n while (parent = parent.parentNode) {\n const parentContext = readPatchedData(parent);\n if (parentContext) {\n const lView = Array.isArray(parentContext) ? parentContext : parentContext.lView;\n // the edge of the app was also reached here through another means\n // (maybe because the DOM was changed manually).\n if (!lView) {\n return null;\n }\n const index = findViaNativeElement(lView, rElement);\n if (index >= 0) {\n const native = unwrapRNode(lView[index]);\n const context = createLContext(lView, index, native);\n attachPatchData(native, context);\n mpValue = context;\n break;\n }\n }\n }\n }\n return mpValue || null;\n}\n/**\n * Creates an empty instance of a `LContext` context\n */\nfunction createLContext(lView, nodeIndex, native) {\n return new LContext(lView[ID], nodeIndex, native);\n}\n/**\n * Takes a component instance and returns the view for that component.\n *\n * @param componentInstance\n * @returns The component's view\n */\nfunction getComponentViewByInstance(componentInstance) {\n let patchedData = readPatchedData(componentInstance);\n let lView;\n if (isLView(patchedData)) {\n const contextLView = patchedData;\n const nodeIndex = findViaComponent(contextLView, componentInstance);\n lView = getComponentLViewByIndex(nodeIndex, contextLView);\n const context = createLContext(contextLView, nodeIndex, lView[HOST]);\n context.component = componentInstance;\n attachPatchData(componentInstance, context);\n attachPatchData(context.native, context);\n } else {\n const context = patchedData;\n const contextLView = context.lView;\n ngDevMode && assertLView(contextLView);\n lView = getComponentLViewByIndex(context.nodeIndex, contextLView);\n }\n return lView;\n}\n/**\n * This property will be monkey-patched on elements, components and directives.\n */\nconst MONKEY_PATCH_KEY_NAME = '__ngContext__';\nfunction attachLViewId(target, data) {\n target[MONKEY_PATCH_KEY_NAME] = data[ID];\n}\n/**\n * Returns the monkey-patch value data present on the target (which could be\n * a component, directive or a DOM node).\n */\nfunction readLView(target) {\n const data = readPatchedData(target);\n if (isLView(data)) {\n return data;\n }\n return data ? data.lView : null;\n}\n/**\n * Assigns the given data to the given target (which could be a component,\n * directive or DOM node instance) using monkey-patching.\n */\nfunction attachPatchData(target, data) {\n ngDevMode && assertDefined(target, 'Target expected');\n // Only attach the ID of the view in order to avoid memory leaks (see #41047). We only do this\n // for `LView`, because we have control over when an `LView` is created and destroyed, whereas\n // we can't know when to remove an `LContext`.\n if (isLView(data)) {\n target[MONKEY_PATCH_KEY_NAME] = data[ID];\n registerLView(data);\n } else {\n target[MONKEY_PATCH_KEY_NAME] = data;\n }\n}\n/**\n * Returns the monkey-patch value data present on the target (which could be\n * a component, directive or a DOM node).\n */\nfunction readPatchedData(target) {\n ngDevMode && assertDefined(target, 'Target expected');\n const data = target[MONKEY_PATCH_KEY_NAME];\n return typeof data === 'number' ? getLViewById(data) : data || null;\n}\nfunction readPatchedLView(target) {\n const value = readPatchedData(target);\n if (value) {\n return isLView(value) ? value : value.lView;\n }\n return null;\n}\nfunction isComponentInstance(instance) {\n return instance && instance.constructor && instance.constructor.ɵcmp;\n}\nfunction isDirectiveInstance(instance) {\n return instance && instance.constructor && instance.constructor.ɵdir;\n}\n/**\n * Locates the element within the given LView and returns the matching index\n */\nfunction findViaNativeElement(lView, target) {\n const tView = lView[TVIEW];\n for (let i = HEADER_OFFSET; i < tView.bindingStartIndex; i++) {\n if (unwrapRNode(lView[i]) === target) {\n return i;\n }\n }\n return -1;\n}\n/**\n * Locates the next tNode (child, sibling or parent).\n */\nfunction traverseNextElement(tNode) {\n if (tNode.child) {\n return tNode.child;\n } else if (tNode.next) {\n return tNode.next;\n } else {\n // Let's take the following template:
text
\n // After checking the text node, we need to find the next parent that has a \"next\" TNode,\n // in this case the parent `div`, so that we can find the component.\n while (tNode.parent && !tNode.parent.next) {\n tNode = tNode.parent;\n }\n return tNode.parent && tNode.parent.next;\n }\n}\n/**\n * Locates the component within the given LView and returns the matching index\n */\nfunction findViaComponent(lView, componentInstance) {\n const componentIndices = lView[TVIEW].components;\n if (componentIndices) {\n for (let i = 0; i < componentIndices.length; i++) {\n const elementComponentIndex = componentIndices[i];\n const componentView = getComponentLViewByIndex(elementComponentIndex, lView);\n if (componentView[CONTEXT] === componentInstance) {\n return elementComponentIndex;\n }\n }\n } else {\n const rootComponentView = getComponentLViewByIndex(HEADER_OFFSET, lView);\n const rootComponent = rootComponentView[CONTEXT];\n if (rootComponent === componentInstance) {\n // we are dealing with the root element here therefore we know that the\n // element is the very first element after the HEADER data in the lView\n return HEADER_OFFSET;\n }\n }\n return -1;\n}\n/**\n * Locates the directive within the given LView and returns the matching index\n */\nfunction findViaDirective(lView, directiveInstance) {\n // if a directive is monkey patched then it will (by default)\n // have a reference to the LView of the current view. The\n // element bound to the directive being search lives somewhere\n // in the view data. We loop through the nodes and check their\n // list of directives for the instance.\n let tNode = lView[TVIEW].firstChild;\n while (tNode) {\n const directiveIndexStart = tNode.directiveStart;\n const directiveIndexEnd = tNode.directiveEnd;\n for (let i = directiveIndexStart; i < directiveIndexEnd; i++) {\n if (lView[i] === directiveInstance) {\n return tNode.index;\n }\n }\n tNode = traverseNextElement(tNode);\n }\n return -1;\n}\n/**\n * Returns a list of directives applied to a node at a specific index. The list includes\n * directives matched by selector and any host directives, but it excludes components.\n * Use `getComponentAtNodeIndex` to find the component applied to a node.\n *\n * @param nodeIndex The node index\n * @param lView The target view data\n */\nfunction getDirectivesAtNodeIndex(nodeIndex, lView) {\n const tNode = lView[TVIEW].data[nodeIndex];\n if (tNode.directiveStart === 0) return EMPTY_ARRAY;\n const results = [];\n for (let i = tNode.directiveStart; i < tNode.directiveEnd; i++) {\n const directiveInstance = lView[i];\n if (!isComponentInstance(directiveInstance)) {\n results.push(directiveInstance);\n }\n }\n return results;\n}\nfunction getComponentAtNodeIndex(nodeIndex, lView) {\n const tNode = lView[TVIEW].data[nodeIndex];\n const {\n directiveStart,\n componentOffset\n } = tNode;\n return componentOffset > -1 ? lView[directiveStart + componentOffset] : null;\n}\n/**\n * Returns a map of local references (local reference name => element or directive instance) that\n * exist on a given element.\n */\nfunction discoverLocalRefs(lView, nodeIndex) {\n const tNode = lView[TVIEW].data[nodeIndex];\n if (tNode && tNode.localNames) {\n const result = {};\n let localIndex = tNode.index + 1;\n for (let i = 0; i < tNode.localNames.length; i += 2) {\n result[tNode.localNames[i]] = lView[localIndex];\n localIndex++;\n }\n return result;\n }\n return null;\n}\n\n/**\n * Retrieve the root view from any component or `LView` by walking the parent `LView` until\n * reaching the root `LView`.\n *\n * @param componentOrLView any component or `LView`\n */\nfunction getRootView(componentOrLView) {\n ngDevMode && assertDefined(componentOrLView, 'component');\n let lView = isLView(componentOrLView) ? componentOrLView : readPatchedLView(componentOrLView);\n while (lView && !(lView[FLAGS] & 512 /* LViewFlags.IsRoot */)) {\n lView = getLViewParent(lView);\n }\n ngDevMode && assertLView(lView);\n return lView;\n}\n/**\n * Returns the context information associated with the application where the target is situated. It\n * does this by walking the parent views until it gets to the root view, then getting the context\n * off of that.\n *\n * @param viewOrComponent the `LView` or component to get the root context for.\n */\nfunction getRootContext(viewOrComponent) {\n const rootView = getRootView(viewOrComponent);\n ngDevMode && assertDefined(rootView[CONTEXT], 'Root view has no context. Perhaps it is disconnected?');\n return rootView[CONTEXT];\n}\n/**\n * Gets the first `LContainer` in the LView or `null` if none exists.\n */\nfunction getFirstLContainer(lView) {\n return getNearestLContainer(lView[CHILD_HEAD]);\n}\n/**\n * Gets the next `LContainer` that is a sibling of the given container.\n */\nfunction getNextLContainer(container) {\n return getNearestLContainer(container[NEXT]);\n}\nfunction getNearestLContainer(viewOrContainer) {\n while (viewOrContainer !== null && !isLContainer(viewOrContainer)) {\n viewOrContainer = viewOrContainer[NEXT];\n }\n return viewOrContainer;\n}\n\n/**\n * Retrieves the component instance associated with a given DOM element.\n *\n * @usageNotes\n * Given the following DOM structure:\n *\n * ```html\n * \n *
\n * \n *
\n *
\n * ```\n *\n * Calling `getComponent` on `` will return the instance of `ChildComponent`\n * associated with this DOM element.\n *\n * Calling the function on `` will return the `MyApp` instance.\n *\n *\n * @param element DOM element from which the component should be retrieved.\n * @returns Component instance associated with the element or `null` if there\n * is no component associated with it.\n *\n * @publicApi\n * @globalApi ng\n */\nfunction getComponent$1(element) {\n ngDevMode && assertDomElement(element);\n const context = getLContext(element);\n if (context === null) return null;\n if (context.component === undefined) {\n const lView = context.lView;\n if (lView === null) {\n return null;\n }\n context.component = getComponentAtNodeIndex(context.nodeIndex, lView);\n }\n return context.component;\n}\n/**\n * If inside an embedded view (e.g. `*ngIf` or `*ngFor`), retrieves the context of the embedded\n * view that the element is part of. Otherwise retrieves the instance of the component whose view\n * owns the element (in this case, the result is the same as calling `getOwningComponent`).\n *\n * @param element Element for which to get the surrounding component instance.\n * @returns Instance of the component that is around the element or null if the element isn't\n * inside any component.\n *\n * @publicApi\n * @globalApi ng\n */\nfunction getContext(element) {\n assertDomElement(element);\n const context = getLContext(element);\n const lView = context ? context.lView : null;\n return lView === null ? null : lView[CONTEXT];\n}\n/**\n * Retrieves the component instance whose view contains the DOM element.\n *\n * For example, if `` is used in the template of ``\n * (i.e. a `ViewChild` of ``), calling `getOwningComponent` on ``\n * would return ``.\n *\n * @param elementOrDir DOM element, component or directive instance\n * for which to retrieve the root components.\n * @returns Component instance whose view owns the DOM element or null if the element is not\n * part of a component view.\n *\n * @publicApi\n * @globalApi ng\n */\nfunction getOwningComponent(elementOrDir) {\n const context = getLContext(elementOrDir);\n let lView = context ? context.lView : null;\n if (lView === null) return null;\n let parent;\n while (lView[TVIEW].type === 2 /* TViewType.Embedded */ && (parent = getLViewParent(lView))) {\n lView = parent;\n }\n return lView[FLAGS] & 512 /* LViewFlags.IsRoot */ ? null : lView[CONTEXT];\n}\n/**\n * Retrieves all root components associated with a DOM element, directive or component instance.\n * Root components are those which have been bootstrapped by Angular.\n *\n * @param elementOrDir DOM element, component or directive instance\n * for which to retrieve the root components.\n * @returns Root components associated with the target object.\n *\n * @publicApi\n * @globalApi ng\n */\nfunction getRootComponents(elementOrDir) {\n const lView = readPatchedLView(elementOrDir);\n return lView !== null ? [getRootContext(lView)] : [];\n}\n/**\n * Retrieves an `Injector` associated with an element, component or directive instance.\n *\n * @param elementOrDir DOM element, component or directive instance for which to\n * retrieve the injector.\n * @returns Injector associated with the element, component or directive instance.\n *\n * @publicApi\n * @globalApi ng\n */\nfunction getInjector(elementOrDir) {\n const context = getLContext(elementOrDir);\n const lView = context ? context.lView : null;\n if (lView === null) return Injector.NULL;\n const tNode = lView[TVIEW].data[context.nodeIndex];\n return new NodeInjector(tNode, lView);\n}\n/**\n * Retrieve a set of injection tokens at a given DOM node.\n *\n * @param element Element for which the injection tokens should be retrieved.\n */\nfunction getInjectionTokens(element) {\n const context = getLContext(element);\n const lView = context ? context.lView : null;\n if (lView === null) return [];\n const tView = lView[TVIEW];\n const tNode = tView.data[context.nodeIndex];\n const providerTokens = [];\n const startIndex = tNode.providerIndexes & 1048575 /* TNodeProviderIndexes.ProvidersStartIndexMask */;\n const endIndex = tNode.directiveEnd;\n for (let i = startIndex; i < endIndex; i++) {\n let value = tView.data[i];\n if (isDirectiveDefHack(value)) {\n // The fact that we sometimes store Type and sometimes DirectiveDef in this location is a\n // design flaw. We should always store same type so that we can be monomorphic. The issue\n // is that for Components/Directives we store the def instead the type. The correct behavior\n // is that we should always be storing injectable type in this location.\n value = value.type;\n }\n providerTokens.push(value);\n }\n return providerTokens;\n}\n/**\n * Retrieves directive instances associated with a given DOM node. Does not include\n * component instances.\n *\n * @usageNotes\n * Given the following DOM structure:\n *\n * ```html\n * \n * \n * \n * \n * ```\n *\n * Calling `getDirectives` on `